ReferenceMedia
DailymotionVideo
Video component that plays Dailymotion videos through a Dailymotion player configuration
The Dailymotion player plays videos inside a player configuration you create in Dailymotion Studio, and this component drives it through the Dailymotion Web SDK. Dailymotion refuses any embed that doesn’t name a player configuration, so every source carries a Player ID. See Create a Player in the official Dailymotion documentation.
Import
Load a source
The simplest src is the player embed URL Dailymotion Studio gives you, which names both the player configuration and the video:
Specify the Player ID
These URLs name a video but no player configuration, so pair them with engine.dailymotion.player:
- Video page URLs:
dailymotion.com/video/<id> - Legacy embed URLs:
dailymotion.com/embed/video/<id>, orgeo.dailymotion.com/player.html?video=<id>, where they now redirect - Short links:
dai.ly/<id>
engine.dailymotion.player also wins over the configuration a player embed URL names. Configure the player in Dailymotion Studio covers where a Player ID comes from. Dailymotion’s runtime parameters go next to it:
The URL’s query can also carry Dailymotion’s startTime (or the older start), scaleMode, and customConfig[key]=value, as Dailymotion’s iframe embed reads them; engine.dailymotion wins over them. loop, autoplay, and mute come from the component’s own props.
Without a Player ID, the component reports a MEDIA_ERR_SRC_NOT_SUPPORTED error instead of creating a player Dailymotion would reject, and in development it logs a warning that points to engine.dailymotion.player. The SDK script is loaded from geo.dailymotion.com with the first player created on the page; under a Content Security Policy, allow that origin.
Use Dailymotion’s controls
Dailymotion’s Terms of Use don’t allow blocking any part of its embedded player, including its links back to Dailymotion. So the component always lets the player take pointer input, and Dailymotion’s own controls, logo, and links stay usable.
A skin doesn’t work over the player, which takes the pointer input over the video before the skin can see it, so use the component without one, as in Basic Usage.
Configure the player in Dailymotion Studio
Create a player configuration on the Players page in Dailymotion Studio. Its Player ID is the part of the player embed URL Studio gives you after /player/: x8lr5 in geo.dailymotion.com/player/x8lr5.html.
The player configuration decides what the embed can’t change at runtime:
Behavior
- Volume and mute both work, like a native
<video>. Dailymotion has no separate mute, so muting sets its volume to0and unmuting restores the previous level. playbackRatetakes Dailymotion’s rates,0.25to2in steps of0.25. Dailymotion rounds any other value up to the next one and caps it at2, andplaybackRatethen reports the rate it plays at.loopis passed to Dailymotion, which restarts the video itself.- A new source loads into the same player while the Player ID and the runtime parameters other than
startTimestay the same, whether they come fromengine.dailymotionor the URL’s query. Any other change creates a new player, since Dailymotion only reads them when a player is created. So doesautoplay, but only at the next load: callload()to apply a change right away.mutedandloopchange in place. - Depending on the player configuration, Dailymotion may ignore a seek made before the video first plays, and playback then starts from the beginning. To start at a known position, set
startTimeon the source (underengine.dailymotion, or in the URL) instead: Dailymotion applies it on load. - Seeking while paused stays paused, as on a native
<video>. Dailymotion starts playback on a seek from its start or end screen, and the component pauses it again as it starts, unless an ad plays first. - The SDK reports no buffered range, so
bufferedends at the furthest point played. - Ads play inside the embed, and the component never pauses one.
pausedfollows the ad while it plays, butcurrentTimeanddurationalways describe the video. - When the browser refuses to start playback, as it does for unmuted autoplay, the component reports
pauseinstead of playing. - Fullscreen targets the element the player is built in.
Examples
Basic Usage
API Reference
Props
Accepts these Video.js-specific props:
Engine options
source.engine.dailymotion
Pass the Player ID as player, plus Dailymotion runtime parameters under source.engine.dailymotion, spelled exactly as Dailymotion spells them. Media Sources covers how engine options fit into a structured source.
The video comes from src, and loop and autoplay from the props of the same name, so none of them has an engine.dailymotion spelling. Mute isn’t a runtime parameter either: the component applies it through the SDK. Configure the player in Dailymotion Studio lists what only the player configuration decides, such as controls.
Refs
ref
Forwards to the rendered <div>,
an HTMLDivElement. The <div> cannot play or seek; use mediaRef for playback.
mediaRef
Receives the DailymotionAdapter that
drives the embed, which exposes media methods and properties such
as play() and currentTime. It is set once the
adapter has attached to the <div>, so its target is already that element, and
it is cleared when the element unmounts.
Events
Handle standard media events with React event props such as onPlay and onTimeUpdate. The adapter dispatches them, not the <div>. For events without a React prop, call addEventListener on the adapter from mediaRef.