@instructure/studio-player 1.2.4 → 1.3.0
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 +18 -0
- package/dist/StudioPlayer/layouts/controls/ControlsLayout.d.ts +2 -2
- package/dist/StudioPlayer/store/StudioPlayerMediaStorage.d.ts +6 -2
- package/dist/StudioPlayer/useStudioPlayer.d.ts +1 -1
- package/dist/StudioPlayer/utils/youtube/caption.d.ts +3 -0
- package/dist/StudioPlayer/utils/youtube/postMessage.d.ts +3 -0
- package/dist/{index-CFsTCjSJ.css → index-iive6GG7.css} +1 -1
- package/dist/studio-player.es.js +7913 -7864
- package/dist/types.d.ts +3 -1
- package/dist/{vidstack-DFQqpjQI.js → vidstack-B8iikcPv.js} +12 -14
- package/dist/{vidstack-audio-C8BDTOBT.js → vidstack-audio-Bq1pJf-F.js} +2 -2
- package/dist/{vidstack-dash-CcyKz4DV.js → vidstack-dash-Bi8vMZlt.js} +2 -2
- package/dist/{vidstack-google-cast-DsFCd0_r.js → vidstack-google-cast-D3ys_R-E.js} +1 -1
- package/dist/{vidstack-hls-DOGlQvLk.js → vidstack-hls-BytcbBHn.js} +2 -2
- package/dist/{vidstack-html-C4pIs4NF.js → vidstack-html-BpBnqulz.js} +1 -1
- package/dist/{vidstack-video-detMAOO-.js → vidstack-video-CqIaj_35.js} +2 -2
- package/dist/{vidstack-vimeo-BIMDkpy7.js → vidstack-vimeo-B9SDrle5.js} +1 -1
- package/dist/{vidstack-youtube-ICZwIt3U.js → vidstack-youtube-Dgmpq-MT.js} +104 -104
- package/package.json +3 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ReactSVGElement } from 'react';
|
|
2
2
|
export type { VideoMimeType, MediaRemoteControl, MediaPlayerInstance, MediaCrossOrigin, } from '@vidstack/react';
|
|
3
|
+
export type CaptionSourceType = 'youtube' | 'standard';
|
|
3
4
|
export type CaptionMetaData = {
|
|
4
|
-
src
|
|
5
|
+
src?: string;
|
|
5
6
|
label: string;
|
|
6
7
|
language: string;
|
|
7
8
|
type: 'vtt' | 'srt';
|
|
9
|
+
sourceType?: CaptionSourceType;
|
|
8
10
|
};
|
|
9
11
|
export type CaptionOffsetOverride = {
|
|
10
12
|
top: string;
|
|
@@ -7,7 +7,7 @@ var y = (n, e, t) => Qw(n, typeof e != "symbol" ? e + "" : e, t), cl = (n, e, t)
|
|
|
7
7
|
var s = (n, e, t) => (cl(n, e, "read from private field"), t ? t.call(n) : e.get(n)), c = (n, e, t) => e.has(n) ? zu("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), u = (n, e, t, i) => (cl(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t), a = (n, e, t) => (cl(n, e, "access private method"), t);
|
|
8
8
|
import { jsx as N, Fragment as zw, jsxs as Jr } from "react/jsx-runtime";
|
|
9
9
|
import * as $ from "react";
|
|
10
|
-
import { g as Yw, a as Xw, i as Yu, h as Jw, b as Zw, c as tT, d as eT, e as iT, f as sT } from "./vidstack-google-cast-
|
|
10
|
+
import { g as Yw, a as Xw, i as Yu, h as Jw, b as Zw, c as tT, d as eT, e as iT, f as sT } from "./vidstack-google-cast-D3ys_R-E.js";
|
|
11
11
|
const li = Symbol(0);
|
|
12
12
|
let mh = !1, $l = !1, Qe = null, Qn = null, Ae = null, ye = 0, jn = [], $u = {};
|
|
13
13
|
const nT = () => {
|
|
@@ -1058,6 +1058,7 @@ class Ns extends Gd {
|
|
|
1058
1058
|
y(this, "language", "");
|
|
1059
1059
|
y(this, "kind");
|
|
1060
1060
|
y(this, "default", !1);
|
|
1061
|
+
y(this, "sourceType");
|
|
1061
1062
|
c(this, Ca, !1);
|
|
1062
1063
|
c(this, Si, 0);
|
|
1063
1064
|
c(this, Xs, "disabled");
|
|
@@ -2808,10 +2809,7 @@ nr = new WeakMap(), Ci = new WeakMap(), Oa = new WeakMap(), rr = new WeakMap(),
|
|
|
2808
2809
|
}, i));
|
|
2809
2810
|
}, Nl = function(t, i) {
|
|
2810
2811
|
var r;
|
|
2811
|
-
this.$state.controlsVisible() !== t && (this.$state.controlsVisible.set(t), !t && document.activeElement && ((r = this.el) != null && r.contains(document.activeElement)) &&
|
|
2812
|
-
var o;
|
|
2813
|
-
(o = this.el) == null || o.focus({ preventScroll: !0 });
|
|
2814
|
-
})), this.dispatch("controls-change", {
|
|
2812
|
+
this.$state.controlsVisible() !== t && (this.$state.controlsVisible.set(t), !t && document.activeElement && ((r = this.el) != null && r.contains(document.activeElement)) && u(this, rs, document.activeElement), this.dispatch("controls-change", {
|
|
2815
2813
|
detail: t,
|
|
2816
2814
|
trigger: i
|
|
2817
2815
|
}));
|
|
@@ -2994,7 +2992,7 @@ class G$ {
|
|
|
2994
2992
|
return "audio";
|
|
2995
2993
|
}
|
|
2996
2994
|
async load(e) {
|
|
2997
|
-
return new (await import("./vidstack-audio-
|
|
2995
|
+
return new (await import("./vidstack-audio-Bq1pJf-F.js")).AudioProvider(this.target, e);
|
|
2998
2996
|
}
|
|
2999
2997
|
}
|
|
3000
2998
|
class Du {
|
|
@@ -3009,7 +3007,7 @@ class Du {
|
|
|
3009
3007
|
return "video";
|
|
3010
3008
|
}
|
|
3011
3009
|
async load(e) {
|
|
3012
|
-
return new (await import("./vidstack-video-
|
|
3010
|
+
return new (await import("./vidstack-video-CqIaj_35.js")).VideoProvider(this.target, e);
|
|
3013
3011
|
}
|
|
3014
3012
|
}
|
|
3015
3013
|
const Mh = class Mh extends Du {
|
|
@@ -3021,7 +3019,7 @@ const Mh = class Mh extends Du {
|
|
|
3021
3019
|
return Mh.supported && ca(t);
|
|
3022
3020
|
}
|
|
3023
3021
|
async load(t) {
|
|
3024
|
-
return new (await import("./vidstack-hls-
|
|
3022
|
+
return new (await import("./vidstack-hls-BytcbBHn.js")).HLSProvider(this.target, t);
|
|
3025
3023
|
}
|
|
3026
3024
|
};
|
|
3027
3025
|
y(Mh, "supported", Mu());
|
|
@@ -3845,7 +3843,7 @@ const qh = class qh extends Du {
|
|
|
3845
3843
|
return qh.supported && Lu(t);
|
|
3846
3844
|
}
|
|
3847
3845
|
async load(t) {
|
|
3848
|
-
return new (await import("./vidstack-dash-
|
|
3846
|
+
return new (await import("./vidstack-dash-Bi8vMZlt.js")).DASHProvider(this.target, t);
|
|
3849
3847
|
}
|
|
3850
3848
|
};
|
|
3851
3849
|
y(qh, "supported", FT());
|
|
@@ -3871,10 +3869,10 @@ class av {
|
|
|
3871
3869
|
return "video";
|
|
3872
3870
|
}
|
|
3873
3871
|
async load(e) {
|
|
3874
|
-
return new (await import("./vidstack-vimeo-
|
|
3872
|
+
return new (await import("./vidstack-vimeo-B9SDrle5.js").then((t) => t.p)).VimeoProvider(this.target, e);
|
|
3875
3873
|
}
|
|
3876
3874
|
async loadPoster(e, t, i) {
|
|
3877
|
-
const { resolveVimeoVideoId: r, getVimeoVideoInfo: o } = await import("./vidstack-vimeo-
|
|
3875
|
+
const { resolveVimeoVideoId: r, getVimeoVideoInfo: o } = await import("./vidstack-vimeo-B9SDrle5.js").then((d) => d.u);
|
|
3878
3876
|
if (!R(e.src)) return null;
|
|
3879
3877
|
const { videoId: h, hash: l } = r(e.src);
|
|
3880
3878
|
return h ? o(h, i, l).then((d) => d ? d.poster : null) : null;
|
|
@@ -3905,10 +3903,10 @@ class ov {
|
|
|
3905
3903
|
return "video";
|
|
3906
3904
|
}
|
|
3907
3905
|
async load(e) {
|
|
3908
|
-
return new (await import("./vidstack-youtube-
|
|
3906
|
+
return new (await import("./vidstack-youtube-Dgmpq-MT.js").then((t) => t.p)).YouTubeProvider(this.target, e);
|
|
3909
3907
|
}
|
|
3910
3908
|
async loadPoster(e, t, i) {
|
|
3911
|
-
const { findYouTubePoster: r, resolveYouTubeVideoId: o } = await import("./vidstack-youtube-
|
|
3909
|
+
const { findYouTubePoster: r, resolveYouTubeVideoId: o } = await import("./vidstack-youtube-Dgmpq-MT.js").then((l) => l.u), h = R(e.src) && o(e.src);
|
|
3912
3910
|
return h ? r(h, i) : null;
|
|
3913
3911
|
}
|
|
3914
3912
|
}
|
|
@@ -9543,7 +9541,7 @@ class Mk {
|
|
|
9543
9541
|
async load(e) {
|
|
9544
9542
|
if (!s(this, Rs))
|
|
9545
9543
|
throw Error("[vidstack] google cast player was not initialized");
|
|
9546
|
-
return new (await import("./vidstack-google-cast-
|
|
9544
|
+
return new (await import("./vidstack-google-cast-D3ys_R-E.js").then((t) => t.p)).GoogleCastProvider(s(this, Rs), e);
|
|
9547
9545
|
}
|
|
9548
9546
|
}
|
|
9549
9547
|
Rs = new WeakMap(), Yt = new WeakSet(), _w = async function(e) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var o = Object.defineProperty;
|
|
2
2
|
var a = (i, e, t) => e in i ? o(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var r = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { s as p, H as d } from "./vidstack-
|
|
5
|
-
import { H as u } from "./vidstack-html-
|
|
4
|
+
import { s as p, H as d } from "./vidstack-B8iikcPv.js";
|
|
5
|
+
import { H as u } from "./vidstack-html-BpBnqulz.js";
|
|
6
6
|
class n extends u {
|
|
7
7
|
constructor(t, s) {
|
|
8
8
|
super(t, s);
|
|
@@ -5,8 +5,8 @@ var u = (e) => {
|
|
|
5
5
|
var g = (e, s, t) => s in e ? S(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
6
|
var h = (e, s, t) => g(e, typeof s != "symbol" ? s + "" : s, t), d = (e, s, t) => s.has(e) || u("Cannot " + t);
|
|
7
7
|
var i = (e, s, t) => (d(e, s, "read from private field"), t ? t.call(e) : s.get(e)), a = (e, s, t) => s.has(e) ? u("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), p = (e, s, t, n) => (d(e, s, "write to private field"), n ? n.call(e, t) : s.set(e, t), t);
|
|
8
|
-
import { D as f, i as m, a as l, p as y, b as D, c as x } from "./vidstack-
|
|
9
|
-
import { VideoProvider as v } from "./vidstack-video-
|
|
8
|
+
import { D as f, i as m, a as l, p as y, b as D, c as x } from "./vidstack-B8iikcPv.js";
|
|
9
|
+
import { VideoProvider as v } from "./vidstack-video-CqIaj_35.js";
|
|
10
10
|
const $ = "https://cdn.jsdelivr.net";
|
|
11
11
|
var c, r, o;
|
|
12
12
|
class b extends v {
|
|
@@ -5,7 +5,7 @@ var U = (r) => {
|
|
|
5
5
|
var ct = (r, t, s) => t in r ? ht(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
|
|
6
6
|
var _ = (r, t, s) => ct(r, typeof t != "symbol" ? t + "" : t, s), D = (r, t, s) => t.has(r) || U("Cannot " + s);
|
|
7
7
|
var e = (r, t, s) => (D(r, t, "read from private field"), s ? s.call(r) : t.get(r)), d = (r, t, s) => t.has(r) ? U("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), u = (r, t, s, n) => (D(r, t, "write to private field"), n ? n.call(r, s) : t.set(r, s), s), a = (r, t, s) => (D(r, t, "access private method"), s);
|
|
8
|
-
import { l as ut, d as dt, T as E, R as lt, G as ft, k as F, o as mt, e as x, c as I, f as gt } from "./vidstack-
|
|
8
|
+
import { l as ut, d as dt, T as E, R as lt, G as ft, k as F, o as mt, e as x, c as I, f as gt } from "./vidstack-B8iikcPv.js";
|
|
9
9
|
function Tt() {
|
|
10
10
|
return "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
|
|
11
11
|
}
|
|
@@ -5,8 +5,8 @@ var u = (e) => {
|
|
|
5
5
|
var g = (e, s, t) => s in e ? S(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
6
|
var a = (e, s, t) => g(e, typeof s != "symbol" ? s + "" : s, t), d = (e, s, t) => s.has(e) || u("Cannot " + t);
|
|
7
7
|
var i = (e, s, t) => (d(e, s, "read from private field"), t ? t.call(e) : s.get(e)), h = (e, s, t) => s.has(e) ? u("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), p = (e, s, t, n) => (d(e, s, "write to private field"), n ? n.call(e, t) : s.set(e, t), t);
|
|
8
|
-
import { g as f, h as m, a as l, p as y, j as L, c as x } from "./vidstack-
|
|
9
|
-
import { VideoProvider as v } from "./vidstack-video-
|
|
8
|
+
import { g as f, h as m, a as l, p as y, j as L, c as x } from "./vidstack-B8iikcPv.js";
|
|
9
|
+
import { VideoProvider as v } from "./vidstack-video-CqIaj_35.js";
|
|
10
10
|
const $ = "https://cdn.jsdelivr.net";
|
|
11
11
|
var c, r, o;
|
|
12
12
|
class j extends v {
|
|
@@ -6,7 +6,7 @@ var p = (i, e, t) => e in i ? l(i, e, { enumerable: !0, configurable: !0, writab
|
|
|
6
6
|
var d = (i, e, t) => p(i, typeof e != "symbol" ? e + "" : e, t), S = (i, e, t) => e.has(i) || m("Cannot " + t);
|
|
7
7
|
var h = (i, e, t) => e.has(i) ? m("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t);
|
|
8
8
|
var n = (i, e, t) => (S(i, e, "access private method"), t);
|
|
9
|
-
import { A as y, d as v, m as f, N as T, o as b, n as c, q as $, a as M } from "./vidstack-
|
|
9
|
+
import { A as y, d as v, m as f, N as T, o as b, n as c, q as $, a as M } from "./vidstack-B8iikcPv.js";
|
|
10
10
|
var r, u;
|
|
11
11
|
class g {
|
|
12
12
|
constructor(e, t) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var n = Object.defineProperty;
|
|
2
2
|
var o = (s, t, e) => t in s ? n(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
3
|
var i = (s, t, e) => o(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { s as c, H as u, r as P, V as p, F as d, P as h, t as l, u as f, v as V, w as y, o as I } from "./vidstack-
|
|
5
|
-
import { H as v } from "./vidstack-html-
|
|
4
|
+
import { s as c, H as u, r as P, V as p, F as d, P as h, t as l, u as f, v as V, w as y, o as I } from "./vidstack-B8iikcPv.js";
|
|
5
|
+
import { H as v } from "./vidstack-html-BpBnqulz.js";
|
|
6
6
|
class m extends v {
|
|
7
7
|
constructor(e, r) {
|
|
8
8
|
super(e, r);
|
|
@@ -5,7 +5,7 @@ var W = (a) => {
|
|
|
5
5
|
var ke = (a, c, e) => c in a ? me(a, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[c] = e;
|
|
6
6
|
var b = (a, c, e) => ke(a, typeof c != "symbol" ? c + "" : c, e), j = (a, c, e) => c.has(a) || W("Cannot " + e);
|
|
7
7
|
var s = (a, c, e) => (j(a, c, "read from private field"), e ? e.call(a) : c.get(a)), d = (a, c, e) => c.has(a) ? W("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(a) : c.set(a, e), f = (a, c, e, t) => (j(a, c, "write to private field"), t ? t.call(a, e) : c.set(a, e), e), h = (a, c, e) => (j(a, c, "access private method"), e);
|
|
8
|
-
import { E as ve, d as we, x as Y, T as g, R as Te, p as Pe, y as x, c as A, a as Ce, z as G, L as M, l as $e, B as ge, C as Ee, I as Re, Q as J } from "./vidstack-
|
|
8
|
+
import { E as ve, d as we, x as Y, T as g, R as Te, p as Pe, y as x, c as A, a as Ce, z as G, L as M, l as $e, B as ge, C as Ee, I as Re, Q as J } from "./vidstack-B8iikcPv.js";
|
|
9
9
|
const Ve = /(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/, O = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
|
|
10
10
|
function K(a) {
|
|
11
11
|
const c = a.match(Ve);
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var B = (a) => {
|
|
3
3
|
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var w = (a, o, e) =>
|
|
7
|
-
var s = (a, o, e) => (E(a, o, "read from private field"), e ? e.call(a) : o.get(a)), p = (a, o, e) => o.has(a) ?
|
|
8
|
-
import { E as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
5
|
+
var W = (a, o, e) => o in a ? Q(a, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[o] = e;
|
|
6
|
+
var w = (a, o, e) => W(a, typeof o != "symbol" ? o + "" : o, e), E = (a, o, e) => o.has(a) || B("Cannot " + e);
|
|
7
|
+
var s = (a, o, e) => (E(a, o, "read from private field"), e ? e.call(a) : o.get(a)), p = (a, o, e) => o.has(a) ? B("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(a) : o.set(a, e), l = (a, o, e, t) => (E(a, o, "write to private field"), t ? t.call(a, e) : o.set(a, e), e), r = (a, o, e) => (E(a, o, "access private method"), e);
|
|
8
|
+
import { E as X, d as Z, x as ee, p as te, y as se, a as ie, J as ae, z as ne, Y as k, K as oe, M as _, T as j, O as re } from "./vidstack-B8iikcPv.js";
|
|
9
|
+
const ue = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, Y = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map();
|
|
10
|
+
function F(a) {
|
|
11
11
|
var o;
|
|
12
|
-
return (o = a.match(
|
|
12
|
+
return (o = a.match(ue)) == null ? void 0 : o[1];
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
14
|
+
async function de(a, o) {
|
|
15
|
+
if (Y.has(a)) return Y.get(a);
|
|
16
|
+
if (V.has(a)) return V.get(a);
|
|
17
17
|
const e = new Promise(async (t) => {
|
|
18
18
|
const u = ["maxresdefault", "sddefault", "hqdefault"];
|
|
19
|
-
for (const
|
|
20
|
-
for (const
|
|
21
|
-
const c =
|
|
19
|
+
for (const d of u)
|
|
20
|
+
for (const h of [!0, !1]) {
|
|
21
|
+
const c = he(a, d, h);
|
|
22
22
|
if ((await fetch(c, {
|
|
23
23
|
mode: "no-cors",
|
|
24
24
|
signal: o.signal
|
|
25
25
|
})).status < 400) {
|
|
26
|
-
|
|
26
|
+
Y.set(a, c), t(c);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
}).catch(() => "").finally(() =>
|
|
31
|
-
return
|
|
30
|
+
}).catch(() => "").finally(() => V.delete(a));
|
|
31
|
+
return V.set(a, e), e;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function he(a, o, e) {
|
|
34
34
|
return `https://i.ytimg.com/${e ? "vi_webp" : "vi"}/${a}/${o}.${e ? "webp" : "jpg"}`;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
37
37
|
__proto__: null,
|
|
38
|
-
findYouTubePoster:
|
|
39
|
-
resolveYouTubeVideoId:
|
|
38
|
+
findYouTubePoster: de,
|
|
39
|
+
resolveYouTubeVideoId: F
|
|
40
40
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
41
|
-
var n,
|
|
42
|
-
class
|
|
41
|
+
var n, b, P, S, O, T, g, y, R, i, le, pe, U, L, m, I, J, N, D, C, q, K, x, M, A;
|
|
42
|
+
class ce extends X {
|
|
43
43
|
constructor(e, t) {
|
|
44
44
|
super(e);
|
|
45
45
|
p(this, i);
|
|
46
46
|
w(this, "$$PROVIDER_TYPE", "YOUTUBE");
|
|
47
|
-
w(this, "scope",
|
|
47
|
+
w(this, "scope", Z());
|
|
48
48
|
p(this, n);
|
|
49
|
-
p(this,
|
|
49
|
+
p(this, b, ee(""));
|
|
50
50
|
p(this, P, -1);
|
|
51
51
|
p(this, S, null);
|
|
52
|
-
p(this,
|
|
53
|
-
p(this,
|
|
52
|
+
p(this, O, null);
|
|
53
|
+
p(this, T, -1);
|
|
54
|
+
p(this, g, !1);
|
|
54
55
|
p(this, y, /* @__PURE__ */ new Map());
|
|
55
56
|
/**
|
|
56
57
|
* Sets the player's interface language. The parameter value is an ISO 639-1 two-letter
|
|
@@ -84,7 +85,7 @@ class de extends Q {
|
|
|
84
85
|
*
|
|
85
86
|
* @defaultValue `undefined`
|
|
86
87
|
*/
|
|
87
|
-
p(this,
|
|
88
|
+
p(this, R);
|
|
88
89
|
l(this, n, t);
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
@@ -94,7 +95,7 @@ class de extends Q {
|
|
|
94
95
|
* @defaultValue `undefined`
|
|
95
96
|
*/
|
|
96
97
|
set encryptedPayload(e) {
|
|
97
|
-
l(this,
|
|
98
|
+
l(this, R, e);
|
|
98
99
|
}
|
|
99
100
|
get currentSrc() {
|
|
100
101
|
return s(this, S);
|
|
@@ -103,16 +104,16 @@ class de extends Q {
|
|
|
103
104
|
return "youtube";
|
|
104
105
|
}
|
|
105
106
|
get videoId() {
|
|
106
|
-
return s(this,
|
|
107
|
+
return s(this, b).call(this);
|
|
107
108
|
}
|
|
108
109
|
preconnect() {
|
|
109
|
-
|
|
110
|
+
te(this.getOrigin());
|
|
110
111
|
}
|
|
111
112
|
setup() {
|
|
112
|
-
super.setup(),
|
|
113
|
+
super.setup(), se(r(this, i, U).bind(this)), s(this, n).notify("provider-setup", this);
|
|
113
114
|
}
|
|
114
115
|
destroy() {
|
|
115
|
-
r(this, i,
|
|
116
|
+
r(this, i, x).call(this);
|
|
116
117
|
const e = "provider destroyed";
|
|
117
118
|
for (const t of s(this, y).values())
|
|
118
119
|
for (const { reject: u } of t) u(e);
|
|
@@ -137,12 +138,12 @@ class de extends Q {
|
|
|
137
138
|
r(this, i, m).call(this, "setPlaybackRate", e);
|
|
138
139
|
}
|
|
139
140
|
async loadSource(e) {
|
|
140
|
-
if (!
|
|
141
|
-
l(this, S, null), s(this,
|
|
141
|
+
if (!ie(e.src)) {
|
|
142
|
+
l(this, S, null), s(this, b).set("");
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
|
-
const t =
|
|
145
|
-
s(this,
|
|
145
|
+
const t = F(e.src);
|
|
146
|
+
s(this, b).set(t ?? ""), l(this, S, e);
|
|
146
147
|
}
|
|
147
148
|
getOrigin() {
|
|
148
149
|
switch (!0) {
|
|
@@ -155,145 +156,144 @@ class de extends Q {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
buildParams() {
|
|
158
|
-
const { keyDisabled: e } = s(this, n).$props, { muted: t, playsInline: u, nativeControls:
|
|
159
|
+
const { keyDisabled: e } = s(this, n).$props, { muted: t, playsInline: u, nativeControls: d } = s(this, n).$state, h = d();
|
|
159
160
|
return {
|
|
160
161
|
rel: 0,
|
|
161
162
|
autoplay: 0,
|
|
162
|
-
cc_lang_pref: this.language,
|
|
163
|
-
cc_load_policy: d ? 1 : void 0,
|
|
164
163
|
color: this.color,
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
cc_load_policy: 1,
|
|
165
|
+
controls: h ? 1 : 0,
|
|
166
|
+
disablekb: !h || e() ? 1 : 0,
|
|
167
167
|
enablejsapi: 1,
|
|
168
168
|
fs: 1,
|
|
169
169
|
hl: this.language,
|
|
170
|
-
iv_load_policy:
|
|
170
|
+
iv_load_policy: h ? 1 : 3,
|
|
171
171
|
mute: t() ? 1 : 0,
|
|
172
172
|
playsinline: u() ? 1 : 0,
|
|
173
|
-
videoId: s(this,
|
|
174
|
-
embed_config: r(this, i,
|
|
173
|
+
videoId: s(this, b).call(this),
|
|
174
|
+
embed_config: r(this, i, L).call(this)
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
onLoad() {
|
|
178
178
|
window.setTimeout(() => this.postMessage({ event: "listening" }), 100);
|
|
179
179
|
}
|
|
180
180
|
onMessage({ info: e }, t) {
|
|
181
|
-
var c
|
|
181
|
+
var c, $;
|
|
182
182
|
if (!e) return;
|
|
183
|
-
const { title: u, intrinsicDuration:
|
|
184
|
-
if (
|
|
183
|
+
const { title: u, intrinsicDuration: d, playbackRate: h } = s(this, n).$state;
|
|
184
|
+
if (oe(e.videoData) && e.videoData.title !== u() && s(this, n).notify("title-change", e.videoData.title, t), (c = e.namespaces) != null && c.includes("captions") && e.captions && s(this, O) === null && (l(this, O, e.captions.tracklist), s(this, n).notify("loaded-metadata")), _(e.duration) && e.duration !== d()) {
|
|
185
185
|
if (_(e.videoLoadedFraction)) {
|
|
186
|
-
const f = ((
|
|
187
|
-
r(this, i,
|
|
186
|
+
const f = (($ = e.progressState) == null ? void 0 : $.loaded) ?? e.videoLoadedFraction * e.duration, v = new j(0, e.duration);
|
|
187
|
+
r(this, i, D).call(this, f, v, t);
|
|
188
188
|
}
|
|
189
189
|
s(this, n).notify("duration-change", e.duration, t);
|
|
190
190
|
}
|
|
191
|
-
if (_(e.playbackRate) && e.playbackRate !==
|
|
192
|
-
const { current: f, seekableStart:
|
|
193
|
-
r(this, i,
|
|
191
|
+
if (_(e.playbackRate) && e.playbackRate !== h() && s(this, n).notify("rate-change", e.playbackRate, t), e.progressState) {
|
|
192
|
+
const { current: f, seekableStart: v, seekableEnd: G, loaded: H, duration: z } = e.progressState;
|
|
193
|
+
r(this, i, N).call(this, f, t), r(this, i, D).call(this, H, new j(v, G), t), z !== d() && s(this, n).notify("duration-change", z, t);
|
|
194
194
|
}
|
|
195
|
-
if (_(e.volume) &&
|
|
195
|
+
if (_(e.volume) && re(e.muted) && !s(this, g)) {
|
|
196
196
|
const f = {
|
|
197
197
|
muted: e.muted,
|
|
198
198
|
volume: e.volume / 100
|
|
199
199
|
};
|
|
200
200
|
s(this, n).notify("volume-change", f, t);
|
|
201
201
|
}
|
|
202
|
-
_(e.playerState) && e.playerState !== s(this, P) && r(this, i,
|
|
202
|
+
_(e.playerState) && e.playerState !== s(this, P) && r(this, i, K).call(this, e.playerState, t);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
n = new WeakMap(),
|
|
205
|
+
n = new WeakMap(), b = new WeakMap(), P = new WeakMap(), S = new WeakMap(), O = new WeakMap(), T = new WeakMap(), g = new WeakMap(), y = new WeakMap(), R = new WeakMap(), i = new WeakSet(), le = function(e) {
|
|
206
206
|
var t;
|
|
207
|
-
(t = r(this, i,
|
|
208
|
-
},
|
|
207
|
+
(t = r(this, i, M).call(this, "playVideo")) == null || t.reject(e);
|
|
208
|
+
}, pe = function(e) {
|
|
209
209
|
var t;
|
|
210
|
-
(t = r(this, i,
|
|
211
|
-
},
|
|
212
|
-
r(this, i,
|
|
213
|
-
const e = s(this,
|
|
210
|
+
(t = r(this, i, M).call(this, "pauseVideo")) == null || t.reject(e);
|
|
211
|
+
}, U = function() {
|
|
212
|
+
r(this, i, x).call(this);
|
|
213
|
+
const e = s(this, b).call(this);
|
|
214
214
|
if (!e) {
|
|
215
215
|
this.src.set("");
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
this.src.set(`${this.getOrigin()}/embed/${e}`), s(this, n).notify("load-start");
|
|
219
|
-
},
|
|
220
|
-
const e = s(this,
|
|
221
|
-
if (!
|
|
222
|
-
return JSON.stringify({ enc: e });
|
|
219
|
+
}, L = function() {
|
|
220
|
+
const e = s(this, R);
|
|
221
|
+
if (!ae(e))
|
|
222
|
+
return JSON.stringify({ enc: e, hideTitle: !0 });
|
|
223
223
|
}, m = function(e, t) {
|
|
224
|
-
let u =
|
|
225
|
-
return
|
|
224
|
+
let u = ne(), d = s(this, y).get(e);
|
|
225
|
+
return d || s(this, y).set(e, d = []), d.push(u), this.postMessage({
|
|
226
226
|
event: "command",
|
|
227
227
|
func: e,
|
|
228
228
|
args: t ? [t] : void 0
|
|
229
229
|
}), u.promise;
|
|
230
|
-
}, L = function(e) {
|
|
231
|
-
s(this, n).notify("loaded-metadata"), s(this, n).notify("loaded-data"), s(this, n).delegate.ready(void 0, e);
|
|
232
230
|
}, I = function(e) {
|
|
231
|
+
s(this, n).notify("loaded-data"), s(this, n).delegate.ready(void 0, e);
|
|
232
|
+
}, J = function(e) {
|
|
233
233
|
var t;
|
|
234
|
-
(t = r(this, i,
|
|
235
|
-
},
|
|
236
|
-
const { duration: u, realCurrentTime:
|
|
237
|
-
s(this, n).notify("time-change", c, t), !
|
|
238
|
-
},
|
|
239
|
-
const
|
|
234
|
+
(t = r(this, i, M).call(this, "pauseVideo")) == null || t.resolve(), s(this, n).notify("pause", void 0, e);
|
|
235
|
+
}, N = function(e, t) {
|
|
236
|
+
const { duration: u, realCurrentTime: d } = s(this, n).$state, h = s(this, P) === k.Ended, c = h ? u() : e;
|
|
237
|
+
s(this, n).notify("time-change", c, t), !h && Math.abs(c - d()) > 1 && s(this, n).notify("seeking", c, t);
|
|
238
|
+
}, D = function(e, t, u) {
|
|
239
|
+
const d = {
|
|
240
240
|
buffered: new j(0, e),
|
|
241
241
|
seekable: t
|
|
242
242
|
};
|
|
243
|
-
s(this, n).notify("progress",
|
|
244
|
-
const { seeking:
|
|
245
|
-
|
|
246
|
-
},
|
|
243
|
+
s(this, n).notify("progress", d, u);
|
|
244
|
+
const { seeking: h, realCurrentTime: c } = s(this, n).$state;
|
|
245
|
+
h() && e > c() && r(this, i, C).call(this, u);
|
|
246
|
+
}, C = function(e) {
|
|
247
247
|
const { paused: t, realCurrentTime: u } = s(this, n).$state;
|
|
248
|
-
window.clearTimeout(s(this,
|
|
248
|
+
window.clearTimeout(s(this, T)), l(this, T, window.setTimeout(
|
|
249
249
|
() => {
|
|
250
|
-
s(this, n).notify("seeked", u(), e), l(this,
|
|
250
|
+
s(this, n).notify("seeked", u(), e), l(this, T, -1);
|
|
251
251
|
},
|
|
252
252
|
t() ? 100 : 0
|
|
253
253
|
));
|
|
254
|
-
},
|
|
254
|
+
}, q = function(e) {
|
|
255
255
|
const { seeking: t } = s(this, n).$state;
|
|
256
|
-
t() && r(this, i,
|
|
257
|
-
},
|
|
258
|
-
var
|
|
259
|
-
const { paused: u, seeking:
|
|
260
|
-
if (c && s(this, n).notify("waiting", void 0, t),
|
|
261
|
-
this.pause(), l(this,
|
|
256
|
+
t() && r(this, i, C).call(this, e), s(this, n).notify("pause", void 0, e), s(this, n).notify("end", void 0, e);
|
|
257
|
+
}, K = function(e, t) {
|
|
258
|
+
var v;
|
|
259
|
+
const { paused: u, seeking: d } = s(this, n).$state, h = e === k.Playing, c = e === k.Buffering, $ = r(this, i, A).call(this, "playVideo"), f = u() && (c || h);
|
|
260
|
+
if (c && s(this, n).notify("waiting", void 0, t), d() && h && r(this, i, C).call(this, t), s(this, g) && h) {
|
|
261
|
+
this.pause(), l(this, g, !1), this.setMuted(s(this, n).$state.muted());
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
if (
|
|
265
|
-
l(this,
|
|
264
|
+
if (!$ && f) {
|
|
265
|
+
l(this, g, !0), this.setMuted(!0);
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
switch (
|
|
268
|
+
switch (f && ((v = r(this, i, M).call(this, "playVideo")) == null || v.resolve(), s(this, n).notify("play", void 0, t)), e) {
|
|
269
269
|
case k.Cued:
|
|
270
|
-
r(this, i,
|
|
270
|
+
r(this, i, I).call(this, t);
|
|
271
271
|
break;
|
|
272
272
|
case k.Playing:
|
|
273
273
|
s(this, n).notify("playing", void 0, t);
|
|
274
274
|
break;
|
|
275
275
|
case k.Paused:
|
|
276
|
-
r(this, i,
|
|
276
|
+
r(this, i, J).call(this, t);
|
|
277
277
|
break;
|
|
278
278
|
case k.Ended:
|
|
279
|
-
r(this, i,
|
|
279
|
+
r(this, i, q).call(this, t);
|
|
280
280
|
break;
|
|
281
281
|
}
|
|
282
282
|
l(this, P, e);
|
|
283
|
-
},
|
|
284
|
-
l(this, P, -1), l(this,
|
|
285
|
-
},
|
|
283
|
+
}, x = function() {
|
|
284
|
+
l(this, P, -1), l(this, T, -1), l(this, g, !1);
|
|
285
|
+
}, M = function(e) {
|
|
286
286
|
var t;
|
|
287
287
|
return (t = s(this, y).get(e)) == null ? void 0 : t.shift();
|
|
288
|
-
},
|
|
288
|
+
}, A = function(e) {
|
|
289
289
|
var t;
|
|
290
290
|
return !!((t = s(this, y).get(e)) != null && t.length);
|
|
291
291
|
};
|
|
292
|
-
const
|
|
292
|
+
const be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
293
293
|
__proto__: null,
|
|
294
|
-
YouTubeProvider:
|
|
294
|
+
YouTubeProvider: ce
|
|
295
295
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
296
296
|
export {
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
be as p,
|
|
298
|
+
me as u
|
|
299
299
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/studio-player",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Next generation media player for Instructure",
|
|
6
6
|
"module": "./dist/studio-player.es.js",
|
|
@@ -66,10 +66,12 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@floating-ui/react": "^0.27.3",
|
|
69
|
+
"@nanostores/react": "^1.0.0",
|
|
69
70
|
"clsx": "^2.1.1",
|
|
70
71
|
"dashjs": "4.7.4",
|
|
71
72
|
"i18next": "^24.2.1",
|
|
72
73
|
"i18next-resources-to-backend": "^1.2.1",
|
|
74
|
+
"nanostores": "^1.0.1",
|
|
73
75
|
"react": "^18.3.1",
|
|
74
76
|
"react-dom": "^18.3.1",
|
|
75
77
|
"react-i18next": "^15.4.0"
|