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)

STATEINFOTYPE
adAdvertiserNameThe advertiser name or null.string
adCompanionAn array of parsed companion ad creatives.array
adCreativeAdIdThe universal ad id node from the VAST or the ad id of the creative node from the VAST.string
adCreativeIdThe id of the creative node from the VAST.string
adDescriptionThe description of the ad or null.string
adDurationThe 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
adErrorContains information about the last ad error that occurred in the Player, including message and code.object
adIdThe id of the ad.string
adIsPlayingWhether an ad resource is running.boolean
adIsSkippableWhether 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
adSkipOffsetThe remaining time (in seconds) before the ad can be skipped, or -1 if no ad is running.number
adTimeThe current playback position of an ad in seconds.number
adTitleThe title of the ad, or null.string

Player properties (web)

STATEINFOTYPE
playerAspectRatio

The Player current aspect ratio.

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

string
playerErrorContains 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
playerIsAlertDialogDisplayedIf the Player has the alert dialog displayed.boolean
playerIsBufferingIf the Player is loading the media resource.boolean
playerIsCriticalPathReadyIf the Player is ready to play.boolean
playerIsMutedIf the Player is muted.boolean
playerIsNavigationEnabledIf the next and previous controls in the PiP are enabled.boolean
playerIsPipNativeSupportedIf the Player does support the native PiP.boolean
playerIsPlaybackAllowedIf the Player is allowed to play, depending on the browser permissions.boolean
playerIsPlayingIf the Player is currently playing video or ad content.boolean
playerIsStartScreenIf the Player is in start screen.boolean
playerIsReplayScreenIf the Player is in replay screen.boolean
playerIsViewableIf the Player is within the viewability threshold.boolean
playerNextVideoThe 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
playerPipIsExpandedIf 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
playerPrevVideoThe 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)

STATEINFOTYPE
videoCreatedTimeThe timestamp that corresponds to the creation of the videonumber
videoAspectRatioNumber representing the aspect ratio of the video (e.g., 1.777 for 16:9)number
videoDurationThe duration time of the video resource in seconds.number
videoIdThe unique ID of the video.string
videoIsCreatedForKidsIf the video is created for children.boolean
videoIsPasswordRequiredIf 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
videoOwnerAvatarsContains the avatar of the video owner, including the height of the image in pixels and its URL.object
videoOwnerIdThe id of the owner of the video.string
videoOwnerScreennameThe screen name of the owner of the video.string
videoOwnerUsernameThe user name of the owner of the video.string
videoPostersContains the thumbnail of the video, including the height of the image in pixels and its URL.object
videoQualitiesListThe video qualities that are available.array
videoQualityThe quality value of the video loaded.string
videoSubtitlesThe language code of the subtitle track that is currently enabled.string
videoSubtitlesListThe language codes of the subtitle tracks which are available for the current media resource.array
videoTimeThe current playback position of the video in seconds.number
videoTitleThe 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",
}