iOS SDK - Player methods



Initialize Player (iOS)

Methods

Description

createPlayer()

Create a new video Player on an iOS environment. 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 either through the “Players” tab in the Dailymotion Studio or programmatically via the API.

**Example: **
Dailymotion.createPlayer(playerId: "PLAYERID", videoId: "VIDEOID", playerParameters: DMPlayerParameters() , playerDelegate: self)

Load content (iOS)

Methods

Description

load​Content(video​Id:​playlist​Id:​start​Time:​)

To load a video or a playlist.

You can play a specific video followed by a playlist by specifying both the video and playlist IDs.

Note that the loaded content playback is based on the autostart configuration defined in the Player ID settings.

Playback (iOS)

Methods

Description

play()

To start or resume video playback.

pause()

To pause video playback.

seek(to:TimeInterval)

To seek to the specified time in video playback in seconds.

Advertising (iOS)

Methods

Description

setCustomConfig(config: Dictionary[String:String])

To set the config for ads and dynamically update the advertising parameter value. Use this method to send a new value which then gets updated when the player loads the next video file.

Settings (iOS)

Methods

Description

setFullScreen(fullscreen: Boolean, orientation: Orientation)

To enable or disable fullscreen mode with fullscreen: true or fullscreen:false.

If fullscreen: true: fullscreen orientation is by default orientation: .landscapeLeft.

Other possible values for orientation: .landscapeRight or portrait.

Example: setFullscreen(fullscreen: true, orientation: .landscapeRight)

setQuality(level: String)

To set the video’s quality to the specified quality.

Possible values: [240, 380, 480, 720, 1080, 1440, 2160, default]

setPlaybackSpeed(speed: Double)

To modify the playback speed.

If the value passed does not match one from the list, the playback speed is rounded to the superior one. The playback speed is kept across videos.

Possible values: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]

setSubtitles(code: String)

To activate a subtitles track to a specified language if available.

setScaleMode(config: String)

To adjust the player view of the video screen.

Possible values: fit fill fillLeft fillRight fillTop or fillBottom

setMute(mute: Boolean)

To set the mute mode of the Player.

updateParams(params:)

To change the following Player config values at runtime: scaleMode mute volume enableControls & customConfig.

Player details (iOS)

Methods

Description

getState(completion: StateCompletionHandler)

To retrieve the current state of the Player.

try await getState()

To retrieve the current state of the Player.