@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/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: string;
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-DsFCd0_r.js";
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)) && (u(this, rs, document.activeElement), requestAnimationFrame(() => {
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-C8BDTOBT.js")).AudioProvider(this.target, e);
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-detMAOO-.js")).VideoProvider(this.target, e);
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-DOGlQvLk.js")).HLSProvider(this.target, t);
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-CcyKz4DV.js")).DASHProvider(this.target, t);
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-BIMDkpy7.js").then((t) => t.p)).VimeoProvider(this.target, e);
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-BIMDkpy7.js").then((d) => d.u);
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-ICZwIt3U.js").then((t) => t.p)).YouTubeProvider(this.target, e);
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-ICZwIt3U.js").then((l) => l.u), h = R(e.src) && o(e.src);
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-DsFCd0_r.js").then((t) => t.p)).GoogleCastProvider(s(this, Rs), e);
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-DFQqpjQI.js";
5
- import { H as u } from "./vidstack-html-C4pIs4NF.js";
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-DFQqpjQI.js";
9
- import { VideoProvider as v } from "./vidstack-video-detMAOO-.js";
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-DFQqpjQI.js";
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-DFQqpjQI.js";
9
- import { VideoProvider as v } from "./vidstack-video-detMAOO-.js";
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-DFQqpjQI.js";
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-DFQqpjQI.js";
5
- import { H as v } from "./vidstack-html-C4pIs4NF.js";
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-DFQqpjQI.js";
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 G = Object.defineProperty;
2
- var z = (a) => {
1
+ var Q = Object.defineProperty;
2
+ var B = (a) => {
3
3
  throw TypeError(a);
4
4
  };
5
- var H = (a, o, e) => o in a ? G(a, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[o] = e;
6
- var w = (a, o, e) => H(a, typeof o != "symbol" ? o + "" : o, e), E = (a, o, e) => o.has(a) || z("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) ? z("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 Q, d as W, x as X, p as Z, y as ee, a as te, J as se, z as ie, Y as k, K as ae, M as _, T as j, O as ne } from "./vidstack-DFQqpjQI.js";
9
- const oe = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, C = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
10
- function B(a) {
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(oe)) == null ? void 0 : o[1];
12
+ return (o = a.match(ue)) == null ? void 0 : o[1];
13
13
  }
14
- async function re(a, o) {
15
- if (C.has(a)) return C.get(a);
16
- if (R.has(a)) return R.get(a);
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 h of u)
20
- for (const d of [!0, !1]) {
21
- const c = ue(a, h, d);
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
- C.set(a, c), t(c);
26
+ Y.set(a, c), t(c);
27
27
  return;
28
28
  }
29
29
  }
30
- }).catch(() => "").finally(() => R.delete(a));
31
- return R.set(a, e), e;
30
+ }).catch(() => "").finally(() => V.delete(a));
31
+ return V.set(a, e), e;
32
32
  }
33
- function ue(a, o, e) {
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 ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
36
+ const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
37
37
  __proto__: null,
38
- findYouTubePoster: re,
39
- resolveYouTubeVideoId: B
38
+ findYouTubePoster: de,
39
+ resolveYouTubeVideoId: F
40
40
  }, Symbol.toStringTag, { value: "Module" }));
41
- var n, g, P, S, v, b, y, M, i, he, ce, F, U, m, L, I, J, Y, V, N, q, D, $, K;
42
- class de extends Q {
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", W());
47
+ w(this, "scope", Z());
48
48
  p(this, n);
49
- p(this, g, X(""));
49
+ p(this, b, ee(""));
50
50
  p(this, P, -1);
51
51
  p(this, S, null);
52
- p(this, v, -1);
53
- p(this, b, !1);
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, M);
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, M, e);
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, g).call(this);
107
+ return s(this, b).call(this);
107
108
  }
108
109
  preconnect() {
109
- Z(this.getOrigin());
110
+ te(this.getOrigin());
110
111
  }
111
112
  setup() {
112
- super.setup(), ee(r(this, i, F).bind(this)), s(this, n).notify("provider-setup", this);
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, D).call(this);
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 (!te(e.src)) {
141
- l(this, S, null), s(this, g).set("");
141
+ if (!ie(e.src)) {
142
+ l(this, S, null), s(this, b).set("");
142
143
  return;
143
144
  }
144
- const t = B(e.src);
145
- s(this, g).set(t ?? ""), l(this, S, e);
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: h } = s(this, n).$state, d = h();
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
- controls: d ? 1 : 0,
166
- disablekb: !d || e() ? 1 : 0,
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: d ? 1 : 3,
170
+ iv_load_policy: h ? 1 : 3,
171
171
  mute: t() ? 1 : 0,
172
172
  playsinline: u() ? 1 : 0,
173
- videoId: s(this, g).call(this),
174
- embed_config: r(this, i, U).call(this)
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: h, playbackRate: d } = s(this, n).$state;
184
- if (ae(e.videoData) && e.videoData.title !== u() && s(this, n).notify("title-change", e.videoData.title, t), _(e.duration) && e.duration !== h()) {
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 = ((c = e.progressState) == null ? void 0 : c.loaded) ?? e.videoLoadedFraction * e.duration, T = new j(0, e.duration);
187
- r(this, i, Y).call(this, f, T, t);
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 !== d() && s(this, n).notify("rate-change", e.playbackRate, t), e.progressState) {
192
- const { current: f, seekableStart: T, seekableEnd: O, loaded: A, duration: x } = e.progressState;
193
- r(this, i, J).call(this, f, t), r(this, i, Y).call(this, A, new j(T, O), t), x !== h() && s(this, n).notify("duration-change", x, t);
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) && ne(e.muted) && !s(this, b)) {
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, q).call(this, e.playerState, t);
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(), g = new WeakMap(), P = new WeakMap(), S = new WeakMap(), v = new WeakMap(), b = new WeakMap(), y = new WeakMap(), M = new WeakMap(), i = new WeakSet(), he = function(e) {
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, $).call(this, "playVideo")) == null || t.reject(e);
208
- }, ce = function(e) {
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, $).call(this, "pauseVideo")) == null || t.reject(e);
211
- }, F = function() {
212
- r(this, i, D).call(this);
213
- const e = s(this, g).call(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
- }, U = function() {
220
- const e = s(this, M);
221
- if (!se(e))
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 = ie(), h = s(this, y).get(e);
225
- return h || s(this, y).set(e, h = []), h.push(u), this.postMessage({
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, $).call(this, "pauseVideo")) == null || t.resolve(), s(this, n).notify("pause", void 0, e);
235
- }, J = function(e, t) {
236
- const { duration: u, realCurrentTime: h } = s(this, n).$state, d = s(this, P) === k.Ended, c = d ? u() : e;
237
- s(this, n).notify("time-change", c, t), !d && Math.abs(c - h()) > 1 && s(this, n).notify("seeking", c, t);
238
- }, Y = function(e, t, u) {
239
- const h = {
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", h, u);
244
- const { seeking: d, realCurrentTime: c } = s(this, n).$state;
245
- d() && e > c() && r(this, i, V).call(this, u);
246
- }, V = function(e) {
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, v)), l(this, v, window.setTimeout(
248
+ window.clearTimeout(s(this, T)), l(this, T, window.setTimeout(
249
249
  () => {
250
- s(this, n).notify("seeked", u(), e), l(this, v, -1);
250
+ s(this, n).notify("seeked", u(), e), l(this, T, -1);
251
251
  },
252
252
  t() ? 100 : 0
253
253
  ));
254
- }, N = function(e) {
254
+ }, q = function(e) {
255
255
  const { seeking: t } = s(this, n).$state;
256
- t() && r(this, i, V).call(this, e), s(this, n).notify("pause", void 0, e), s(this, n).notify("end", void 0, e);
257
- }, q = function(e, t) {
258
- var O;
259
- const { paused: u, seeking: h } = s(this, n).$state, d = e === k.Playing, c = e === k.Buffering, f = r(this, i, K).call(this, "playVideo"), T = u() && (c || d);
260
- if (c && s(this, n).notify("waiting", void 0, t), h() && d && r(this, i, V).call(this, t), s(this, b) && d) {
261
- this.pause(), l(this, b, !1), this.setMuted(s(this, n).$state.muted());
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 (!f && T) {
265
- l(this, b, !0), this.setMuted(!0);
264
+ if (!$ && f) {
265
+ l(this, g, !0), this.setMuted(!0);
266
266
  return;
267
267
  }
268
- switch (T && ((O = r(this, i, $).call(this, "playVideo")) == null || O.resolve(), s(this, n).notify("play", void 0, t)), e) {
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, L).call(this, t);
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, I).call(this, t);
276
+ r(this, i, J).call(this, t);
277
277
  break;
278
278
  case k.Ended:
279
- r(this, i, N).call(this, t);
279
+ r(this, i, q).call(this, t);
280
280
  break;
281
281
  }
282
282
  l(this, P, e);
283
- }, D = function() {
284
- l(this, P, -1), l(this, v, -1), l(this, b, !1);
285
- }, $ = function(e) {
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
- }, K = function(e) {
288
+ }, A = function(e) {
289
289
  var t;
290
290
  return !!((t = s(this, y).get(e)) != null && t.length);
291
291
  };
292
- const fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
292
+ const be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
293
293
  __proto__: null,
294
- YouTubeProvider: de
294
+ YouTubeProvider: ce
295
295
  }, Symbol.toStringTag, { value: "Module" }));
296
296
  export {
297
- fe as p,
298
- ye as u
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.2.4",
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"