Android SDK - Player methods



Initialize & destroy Player (Android)

Methods

Description

createPlayer()

Create a new video Player on an Android environment.

Player ID is mandatory. Players can be created and managed either through the “Players” tab in the Dailymotion Studio or programmatically via the API.

**Example: **
Dailymotion.createPlayer(\ context: Context, playerId: String, videoId: String?, playlistId: String?, playerParameters: PlayerParameters, playerListener: PlayerListener?, videoListener: VideoListener?, adListener: AdListener?, playerSetupListener: PlayerSetupListener )

destroy()

Destroy the Player. Once the Player is destroyed, PlayerView will become useless.

Load content (Android)

Methods

Description

load​Content(video​Id: String?, playlist​Id:​ String?, start​Time:​ Long?)

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 (Android)

Methods

Description

play()

To start or resume video playback.

pause()

To pause video playback.

seek(seekTo:)

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

Advertising (Android)

Methods

Description

setCustomConfig(customConfig:)

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 (Android)

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: Landscape.

Other possible values for orientation: Landscape ReverseLandscape Portrait or ReversePortrait.

Example: setFullScreen(fullscreen: true, orientation: ReverseLandscape)

setQuality(wantedQuality: String)

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

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

setPlaybackSpeed(playbackSpeed: 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(wantedSubtitle: String)

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

setScaleMode(wantedScaleMode: String)

To adjust the player view of the video screen.

Possible values: fit fill fillLeft fillRight fillTop or fillBottom

setMute()

To set the mute mode of the Player.

Player details (Android)

Methods

Description

getState(callback: PlayerStateCallback)

To retrieve the current state of the Player.

Logs (Android)

Methods

Description

setLogLevel(LogLevel.String)

To determine the level of details logs should return.

Possible values: None Info Warning Error and All