---
updatedAt: 2026-07-27T09:59:35.000Z
agentTools:
  projectIndex: https://developers.dailymotion.com/v0/llms.txt
---

# Getting started (iOS SDK)

# Overview

<br />

## Repository

The iOS SDK is available on [GitHub](https://github.com/dailymotion/player-sdk-ios).

<br />

## 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 <br />

## Supported versions & requirements

|           |
| --------- |
| Swift 5+  |
| iOS 14+   |
| Xcode 14+ |

***

# Installation

## 1. Create an iOS Player configuration

As a first step you need to create a custom Player configuration for your iOS application in your Dailymotion account. A unique Player Id will be generated which will be required for Player initialization in-app, accurate monetization, targeting and attribution.

The custom Player configuration can be created and managed either through the [“Players” tab in the Dailymotion Studio](https://www.dailymotion.com/partner/embed/players), or programmatically via the [Platform API](https://developers.dailymotion.com/v0/reference/ios-sdk-player-methods#initialize-player-ios).![](images/Dailymotion-Studio-Player-Configuration-1024x514.png)

<Image align="center" border={false} src="https://files.readme.io/bd95a13edeb0838ae241df70e5de074df2614f58cd881d30dbc5237d4d3a7081-Dailymotion-Studio-Player-Configuration-1024x514.png" />

> 📘 Note
>
> “Picture-in-Picture”, “First time viewable”, “Aspect ratio” and “Use embedder link when sharing” features are not available on the iOS SDK and are reserved for JavaScript embeds.

> ⚠️ CMP implementation required to ensure monetization
>
> Publishers in GDPR countries are required to implement a TCF2 registered CMP (Consent Management Platform) in their native app to ensure monetization. A compliant CMP must be used to use IAB TCF2 for the creation and storage of the transparency & consent string. As Dailymotion fully supports the IAB TCF2 standard, our native SDKs and our Player can access this string received from the CMP in-app.
>
> **It’s important that the consent string is available before the Player is loading**. For information on how to use a CMP in-app see **[here](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#how-is-a-cmp-used-in-app)**.

## 2. Add the SDK to your project

### Option 1: Using the Swift Package Manager

The [Swift Package Manager](https://swift.org/package-manager/)  is a tool for automating the distribution of Swift code and is integrated into Xcode and the Swift compiler.

1. Click `File`.
2. Click `Add Packages...`.
3. Specify the git URL for Dailymotion iOS SDK: <https://github.com/dailymotion/player-sdk-ios>. <br />

### Option 2: Implement it manually

1. Clone the Dailymotion iOS SDK git : [https://github.com/dailymotion/player-sdk-ios](https://github.com/dailymotion/dailymotion-player-ios-sdk)
2. Copy the `**Frameworks**` folder from the cloned git into your project.
3. From Xcode select your project.
4. Select `**General**` tab.
5. Expand `**Frameworks, Libraries,**` and `**Embedded**` Content section.
6. Open previous copied `**Frameworks**` folder.

Select Drag and Drop into `**Frameworks**, **Libraries**, and **Embedded**` section the `.xcframework` found in the directories `**DailymotionPlayer**` and `**AdvertisingFramework**` found there.

The frameworks added to the project target should be :

* **`DailymotionPlayerSDK.xcframework`**
* **`DailymotionAdvertisingServices.xcframework`**
* **`GoogleInteractiveMediaAds.xcframework`**
* **`OMSDK_Dailymotion.xcframework`**

You can now build your project 🚀

## 3. Create and add a Player view

### Import Dailymotion SDK

```swift
import DailymotionPlayerSDK
import AVFoundation
import UIKit

class ViewController: UIViewController {
// Container View IBOutlet - host view for the player
  @IBOutlet weak var playerContainerView: UIView!
...
```

### Create the Player view and add it to view hierarchy - Closure

```swift
/ Please replace the player id with your own Player ID accessed via the Dailymotion Studio or Platform API.
    Dailymotion.createPlayer(playerId: <#"xbzlf"#>, videoId: <#"x84sh87"#>, playerParameters:  DMPlayerParameters() , playerDelegate: self) { [weak self] playerView, error in
// Wait for Player initialisation and check if self is still allocated
      guard let self = self else {
        return
      }
      // Check For errors
      if let error = error {
        print("Error creating player: \(error)")
      } else {
        guard let playerView = playerView else {
          return
        }
        // Attach the created Player View to your player container View
        let constraints = [
          playerView.topAnchor.constraint(equalTo: self.playerContainerView.topAnchor, constant: 0),
          playerView.bottomAnchor.constraint(equalTo: self.playerContainerView.bottomAnchor, constant: 0),
          playerView.leadingAnchor.constraint(equalTo: self.playerContainerView.leadingAnchor, constant: 0),
          playerView.trailingAnchor.constraint(equalTo: self.playerContainerView.trailingAnchor, constant: 0)
        ]
        // Activate created constraints
        NSLayoutConstraint.activate(constraints)
      }
    }
```

### Create the Player view and add it to view hierarchy - Async/Await

```swift
do {
      // Please replace the Player ID with your own Player ID accessed via the Dailymotion Studio or Platform API.
      let playerView = try await Dailymotion.createPlayer(playerId: <#"xbzlf"#>, videoId: <#"x84sh87"#>, playerParameters:  DMPlayerParameters() , playerDelegate: self)
      // Attach the created Player View to your player container View
      let constraints = [
        playerView.topAnchor.constraint(equalTo: self.playerContainerView.topAnchor, constant: 0),
        playerView.bottomAnchor.constraint(equalTo: self.playerContainerView.bottomAnchor, constant: 0),
        playerView.leadingAnchor.constraint(equalTo: self.playerContainerView.leadingAnchor, constant: 0),
        playerView.trailingAnchor.constraint(equalTo: self.playerContainerView.trailingAnchor, constant: 0)
      ]
      // Activate created constraints
      NSLayoutConstraint.activate(constraints)
    }
    catch {
      // Handle erros
      print("Error creating player: \(error)")
    }
}
```

### Implement DMPlayerDelegate:

In order to get full functionality and benefit from full monetization, implementing `DMPlayerDelegate` is mandatory.

```swift
extension ViewController: DMPlayerDelegate {
func player(_ player: DMPlayerView, openUrl url: URL) {
    UIApplication.shared.open(url)
  }
  
  func playerWillPresentFullscreenViewController(_ player: DMPlayerView) -> UIViewController {
    return self
  }
  
  func playerWillPresentAdInParentViewController(_ player: DMPlayerView) -> UIViewController {
    return self
  }
}
```

#### Initialization method

| **Name**      | **Info**                                                                                                                                                                                            | **Example**                                                                                                                         |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Create Player | To create the player object `DMPlayerView`, the object will be returned in the completion closure given as a parameter. Player ID is mandatory and can be created and managed on Dailymotion Studio | `Dailymotion.createPlayer(playerId: "PLAYERID", videoId: "VIDEOID", playerParameters: DMPlayerParameters() , playerDelegate: self)` |

### Required configuration methods

After configuring the initialization of the player, it is required to implement the necessary methods of the protocol `DMPlayerDelegate` to ensure your application can manage the player in all contexts.

> ❗️ Warning:
>
> The below methods **need** to be configured to ensure your application can manage the player in all contexts.

| **Info**                                                                                  | **Example**                                           |
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| Informs the delegate that the app has to open a URL in a browser result as a user action  | `player(_ player: DMPlayerView, openUrl url: URL`     |
| Asks the delegate for a UIViewController to present the player in fullscreen              | `player​Will​Present​Fullscreen​View​Controller(_:​)` |
| Asks the delegate for a UIViewController to display an Ad dependent by a UIViewController | `player​Will​Present​AdInParent​View​Controller(_:​)` |