Table of content

iOS SDK Migration guide


This guide is intended to help you migrate from the legacy native SDK to our new iOS SDK.

Sunset notice legacy SDK:

 

From February 3rd 2025, the legacy iOS SDK will be officially sunset and will no longer be supported.

To avoid any disruption, it is required for all Partners still using the legacy SDK to migrate to the new iOS SDK as soon as possible following guidelines below.

If you have questions or need assistance, please reach out to our Support team.

Overview

New repositoriyNew iOS SDK available on GitHub
Sample applicationsiOS sample app: Download the sample app on your device and explore the SDK functionalities in a user-friendly UI
Source code: Access the sample app source code, customize it as you wish and easily integrate the SDK into your projects
Key features– Remote Player management
– iOS 18 support
– Verified Google IMA integration
– OMSDK support
– Sample Player applications & code samples
– Fullscreen playback management
– Access to Player events and state facilitated
– Chromecast support
Minimum supported versionsSwift 5+
iOS 14+
Xcode 14+

Implementation resources


Benefits

Key benefits of the new iOS SDK:

  • More customization: The new iOS SDK offers more customization options and greater flexibility in managing Player configurations via the Studio. Embedding and controlling your Players is easier and more efficient thanks to Player IDs.
  • Better monetization: The new SDK complies with Google IMA standards and TCF2 to help you handle monetization more effectively
  • Improved developer experience: The new SDK provides an easier way to embed and control custom Players, and simplified access to various data

Integration principles

Find the key technical steps required to use our new iOS SDK the best way and benefit from improved functionalities and flexibility compared to the legacy one.

Player customization

While the legacy SDK could only offer limited customization options and control, the new SDK is built around Player IDs. They carry your Player configuration, providing more flexibility and control over the Player’s behavior and appearance without requiring heavy customization within your code:

  • Manage from Studio: You can easily create and manage custom Player configurations from the Dailymotion Studio
  • Embed Player IDs: Each Player configuration is linked to a unique Player ID which is required for Player initialization in your Android app, and accurate monetization, targeting and attribution
  • Optimize with API: Additional customization can be added programmatically using the Player methods, events and state

Learn more about how to create and manage Players from the Studio.

Advertising dependencies

The IMA SDK is already integrated into the new SDK, however, it requires declaring additional dependencies to load the IMA libraries.

The Swift Package Manager can be used to access the SDK. Specify the git URL for Dailymotion iOS SDK: https://github.com/dailymotion/player-sdk-ios

Included libraries:
  • Dailymotion Advertising SDK
  • Google IMA
  • OM SDK

Handling advertising set up

In order to benefit from accurate monetization, make sure to implement the following steps:

  1. Create a dedicated Player config for your iOS app from your Dailymotion Studio or via the Platform API, and use the generated Player ID in the Player initialization method.
  2. Publishers in GDPR countries are required to implement a TCF2-registered CMP in their native app to ensure monetization. Collect consent from CMP before loading the Player.
  3. Implementing DMPlayerDelegate is mandatory, see here.
  4. Implement the necessary methods to ensure your application can manage the Player in all contexts, see here.
  5. Pass in and update custom advertising values. To learn more please see here.

Fullscreen management

The new iOS SDK provides an out-of-the-box fullscreen implementation as well as a custom fullscreen implementation.

See how to implement fullscreen with the new SDK.

Destroy/release Player

The Player instance will be automatically destroyed and removed when there are no more references to the DMPlayerView object, and when the Automatic Reference Counting (ARC) counter reaches zero.


Mapping

This section provides a mapping of the methods, events and state from the legacy SDK to the new iOS SDK to help you update your integration.

Methods

Legacy iOS methodsNew iOS methods
initialize()Dailymotion.createPlayer(playerId: "PLAYERID", videoId: "VIDEOID", playerParameters: DMPlayerParameters() , playerDelegate: self)
load(params: String)load​Content(video​Id:​playlist​Id:​start​Time:​)
play()play()
pause()pause()
toggleFullscreen()setFullscreen()
Learn more
unmute()setMute(mute:)
mute()setMute(mute:)
seek()seek(to:)
toggleControls()No longer supported. Ad and playback controls are now managed in Player configuration.

Find the complete list of methods for the new iOS SDK.

Events

DescriptionLegacy eventsNew events
Sent when the Player is ready to accept API commands. Do not try to call functions before receiving this event.apireadyManaged via createPlayer() method
Sent the first time the Player attempts to start the playback, either because of user interaction, an autoplay parameter or an API call (e.g play(), load(), etc.).startplayerDidStart
Sent when playback of the content video, and eventual post-roll ad video, is completed.VideoEndEventplayerDidEnd
Sent when the Player triggers an error. See all error codes.errorplayer(_:didFailWithError:)
Sent when the Player enters or exits the fullscreen state.fullscreenchangeBuilt-in fullscreen behavior
Custom integration with playerDidRequestFullscreen
and
playerDidExitFullScreen
Sent every time a video is ready to play, or started playing (depending on autoplay settings, and their resolution by the browser), or is unable to play (blocked, restricted, unavailable). Listen to this event if you want to defer doing network-heavy and JavaScript-heavy work, to allow the optimal delivery of the first frames of the video to the use.playback_readyplayerDidCriticalPathReady(_:)
Sent when the Player starts to seek to another position in the video timeline.seekingvideo(_:didSeekStart:)
Sent when the Player has completed a seeking operation.seekedvideo(_:didSeekEnd:)
Sent when a new video has been loaded in the Player. (e.g. after calling load(videoId, [params]), or at player start-up).videochangeplayer(_:didChangeVideo:)
Sent when the volume or mute state changes.volumechangeplayer(_:didChangeVolume:_:)

Find the complete list of events for the new iOS SDK.

Player state and properties

Legacy SDK

The legacy SDK provided limited access to Player properties: it required specific events to be triggered to be able to retrieve associated Player properties

func player(_ player: DMPlayerViewController, didReceiveEvent event: PlayerEvent) {
    switch event {
    case .namedEvent(let name, let data):
        print("\(name) - \(data)")
    case .timeEvent(let name, let position):
        print("\(name) - \(position)")

New SDK

The new iOS SDK provides more data with easier access: any value in the Player state can be retrieved at any time using the getState(completion:) method, without having to rely on specific events.

self.dmPlayerView?.getState(completion: { [weak self] (playerState) in
     print("playerIsPlaying : \(playerState?.playerIsPlaying)")
     print("videoId : \(playerState?.videoId)")
     print("playerError : \(playerState?.playerError)")
})

See full list of available state properties.

If you need assistance with the migration:

 

Please reach out to your dedicated Dailymotion Account Manager or our Support team