Skip to content

ReferenceMedia

dailymotion-video

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

pnpm add @videojs/dailymotion-video
import '@videojs/html/media/dailymotion-video';

Or load it from the CDN:

<script type="module" src="https://cdn.jsdelivr.net/npm/@videojs/cdn@10.3.0/media/dailymotion-video.js"></script>

Load a source

The simplest src is the player embed URL Dailymotion Studio gives you, which names both the player configuration and the video:

<dailymotion-video src="https://geo.dailymotion.com/player/x8lr5.html?video=x84sh87"></dailymotion-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>, or geo.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:

const video = document.querySelector('dailymotion-video');
video.source = {
  src: 'https://www.dailymotion.com/video/x84sh87',
  engine: { dailymotion: { player: 'x8lr5', startTime: 10 } },
};

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:

Setting Effect
Controls Which of Dailymotion’s controls show. controls has no effect.
Autostart autoplay decides whether the video starts: with it off, the component pauses the configuration’s autostart as it starts. An ad that plays first is never paused, and the video after it is. Turning Autostart off avoids the pause.
Autonext When the player moves on to the next video by itself, src still names the one you loaded. It also overrides loop: the video stops at the end, and the component reports ended.
Picture-in-picture Dailymotion’s picture-in-picture moves the player out of the element.
Poster, preload, and inline playback poster, preload, and playsinline are accepted for parity with <video> but have no effect.

Behavior

  • Volume and mute both work, like a native <video>. Dailymotion has no separate mute, so muting sets its volume to 0 and unmuting restores the previous level.
  • playbackRate takes Dailymotion’s rates, 0.25 to 2 in steps of 0.25. Dailymotion rounds any other value up to the next one and caps it at 2, and playbackRate then reports the rate it plays at.
  • loop is 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 startTime stay the same, whether they come from engine.dailymotion or the URL’s query. Any other change creates a new player, since Dailymotion only reads them when a player is created. So does autoplay, but only at the next load: call load() to apply a change right away. muted and loop change 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 startTime on the source (under engine.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 buffered ends at the furthest point played.
  • Ads play inside the embed, and the component never pauses one. paused follows the ad while it plays, but currentTime and duration always describe the video.
  • When the browser refuses to start playback, as it does for unmuted autoplay, the component reports pause instead of playing.
  • Fullscreen targets the element the player is built in.

Examples

Basic Usage

<dailymotion-video muted src="https://geo.dailymotion.com/player/x8lr5.html?video=x84sh87" class="dailymotion-video"></dailymotion-video>

API Reference

Attributes

These attributes configure the embedded media adapter:

AttributeTypeDefaultDetails
autoplaybooleanfalse
controlsbooleanfalse
loopbooleanfalse
mutedbooleanfalse
playsinlinebooleantrue
posterstring''
preloadMediaPreloadType'metadata'
srcstring''

Properties

PropertyTypeDefaultDetails
autoplaybooleanfalse
bufferedTimeRangeLike—
controlsbooleanfalse
currentSrcstring—
currentTimenumber—
defaultMutedbooleanfalse
durationnumber—
endedboolean—
engineobject—
errorMediaError | null—
isFullscreenboolean—
loopbooleanfalse
mutedbooleanfalse
pausedboolean—
playbackRatenumber—
playedobject—
playsInlinebooleantrue
posterstring''
preloadMediaPreloadType'metadata'
readyStatenumber—
seekableTimeRangeLike—
seekingboolean—
sourceobjectnull
srcstring''
textTracksTextTrackListLike—
volumenumber—

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.

OptionTypeDetails
customConfigRecord<string, string> | undefined
playerstring | undefined
referrerPolicyReferrerPolicy | undefined
scaleMode'fit' | 'fill' | 'fillLeft' | 'fillRi...
startTimenumber | undefined

Methods

Supports these media methods: exitFullscreenloadpauseplayrequestFullscreen

Events

Implements these standard media events through the embedded player: canplaydurationchangeemptiedendederrorloadedmetadataloadstartpauseplayplayingratechangeseekedseekingtimeupdatevolumechangewaiting

Also emits these Video.js-specific events:

EventDescription
loadcomplete
sourcechangeFired when source changes, either directly or by resolving a new src. Read source for the new value.