@munsonlabs/video-player 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,35 +49,38 @@ import '@munsonlabs/video-player/style'
49
49
 
50
50
  ## VideoItem / VideoPlayer Props
51
51
 
52
- | Prop | Type | Default | Description |
53
- | -------------- | -------------- | -------- | ----------------------------------------------------------------------------------------- |
54
- | `videoUrl` | `string` | — | **Required.** The video URL or platform-specific URI |
55
- | `platform` | `string` | — | `youtube` · `vimeo` · `dailymotion` · `brightcove` · `jwplayer` · `html5` |
56
- | `title` | `string` | `''` | Video title |
57
- | `poster` | `string` | `''` | Poster image URL |
58
- | `aspectRatio` | `string` | `'16:9'` | e.g. `'16:9'`, `'9:16'`, `'4:3'` |
59
- | `autoplay` | `boolean` | `false` | Autoplay on mount (mutes automatically) |
60
- | `muted` | `boolean` | `false` | Start muted |
61
- | `lazy` | `boolean` | `true` | Show placeholder until clicked |
62
- | `nativeUi` | `boolean` | `false` | Use the platform's native controls (YouTube, Vimeo, Dailymotion only) |
63
- | `autoStage` | `boolean` | `false` | Immediately send this video to the stage on mount |
64
- | `playbackRate` | `number` | `1` | Initial playback rate |
65
- | `adTagUrl` | `string` | `''` | VAST or VMAP ad tag URL |
66
- | `imaOptions` | `object` | `{}` | Extra options passed to the IMA plugin (e.g. `{ customParameters: { section: 'news' } }`) |
67
- | `techOptions` | `object` | `{}` | Extra options passed directly to Video.js |
68
- | `payload` | `object` | `{}` | Arbitrary data attached to every `state-change` event |
69
- | `action` | `PlayerAction` | `null` | Button shown in the player HUD — see [Actions](#actions) |
52
+ | Prop | Type | Default | Description |
53
+ | -------------- | -------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
54
+ | `videoUrl` | `string` | — | **Required.** The video URL or platform-specific URI |
55
+ | `platform` | `string` | — | `youtube` · `vimeo` · `dailymotion` · `brightcove` · `jwplayer` · `html5` |
56
+ | `title` | `string` | `''` | Video title |
57
+ | `poster` | `string` | `''` | Poster image URL |
58
+ | `aspectRatio` | `string` | `'16:9'` | e.g. `'16:9'`, `'9:16'`, `'4:3'` |
59
+ | `autoplay` | `boolean` | `false` | Autoplay on mount (mutes automatically) |
60
+ | `muted` | `boolean` | `false` | Start muted |
61
+ | `lazy` | `boolean` | `true`\* | Show placeholder until clicked |
62
+ | `nativeUi` | `boolean` | `false` | Use the platform's native controls (YouTube, Vimeo, Dailymotion only) |
63
+ | `autoStage` | `boolean` | `false` | Immediately send this video to the stage on mount |
64
+ | `playbackRate` | `number` | `1` | Initial playback rate |
65
+ | `adTagUrl` | `string` | `''` | VAST or VMAP ad tag URL |
66
+ | `imaOptions` | `object` | `{}` | Extra options passed to the IMA plugin (e.g. `{ customParameters: { section: 'news' } }`) |
67
+ | `techOptions` | `object` | `{}` | Extra options passed directly to Video.js |
68
+ | `payload` | `object` | `{}` | Arbitrary data attached to every `state-change` event |
69
+ | `action` | `PlayerAction` | `null` | Button shown in the player HUD — see [Actions](#actions) |
70
+ | `focusMode` | `boolean` | `false` | The "show controls" button centers the video and renders controls below it — see [Focus mode](#focus-mode) |
71
+
72
+ \* `lazy` only has an effect on `VideoItem` (default `true`), which is what actually implements the placeholder-until-clicked behavior. `VideoPlayer` accepts the prop for type compatibility but defaults to `false` and never reads it — using `<VideoPlayer>` directly always mounts the real player immediately, regardless of `lazy`.
70
73
 
71
74
  ### Platform URLs
72
75
 
73
- | Platform | URL format |
74
- | ------------- | -------------------------------------------------- |
75
- | `youtube` | `https://www.youtube.com/watch?v=VIDEO_ID` |
76
- | `vimeo` | `https://vimeo.com/VIDEO_ID` |
77
- | `dailymotion` | `https://www.dailymotion.com/video/VIDEO_ID` |
78
- | `brightcove` | `brightcove://ACCOUNT_ID/PLAYER_ID/embed/VIDEO_ID` |
79
- | `jwplayer` | `https://cdn.jwplayer.com/videos/...` |
80
- | `html5` | Any direct MP4 / HLS URL |
76
+ | Platform | URL format |
77
+ | ------------- | -------------------------------------------------------------------------------------------------------- |
78
+ | `youtube` | `https://www.youtube.com/watch?v=VIDEO_ID` |
79
+ | `vimeo` | `https://vimeo.com/VIDEO_ID` |
80
+ | `dailymotion` | `https://www.dailymotion.com/video/VIDEO_ID` |
81
+ | `brightcove` | `brightcove://ACCOUNT_ID/PLAYER_ID/embed/VIDEO_ID` |
82
+ | `jwplayer` | `https://cdn.jwplayer.com/videos/...` · `https://cdn.jwplayer.com/manifests/...` · `jwplayer://MEDIA_ID` |
83
+ | `html5` | Any direct MP4 / HLS URL |
81
84
 
82
85
  ---
83
86
 
@@ -89,7 +92,21 @@ Emitted by `VideoItem`, `VideoPlayer`, and `VideoStage`.
89
92
 
90
93
  ```ts
91
94
  interface StateChangeEvent {
92
- type: 'play' | 'pause' | 'ended' | 'seeked' | 'error' | 'adstart' | 'adend' | 'volumechange' | 'ratechange'
95
+ type:
96
+ | 'play'
97
+ | 'pause'
98
+ | 'ended'
99
+ | 'seeked'
100
+ | 'error'
101
+ | 'adstart'
102
+ | 'adend'
103
+ | 'volumechange'
104
+ | 'ratechange'
105
+ | 'firstQuartile'
106
+ | 'midpoint'
107
+ | 'thirdQuartile'
108
+ | 'focusstart'
109
+ | 'focusend'
93
110
  currentTime: number
94
111
  duration: number
95
112
  src: string
@@ -100,12 +117,45 @@ interface StateChangeEvent {
100
117
  }
101
118
  ```
102
119
 
120
+ `firstQuartile` / `midpoint` / `thirdQuartile` fire once each as playback crosses 25%, 50%, and 75% of the video's duration — useful for analytics integrations that expect IAB-style progress milestones. They reset and can fire again on loop restart.
121
+
122
+ `focusstart` / `focusend` fire when [focus mode](#focus-mode) is entered/exited (only relevant if `focusMode` is set).
123
+
124
+ On `error`, the player shows a "Retry" button that re-attempts loading the current source. You can also trigger this yourself via a template ref on `VideoPlayer`, which exposes a `retry()` method along with `togglePlay()`, `seek()`, `toggleMute()`, `setVolume()`, `toggleFullscreen()`, `toggleLoop()`, and `setPlaybackRate()`. Note this is on `VideoPlayer` specifically — `VideoItem` doesn't forward a ref to it, since it may be showing a lazy placeholder instead:
125
+
126
+ ```vue
127
+ <script setup>
128
+ import { ref } from 'vue'
129
+ const player = ref(null)
130
+ </script>
131
+
132
+ <template>
133
+ <VideoPlayer ref="player" video-url="..." platform="html5" />
134
+ <button @click="player.retry()">Retry</button>
135
+ </template>
136
+ ```
137
+
103
138
  ```vue
104
139
  <VideoItem video-url="..." platform="html5" @state-change="onStateChange" />
105
140
  ```
106
141
 
107
142
  ---
108
143
 
144
+ ## Focus mode
145
+
146
+ Set `focusMode` to change what the "show controls" button (in the HUD row) does: instead of overlaying the expanded controls on top of the video, the video centers itself on the page and the controls bar renders below it, dimming the rest of the page behind a backdrop.
147
+
148
+ ```vue
149
+ <VideoItem video-url="..." platform="youtube" focus-mode />
150
+ ```
151
+
152
+ - The video's original spot in the page keeps its size (an empty placeholder box) so surrounding layout doesn't jump while it's centered.
153
+ - Clicking the backdrop, pressing `Escape`, or the close button in the controls bar all return it to its original position.
154
+ - The move is animated via the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) where supported, falling back to an instant toggle otherwise.
155
+ - The video element itself is never moved in the DOM (no `Teleport`) — it's purely a CSS `position: fixed` toggle — so YouTube/Vimeo/Dailymotion iframes are never reloaded by entering or exiting focus mode.
156
+
157
+ ---
158
+
109
159
  ## Actions
110
160
 
111
161
  The `action` prop adds a button to the player HUD. Pass a built-in string or a custom action object.
@@ -167,6 +217,23 @@ Ads are not supported on YouTube, Vimeo, or Dailymotion.
167
217
 
168
218
  ---
169
219
 
220
+ ## Theming the HUD buttons
221
+
222
+ The three buttons in the HUD row — the action button (mute/loop/custom/save), the central play/pause button, and the "show controls" button — read their background and icon color from two CSS custom properties, falling back to the default frosted-glass look when unset. The expanded controls popup (opened via the "show controls" button) is unaffected and keeps its own fixed styling.
223
+
224
+ Set the variables on any ancestor of the player — e.g. a wrapper `<div>` or `:root` — to restyle all three buttons at once:
225
+
226
+ ```css
227
+ .my-video-wrapper {
228
+ --mvp-btn-bg: #e11d48;
229
+ --mvp-btn-color: #fff;
230
+ }
231
+ ```
232
+
233
+ Icons use `fill="currentColor"`, so `--mvp-btn-color` recolors the icon along with `--mvp-btn-bg` for the background. Hover state is a `filter: brightness()` lift on top of `--mvp-btn-bg`, so it works for both the default translucent look and a solid theme color.
234
+
235
+ ---
236
+
170
237
  ## Window Events
171
238
 
172
239
  `VideoItem` and `VideoStage` communicate via window custom events. You can dispatch these yourself to control the stage from outside Vue.
@@ -0,0 +1 @@
1
+ import{a as e}from"./tech-DYVa4zaY.mjs";import t from"video.js";const n={};function r(e){let t=e.match(/^brightcove:\/\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)$/);return t?{accountId:t[1],playerId:t[2],embed:t[3],videoId:t[4]}:null}function i(e){return(e?.plugins??[]).find(e=>e.name===`ima3`)?.options?.serverUrl??null}async function a(e,t,r,a){let o=`${e}/${t}_${r}`;if(n[o])return n[o];let s=await fetch(`https://players.brightcove.net/${e}/${t}_${r}/config.json`);if(!s.ok)throw Error(`Brightcove: could not load player config (${s.status})`);let c=await s.json(),l=a??c?.video_cloud?.policy_key;if(!l)throw Error(`Brightcove: policy_key not found in player config`);let u={policyKey:l,adTagUrl:i(c)};return n[o]=u,u}async function o(e,t){let n=r(e);if(!n)return null;let{accountId:i,playerId:o,embed:s}=n;return a(i,o,s,t)}async function s(t,n,r){let i=await fetch(`https://edge.api.brightcove.com/playback/v1/accounts/${t}/videos/${n}`,{headers:{Accept:`application/json;pk=${r}`}});if(!i.ok)throw Error(`Brightcove Playback API error: ${i.status}`);let a=await i.json(),o=e(a.sources||[]);if(!o.length)throw Error(`Brightcove: no playable sources found`);return{sources:o.map(e=>({src:e.src,type:e.type})),poster:a.poster??a.thumbnail??null}}t.use(`video/brightcove`,e=>({setSource(n,i){let o=r(n.src);if(!o){i(Error(`Brightcove: invalid src — expected "brightcove://accountId/playerId/embed/videoId"`),n);return}let{accountId:c,playerId:l,embed:u,videoId:d}=o,f=e.options_?.brightcove?.policyKey;(async()=>{try{let{policyKey:n}=await a(c,l,u,f);t.log(`Brightcove: resolved policy key, fetching sources…`);let{sources:r,poster:o}=await s(c,d,n);t.log(`Brightcove: sources resolved`,r),o&&!e.poster()&&e.poster(o),i(null,r[0])}catch(e){t.log.error(`Brightcove error:`,e.message),i(e,n)}})()}}));export{o as prefetchConfig};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./video.cjs-gZWrkL0e.mjs";import{a as n}from"./tech-hIKMwrTq.mjs";var r=e(t(),1);const i={};function a(e){let t=e.match(/^brightcove:\/\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)$/);return t?{accountId:t[1],playerId:t[2],embed:t[3],videoId:t[4]}:null}function o(e){return(e?.plugins??[]).find(e=>e.name===`ima3`)?.options?.serverUrl??null}async function s(e,t,n,r){let a=`${e}/${t}_${n}`;if(i[a])return i[a];let s=await fetch(`https://players.brightcove.net/${e}/${t}_${n}/config.json`);if(!s.ok)throw Error(`Brightcove: could not load player config (${s.status})`);let c=await s.json(),l=r??c?.video_cloud?.policy_key;if(!l)throw Error(`Brightcove: policy_key not found in player config`);let u={policyKey:l,adTagUrl:o(c)};return i[a]=u,u}async function c(e,t){let n=a(e);if(!n)return null;let{accountId:r,playerId:i,embed:o}=n;return s(r,i,o,t)}async function l(e,t,r){let i=await fetch(`https://edge.api.brightcove.com/playback/v1/accounts/${e}/videos/${t}`,{headers:{Accept:`application/json;pk=${r}`}});if(!i.ok)throw Error(`Brightcove Playback API error: ${i.status}`);let a=await i.json(),o=n(a.sources||[]);if(!o.length)throw Error(`Brightcove: no playable sources found`);return{sources:o.map(e=>({src:e.src,type:e.type})),poster:a.poster??a.thumbnail??null}}r.default.use(`video/brightcove`,e=>({setSource(t,n){let i=a(t.src);if(!i){n(Error(`Brightcove: invalid src — expected "brightcove://accountId/playerId/embed/videoId"`),t);return}let{accountId:o,playerId:c,embed:u,videoId:d}=i,f=e.options_?.brightcove?.policyKey;(async()=>{try{let{policyKey:t}=await s(o,c,u,f);r.default.log(`Brightcove: resolved policy key, fetching sources…`);let{sources:i,poster:a}=await l(o,d,t);r.default.log(`Brightcove: sources resolved`,i),a&&!e.poster()&&e.poster(a),n(null,i[0])}catch(e){r.default.log.error(`Brightcove error:`,e.message),n(e,t)}})()}}));export{c as prefetchConfig};
@@ -0,0 +1 @@
1
+ const e=`video-select`,t=`video-toggle`,n=`video-state`,r=`fullscreen-pending`,i=`fullscreen-pending-done`,a=`ads-pod-started`,o=`ads-pod-ended`,s=`player:positions`;export{i as a,t as c,r as i,o as n,e as o,a as r,n as s,s as t};
@@ -0,0 +1 @@
1
+ import{c as e,o as t,r as n,t as r}from"./tech-DYVa4zaY.mjs";import{a as i,i as a}from"./constants-DZGeSme4.mjs";import{t as o}from"./loadScript-Du6JsTc2.mjs";import s from"video.js";const c=s.getTech(`Tech`);var l=class t extends c{constructor(e,t){super(e,t),this._currentTime=0,this._duration=0,this._volume=1,this._muted=!1,this._paused=!0,this._seeking=!1,this._dm=null,this.setSrc(this.options_.source),this.setTimeout(()=>{this.el_&&(this.el_.parentNode.classList.add(`vjs-dailymotion`),this.initPlayer())})}createEl(){let e=document.createElement(`div`);return e.setAttribute(`id`,this.options_.techId),e.setAttribute(`class`,`vjs-tech`),e.setAttribute(`style`,`position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden`),e}async initPlayer(){let e=this.options_,t=e.source?.dailymotion?.playerId;if(!this.videoId){s.log.error(`Dailymotion Tech: could not parse video ID from source URL`);return}this._playerId=t;let n=this.el_?.parentNode;for(;n&&!n.classList?.contains(`player__shell`);)n=n.parentNode;this._shell=n;try{let n=await o(t?`https://geo.dailymotion.com/libs/player/${t}.js`:`https://geo.dailymotion.com/libs/player.js`,t||`dailymotion-sdk`).then(()=>window.dailymotion);if(!this.el_)return;this._dm_sdk=n;let r=await n.createPlayer(this.options_.techId,{...t?{player:t}:{},video:this.videoId,params:{autoplay:!!e.autoplay,mute:!!e.muted}});if(!this.el_)return;this._dm=r;let{events:i}=this._dm_sdk;this.triggerReady(),this.playOnReady&&this.play(),r.on(i.PLAYER_CRITICALPATHREADY,e=>{let t=e.videoThumbnails;if(t){let e=t[Object.keys(t).map(Number).sort((e,t)=>t-e)[0]];e&&this.trigger({type:`posterchange`,src:e})}}),r.on(i.VIDEO_PLAY,()=>{this._paused=!1,this.trigger(`play`),this.trigger(`playing`)}),r.on(i.VIDEO_PLAYING,()=>{this._paused=!1,this.trigger(`play`),this.trigger(`playing`)}),r.on(i.VIDEO_PAUSE,()=>{this._paused=!0,this.trigger(`pause`)}),r.on(i.VIDEO_END,()=>{this._paused=!0,this.trigger(`ended`)}),r.on(i.VIDEO_TIMECHANGE,e=>{this._currentTime=e.videoTime??this._currentTime,this._duration=e.videoDuration??this._duration,this.trigger(`timeupdate`)}),r.on(i.VIDEO_DURATIONCHANGE,e=>{this._duration=e.videoDuration??this._duration,this.trigger(`durationchange`)}),r.on(i.VIDEO_SEEKSTART,()=>{this._seeking=!0,this.trigger(`seeking`)}),r.on(i.VIDEO_SEEKEND,e=>{this._seeking=!1,this._currentTime=e.videoTime??this._currentTime,this.trigger(`seeked`)}),r.on(i.PLAYER_VOLUMECHANGE,e=>{this._volume=e.playerVolume??this._volume,this._muted=e.playerIsMuted??this._muted,this.trigger(`volumechange`)}),r.on(i.PLAYER_ERROR,()=>this.trigger(`error`)),i.AD_START&&r.on(i.AD_START,()=>this.trigger(`adstart`)),i.AD_END&&r.on(i.AD_END,()=>this.trigger(`adend`))}catch(e){s.log.error(`Dailymotion:`,e.message)}}play(){this._dm?this._dm.play():this.playOnReady=!0}pause(){this._dm?.pause()}paused(){return this._paused}seeking(){return this._seeking}currentTime(){return this._currentTime}setCurrentTime(e){this._currentTime=e,this._dm?.seek(e),this._seeking=!0,this.trigger(`seeking`)}duration(){return this._duration}volume(){return this._volume}setVolume(e){this._volume=e,this._dm?.setVolume(e)}muted(){return this._muted}setMuted(e){this._muted=e,this._dm?.setMute(e)}playbackRate(){return 1}setPlaybackRate(){}buffered(){return s.createTimeRange(0,this._currentTime)}seekable(){return s.createTimeRange(0,this._duration)}currentSrc(){return this.source?.src??``}ended(){return!1}preload(){}load(){}reset(){}networkState(){return+!!this._dm}readyState(){return this._dm?4:0}supportsFullScreen(){return e()}enterFullscreen(){if(n()){this._spawnIosFullscreen();return}(this._shell?.requestFullscreen||this._shell?.webkitRequestFullscreen)?.call(this._shell)}exitFullscreen(){r()}_spawnIosFullscreen(){let e=this._currentTime;this._dm?.pause(),this.player_.trigger(a);let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:99999;opacity:0;pointer-events:none`,document.body.appendChild(t);let n=this._playerId?`https://geo.dailymotion.com/player/${this._playerId}.html?video=${this.videoId}&autoplay=1&startTime=${Math.floor(e)}`:`https://geo.dailymotion.com/player.html?video=${this.videoId}&autoplay=1&startTime=${Math.floor(e)}`,r=document.createElement(`iframe`);r.src=n,r.setAttribute(`allow`,`autoplay; fullscreen`),r.setAttribute(`allowfullscreen`,`true`),r.style.cssText=`width:100%;height:100%;border:0`,t.appendChild(r);let o=!1,s=()=>{o||(o=!0,document.removeEventListener(`fullscreenchange`,c),document.removeEventListener(`webkitfullscreenchange`,c),this.player_.trigger(i),t.remove(),this._dm?.seek(e),this._dm?.play())},c=()=>{!document.fullscreenElement&&!document.webkitFullscreenElement&&s()};document.addEventListener(`fullscreenchange`,c),document.addEventListener(`webkitfullscreenchange`,c),r.onload=()=>this.player_.trigger(`fullscreen-pending-done`)}setSrc(e){e?.src&&(this.source=e,this.videoId=t.parseVideoId(e.src),this.options_.autoplay&&(this.playOnReady=!0))}dispose(){this._dm?.destroy?.(),this._dm=null,this.el_?.parentNode?.classList.remove(`vjs-dailymotion`),c.prototype.dispose.call(this)}};l.isSupported=()=>!0,l.canPlayType=e=>e===`video/dailymotion`?`probably`:``,l.canPlaySource=({type:e,src:t})=>e===`video/dailymotion`?`probably`:/dailymotion\.com|dai\.ly/.test(t)?`maybe`:``,l.parseVideoId=e=>{let t=e.match(/[?&]video=([a-zA-Z0-9]+)/);if(t)return t[1];let n=e.match(/(?:dailymotion\.com\/(?:embed\/)?video\/|dai\.ly\/)([a-zA-Z0-9]+)/);return n?n[1]:null},t(`Dailymotion`,l);export{l as default};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./video.cjs-gZWrkL0e.mjs";import{c as n,o as r,r as i,t as a}from"./tech-hIKMwrTq.mjs";import{a as o,i as s}from"./constants-DZGeSme4.mjs";import{t as c}from"./loadScript-Du6JsTc2.mjs";var l=e(t(),1);const u=l.default.getTech(`Tech`);var d=class e extends u{constructor(e,t){super(e,t),this._currentTime=0,this._duration=0,this._volume=1,this._muted=!1,this._paused=!0,this._seeking=!1,this._dm=null,this.setSrc(this.options_.source),this.setTimeout(()=>{this.el_&&(this.el_.parentNode.classList.add(`vjs-dailymotion`),this.initPlayer())})}createEl(){let e=document.createElement(`div`);return e.setAttribute(`id`,this.options_.techId),e.setAttribute(`class`,`vjs-tech`),e.setAttribute(`style`,`position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden`),e}async initPlayer(){let e=this.options_,t=e.source?.dailymotion?.playerId;if(!this.videoId){l.default.log.error(`Dailymotion Tech: could not parse video ID from source URL`);return}this._playerId=t;let n=this.el_?.parentNode;for(;n&&!n.classList?.contains(`player__shell`);)n=n.parentNode;this._shell=n;try{let n=await c(t?`https://geo.dailymotion.com/libs/player/${t}.js`:`https://geo.dailymotion.com/libs/player.js`,t||`dailymotion-sdk`).then(()=>window.dailymotion);if(!this.el_)return;this._dm_sdk=n;let r=await n.createPlayer(this.options_.techId,{...t?{player:t}:{},video:this.videoId,params:{autoplay:!!e.autoplay,mute:!!e.muted}});if(!this.el_)return;this._dm=r;let{events:i}=this._dm_sdk;this.triggerReady(),this.playOnReady&&this.play(),r.on(i.PLAYER_CRITICALPATHREADY,e=>{let t=e.videoThumbnails;if(t){let e=t[Object.keys(t).map(Number).sort((e,t)=>t-e)[0]];e&&this.trigger({type:`posterchange`,src:e})}}),r.on(i.VIDEO_PLAY,()=>{this._paused=!1,this.trigger(`play`),this.trigger(`playing`)}),r.on(i.VIDEO_PLAYING,()=>{this._paused=!1,this.trigger(`play`),this.trigger(`playing`)}),r.on(i.VIDEO_PAUSE,()=>{this._paused=!0,this.trigger(`pause`)}),r.on(i.VIDEO_END,()=>{this._paused=!0,this.trigger(`ended`)}),r.on(i.VIDEO_TIMECHANGE,e=>{this._currentTime=e.videoTime??this._currentTime,this._duration=e.videoDuration??this._duration,this.trigger(`timeupdate`)}),r.on(i.VIDEO_DURATIONCHANGE,e=>{this._duration=e.videoDuration??this._duration,this.trigger(`durationchange`)}),r.on(i.VIDEO_SEEKSTART,()=>{this._seeking=!0,this.trigger(`seeking`)}),r.on(i.VIDEO_SEEKEND,e=>{this._seeking=!1,this._currentTime=e.videoTime??this._currentTime,this.trigger(`seeked`)}),r.on(i.PLAYER_VOLUMECHANGE,e=>{this._volume=e.playerVolume??this._volume,this._muted=e.playerIsMuted??this._muted,this.trigger(`volumechange`)}),r.on(i.PLAYER_ERROR,()=>this.trigger(`error`)),i.AD_START&&r.on(i.AD_START,()=>this.trigger(`adstart`)),i.AD_END&&r.on(i.AD_END,()=>this.trigger(`adend`))}catch(e){l.default.log.error(`Dailymotion:`,e.message)}}play(){this._dm?this._dm.play():this.playOnReady=!0}pause(){this._dm?.pause()}paused(){return this._paused}seeking(){return this._seeking}currentTime(){return this._currentTime}setCurrentTime(e){this._currentTime=e,this._dm?.seek(e),this._seeking=!0,this.trigger(`seeking`)}duration(){return this._duration}volume(){return this._volume}setVolume(e){this._volume=e,this._dm?.setVolume(e)}muted(){return this._muted}setMuted(e){this._muted=e,this._dm?.setMute(e)}playbackRate(){return 1}setPlaybackRate(){}buffered(){return l.default.createTimeRange(0,this._currentTime)}seekable(){return l.default.createTimeRange(0,this._duration)}currentSrc(){return this.source?.src??``}ended(){return!1}preload(){}load(){}reset(){}networkState(){return+!!this._dm}readyState(){return this._dm?4:0}supportsFullScreen(){return n()}enterFullscreen(){if(i()){this._spawnIosFullscreen();return}(this._shell?.requestFullscreen||this._shell?.webkitRequestFullscreen)?.call(this._shell)}exitFullscreen(){a()}_spawnIosFullscreen(){let e=this._currentTime;this._dm?.pause(),this.player_.trigger(s);let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:99999;opacity:0;pointer-events:none`,document.body.appendChild(t);let n=this._playerId?`https://geo.dailymotion.com/player/${this._playerId}.html?video=${this.videoId}&autoplay=1&startTime=${Math.floor(e)}`:`https://geo.dailymotion.com/player.html?video=${this.videoId}&autoplay=1&startTime=${Math.floor(e)}`,r=document.createElement(`iframe`);r.src=n,r.setAttribute(`allow`,`autoplay; fullscreen`),r.setAttribute(`allowfullscreen`,`true`),r.style.cssText=`width:100%;height:100%;border:0`,t.appendChild(r);let i=!1,a=()=>{i||(i=!0,document.removeEventListener(`fullscreenchange`,c),document.removeEventListener(`webkitfullscreenchange`,c),this.player_.trigger(o),t.remove(),this._dm?.seek(e),this._dm?.play())},c=()=>{!document.fullscreenElement&&!document.webkitFullscreenElement&&a()};document.addEventListener(`fullscreenchange`,c),document.addEventListener(`webkitfullscreenchange`,c),r.onload=()=>this.player_.trigger(`fullscreen-pending-done`)}setSrc(t){t?.src&&(this.source=t,this.videoId=e.parseVideoId(t.src),this.options_.autoplay&&(this.playOnReady=!0))}dispose(){this._dm?.destroy?.(),this._dm=null,this.el_?.parentNode?.classList.remove(`vjs-dailymotion`),u.prototype.dispose.call(this)}};d.isSupported=()=>!0,d.canPlayType=e=>e===`video/dailymotion`?`probably`:``,d.canPlaySource=({type:e,src:t})=>e===`video/dailymotion`?`probably`:/dailymotion\.com|dai\.ly/.test(t)?`maybe`:``,d.parseVideoId=e=>{let t=e.match(/[?&]video=([a-zA-Z0-9]+)/);if(t)return t[1];let n=e.match(/(?:dailymotion\.com\/(?:embed\/)?video\/|dai\.ly\/)([a-zA-Z0-9]+)/);return n?n[1]:null},r(`Dailymotion`,d);export{d as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./tech-DYVa4zaY.mjs";import t from"video.js";const n={};function r(e){return e.match(/cdn\.jwplayer\.com\/videos\/([^-]+)/)?.[1]??e.match(/cdn\.jwplayer\.com\/manifests\/([^.]+)/)?.[1]??e.match(/^jwplayer:\/\/([^/]+)$/)?.[1]??null}function i(e){let t=e?.advertising?.schedule;return Array.isArray(t)&&t.length?t[0].tag??null:e?.advertising?.tag??null}async function a(t){if(n[t])return n[t];let r=await fetch(`https://cdn.jwplayer.com/v2/media/${t}`);if(!r.ok)throw Error(`JW Platform API error: ${r.status}`);let a=(await r.json()).playlist?.[0];if(!a)throw Error(`JW Platform: empty playlist`);let o=e((a.sources??[]).map(e=>({src:e.file,type:e.type})));if(!o.length)throw Error(`JW Platform: no playable sources found`);let s={src:o[0].src,type:o[0].type,poster:a.image??null,adTagUrl:i(a)};return n[t]=s,s}async function o(e){let t=r(e);if(!t)throw Error(`JW Platform: unrecognised source URL: ${e}`);let n=await a(t);if(e.startsWith(`jwplayer://`))return n;let i=/\.mp4(\?|$)/.test(e)?`video/mp4`:`application/x-mpegURL`;return{...n,src:e,type:i}}async function s(e){let t=r(e);return t?a(t).catch(()=>null):null}t.use(`video/jwplayer`,e=>({setSource(n,r){(async()=>{try{let{src:i,type:a,poster:s}=await o(n.src);t.log(`JW Platform: resolved source`,i),s&&!e.poster()&&e.poster(s),r(null,{src:i,type:a})}catch(e){t.log.error(`JW Platform error:`,e.message),r(e,n)}})()}}));export{s as prefetchConfig};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./video.cjs-gZWrkL0e.mjs";import{a as n}from"./tech-hIKMwrTq.mjs";var r=e(t(),1);const i={};function a(e){return e.match(/cdn\.jwplayer\.com\/videos\/([^-]+)/)?.[1]??e.match(/cdn\.jwplayer\.com\/manifests\/([^.]+)/)?.[1]??e.match(/^jwplayer:\/\/([^/]+)$/)?.[1]??null}function o(e){let t=e?.advertising?.schedule;return Array.isArray(t)&&t.length?t[0].tag??null:e?.advertising?.tag??null}async function s(e){if(i[e])return i[e];let t=await fetch(`https://cdn.jwplayer.com/v2/media/${e}`);if(!t.ok)throw Error(`JW Platform API error: ${t.status}`);let r=(await t.json()).playlist?.[0];if(!r)throw Error(`JW Platform: empty playlist`);let a=n((r.sources??[]).map(e=>({src:e.file,type:e.type})));if(!a.length)throw Error(`JW Platform: no playable sources found`);let s={src:a[0].src,type:a[0].type,poster:r.image??null,adTagUrl:o(r)};return i[e]=s,s}async function c(e){let t=a(e);if(!t)throw Error(`JW Platform: unrecognised source URL: ${e}`);let n=await s(t);if(e.startsWith(`jwplayer://`))return n;let r=/\.mp4(\?|$)/.test(e)?`video/mp4`:`application/x-mpegURL`;return{...n,src:e,type:r}}async function l(e){let t=a(e);return t?s(t).catch(()=>null):null}r.default.use(`video/jwplayer`,e=>({setSource(t,n){(async()=>{try{let{src:i,type:a,poster:o}=await c(t.src);r.default.log(`JW Platform: resolved source`,i),o&&!e.poster()&&e.poster(o),n(null,{src:i,type:a})}catch(e){r.default.log.error(`JW Platform error:`,e.message),n(e,t)}})()}}));export{l as prefetchConfig};
@@ -0,0 +1 @@
1
+ import e from"video.js";function t(){return/iPad|iPhone|iPod/.test(navigator.userAgent)||/Mac/.test(navigator.userAgent)&&navigator.maxTouchPoints>1}function n(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled)}function r(e){(e.requestFullscreen||e.webkitRequestFullscreen)?.call(e)}function i(){(document.exitFullscreen||document.webkitExitFullscreen)?.call(document)}function a(t,n){e.registerTech(t,n)}function o(e){let[t,n]=e.split(`:`).map(Number);return{isPortrait:n>t,cssRatio:`${t}/${n}`}}function s(e){return!e||isNaN(e)?`0:00`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function c(e){return e.filter(e=>e.src&&(e.type===`application/x-mpegURL`||e.type===`video/mp4`)).sort((e,t)=>e.type===`application/x-mpegURL`?-1:1)}export{c as a,n as c,o as i,s as n,a as o,t as r,r as s,i as t};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./video.cjs-gZWrkL0e.mjs";var n=e(t(),1);function r(){return/iPad|iPhone|iPod/.test(navigator.userAgent)||/Mac/.test(navigator.userAgent)&&navigator.maxTouchPoints>1}function i(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled)}function a(e){(e.requestFullscreen||e.webkitRequestFullscreen)?.call(e)}function o(){(document.exitFullscreen||document.webkitExitFullscreen)?.call(document)}function s(e,t){n.default.registerTech(e,t)}function c(e){let[t,n]=e.split(`:`).map(Number);return{isPortrait:n>t,cssRatio:`${t}/${n}`}}function l(e){return!e||isNaN(e)?`0:00`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function u(e){return e.filter(e=>e.src&&(e.type===`application/x-mpegURL`||e.type===`video/mp4`)).sort((e,t)=>e.type===`application/x-mpegURL`?-1:1)}export{u as a,i as c,c as i,l as n,s as o,r,a as s,o as t};