Native Android SDK – Pre-release
Key Features
- Developed in Kotlin
- Remote player management
- Verified Google IMA support
- OMSDK support
- TCF2 support
- Fully-featured Player API to access player events, state and native control
Supported versions & requirements
minSdk set to 21 (Lollipop) |
Dependencies
The following dependencies are required:
For the player
androidx.fragment:fragment:1.5.7 |
org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 |
com.google.ads.interactivemedia.v3:interactivemedia |
For advertising
com.google.ads.interactivemedia.v3:interactivemedia |
Note: DM advertising SDK includes IMA Native. This will require additional dependencies to work. Those additional dependencies can be found in Android IMA sdk integration guide.
Getting started
Create an Android Player configuration
As a first step you need to create a custom player configuration for your Android 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 or programmatically via the player REST API.

Add the SDK to your project
- Add our Nexus repository to your
settings.gradle
file by adding the lines below
maven {
name = "DailymotionMavenRelease"
url = "https://mvn.dailymotion.com/repository/releases/"
}
to the repositories
block within the dependencyResolutionManagement
block.
The resulting settings.gradle
should look like this:
dependencyResolutionManagement {
...
repositories {
...
maven {
name = "DailymotionMavenRelease"
url = "https://mvn.dailymotion.com/repository/releases/"
}
...
}
...
}
- Add dependencies inside your application
build.gradle
file:
dependencies {
...
implementation 'com.dailymotion.player.android:sdk:1.0.6'
implementation 'androidx.fragment:fragment:1.5.7'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'com.dailymotion.player.android:ads:1.0.6'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.29.0'
...
}
Create and add PlayerView to view hierarchy
Create a PlayerView
using Dailymotion.createPlayer(...)
method:
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
}
)
Fullscreen implementation
The SDK provides an out-of-the-box fullscreen implementation supporting navigation stack using either Android standard FragmentManager
or Android Jetpack Navigation library
.
The out-of-the-box implementation handles:
- Orientation change: portrait, reverse portrait, landscape and reverse landscape
- Native back button support: fullscreen can be exited when user taps on the device software / physical back button or by tapping on the exit fullscreen button from the player controls
- Fullscreen will start in landscape mode
PlayerView
controls button fullscreen state change from enter fullscreen icon from/to exit fullscreen icon
The out-of-the-box implementation is not customizable. For Partners who require to implement their own fullscreen, please refer to the custom implementation section below.
Sample applications showcasing implementation of fullscreen are available here: https://github.com/dailymotion/player-sdk-android-samples
Out-of-the-box implementation
To use the out-of-the-box implementation:
- Make the device rotation a configuration change.
Add the following code to the<activity>
tag of theActivity
hosting thePlayerView
in theAndroidManifest.xml
file.
android:configChanges="orientation|screenSize"
It’s more efficient to handle the orientation change as a device configuration change. This keeps the Activity
instantiated and only invalidate the Activity
layout.
Be sure to re-use the created PlayerView
and avoid creating a new PlayerView
on a state change: this will optimize the device battery life, bandwidth and memory consumption.
To handle correctly state management refer to: https://developer.android.com/topic/libraries/architecture/saving-states
- Pass an object implementing
PlayerListener.onFullscreenRequested(playerDialogFragment: DialogFragment)
method.
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
},
playerListener = object : PlayerListener {
override fun onFullscreenRequested(playerDialogFragment: DialogFragment) {
// Show the playerDialogFragment on screen
}
}
)
The code to display playerDialogFragment
on screen will depend of the navigation stack used by the application.
Using FragmentManager
If the application is using FragmentManager
, display playerDialogFragment
like a standard android dialog fragment
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
},
playerListener = object : PlayerListener {
override fun onFullscreenRequested(playerDialogFragment: DialogFragment) {
// Show the playerDialogFragment on screen
playerDialogFragment.show(this@MainActivity.supportFragmentManager, "dmPlayerFullscreenFragment")
}
}
)
Using Android Jetpack Navigation
If the application is using Android Jetpack Navigation library
, you will need to add the fullscreen dialog fragment to navigation graph before being able to navigate to it.
Add fullscreen dialog fragment to navigation graph
- Add the fullscreen dialog fragment to your navigation graph file:
<dialog
android:id="@+id/FullscreenPlayerWebViewFragment" android:name="com.dailymotion.player.android.sdk.webview.fullscreen.FullscreenPlayerWebViewDialogFragment"
android:label="FullscreenPlayerWebViewFragment"
tools:layout="@layout/dm_sdk_fragment_dialog_fullscreen_player_webview" />
- Add the
navigation action
to display the fullscreen dialog fragment inside the hosting fragment. Be sure insert the correct value of theaction id
attribute.
<action android:id="action_MainFragment_to_FullscreenPlayerWebViewFragment"
app:destination="@id/FullscreenPlayerWebViewFragment" />
The resulting navigation graph file should look like this:
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph"
app:startDestination="@id/MainFragment">
<fragment
android:id="@+id/MainFragment"
android:name="com.dailymotion.player.android.jetpackfullscreen.MainFragment"
android:label="@string/fragment_main_label"
tools:layout="@layout/fragment_main">
<!-- Action to Fullscreen dialog fragment -->
<action android:id="@+id/action_MainFragment_to_FullscreenPlayerWebViewFragment"
app:destination="@id/FullscreenPlayerWebViewFragment" />
</fragment>
<!-- Fullscreen dialog fragment -->
<dialog
android:id="@+id/FullscreenPlayerWebViewFragment" android:name="com.dailymotion.player.android.sdk.webview.fullscreen.FullscreenPlayerWebViewDialogFragment"
android:label="FullscreenPlayerWebViewFragment"
tools:layout="@layout/dm_sdk_fragment_dialog_fullscreen_player_webview" />
</navigation>
Display fullscreen dialog fragment
To display the fullscreen dialog fragment, use the action
generated by Android Jetpack Navigation library
:
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
},
playerListener = object : PlayerListener {
override fun onFullscreenRequested(playerDialogFragment: DialogFragment) {
// Show the playerDialogFragment on screen
findNavController()
.navigate(MainFragmentDirections.actionMainFragmentToFullscreenPlayerWebViewFragment())
}
}
)
Custom implementation
To implement a custom fullscreen, pass an object implementing both PlayerListener.onFullscreenRequested(playerDialogFragment: DialogFragment)
and PlayerListener.onFullscreenExit(playerView: PlayerView)
methods:
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
},
playerListener = object : PlayerListener {
override fun onFullscreenRequested(playerDialogFragment: DialogFragment) {
super.onFullscreenRequested(playerDialogFragment)
// Resize PlayerView to take whole screen space
// Notify PlayerView that we entered fullscreen: this will change PlayerView fullscreen button state.
playerView.notifyFullscreenChanged()
}
override fun onFullscreenExit(playerView: PlayerView) {
super.onFullscreenExit(playerView)
// Resize PlayerView to take whole screen space
// Notify PlayerView that we exited fullscreen: this will change PlayerView fullscreen button state.
playerView.notifyFullscreenChanged()
}
}
)
A call to playerView.notifyFullscreenChanged()
is necessary after entering or exiting fullscreen to update the PlayerView
controls fullscreen button state.
Customize the player
The main Player experience is controlled using Player Settings managed in the Dailymotion Studio (Players tab) or REST API. Additional runtime customization is achievable using client-side player parameters.
Working with Player Parameters
Additional runtime customization is achievable when embedding the Player using client-side parameters from the table below. These parameters allow you to specify additional Player behavior or pass in required values to a specific Player embed.
Name | Parameter | Default | Description | Values | Type |
---|---|---|---|---|---|
Video ID | video | null | The ID of the video to load | – | String |
Playlist ID | playlist | null | The ID of the playlist to load | – | String |
Advertising Config | customConfig | null | For passing in unique keys for advertising purposes. See how to configure customConfig. | – | Map<String, String> |
Scale mode | scaleMode | fit | To adjust the player’s video focus | "fit" , "fill" , "fillLeft" , "fillRight" , "fillTop" & "fillBottom" | Sealed class |
Mute | mute | false | To mute the player | "true" ,"false" | Boolean |
Start | startTime | 0 | Specify the time (in seconds) from which the video should start playing | – | Long |
Loop | loop | false | To set the video to loop. Check dedicated section for more details. | "true" ,"false" | Boolean |
val playerParameters = PlayerParameters(
mute = false
)
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playlistId = "A_PLAYLIST_ID", // replace by desired playlist id
playerParameters = playerParameter,
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
}
)
Working with the advertising configuration
The advertising parameter is a custom parameter used for targeting and reporting purposes. Verified Partners can use the parameter to dynamically pass information to their VAST tag.
Parameters are passed in on player initialization and can be updated dynamically by the Player API.
Some configuration is also required on our side. If more complex use-cases need to be handled we invite you to contact our Ads Ops team. Please see examples of the below embed types on how to pass in the parameter on initialization.
Note, no encoding is required.
Add keys on Player initialization
Advertising values can be passed in via different parameters and keys. It’s possible to send all the values via a single key or add multiple values separately.
- Working with single/unique keys
Add all key values through a single key, use the customParams
key and the customConfig
Parameter with the createPlayer(...)
method.
val playerParameters = PlayerParameters(
mute = false,
customConfig = mapOf("keysvalues"to "category=sports§ion=video"),
)
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playlistId = "A_PLAYLIST_ID", // replace by desired playlist id
playerParameters = playerParameter,
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
}
)
- Working with multiple keys
Different pre-defined keys and values can be added and defined separately. Pass the defined keys into the customConfig
parameter with the createPlayer()
method.
val playerParameters = PlayerParameters(
mute = false,
customConfig = mapOf(
"keysvalues" to "category=sports§ion=video",
"dynamiciu" to "12345",
),
)
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playlistId = "A_PLAYLIST_ID", // replace by desired playlist id
playerParameters = playerParameter,
playerSetupListener = object : Dailymotion.PlayerSetupListener {
override fun onPlayerSetupSuccess(player: PlayerView) {
// Add PlayerView to view hierarchy
}
override fun onPlayerSetupFailed(error: PlayerError) {
// PlayerView setup failed
}
}
)
Updating the values with the Player API
Use the method setCustomConfig()
in order to dynamically update the advertising parameter value, a new value will be sent. This will then get updated when the player loads the next video file.
val customConfig = mapOf(
"keysvalues" to "category=sports§ion=video",
"dynamiciu" to "12345",
)
playerView.setCustomConfig(customConfig = customConfig)
API Reference
Initialization methods
Name | Info | Example |
Create Player | To create the player object Player ID is mandatory and can be created and managed either through the “Players” tab in the Dailymotion Studio or programmatically via the player REST API. | Dailymotion.createPlayer( |
val playerParameters = PlayerParameters(
mute = false,
customConfig = mapOf(
"keysvalues" to "category=sports§ion=video",
"dynamiciu" to "12345",
),
)
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
videoId = "A_VIDEO_ID", // replace by desired video id
playlistId = "A_PLAYLIST_ID", // replace by desired playlist id
playerParameters = playerParameter,
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
playerListener = object : PlayerListener {
...
}
videoListener = object : VideoListener {
...
}
adListener = object : AdListener {
...
}
)
Player Methods
Method | Info | Type |
loadContent(videoId: String?, playlistId: String?, startTime: 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 PlayerID settings | String?, |
play() | To play video playback | |
pause() | To pause video playback | |
setSubtitles(wantedSubtitle: String) | To activate a subtitles track to a specified language if available | String |
setQuality(wantedQuality: String) | To set the video’s quality to the specified quality | String |
seek(seekTo:) | To seek to the specified time in video playback in seconds | Double |
SetMute() | Mute the player | |
setCustomConfig(customConfig:) | To set the config for ads Dynamically update the advertising parameter value, use the method to send a new value which then gets updated when the player loads the next video file | Map<String, String> |
setScaleMode(wantedScaleMode: String) | To adjust the player view of the video screen"fit" , "fill" , "fillLeft" , "fillRight" , "fillTop" & "fillBottom" | String |
getState(callback: PlayerStateCallback) | To retrieve the current state of the player | PlayerStateCallback |
Events
Managing event listeners
Pass object implementing interface PlayerListener
, VideoListener
, AdListener
to Dailymotion.create(...)
method to listen to Player, Video, Ad events.
Player events
To listen to Player events, pass an object implementing PlayerListener
interface to Dailymotion.createPlayer(...)
.
PlayerListener
interface provide an empty default implementation for all its method. This allows overriding / implementation of only wanted method instead of implementing all methods just for compilation sake (it also improve code readability).
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
playerListener = object : PlayerListener {
...
}
)
Android | INFO |
onPlayerError | Sent when the player triggers an error. |
onPlayerStart | 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() , loadContent() , etc.) |
onPlayerEnd | Sent when the playback of the content video, and eventual post-roll ad video is completed |
onPlayerVideoChange | Sent when a new video has been loaded in the player. (e.g. after calling loadContent({ video: 'xID' }) , or at player start-up) |
onPlayerVolumeChange | Sent when the volume level or mute state changes |
onPlayerPlaybackPermission | Sent each time any playback request has failed or if the initial playback attempt has succeeded |
onPlayerScaleModeChange | Sent when the scale mode of the player changes after using setScaleMode() |
For example, to listen to onPlayerEnd
event, just implement the method onPlayerEnd()
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
playerListener = object : PlayerListener {
override fun onPlayerEnd(playerView: PlayerView) {
// player end event
}
}
)
Video events
To listen to Video events, pass an object implementing VideoListener
interface to Dailymotion.createPlayer(...)
.
VideoListener
interface provide an empty default implementation for all its method. This allows overriding / implementation of only wanted method instead of implementing all methods just for compilation sake (it also improve code readability).
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
videoListener = object : VideoListener {
...
}
)
Android | Info |
onVideoSubtitlesChange | Sent when the current subtitle changes |
onVideoSubtitlesReady | Sent when subtitles are available |
onVideoDurationChange | Sent when the duration property of the video becomes available or changes after a new video load |
onVideoEnd | Sent when the player completes playback of the content video |
onVideoPause | Sent when the video playback has paused |
onVideoPlay | Sent when the playback state of the content video is no longer paused, as a result of the play method or the autoplay attribute |
onVideoPlaying | Sent when the content video starts playing, after the play or waiting event |
onVideoProgress | Sent when the browser is fetching the media data |
onVideoQualitiesReady | Sent when video qualities are available |
onVideoQualityChange | Sent when the video quality changes |
onVideoSeekEnd | Sent when the player has completed a seeking operation |
onVideoSeekStart | Sent when the player starts to seek to another position in the video timeline |
onVideoStart | Sent when the player begins playback of the content video |
onVideoTimeChange | Sent when the playback position changes |
onVideoBuffering | Sent when the player has to temporarily stop video playback for further buffering of content |
For example, to listen to onVideoEnd
event, just implement the method onVideoEnd
()
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
videoListener = object : VideoListener {
override fun onVideoEnd(playerView: PlayerView) {
// video end event
}
}
)
Ad events
To listen to Ad events, pass an object implementing AdListener
to Dailymotion.createPlayer(...)
.
AdListener
interface provide an empty default implementation for all its method. This allows overriding / implementation of only wanted method instead of implementing all methods just for compilation sake (it also improve code readability).
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
adListener = object : AdListener {
...
}
)
Android | Info |
onAdCompanionsReady | Sent when a companion ad is received. Companion ads should be played in sync with the main ad (linear/non-linear) by listening to events AD_START and AD_END |
onAdDurationChange | Sent when the duration property of the video advertisement becomes available or changes after a new video load |
onAdEnd | Sent when the player completes playback of an ad |
onAdPause | Sent when the player pauses an ad |
onAdPlay | Sent when the ad playback starts or continues after being in a paused state |
onAdstart | Sent when the player begins playback of an ad video |
onAdTimeChange | Sent when the playback position of an ad changes |
onAdImpression | Sent when the first ad frame is displayed |
onAdLoaded | Sent when the player has loaded and buffered the creative’s media and assets either fully or to the extent that it is ready to play the media |
onAdClick | Sent when a user clicks on a video ad |
For example, to listen to onAdStart
event, just implement the method onAdStart
()
Dailymotion.createPlayer(
context = context,
playerId = "MY_PLAYER_ID", // replace by desired player id
playerSetupListener = object : Dailymotion.PlayerSetupListener {
....
},
adListener = object : AdListener {
override fun onAdStart(playerView: PlayerView, type: String, position: String) {
// ad start event
}
}
)
Player State
To retrieve the player state, pass an object implementing PlayerView.PlayerStateCallback
to PlayerView#queryPlayerState(...)
method.
playerView.queryPlayerState(object: PlayerView.PlayerStateCallback {
fun onPlayerStateReceived(playerView: PlayerView, playerState: PlayerEvent.PlayerState)
// Use playerState
}
)
Player state structure:
class PlayerState(
// The description of the ad
var adDescription: String? = null,
// The advertiser name
var adAdvertiserName: String? = null,
/// The universal ad id node from the VAST or the ad id of the creative node from the VAST
var adCreativeAdId: String? = null,
// The id of the creative node from the VAST
var adCreativeId: String? = null,
// The reason why the last ad ended
var adEndedReason: String? = null,
// Contains information about the last error that occurred with the ad
var adError: String? = null,
// The id of the ad
var adId: String? = null,
// If an ad resource is running
var adIsPlaying: Boolean? = null,
// If the ad can be skipped by the user at this moment
var adIsSkippable: Boolean? = null,
// The position of the ad in the video
var adPosition: String? = null,
// The remaining time before the ad can be skipped or -1 if no ad is running
var adSkipOffset: Long? = null,
// The title of the ad
var adTitle: String? = null,
// The player current aspect ratio
var playerAspectRatio: String? = null,
// If the player is ready to play
var playerIsCriticalPathReady: Boolean? = null,
// If the player is allowed to play, depending on the browser permissions
var playerIsPlaybackAllowed: Boolean? = null,
// The reason why the playback has been allowed or not
var playerPlaybackPermissionReason: String? = null,
// The current mode where the player is displayed
var playerPresentationMode: String? = null,
// The player’s current scale mode
var playerScaleMode: String? = null,
// If the video is created for Children
var videoIsCreatedForKids: Boolean? = null,
// If the player controls are enabled
var playerAreControlsEnabled: Boolean? = null,
// If the player is muted
var playerIsMuted: Boolean? = null,
// If the player is currently playing video or ad content
var playerIsPlaying: Boolean? = null,
// If the player is loading the media resource
var playerIsBuffering: Boolean? = null,
// The current playback speed
var playerPlaybackSpeed: Long? = null,
// If the next and previous controls in the PiP are enabled
var playerIsNavigationEnabled: Boolean? = null,
// If the player is in replay screen
var playerIsReplayScreen: Boolean? = null,
// If the video required a password to be read
var videoIsPasswordRequired: Boolean? = null,
// If the player is in start screen
var playerIsStartScreen: Boolean? = null,
// If the player has the alert dialog displayed
var playerIsAlertDialogDisplayed: Boolean? = null,
// The id of the video previous video which was played
var playerPrevVideo: String? = null,
// The id of the video next video in the queue
var playerNextVideo: String? = null,
// The id of the owner of the video
var videoOwnerId: String? = null,
// The user name of the owner of the video
var videoOwnerUsername: String? = null,
// The screen name of the owner of the video
var videoOwnerScreenName: String? = null,
// The video qualities that are available
var videoQualitiesList: List<String>? = null,
// The quality value of the video loaded
var videoQuality: String? = null,
// The language codes of the subtitle tracks which are available for the current media resource
var videoSubtitlesList: List<String>? = null,
// The language code of the subtitle track that is currently enabled
var videoSubtitles: String? = null,
// The unique Id of the video
var videoId: String? = null,
// The title of the video loaded
var videoTitle: String? = null,
// The timestamp that corresponds to the creation of the video
var videoCreatedTime: Double? = null,
// The current volume level. The volume and mute params operate separately, therefore, you could have a player with full volume, but also muted
var playerVolume: Double? = null,
// The current playback position of an ad in seconds
var adTime: Double? = null,
// The duration time of the ad resource in seconds
var adDuration: Double? = null,
// The current playback position of the video in seconds
var videoTime: Double? = null,
// The duration time of the video resource in seconds
var videoDuration: Double? = null,
var playerError: Error? = null,
var adCompanion: AdCompanion? = null
) : PlayerEvent(...) {
class Error(
val title: String? = null,
val message: String? = null
)
class AdCompanion(
val id: String? = null,
val adId: String? = null,
val sequence: String? = null,
val apiFramework: String? = null,
val type: String? = null,
val adCompanionRequired: Boolean? = null,
)
}
TCF2
Our Android SDK complies with IAB TCF2 standards so it’s easy to access the stored content string and pass it to the Player.
Using a recognized CMP, generate the consent string and store it in the correct location as specified by the TCF2 iAB specification.
When creating a PlayerView
, we will automatically attempt to access the stored consent string and pass it to the Player.
In the case the consent string missing when creating a PlayerView
, you can pass it using our ConsentManager()#loadConsentString(...)
method.
val consentManager = ConsentManager()
consentManager.loadConsentString(context = context)
Destroy/Release the Player
The Player instance will be automatically destroyed and removed by setting the Player view to null or by removing the reference to it. It will then be destroyed by the Android System garbage collector.
Changelog
2023 – 08 – 08
Android – Player & Ads SDKs – Versions 1.0.4
Includes out-of-the-box and custom fullscreen functionality.