Web SDK - Player states

From the state, it is possible to access required player, video or advertising data for your video application or analytics purposes.

For example, you can determine if PiP is currently displayed, access the duration of the video or know if the Player is in or out of the user’s viewport.

To access data state of the Player, video or advertising, use the getState() method: on resolve, it will return an object representation of the player state.




Ad properties (web)

STATE

INFO

TYPE

adAdvertiserName

The advertiser name or null.

string

adCompanion

An array of parsed companion ad creatives.

array

adCreativeAdId

The universal ad id node from the VAST or the ad id of the creative node from the VAST.

string

adCreativeId

The id of the creative node from the VAST.

string

adDescription

The description of the ad or null.

string

adDuration

The duration time of the ad resource in seconds.

number

adEndedReason

The reason why the last ad ended.

Possible values: error stopped skipped interrupted or null

string

adError

Contains information about the last ad error that occurred in the Player, including message and code.

object

adId

The id of the ad.

string

adIsPlaying

Whether an ad resource is running.

boolean

adIsSkippable

Whether the ad can be skipped by the user at this moment.

boolean

adPosition

The position of the ad in the video, or null if no ad is running.

Possible values: preroll midroll postroll or null

string

adSkipOffset

The remaining time (in seconds) before the ad can be skipped, or -1 if no ad is running.

number

adTime

The current playback position of an ad in seconds.

number

adTitle

The title of the ad, or null.

string

Player properties (web)

STATE

INFO

TYPE

playerAspectRatio

The Player current aspect ratio.

Possible values: inherit, 16:9, 4:3, 1:1, 3:4, 9:16

string

playerError

Contains information about the last error that occurred in the player, including title, message and code.

object

playerInstanceI

Contains a unique identifier generated for each player instance.
Format: uuid V4

A player instance is generated each time a player is created, with either dailymotion.createPlayer or the Player Embed Script.

Player instance ≠ player configuration, i.e when loading on the same page 3 players using the same player configuration, 3 unique player instances will be generated.

string

playerIsAlertDialogDisplayed

If the Player has the alert dialog displayed.

boolean

playerIsBuffering

If the Player is loading the media resource.

boolean

playerIsCriticalPathReady

If the Player is ready to play.

boolean

playerIsMuted

If the Player is muted.

boolean

playerIsNavigationEnabled

If the next and previous controls in the PiP are enabled.

boolean

playerIsPipNativeSupported

If the Player does support the native PiP.

boolean

playerIsPlaybackAllowed

If the Player is allowed to play, depending on the browser permissions.

boolean

playerIsPlaying

If the Player is currently playing video or ad content.

boolean

playerIsStartScreen

If the Player is in start screen.

boolean

playerIsReplayScreen

If the Player is in replay screen.

boolean

playerIsViewable

If the Player is within the viewability threshold.

boolean

playerNextVideo

The ID of the next video in the queue.

string

playerPipDisplay

The current display mode of PiP, whether it is displayed on a larger/smaller screen.

Possible values: largeViewport or smallViewport

string

playerPipStatus

The current PiP feature status.

Possible values: enabled disabled or closed

string

playerPipIsExpanded

If the mobile sticky PiP is expanded.

boolean

playerPlaybackPermissionReason

The reason why the playback has been allowed or not.

Possible values: allowedFallbackMuted allowed rejectedInactiveTab or rejectedByBrowser

string

playerPlaybackSpeed

The player current playback speed.

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

number

playerPresentationMode

The current mode where the Player is displayed.

Possible values: inline nativePip pip or fullscreen

string

playerPrevVideo

The id of the previously played video.

string

playerScaleMode

The Player’s current scale mode.

Possible values: fit fill fillLeft fillRight fillTop or fillBottom

string

playerVolume

The current volume level. The volume and mute params operate separately, therefore, you could have a player with full volume, but also muted.

Possible values: Between 0.0 and 1.0

number

recommendedVideoDisplayed

Information about the recommended videos currently displayed.

Example: [{index: 0, xid: 'xid1'}, {index: 1, xid: 'xid2'}]

object


Video properties (web)

STATE

INFO

TYPE

videoCreatedTime

The timestamp that corresponds to the creation of the video

number

videoAspectRatio

Number representing the aspect ratio of the video (e.g., 1.777 for 16:9)

number

videoDuration

The duration time of the video resource in seconds.

number

videoId

The unique ID of the video.

string

videoIsCreatedForKids

If the video is created for children.

boolean

videoIsPasswordRequired

If the video requires a password to be read.

boolean

videoLoadedFrom

The origin of a video load.

Possible values: playback_button, replay_button, reload_button, previous_button, next_button, auto_skip, auto_next, carousel_card, password, api, programmatic

string

videoOwnerAvatars

Contains the avatar of the video owner, including the height of the image in pixels and its URL.

object

videoOwnerId

The id of the owner of the video.

string

videoOwnerScreenname

The screen name of the owner of the video.

string

videoOwnerUsername

The user name of the owner of the video.

string

videoPosters

Contains the thumbnail of the video, including the height of the image in pixels and its URL.

object

videoQualitiesList

The video qualities that are available.

array

videoQuality

The quality value of the video loaded.

string

videoSubtitles

The language code of the subtitle track that is currently enabled.

string

videoSubtitlesList

The language codes of the subtitle tracks which are available for the current media resource.

array

videoTime

The current playback position of the video in seconds.

number

videoTitle

The title of the video loaded.

string

videoViewId

Contains a unique identifier generated each time a video is loaded in the Player.

Format: 19 random characters based on timestamp

string

Retrieving Player state & properties (web)

To access data state, use the getState() method: on resolve, it will return an object representation of the Player state.

Example Player state:

{
  "adAdvertiserName": "Dailymotion advertiser",
  "adCompanion": null,
  "adCreativeAdId": null,
  "adCreativeId": "video",
  "adDescription": "Dailymotion ad",
  "adDuration": 15.07,
  "adEndedReason": null,
  "adError": null,
  "adId": "32251",
  "adIsPlaying": true,
  "adIsSkippable": true,
  "adPosition": "midroll",
  "adSkipOffset": 0,
  "adTime": 6.42,
  "adTitle": "Dailymotion_ad",
  "playerAspectRatio": "16:9",
  "playerError": null,
  "playerInstanceId": "e10b4d45-438f-065a-31f8-d1d6482cb34a",
  "playerIsAlertDialogDisplayed": false,
  "playerIsBuffering": false,
  "playerIsCriticalPathReady": true,
  "playerIsMuted": null,
  "playerIsNavigationEnabled": true,
  "playerIsPipNativeSupported": true,
  "playerIsPlaybackAllowed": true,
  "playerIsPlaying": true,
  "playerIsReplayScreen": false,
  "playerIsStartScreen": false,
  "playerIsViewable": true,
  "playerNextVideo": "x81ixxp",
  "playerPipDisplay": "largeViewport",
  "playerPipIsExpanded": false,
  "playerPipStatus": "enabled",
  "playerPlaybackPermissionReason": "allowed",
  "playerPresentationMode": "inline",
  "playerPrevVideo": null,
  "playerScaleMode": "fit",
  "playerVolume": 1,
  "videoCreatedTime": 1551103337,
  "videoDuration": 214.06,
  "videoId": "x730nnd",
  "videoIsCreatedForKids": false,
  "videoIsPasswordRequired": false,
  "videoOwnerAvatars": {"60": "https://s1.dmcdn.net/u/4gS6x1bAn1J4XkTtz/60x60"},
  "videoOwnerId": "x23rwb7",
  "videoOwnerScreenname": "Player team",
  "videoOwnerUsername": "player-team",
  "videoPosters" : {
    "60": "https://s2.dmcdn.net/v/DZRrE1a-UY_P8Q4HG/x60",
    "120": "https://s2.dmcdn.net/v/DZRrE1a-UY_Llrtde/x120",
    "180": "https://s1.dmcdn.net/v/DZRrE1a-UY_YZWP_m/x180",
    "240": "https://s1.dmcdn.net/v/DZRrE1a-UY_lKqwAs/x240",
    "360": "https://s2.dmcdn.net/v/DZRrE1a-UY_vfzXEe/x360",
    "480": "https://s1.dmcdn.net/v/DZRrE1a-UY_MePtiX/x480",
    "720": "https://s2.dmcdn.net/v/DZRrE1a-UY_19B5cB/x720",
    "1080": "https://s1.dmcdn.net/v/DZRrE1a-UY_vvxuk3/x1080"
    },
  "videoQualitiesList": ["1080", "720", "480", "380", "240", "144"],
  "videoQuality": "Auto",
  "videoSubtitles": "en",
  "videoSubtitlesList": ["fr", "en"],
  "videoTime": 60.12,
  "videoTitle": "Dailymotion video",
  "videoViewId": "1h2fo92qc4qahuhdekq",
}