The Player is loaded asynchronously using a Promise, which on resolve returns a player object. In order to get access to a Player, you can retrieve a Player using one of the below methods. API commands can be called to programmatically create and control a Player. Once you have access to a Player on a page, you can control that Player programmatically.
Initialize & destroy Player (web)
| Methods | Description |
|---|---|
onScriptLoaded() | Check if the Player Library Script is fully loaded before using any other method to interact with the Player. |
createPlayer() | Create a new video Player on a web page. |
getPlayer() | On resolve, the Promise will return a player if there is a single player instance. Otherwise, it will be rejected if there are multiple player embeds. |
getPlayer('source_id') | On resolve, the Promise will return the specified player, pass the container ID of the specific player as an argument into the getPlayer() method. |
getAllPlayers() | Returns an array of promises. Each promise returns one of the player of the page. |
destroy() | To destroy a Player instance, pass in specified Player ID. |
Load content (web)
| Methods | Description |
|---|---|
loadContent() | To load a video or a playlist. |
setCustomRecommendations() | To set custom recommendations in the Player, giving a list of video xIDs. |
Playback (web)
| Methods | Description |
|---|---|
play() | To start or resume video playback. |
pause() | To pause video playback. |
seek() | To seek to the specified time in video playback in seconds. |
Advertising (web)
| Methods | Description |
|---|---|
setCustomConfig() | To set the config for ads and dynamically update the advertising parameter value. |
Settings (web)
Methods | Description |
|---|---|
| To enable or disable fullscreen mode. |
| To set the video’s quality to the specified quality. Possible values: [ |
| 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: |
| To activate a subtitles track to a specified language if available. |
| To adjust the player view of the video screen. Possible values: |
| To set the player’s volume to the specified level. |
| To set the mute mode of the player. |
| To change the following player config values at runtime: |
Picture-in-picture (web)
| Methods | Description |
|---|---|
pipClose() | To deactivate PiP. |
pipResume() | To resume PiP. |
pipCollapse() | To collapse the mobile sticky PiP. |
pipExpand() | To expand the mobile sticky PiP. |
pipRepaint() | To repaint PiP seamlessly when dynamic elements are changing the layout of a page. |
Player details (web)
| Methods | Description |
|---|---|
getSettings() | To retrieve the configuration of a Player as defined in your Dailymotion Studio. |
getState() | To retrieve the current state of the Player. |
getRootNode() | Retrieve the node where the Player iFrame is contained. |
