Custom fullscreen implementation (iOS SDK)

Custom fullscreen implementation for advanced needs.

For more control over how fullscreen is handled, you can create your own fullscreen experience starting from SDK version 1.1.0. following the below steps:

  1. Implement DMPlayerDelegate and playerWillPresentFullscreenViewController function where you have to return nil  instead of a UIViewController. This will disable the out-of-the-box feature.
  2. Implement playerDidRequestFullscreen and playerDidExitFullScreen delegates to handle "enter fullscreen" and "exit fullscreen" modes.
  3. Call notifyFullscreenChanged() after each fullscreen state change to allow the Player to update accordingly.
class ViewController: UIViewController {
 override func viewDidLoad() {
  super.viewDidLoad()
  Dailymotion.createPlayer(playerId: "PlayerID", playerDelegate: self) { playerView, error in
       
   }
 }
}
 
extension ViewController: DMPlayerDelegate {
 func playerWillPresentFullscreenViewController(_ player: DMPlayerView) -> UIViewController? {
    return nil
 }
 
 func playerDidRequestFullscreen(_ player: DMPlayerView) {
    // Move the player in fullscreen State
    // Call notifyFullscreenChanged() the player will update his state 
    player.notifyFullscreenChanged()
 }
   
 func playerDidExitFullScreen(_ player: DMPlayerView) {
    // Move the player in initial State
    // Call notifyFullscreenChanged() the player will update his state  
    player.notifyFullscreenChanged()
 }
}
⚠️

Important:

Always call player.notifyFullscreenChanged() after updating the Player state to either inline or fullscreen. Not calling it might affect monetisation and certain Player functionalities.