@munsonlabs/video-player 0.0.1 → 0.0.2
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 +32 -1
- package/dist/chunks/brightcove-BjpjJMHX.mjs +1 -0
- package/dist/chunks/brightcove-mjKXQYMp.mjs +1 -0
- package/dist/chunks/constants-DZGeSme4.mjs +1 -0
- package/dist/chunks/dailymotion-B6CwDPyk.mjs +1 -0
- package/dist/chunks/dailymotion-BhvOCSDo.mjs +1 -0
- package/dist/chunks/jwplayer-CNDwSK03.mjs +1 -0
- package/dist/chunks/jwplayer-eDjA1f7V.mjs +1 -0
- package/dist/chunks/tech-DYVa4zaY.mjs +1 -0
- package/dist/chunks/tech-hIKMwrTq.mjs +1 -0
- package/dist/chunks/video.cjs-gZWrkL0e.mjs +239 -0
- package/dist/chunks/videojs.ads-jA_s2l9Y.mjs +3 -0
- package/dist/chunks/videojs.ima-Ccon1y6f.mjs +2 -0
- package/dist/chunks/vimeo-D1LvZaNd.mjs +15 -0
- package/dist/chunks/vimeo-yir3kEbO.mjs +1 -0
- package/dist/chunks/youtube-BE1BWyQG.mjs +1 -0
- package/dist/chunks/youtube-VA8teDMJ.mjs +1 -0
- package/dist/element.d.mts +27 -2
- package/dist/element.mjs +1 -1
- package/dist/index.d.mts +205 -1
- package/dist/index.mjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/chunks/VideoItem-C2dc1Nw7.mjs +0 -1
- package/dist/chunks/brightcove-CQ7KZDbD.mjs +0 -1
- package/dist/chunks/dailymotion-BgVShGbi.mjs +0 -1
- package/dist/chunks/index-DCRJ3iTc.d.mts +0 -204
- package/dist/chunks/jwplayer-C3SeHLno.mjs +0 -1
- package/dist/chunks/vimeo-BHc3ewpt.mjs +0 -1
- package/dist/chunks/youtube-CNXFp2IX.mjs +0 -1
package/README.md
CHANGED
|
@@ -89,7 +89,19 @@ Emitted by `VideoItem`, `VideoPlayer`, and `VideoStage`.
|
|
|
89
89
|
|
|
90
90
|
```ts
|
|
91
91
|
interface StateChangeEvent {
|
|
92
|
-
type:
|
|
92
|
+
type:
|
|
93
|
+
| 'play'
|
|
94
|
+
| 'pause'
|
|
95
|
+
| 'ended'
|
|
96
|
+
| 'seeked'
|
|
97
|
+
| 'error'
|
|
98
|
+
| 'adstart'
|
|
99
|
+
| 'adend'
|
|
100
|
+
| 'volumechange'
|
|
101
|
+
| 'ratechange'
|
|
102
|
+
| 'firstQuartile'
|
|
103
|
+
| 'midpoint'
|
|
104
|
+
| 'thirdQuartile'
|
|
93
105
|
currentTime: number
|
|
94
106
|
duration: number
|
|
95
107
|
src: string
|
|
@@ -100,6 +112,8 @@ interface StateChangeEvent {
|
|
|
100
112
|
}
|
|
101
113
|
```
|
|
102
114
|
|
|
115
|
+
`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.
|
|
116
|
+
|
|
103
117
|
```vue
|
|
104
118
|
<VideoItem video-url="..." platform="html5" @state-change="onStateChange" />
|
|
105
119
|
```
|
|
@@ -167,6 +181,23 @@ Ads are not supported on YouTube, Vimeo, or Dailymotion.
|
|
|
167
181
|
|
|
168
182
|
---
|
|
169
183
|
|
|
184
|
+
## Theming the HUD buttons
|
|
185
|
+
|
|
186
|
+
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.
|
|
187
|
+
|
|
188
|
+
Set the variables on any ancestor of the player — e.g. a wrapper `<div>` or `:root` — to restyle all three buttons at once:
|
|
189
|
+
|
|
190
|
+
```css
|
|
191
|
+
.my-video-wrapper {
|
|
192
|
+
--mvp-btn-bg: #e11d48;
|
|
193
|
+
--mvp-btn-color: #fff;
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
170
201
|
## Window Events
|
|
171
202
|
|
|
172
203
|
`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??e.playerId;if(!t){s.log.error(`Dailymotion Tech: dailymotion.playerId option is required`);return}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(`https://geo.dailymotion.com/libs/player/${t}.js`,t).then(()=>window.dailymotion);if(!this.el_)return;this._dm_sdk=n;let r=await n.createPlayer(this.options_.techId,{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=document.createElement(`iframe`);n.src=`https://geo.dailymotion.com/player/${this._playerId}.html?video=${this.videoId}&autoplay=1&startTime=${Math.floor(e)}`,n.setAttribute(`allow`,`autoplay; fullscreen`),n.setAttribute(`allowfullscreen`,`true`),n.style.cssText=`width:100%;height:100%;border:0`,t.appendChild(n);let r=!1,o=()=>{r||(r=!0,document.removeEventListener(`fullscreenchange`,s),document.removeEventListener(`webkitfullscreenchange`,s),this.player_.trigger(i),t.remove(),this._dm?.seek(e),this._dm?.play())},s=()=>{!document.fullscreenElement&&!document.webkitFullscreenElement&&o()};document.addEventListener(`fullscreenchange`,s),document.addEventListener(`webkitfullscreenchange`,s),n.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??e.playerId;if(!t){l.default.log.error(`Dailymotion Tech: dailymotion.playerId option is required`);return}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(`https://geo.dailymotion.com/libs/player/${t}.js`,t).then(()=>window.dailymotion);if(!this.el_)return;this._dm_sdk=n;let r=await n.createPlayer(this.options_.techId,{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=document.createElement(`iframe`);n.src=`https://geo.dailymotion.com/player/${this._playerId}.html?video=${this.videoId}&autoplay=1&startTime=${Math.floor(e)}`,n.setAttribute(`allow`,`autoplay; fullscreen`),n.setAttribute(`allowfullscreen`,`true`),n.style.cssText=`width:100%;height:100%;border:0`,t.appendChild(n);let r=!1,i=()=>{r||(r=!0,document.removeEventListener(`fullscreenchange`,a),document.removeEventListener(`webkitfullscreenchange`,a),this.player_.trigger(o),t.remove(),this._dm?.seek(e),this._dm?.play())},a=()=>{!document.fullscreenElement&&!document.webkitFullscreenElement&&i()};document.addEventListener(`fullscreenchange`,a),document.addEventListener(`webkitfullscreenchange`,a),n.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};
|