Picture-in-Picture (PiP)
How to work with Picture-in-Picture (PiP).
You are reading API v2 documentationStill using the Legacy API? Access the Legacy API documentation.
The Dailymotion Player is compatible with native Picture-in-Picture (PiP) in addition to our own out-of-the-box Picture-in-Picture product.
Native PiP allows viewers to continue watching content while browsing on other apps and websites on their devices. This functionality is controlled by the browsers APIs and cannot be customized: the below method doesn’t apply to it.
Our own Dailymotion PiP solution allows viewers to continue watching your content while scrolling the page. Our PiP is easily managed through the Dailymotion Studio and can be customized: it delivers a smooth and engaging user experience and will help boost your monetization opportunities.
Pro subscribers can enable the Picture-in-Picture feature in the Player settings using the Dailymotion Studio or API. This functionality requires JavaScript and can only be used with the Player Embed Script or Player Library Script on web embeds. It is not available with the iFrame embed method.
PiP settings
As the user scrolls the page, the video transitions from playing in the in-page Player to playing in a sticky mini Player, which remains in view as the user continues scrolling.
The pip.mode parameter controls this behavior:
pip.mode Value | Info |
|---|---|
off | PiP is not enabled |
on | PiP transitions after the main Player has been seen by the user and after they scroll until less than 50% of the main Player is within the viewport |
instant | PiP launches as soon as the Player is loaded and the main player isn't in the user's viewport |
You can set this parameter when creating or updating a Player via the API:
curl --request POST \
--url https://api.dailymotion.com/v2/profiles/<YOUR_PROFILE_ID>/players \
--header 'accept: application/json' \
--header 'authorization: Bearer ${ACCESS_TOKEN}' \
--header 'content-type: application/json' \
--data '{
"name": "My Player",
"pip": {
"mode": "on"
}
}'When triggered, the mini Player is displayed at your selected corner — bottom right by default — consistently across desktop, tablet and mobile.
PiP positioning
Default placement
The PiP frame will, by default, transition and appear at the bottom right of the screen. It's optimized for viewability, performance, monetization and built with a minimal, user-centric design.
You can configure the default corner position using pip.selected_placement when creating or updating a Player. Accepted values are: bottom_right (default), bottom_left, top_right, top_left.
This placement is applied consistently across desktop, tablet and mobile viewports.
PiP size
By default, the PiP window is displayed at a standard size: a minimum width of 410px on desktop and a compact, responsive size on mobile and tablet. In all cases the 16:9 aspect ratio is preserved and the window is sized responsively.
To display a larger PiP on smaller screens, set pip.enable_large_size to true when creating or updating a Player. When enabled, the PiP window is computed to cover approximately 20% of the viewport area on mobile and tablet. When set to false or left unset, the default PiP size is used.
curl --request POST \
--url https://api.dailymotion.com/v2/profiles/<YOUR_PROFILE_ID>/players \
--header 'accept: application/json' \
--header 'authorization: Bearer ${ACCESS_TOKEN}' \
--header 'content-type: application/json' \
--data '{
"name": "My Player",
"pip": {
"mode": "on",
"enable_large_size": true
}
}'Programmatically interacting with PiP
The PiP can be programmatically closed, resumed or repainted using the dedicated Web SDK methods. The PiP setting has to be enabled in the Player configuration. Once PiP is activated, the Player API exposes the following global methods:
| Type | Method | Info |
|---|---|---|
| Close PiP | dailymotion.pipClose() | To suspend PiP functionality Demo |
| Resume PiP | dailymotion.pipResume() | To resume PiP functionality after it has been suspended. Re-enables the PiP mechanism but does not immediately display the PiP. The PiP will automatically reappear when the player scrolls out of the viewport. |
| Repaint PiP | dailymotion.pipRepaint() | To repaint PiP seamlessly when dynamic elements are changing the layout of a page Demo |
Updated 10 days ago
