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 |
|---|---|---|
| The advertiser name or | string |
| An array of parsed companion ad creatives. | array |
| The universal ad id node from the VAST or the ad id of the creative node from the VAST. | string |
| The id of the creative node from the VAST. | string |
| The description of the ad or | string |
| The duration time of the ad resource in seconds. | number |
| The reason why the last ad ended. Possible values: | string |
| Contains information about the last ad error that occurred in the Player, including | object |
| The id of the ad. | string |
| Whether an ad resource is running. | boolean |
| Whether the ad can be skipped by the user at this moment. | boolean |
| The position of the ad in the video, or Possible values: | string |
| The remaining time (in seconds) before the ad can be skipped, or | number |
| The current playback position of an ad in seconds. | number |
| The title of the ad, or | string |
Player properties (web)
STATE | INFO | TYPE |
|---|---|---|
| The Player current aspect ratio. Possible values: | string |
| Contains information about the last error that occurred in the player, including title, message and code. | object |
| Contains a unique identifier generated for each player instance. A player instance is generated each time a player is created, with either 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 |
| If the Player has the alert dialog displayed. | boolean |
| If the Player is loading the media resource. | boolean |
| If the Player is ready to play. | boolean |
| If the Player is muted. | boolean |
| If the next and previous controls in the PiP are enabled. | boolean |
| If the Player does support the native PiP. | boolean |
| If the Player is allowed to play, depending on the browser permissions. | boolean |
| If the Player is currently playing video or ad content. | boolean |
| If the Player is in start screen. | boolean |
| If the Player is in replay screen. | boolean |
| If the Player is within the viewability threshold. | boolean |
| The ID of the next video in the queue. | string |
| The current display mode of PiP, whether it is displayed on a larger/smaller screen. Possible values: | string |
| The current PiP feature status. Possible values: | string |
| If the mobile sticky PiP is expanded. | boolean |
| The reason why the playback has been allowed or not. Possible values: | string |
| The player current playback speed. **Possible values: ** | number |
| The current mode where the Player is displayed. Possible values: | string |
| The id of the previously played video. | string |
| The Player’s current scale mode. Possible values: | string |
| 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 | number |
| Information about the recommended videos currently displayed. Example: | object |
Video properties (web)
STATE | INFO | TYPE |
|---|---|---|
| The timestamp that corresponds to the creation of the video | number |
| Number representing the aspect ratio of the video (e.g., 1.777 for 16:9) | number |
| The duration time of the video resource in seconds. | number |
| The unique ID of the video. | string |
| If the video is created for children. | boolean |
| If the video requires a password to be read. | boolean |
| The origin of a video load. Possible values: | string |
| Contains the avatar of the video owner, including the height of the image in pixels and its URL. | object |
| The id of the owner of the video. | string |
| The screen name of the owner of the video. | string |
| The user name of the owner of the video. | string |
| Contains the thumbnail of the video, including the height of the image in pixels and its URL. | object |
| The video qualities that are available. | array |
| The quality value of the video loaded. | string |
| The language code of the subtitle track that is currently enabled. | string |
| The language codes of the subtitle tracks which are available for the current media resource. | array |
| The current playback position of the video in seconds. | number |
| The title of the video loaded. | string |
| 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",
}