@hanifhan1f/vidstack 1.12.33 → 1.12.35

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.
Files changed (210) hide show
  1. package/cdn/with-layouts/chunks/{vidstack-BCLumCST.js → vidstack-BEgmmcDO.js} +56 -52
  2. package/cdn/with-layouts/chunks/{vidstack-DJyGEdCH.js → vidstack-t3PBZMbl.js} +1 -1
  3. package/cdn/with-layouts/vidstack.js +1 -1
  4. package/dev/chunks/{vidstack-B__DfQsT.js → vidstack-BReSQAMt.js} +10 -6
  5. package/dev/define/templates/vidstack-audio-layout.js +1 -1
  6. package/dev/define/templates/vidstack-video-layout.js +7 -5
  7. package/dev/define/vidstack-player-default-layout.js +1 -1
  8. package/dev/define/vidstack-player-layouts.js +1 -1
  9. package/dev/vidstack-elements.js +1 -1
  10. package/dev/vidstack.js +0 -4
  11. package/elements.d.ts +1 -1
  12. package/global/player.d.ts +1 -1
  13. package/global/plyr.d.ts +2 -2
  14. package/index.d.ts +2 -2
  15. package/package.json +1 -1
  16. package/prod/chunks/{vidstack-BnEo_Sla.js → vidstack-B0glDgAI.js} +10 -6
  17. package/prod/define/templates/vidstack-audio-layout.js +1 -1
  18. package/prod/define/templates/vidstack-video-layout.js +7 -5
  19. package/prod/define/vidstack-player-default-layout.js +1 -1
  20. package/prod/define/vidstack-player-layouts.js +1 -1
  21. package/prod/vidstack-elements.js +1 -1
  22. package/server/chunks/{vidstack-BIGdJnUK.js → vidstack-nANS1jfu.js} +16 -10
  23. package/server/define/vidstack-player-default-layout.js +1 -1
  24. package/server/define/vidstack-player-layouts.js +1 -1
  25. package/server/vidstack-elements.js +1 -1
  26. package/types/{vidstack-DYLKXUvI.d.ts → vidstack-CZqFq0VF.d.ts} +13 -1
  27. package/cdn/chunks/vidstack-8JHLDxl5.js +0 -1
  28. package/cdn/chunks/vidstack-BF7lZRtq.js +0 -3
  29. package/cdn/chunks/vidstack-BYgY9wmd.js +0 -1
  30. package/cdn/chunks/vidstack-BYpysj84.js +0 -1
  31. package/cdn/chunks/vidstack-Bjo5esRp.js +0 -1
  32. package/cdn/chunks/vidstack-BkxGdzTJ.js +0 -16
  33. package/cdn/chunks/vidstack-BuL67v3q.js +0 -1
  34. package/cdn/chunks/vidstack-Bzk6lVKb.js +0 -1
  35. package/cdn/chunks/vidstack-C0msPRTd.js +0 -3
  36. package/cdn/chunks/vidstack-C1FlyyzK.js +0 -1
  37. package/cdn/chunks/vidstack-CIjxJCz3.js +0 -1
  38. package/cdn/chunks/vidstack-CioT3Yw2.js +0 -1
  39. package/cdn/chunks/vidstack-Cj0I-Rec.js +0 -1
  40. package/cdn/chunks/vidstack-CmpbA3Yd.js +0 -16
  41. package/cdn/chunks/vidstack-CnWKPIKT.js +0 -16
  42. package/cdn/chunks/vidstack-CrqkytHl.js +0 -1
  43. package/cdn/chunks/vidstack-D0M8R0ZU.js +0 -1
  44. package/cdn/chunks/vidstack-D40FSa5B.js +0 -3
  45. package/cdn/chunks/vidstack-D84Fzc__.js +0 -16
  46. package/cdn/chunks/vidstack-DD2JwFVU.js +0 -1
  47. package/cdn/chunks/vidstack-DQvyz7Mm.js +0 -1
  48. package/cdn/chunks/vidstack-Dd9fqVv6.js +0 -1
  49. package/cdn/chunks/vidstack-DfDZuHNP.js +0 -1
  50. package/cdn/chunks/vidstack-uMxrPflF.js +0 -1
  51. package/cdn/chunks/vidstack-xjJ-ui_l.js +0 -1
  52. package/cdn/chunks/vidstack-zemsqC5d.js +0 -1
  53. package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +0 -1
  54. package/cdn/providers/vidstack-audio-BOGYlExy.js +0 -1
  55. package/cdn/providers/vidstack-dash-CUtD4e6q.js +0 -1
  56. package/cdn/providers/vidstack-dash-D4ZARr66.js +0 -1
  57. package/cdn/providers/vidstack-google-cast-BdORATUX.js +0 -1
  58. package/cdn/providers/vidstack-hls-8-552IuX.js +0 -1
  59. package/cdn/providers/vidstack-hls-R25Kb6DP.js +0 -1
  60. package/cdn/providers/vidstack-html-BvVaN2VT.js +0 -1
  61. package/cdn/providers/vidstack-html-DaAUJYsD.js +0 -1
  62. package/cdn/providers/vidstack-video-BnwQZKER.js +0 -1
  63. package/cdn/providers/vidstack-video-Csvox7SO.js +0 -1
  64. package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +0 -1
  65. package/cdn/providers/vidstack-vimeo-gJmBqtLK.js +0 -1
  66. package/cdn/providers/vidstack-youtube-Chl_dTAz.js +0 -1
  67. package/cdn/providers/vidstack-youtube-DiND6h3s.js +0 -1
  68. package/cdn/with-layouts/chunks/vidstack-4liSokT6.js +0 -1
  69. package/cdn/with-layouts/chunks/vidstack-B97B8XDc.js +0 -3
  70. package/cdn/with-layouts/chunks/vidstack-BD5YoTt5.js +0 -937
  71. package/cdn/with-layouts/chunks/vidstack-BGhRKayG.js +0 -914
  72. package/cdn/with-layouts/chunks/vidstack-BL_lNyW_.js +0 -1
  73. package/cdn/with-layouts/chunks/vidstack-BMhNagfl.js +0 -1
  74. package/cdn/with-layouts/chunks/vidstack-BP3ybDy9.js +0 -912
  75. package/cdn/with-layouts/chunks/vidstack-BbFHhcVG.js +0 -1
  76. package/cdn/with-layouts/chunks/vidstack-BjOOdDcQ.js +0 -1
  77. package/cdn/with-layouts/chunks/vidstack-C5AP9wid.js +0 -1
  78. package/cdn/with-layouts/chunks/vidstack-CS2aNc61.js +0 -1
  79. package/cdn/with-layouts/chunks/vidstack-CXEcXyBI.js +0 -1
  80. package/cdn/with-layouts/chunks/vidstack-Ciq-n5rg.js +0 -1
  81. package/cdn/with-layouts/chunks/vidstack-CmuGllcj.js +0 -1
  82. package/cdn/with-layouts/chunks/vidstack-CyNByJUW.js +0 -912
  83. package/cdn/with-layouts/chunks/vidstack-D-3_fAsK.js +0 -1
  84. package/cdn/with-layouts/chunks/vidstack-DCaNJN4T.js +0 -1
  85. package/cdn/with-layouts/chunks/vidstack-DKqYI_HJ.js +0 -1
  86. package/cdn/with-layouts/chunks/vidstack-DLGH9jfs.js +0 -1
  87. package/cdn/with-layouts/chunks/vidstack-DLVdcWrK.js +0 -3
  88. package/cdn/with-layouts/chunks/vidstack-DPO7J4-v.js +0 -3
  89. package/cdn/with-layouts/chunks/vidstack-DWjB11vV.js +0 -1
  90. package/cdn/with-layouts/chunks/vidstack-Dd3L-eQj.js +0 -1
  91. package/cdn/with-layouts/chunks/vidstack-Dh2GOjra.js +0 -1
  92. package/cdn/with-layouts/chunks/vidstack-DhNpv7SU.js +0 -1
  93. package/cdn/with-layouts/chunks/vidstack-QW5tTAS4.js +0 -897
  94. package/cdn/with-layouts/chunks/vidstack-T2rZVigk.js +0 -912
  95. package/cdn/with-layouts/chunks/vidstack-Xe_d7ovA.js +0 -1
  96. package/cdn/with-layouts/chunks/vidstack-wt2OT4N7.js +0 -1
  97. package/cdn/with-layouts/providers/vidstack-audio-Bw1csc6N.js +0 -1
  98. package/cdn/with-layouts/providers/vidstack-audio-CwoQJvl2.js +0 -1
  99. package/cdn/with-layouts/providers/vidstack-dash-CJsKJfLI.js +0 -1
  100. package/cdn/with-layouts/providers/vidstack-dash-DHRMFG4Y.js +0 -1
  101. package/cdn/with-layouts/providers/vidstack-google-cast-BSYJYn-o.js +0 -1
  102. package/cdn/with-layouts/providers/vidstack-hls-DG1rTEqu.js +0 -1
  103. package/cdn/with-layouts/providers/vidstack-hls-ji26kFdQ.js +0 -1
  104. package/cdn/with-layouts/providers/vidstack-html-BvHMxtoe.js +0 -1
  105. package/cdn/with-layouts/providers/vidstack-html-CoKFAYW5.js +0 -1
  106. package/cdn/with-layouts/providers/vidstack-video-1Uj5cNP2.js +0 -1
  107. package/cdn/with-layouts/providers/vidstack-video-CIxFJ9Z1.js +0 -1
  108. package/cdn/with-layouts/providers/vidstack-vimeo-CNLKOGMa.js +0 -1
  109. package/cdn/with-layouts/providers/vidstack-vimeo-DACTbJaQ.js +0 -1
  110. package/cdn/with-layouts/providers/vidstack-youtube-D1e-LE-8.js +0 -1
  111. package/cdn/with-layouts/providers/vidstack-youtube-RoLp-I6u.js +0 -1
  112. package/dev/chunks/vidstack-03oQOdB7.js +0 -58
  113. package/dev/chunks/vidstack-0XhA3AD_.js +0 -5181
  114. package/dev/chunks/vidstack-44ILR0Cb.js +0 -1521
  115. package/dev/chunks/vidstack-B4XOm7dP.js +0 -104
  116. package/dev/chunks/vidstack-BJsZjPkB.js +0 -204
  117. package/dev/chunks/vidstack-BXSB7eI9.js +0 -58
  118. package/dev/chunks/vidstack-BaGbgcvz.js +0 -107
  119. package/dev/chunks/vidstack-Blfm1k-4.js +0 -1520
  120. package/dev/chunks/vidstack-Bo8BNFJ2.js +0 -2986
  121. package/dev/chunks/vidstack-Bs54kFSz.js +0 -66
  122. package/dev/chunks/vidstack-C3N4zIuV.js +0 -254
  123. package/dev/chunks/vidstack-C4aPQ7hZ.js +0 -1482
  124. package/dev/chunks/vidstack-C6OqdJO7.js +0 -114
  125. package/dev/chunks/vidstack-CAL4iu_K.js +0 -1482
  126. package/dev/chunks/vidstack-CEjYxSqZ.js +0 -297
  127. package/dev/chunks/vidstack-CJCnHmKE.js +0 -104
  128. package/dev/chunks/vidstack-CQdFhXSo.js +0 -204
  129. package/dev/chunks/vidstack-CSryZFvY.js +0 -1521
  130. package/dev/chunks/vidstack-C_rvOKWp.js +0 -33
  131. package/dev/chunks/vidstack-CaudO1jl.js +0 -109
  132. package/dev/chunks/vidstack-CcQdBWil.js +0 -58
  133. package/dev/chunks/vidstack-Cky9ors4.js +0 -297
  134. package/dev/chunks/vidstack-DAOcbKGP.js +0 -254
  135. package/dev/chunks/vidstack-DD_3HszA.js +0 -1520
  136. package/dev/chunks/vidstack-DKaohJzR.js +0 -5181
  137. package/dev/chunks/vidstack-DLXCqdYV.js +0 -3010
  138. package/dev/chunks/vidstack-DS7nRfge.js +0 -204
  139. package/dev/chunks/vidstack-DWtK42Sh.js +0 -1483
  140. package/dev/chunks/vidstack-D_LvMxPr.js +0 -204
  141. package/dev/chunks/vidstack-Db1-Hg_U.js +0 -297
  142. package/dev/chunks/vidstack-DrczgsqN.js +0 -297
  143. package/dev/chunks/vidstack-EoLRQZbs.js +0 -2986
  144. package/dev/chunks/vidstack-FKkY62Dr.js +0 -104
  145. package/dev/chunks/vidstack-el2dbO0m.js +0 -5181
  146. package/dev/chunks/vidstack-rvhuswgi.js +0 -2986
  147. package/prod/chunks/vidstack-BAqdCFIm.js +0 -4771
  148. package/prod/chunks/vidstack-BHqGlnGz.js +0 -1482
  149. package/prod/chunks/vidstack-BP49Gz0m.js +0 -58
  150. package/prod/chunks/vidstack-BRZe2BNi.js +0 -107
  151. package/prod/chunks/vidstack-BRnfTkxi.js +0 -297
  152. package/prod/chunks/vidstack-BaaRY-9x.js +0 -201
  153. package/prod/chunks/vidstack-BexQYZop.js +0 -2976
  154. package/prod/chunks/vidstack-BpLd9ASW.js +0 -246
  155. package/prod/chunks/vidstack-C-yd_bAJ.js +0 -4771
  156. package/prod/chunks/vidstack-C05ipjAK.js +0 -1520
  157. package/prod/chunks/vidstack-CA4tDJdF.js +0 -33
  158. package/prod/chunks/vidstack-CFXAYpuh.js +0 -1521
  159. package/prod/chunks/vidstack-CIvL96_j.js +0 -297
  160. package/prod/chunks/vidstack-CYVCrFjx.js +0 -201
  161. package/prod/chunks/vidstack-Cs0fH84E.js +0 -1521
  162. package/prod/chunks/vidstack-D7hJcnN-.js +0 -297
  163. package/prod/chunks/vidstack-DDePVDjt.js +0 -2976
  164. package/prod/chunks/vidstack-DESBVLFp.js +0 -104
  165. package/prod/chunks/vidstack-DMDDSV3t.js +0 -104
  166. package/prod/chunks/vidstack-DXfGRhxZ.js +0 -201
  167. package/prod/chunks/vidstack-D_atbNqH.js +0 -3000
  168. package/prod/chunks/vidstack-DcMkaIHJ.js +0 -2976
  169. package/prod/chunks/vidstack-DnRxQoqP.js +0 -104
  170. package/prod/chunks/vidstack-DwenML7x.js +0 -4771
  171. package/prod/chunks/vidstack-IDWYvfna.js +0 -58
  172. package/prod/chunks/vidstack-Ko2EJadT.js +0 -1483
  173. package/prod/chunks/vidstack-MbEMbVfP.js +0 -109
  174. package/prod/chunks/vidstack-ShUhyBfI.js +0 -201
  175. package/prod/chunks/vidstack-SnIdjCkV.js +0 -58
  176. package/prod/chunks/vidstack-V1jwkH0s.js +0 -66
  177. package/prod/chunks/vidstack-V9U6gsde.js +0 -1482
  178. package/prod/chunks/vidstack-XA3zT5W9.js +0 -297
  179. package/prod/chunks/vidstack-bdt7uOlN.js +0 -114
  180. package/prod/chunks/vidstack-kdaDngIm.js +0 -1520
  181. package/prod/chunks/vidstack-oNEzlviH.js +0 -246
  182. package/server/chunks/vidstack-B2Bc9g7_.js +0 -2000
  183. package/server/chunks/vidstack-B4CWj0Hp.js +0 -381
  184. package/server/chunks/vidstack-B8P1aUCK.js +0 -1503
  185. package/server/chunks/vidstack-B8_v1VQn.js +0 -3059
  186. package/server/chunks/vidstack-BGgfNYAH.js +0 -141
  187. package/server/chunks/vidstack-BGmwlunt.js +0 -3035
  188. package/server/chunks/vidstack-BO8FLks6.js +0 -295
  189. package/server/chunks/vidstack-BosyhF3p.js +0 -207
  190. package/server/chunks/vidstack-C19bj3Wq.js +0 -307
  191. package/server/chunks/vidstack-C8F1EUBn.js +0 -104
  192. package/server/chunks/vidstack-CFTkUXGK.js +0 -295
  193. package/server/chunks/vidstack-CQMB7Msg.js +0 -1502
  194. package/server/chunks/vidstack-CWho6PlG.js +0 -141
  195. package/server/chunks/vidstack-CdBfecZT.js +0 -205
  196. package/server/chunks/vidstack-Cv_Art04.js +0 -4635
  197. package/server/chunks/vidstack-DE4b5Bgx.js +0 -2002
  198. package/server/chunks/vidstack-Db22EuE_.js +0 -207
  199. package/server/chunks/vidstack-DbvCOsqU.js +0 -107
  200. package/server/chunks/vidstack-DgHfFDiw.js +0 -1962
  201. package/server/chunks/vidstack-DhF59-Up.js +0 -4635
  202. package/server/chunks/vidstack-DnkB7eGO.js +0 -207
  203. package/server/chunks/vidstack-DoHmOxNm.js +0 -295
  204. package/server/chunks/vidstack-DsnTqzpL.js +0 -29
  205. package/server/chunks/vidstack-DzWvfg1d.js +0 -1503
  206. package/server/chunks/vidstack-FHGkN5xj.js +0 -566
  207. package/server/chunks/vidstack-PnFpou7g.js +0 -3035
  208. package/server/chunks/vidstack-f5-aflD2.js +0 -104
  209. package/server/chunks/vidstack-gEJMQpTE.js +0 -2001
  210. package/server/chunks/vidstack-n4zAyLEV.js +0 -2139
@@ -1,307 +0,0 @@
1
- import { EventsTarget, DOMEvent, isString, isArray, isNumber, signal, ViewController, effect, setAttribute, EventsController } from './vidstack-B8LynzY5.js';
2
- import { isCueActive, getRequestCredentials } from './vidstack-B4CWj0Hp.js';
3
-
4
- const CROSS_ORIGIN = Symbol(0), READY_STATE = Symbol(0), UPDATE_ACTIVE_CUES = Symbol(0), CAN_LOAD = Symbol(0), ON_MODE_CHANGE = Symbol(0), NATIVE = Symbol(0), NATIVE_HLS = Symbol(0);
5
- const TextTrackSymbol = {
6
- crossOrigin: CROSS_ORIGIN,
7
- readyState: READY_STATE,
8
- updateActiveCues: UPDATE_ACTIVE_CUES,
9
- canLoad: CAN_LOAD,
10
- onModeChange: ON_MODE_CHANGE,
11
- native: NATIVE,
12
- nativeHLS: NATIVE_HLS
13
- };
14
-
15
- class TextTrack extends EventsTarget {
16
- static createId(track) {
17
- return `vds-${track.type}-${track.kind}-${track.src ?? track.label ?? "?"}`;
18
- }
19
- src;
20
- content;
21
- type;
22
- encoding;
23
- id = "";
24
- label = "";
25
- language = "";
26
- kind;
27
- default = false;
28
- #canLoad = false;
29
- #currentTime = 0;
30
- #mode = "disabled";
31
- #metadata = {};
32
- #regions = [];
33
- #cues = [];
34
- #activeCues = [];
35
- #cueIds = /* @__PURE__ */ new Set();
36
- /** @internal */
37
- [TextTrackSymbol.readyState] = 0;
38
- /** @internal */
39
- [TextTrackSymbol.crossOrigin];
40
- /** @internal */
41
- [TextTrackSymbol.onModeChange] = null;
42
- /** @internal */
43
- [TextTrackSymbol.native] = null;
44
- get metadata() {
45
- return this.#metadata;
46
- }
47
- get regions() {
48
- return this.#regions;
49
- }
50
- get cues() {
51
- return this.#cues;
52
- }
53
- get activeCues() {
54
- return this.#activeCues;
55
- }
56
- /**
57
- * - 0: Not Loading
58
- * - 1: Loading
59
- * - 2: Ready
60
- * - 3: Error
61
- */
62
- get readyState() {
63
- return this[TextTrackSymbol.readyState];
64
- }
65
- get mode() {
66
- return this.#mode;
67
- }
68
- set mode(mode) {
69
- this.setMode(mode);
70
- }
71
- constructor(init) {
72
- super();
73
- for (const prop of Object.keys(init)) this[prop] = init[prop];
74
- if (!this.type) this.type = "vtt";
75
- if (!init.src) {
76
- this[TextTrackSymbol.readyState] = 2;
77
- }
78
- }
79
- addCue(cue, trigger) {
80
- if (cue.id) {
81
- if (this.#cueIds.has(cue.id)) return;
82
- this.#cueIds.add(cue.id);
83
- }
84
- let i = 0, length = this.#cues.length;
85
- for (i = 0; i < length; i++) if (cue.endTime <= this.#cues[i].startTime) break;
86
- if (i === length) this.#cues.push(cue);
87
- else this.#cues.splice(i, 0, cue);
88
- if (!(cue instanceof TextTrackCue)) {
89
- this[TextTrackSymbol.native]?.track.addCue(cue);
90
- }
91
- this.dispatchEvent(new DOMEvent("add-cue", { detail: cue, trigger }));
92
- if (isCueActive(cue, this.#currentTime)) {
93
- this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
94
- }
95
- }
96
- removeCue(cue, trigger) {
97
- const index = this.#cues.indexOf(cue);
98
- if (index >= 0) {
99
- const isActive = this.#activeCues.includes(cue);
100
- if (cue.id) this.#cueIds.delete(cue.id);
101
- this.#cues.splice(index, 1);
102
- this[TextTrackSymbol.native]?.track.removeCue(cue);
103
- this.dispatchEvent(new DOMEvent("remove-cue", { detail: cue, trigger }));
104
- if (isActive) {
105
- this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
106
- }
107
- }
108
- }
109
- setMode(mode, trigger) {
110
- if (this.#mode === mode) return;
111
- this.#mode = mode;
112
- if (mode === "disabled") {
113
- this.#activeCues = [];
114
- this.#activeCuesChanged();
115
- } else if (this.readyState === 2) {
116
- this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
117
- } else {
118
- this.#load();
119
- }
120
- this.dispatchEvent(new DOMEvent("mode-change", { detail: this, trigger }));
121
- this[TextTrackSymbol.onModeChange]?.();
122
- }
123
- /** @internal */
124
- [TextTrackSymbol.updateActiveCues](currentTime, trigger) {
125
- this.#currentTime = currentTime;
126
- if (this.mode === "disabled" || !this.#cues.length) return;
127
- const activeCues = [];
128
- for (let i = 0, length = this.#cues.length; i < length; i++) {
129
- const cue = this.#cues[i];
130
- if (isCueActive(cue, currentTime)) activeCues.push(cue);
131
- }
132
- let changed = activeCues.length !== this.#activeCues.length;
133
- if (!changed) {
134
- for (let i = 0; i < activeCues.length; i++) {
135
- if (!this.#activeCues.includes(activeCues[i])) {
136
- changed = true;
137
- break;
138
- }
139
- }
140
- }
141
- this.#activeCues = activeCues;
142
- if (changed) this.#activeCuesChanged(trigger);
143
- }
144
- /** @internal */
145
- [TextTrackSymbol.canLoad]() {
146
- this.#canLoad = true;
147
- if (this.#mode !== "disabled") this.#load();
148
- }
149
- #parseContent(init) {
150
- import('media-captions').then(({ parseText, VTTCue, VTTRegion }) => {
151
- if (!isString(init.content) || init.type === "json") {
152
- this.#parseJSON(init.content, VTTCue, VTTRegion);
153
- if (this.readyState !== 3) this.#ready();
154
- } else {
155
- const content = init.content.split("\n").map((line) => line.trim()).join("\n").trim();
156
- parseText(content, { type: init.type }).then(({ cues, regions }) => {
157
- this.#cues = cues;
158
- this.#regions = regions;
159
- this.#ready();
160
- });
161
- }
162
- });
163
- }
164
- async #load() {
165
- if (!this.#canLoad || this[TextTrackSymbol.readyState] > 0) return;
166
- this[TextTrackSymbol.readyState] = 1;
167
- this.dispatchEvent(new DOMEvent("load-start"));
168
- if (!this.src) {
169
- this.#ready();
170
- return;
171
- }
172
- try {
173
- const { parseResponse, VTTCue, VTTRegion } = await import('media-captions'), crossOrigin = this[TextTrackSymbol.crossOrigin]?.();
174
- const response = fetch(this.src, {
175
- headers: this.type === "json" ? { "Content-Type": "application/json" } : void 0,
176
- credentials: getRequestCredentials(crossOrigin)
177
- });
178
- if (this.type === "json") {
179
- this.#parseJSON(await (await response).text(), VTTCue, VTTRegion);
180
- } else {
181
- const { errors, metadata, regions, cues } = await parseResponse(response, {
182
- type: this.type,
183
- encoding: this.encoding
184
- });
185
- if (errors[0]?.code === 0) {
186
- throw errors[0];
187
- } else {
188
- this.#metadata = metadata;
189
- this.#regions = regions;
190
- this.#cues = cues;
191
- }
192
- }
193
- this.#ready();
194
- } catch (error) {
195
- this.#error(error);
196
- }
197
- }
198
- #ready() {
199
- this[TextTrackSymbol.readyState] = 2;
200
- if (!this.src || this.type !== "vtt") {
201
- const native = this[TextTrackSymbol.native];
202
- if (native && !native.managed) {
203
- for (const cue of this.#cues) native.track.addCue(cue);
204
- }
205
- }
206
- const loadEvent = new DOMEvent("load");
207
- this[TextTrackSymbol.updateActiveCues](this.#currentTime, loadEvent);
208
- this.dispatchEvent(loadEvent);
209
- }
210
- #error(error) {
211
- this[TextTrackSymbol.readyState] = 3;
212
- this.dispatchEvent(new DOMEvent("error", { detail: error }));
213
- }
214
- #parseJSON(json, VTTCue, VTTRegion) {
215
- try {
216
- const { regions, cues } = parseJSONCaptionsFile(json, VTTCue, VTTRegion);
217
- this.#regions = regions;
218
- this.#cues = cues;
219
- } catch (error) {
220
- this.#error(error);
221
- }
222
- }
223
- #activeCuesChanged(trigger) {
224
- this.dispatchEvent(new DOMEvent("cue-change", { trigger }));
225
- }
226
- }
227
- const captionRE = /captions|subtitles/;
228
- function isTrackCaptionKind(track) {
229
- return captionRE.test(track.kind);
230
- }
231
- function parseJSONCaptionsFile(json, Cue, Region) {
232
- const content = isString(json) ? JSON.parse(json) : json;
233
- let regions = [], cues = [];
234
- if (content.regions && Region) {
235
- regions = content.regions.map((region) => Object.assign(new Region(), region));
236
- }
237
- if (content.cues || isArray(content)) {
238
- cues = (isArray(content) ? content : content.cues).filter((content2) => isNumber(content2.startTime) && isNumber(content2.endTime)).map((cue) => Object.assign(new Cue(0, 0, ""), cue));
239
- }
240
- return { regions, cues };
241
- }
242
-
243
- function round(num, decimalPlaces = 2) {
244
- return Number(num.toFixed(decimalPlaces));
245
- }
246
- function getNumberOfDecimalPlaces(num) {
247
- return String(num).split(".")[1]?.length ?? 0;
248
- }
249
- function clampNumber(min, value, max) {
250
- return Math.max(min, Math.min(max, value));
251
- }
252
-
253
- function coerceToError(error) {
254
- return error instanceof Error ? error : Error(typeof error === "string" ? error : JSON.stringify(error));
255
- }
256
- function assert(condition, message) {
257
- if (!condition) {
258
- throw Error("Assertion failed.");
259
- }
260
- }
261
-
262
- let $keyboard = signal(false);
263
- class FocusVisibleController extends ViewController {
264
- #focused = signal(false);
265
- onConnect(el) {
266
- effect(() => {
267
- const events = new EventsController(el);
268
- if (!$keyboard()) {
269
- this.#focused.set(false);
270
- updateFocusAttr(el, false);
271
- events.add("pointerenter", this.#onPointerEnter.bind(this)).add("pointerleave", this.#onPointerLeave.bind(this));
272
- return;
273
- }
274
- const active = document.activeElement === el;
275
- this.#focused.set(active);
276
- updateFocusAttr(el, active);
277
- events.add("focus", this.#onFocus.bind(this)).add("blur", this.#onBlur.bind(this));
278
- });
279
- }
280
- focused() {
281
- return this.#focused();
282
- }
283
- #onFocus() {
284
- this.#focused.set(true);
285
- updateFocusAttr(this.el, true);
286
- }
287
- #onBlur() {
288
- this.#focused.set(false);
289
- updateFocusAttr(this.el, false);
290
- }
291
- #onPointerEnter() {
292
- updateHoverAttr(this.el, true);
293
- }
294
- #onPointerLeave() {
295
- updateHoverAttr(this.el, false);
296
- }
297
- }
298
- function updateFocusAttr(el, isFocused) {
299
- setAttribute(el, "data-focus", isFocused);
300
- setAttribute(el, "data-hocus", isFocused);
301
- }
302
- function updateHoverAttr(el, isHovering) {
303
- setAttribute(el, "data-hocus", isHovering);
304
- setAttribute(el, "data-hover", isHovering);
305
- }
306
-
307
- export { $keyboard, FocusVisibleController, TextTrack, TextTrackSymbol, assert, clampNumber, coerceToError, getNumberOfDecimalPlaces, isTrackCaptionKind, parseJSONCaptionsFile, round };
@@ -1,104 +0,0 @@
1
- import { Host, effect, computed, setAttribute } from './vidstack-B8LynzY5.js';
2
- import { MediaProvider, MediaPlayer } from './vidstack-DhF59-Up.js';
3
- import { useMediaContext } from './vidstack-B4CWj0Hp.js';
4
-
5
- class MediaProviderElement extends Host(HTMLElement, MediaProvider) {
6
- static tagName = "media-provider";
7
- #media;
8
- #target = null;
9
- #blocker = null;
10
- onSetup() {
11
- this.#media = useMediaContext();
12
- this.setAttribute("keep-alive", "");
13
- }
14
- onDestroy() {
15
- this.#blocker?.remove();
16
- this.#blocker = null;
17
- this.#target?.remove();
18
- this.#target = null;
19
- }
20
- onConnect() {
21
- effect(() => {
22
- const loader = this.$state.loader(), isYouTubeEmbed = loader?.name === "youtube", isVimeoEmbed = loader?.name === "vimeo", isEmbed = isYouTubeEmbed || isVimeoEmbed, isGoogleCast = loader?.name === "google-cast";
23
- const target = loader ? isGoogleCast ? this.#createGoogleCastContainer() : isEmbed ? this.#createIFrame() : loader.mediaType() === "audio" ? this.#createAudio() : this.#createVideo() : null;
24
- if (this.#target !== target) {
25
- const parent = this.#target?.parentElement ?? this;
26
- this.#target?.remove();
27
- this.#target = target;
28
- if (target) parent.prepend(target);
29
- if (isEmbed && target) {
30
- effect(() => {
31
- const { nativeControls, viewType } = this.#media.$state, showNativeControls = nativeControls(), isAudioView = viewType() === "audio", showBlocker = !showNativeControls && !isAudioView;
32
- if (showBlocker) {
33
- this.#blocker = this.querySelector(".vds-blocker");
34
- if (!this.#blocker) {
35
- this.#blocker = document.createElement("div");
36
- this.#blocker.classList.add("vds-blocker");
37
- target.after(this.#blocker);
38
- }
39
- } else {
40
- this.#blocker?.remove();
41
- this.#blocker = null;
42
- }
43
- setAttribute(target, "data-no-controls", !showNativeControls);
44
- });
45
- }
46
- }
47
- if (isYouTubeEmbed) target?.classList.add("vds-youtube");
48
- else if (isVimeoEmbed) target?.classList.add("vds-vimeo");
49
- if (!isEmbed) {
50
- this.#blocker?.remove();
51
- this.#blocker = null;
52
- }
53
- this.load(target);
54
- });
55
- }
56
- #createAudio() {
57
- const audio = this.#target instanceof HTMLAudioElement ? this.#target : document.createElement("audio");
58
- const { controls, crossOrigin } = this.#media.$state;
59
- effect(() => {
60
- setAttribute(audio, "controls", controls());
61
- setAttribute(audio, "crossorigin", crossOrigin());
62
- });
63
- return audio;
64
- }
65
- #createVideo() {
66
- const video = this.#target instanceof HTMLVideoElement ? this.#target : document.createElement("video");
67
- const { crossOrigin, poster, nativeControls } = this.#media.$state, $controls = computed(() => nativeControls() ? "true" : null), $poster = computed(() => poster() && nativeControls() ? poster() : null);
68
- effect(() => {
69
- setAttribute(video, "controls", $controls());
70
- setAttribute(video, "crossorigin", crossOrigin());
71
- setAttribute(video, "poster", $poster());
72
- });
73
- return video;
74
- }
75
- #createIFrame() {
76
- const iframe = this.#target instanceof HTMLIFrameElement ? this.#target : document.createElement("iframe"), { nativeControls } = this.#media.$state;
77
- effect(() => setAttribute(iframe, "tabindex", !nativeControls() ? -1 : null));
78
- return iframe;
79
- }
80
- #createGoogleCastContainer() {
81
- if (this.#target?.classList.contains("vds-google-cast")) {
82
- return this.#target;
83
- }
84
- const container = document.createElement("div");
85
- container.classList.add("vds-google-cast");
86
- import('./vidstack-DsnTqzpL.js').then(({ insertContent }) => {
87
- insertContent(container, this.#media.$state);
88
- });
89
- return container;
90
- }
91
- }
92
-
93
- class MediaPlayerElement extends Host(HTMLElement, MediaPlayer) {
94
- static tagName = "media-player";
95
- static attrs = {
96
- autoPlay: "autoplay",
97
- crossOrigin: "crossorigin",
98
- playsInline: "playsinline",
99
- preferNativeHLS: "prefer-native-hls",
100
- minLiveDVRWindow: "min-live-dvr-window"
101
- };
102
- }
103
-
104
- export { MediaPlayerElement, MediaProviderElement };
@@ -1,295 +0,0 @@
1
- import { Host, effect, Component, signal, setAttribute, isBoolean, computed, isString, useState } from './vidstack-B8LynzY5.js';
2
- import { Captions, Gesture, MediaAnnouncer, Controls, ControlsGroup, GoogleCastButton, ToggleButton, Tooltip, TooltipTrigger, TooltipContent, ChaptersRadioGroup, AudioGainRadioGroup, RadioGroup, SliderVideo, AudioGainSlider, SpeedSlider, QualitySlider, SliderChapters } from './vidstack-CQMB7Msg.js';
3
- import { useMediaContext, watchCueTextChange, requestScopedAnimationFrame, isHTMLElement, cloneTemplateContent, createTemplate, cloneTemplate } from './vidstack-B4CWj0Hp.js';
4
- import { html } from 'lit-html';
5
- import { LitElement } from './vidstack-CwTj4H1w.js';
6
- import { MenuPortal, Slider, sliderState } from './vidstack-BGmwlunt.js';
7
- import { renderMenuItemsTemplate } from './vidstack-DnkB7eGO.js';
8
-
9
- class MediaCaptionsElement extends Host(HTMLElement, Captions) {
10
- static tagName = "media-captions";
11
- }
12
-
13
- class MediaGestureElement extends Host(HTMLElement, Gesture) {
14
- static tagName = "media-gesture";
15
- }
16
-
17
- class MediaAnnouncerElement extends Host(HTMLElement, MediaAnnouncer) {
18
- static tagName = "media-announcer";
19
- }
20
-
21
- class MediaControlsElement extends Host(HTMLElement, Controls) {
22
- static tagName = "media-controls";
23
- }
24
-
25
- class MediaControlsGroupElement extends Host(HTMLElement, ControlsGroup) {
26
- static tagName = "media-controls-group";
27
- }
28
-
29
- class Title extends Component {
30
- }
31
- class MediaTitleElement extends Host(HTMLElement, Title) {
32
- static tagName = "media-title";
33
- #media;
34
- onSetup() {
35
- this.#media = useMediaContext();
36
- }
37
- onConnect() {
38
- effect(this.#watchTitle.bind(this));
39
- }
40
- #watchTitle() {
41
- const { title } = this.#media.$state;
42
- this.textContent = title();
43
- }
44
- }
45
-
46
- class ChapterTitle extends Component {
47
- static props = {
48
- defaultText: ""
49
- };
50
- }
51
- class MediaChapterTitleElement extends Host(HTMLElement, ChapterTitle) {
52
- static tagName = "media-chapter-title";
53
- #media;
54
- #chapterTitle;
55
- onSetup() {
56
- this.#media = useMediaContext();
57
- this.#chapterTitle = signal("");
58
- }
59
- onConnect() {
60
- const tracks = this.#media.textTracks;
61
- watchCueTextChange(tracks, "chapters", this.#chapterTitle.set);
62
- effect(this.#watchChapterTitle.bind(this));
63
- }
64
- #watchChapterTitle() {
65
- const { defaultText } = this.$props;
66
- this.textContent = this.#chapterTitle() || defaultText();
67
- }
68
- }
69
-
70
- class Spinner extends Component {
71
- static props = {
72
- size: 96,
73
- trackWidth: 8,
74
- fillPercent: 50
75
- };
76
- onConnect(el) {
77
- requestScopedAnimationFrame(() => {
78
- if (!this.connectScope) return;
79
- const root = el.querySelector("svg"), track = root.firstElementChild, trackFill = track.nextElementSibling;
80
- effect(this.#update.bind(this, root, track, trackFill));
81
- });
82
- }
83
- #update(root, track, trackFill) {
84
- const { size, trackWidth, fillPercent } = this.$props;
85
- setAttribute(root, "width", size());
86
- setAttribute(root, "height", size());
87
- setAttribute(track, "stroke-width", trackWidth());
88
- setAttribute(trackFill, "stroke-width", trackWidth());
89
- setAttribute(trackFill, "stroke-dashoffset", 100 - fillPercent());
90
- }
91
- }
92
- class MediaSpinnerElement extends Host(LitElement, Spinner) {
93
- static tagName = "media-spinner";
94
- render() {
95
- return html`
96
- <svg fill="none" viewBox="0 0 120 120" aria-hidden="true" data-part="root">
97
- <circle cx="60" cy="60" r="54" stroke="currentColor" data-part="track"></circle>
98
- <circle
99
- cx="60"
100
- cy="60"
101
- r="54"
102
- stroke="currentColor"
103
- pathLength="100"
104
- stroke-dasharray="100"
105
- data-part="track-fill"
106
- ></circle>
107
- </svg>
108
- `;
109
- }
110
- }
111
-
112
- class MediaLayout extends Component {
113
- static props = {
114
- when: false
115
- };
116
- }
117
- class MediaLayoutElement extends Host(HTMLElement, MediaLayout) {
118
- static tagName = "media-layout";
119
- #media;
120
- onSetup() {
121
- this.#media = useMediaContext();
122
- }
123
- onConnect() {
124
- effect(this.#watchWhen.bind(this));
125
- }
126
- #watchWhen() {
127
- const root = this.firstElementChild, isTemplate = root?.localName === "template", when = this.$props.when(), matches = isBoolean(when) ? when : computed(() => when(this.#media.player.state))();
128
- if (!matches) {
129
- if (isTemplate) {
130
- this.textContent = "";
131
- this.appendChild(root);
132
- } else if (isHTMLElement(root)) {
133
- root.style.display = "none";
134
- }
135
- return;
136
- }
137
- if (isTemplate) {
138
- this.append(root.content.cloneNode(true));
139
- } else if (isHTMLElement(root)) {
140
- root.style.display = "";
141
- }
142
- }
143
- }
144
-
145
- class MediaGoogleCastButtonElement extends Host(HTMLElement, GoogleCastButton) {
146
- static tagName = "media-google-cast-button";
147
- }
148
-
149
- class MediaToggleButtonElement extends Host(HTMLElement, ToggleButton) {
150
- static tagName = "media-toggle-button";
151
- }
152
-
153
- class MediaTooltipElement extends Host(HTMLElement, Tooltip) {
154
- static tagName = "media-tooltip";
155
- }
156
-
157
- class MediaTooltipTriggerElement extends Host(HTMLElement, TooltipTrigger) {
158
- static tagName = "media-tooltip-trigger";
159
- onConnect() {
160
- this.style.display = "contents";
161
- }
162
- }
163
-
164
- class MediaTooltipContentElement extends Host(HTMLElement, TooltipContent) {
165
- static tagName = "media-tooltip-content";
166
- }
167
-
168
- class MediaMenuPortalElement extends Host(HTMLElement, MenuPortal) {
169
- static tagName = "media-menu-portal";
170
- static attrs = {
171
- disabled: {
172
- converter(value) {
173
- if (isString(value)) return value;
174
- return value !== null;
175
- }
176
- }
177
- };
178
- }
179
-
180
- class MediaChaptersRadioGroupElement extends Host(HTMLElement, ChaptersRadioGroup) {
181
- static tagName = "media-chapters-radio-group";
182
- onConnect() {
183
- renderMenuItemsTemplate(this, (el, option) => {
184
- const { cue, startTime, duration } = option, thumbnailEl = el.querySelector(".vds-thumbnail,media-thumbnail"), startEl = el.querySelector('[data-part="start-time"]'), durationEl = el.querySelector('[data-part="duration"]');
185
- if (startEl) startEl.textContent = startTime;
186
- if (durationEl) durationEl.textContent = duration;
187
- if (thumbnailEl) {
188
- thumbnailEl.setAttribute("time", cue.startTime + "");
189
- effect(() => {
190
- const thumbnails = this.$props.thumbnails();
191
- if ("src" in thumbnailEl) {
192
- thumbnailEl.src = thumbnails;
193
- } else if (isString(thumbnails)) {
194
- thumbnailEl.setAttribute("src", thumbnails);
195
- }
196
- });
197
- }
198
- });
199
- }
200
- }
201
-
202
- class MediaAudioGainRadioGroupElement extends Host(HTMLElement, AudioGainRadioGroup) {
203
- static tagName = "media-audio-gain-radio-group";
204
- onConnect() {
205
- renderMenuItemsTemplate(this);
206
- }
207
- }
208
-
209
- class MediaRadioGroupElement extends Host(HTMLElement, RadioGroup) {
210
- static tagName = "media-radio-group";
211
- }
212
-
213
- class MediaSliderElement extends Host(HTMLElement, Slider) {
214
- static tagName = "media-slider";
215
- }
216
-
217
- const videoTemplate = /* @__PURE__ */ createTemplate(
218
- `<video muted playsinline preload="none" style="max-width: unset;"></video>`
219
- );
220
- class MediaSliderVideoElement extends Host(HTMLElement, SliderVideo) {
221
- static tagName = "media-slider-video";
222
- #media;
223
- #video = this.#createVideo();
224
- onSetup() {
225
- this.#media = useMediaContext();
226
- this.$state.video.set(this.#video);
227
- }
228
- onConnect() {
229
- const { canLoad } = this.#media.$state, { src, crossOrigin } = this.$state;
230
- if (this.#video.parentNode !== this) {
231
- this.prepend(this.#video);
232
- }
233
- effect(() => {
234
- setAttribute(this.#video, "crossorigin", crossOrigin());
235
- setAttribute(this.#video, "preload", canLoad() ? "auto" : "none");
236
- setAttribute(this.#video, "src", src());
237
- });
238
- }
239
- #createVideo() {
240
- return cloneTemplateContent(videoTemplate);
241
- }
242
- }
243
-
244
- class MediaAudioGainSliderElement extends Host(HTMLElement, AudioGainSlider) {
245
- static tagName = "media-audio-gain-slider";
246
- }
247
-
248
- class MediaSpeedSliderElement extends Host(HTMLElement, SpeedSlider) {
249
- static tagName = "media-speed-slider";
250
- }
251
-
252
- class MediaQualitySliderElement extends Host(HTMLElement, QualitySlider) {
253
- static tagName = "media-quality-slider";
254
- }
255
-
256
- class MediaSliderChaptersElement extends Host(HTMLElement, SliderChapters) {
257
- static tagName = "media-slider-chapters";
258
- #template = null;
259
- onConnect() {
260
- requestScopedAnimationFrame(() => {
261
- if (!this.connectScope) return;
262
- const template = this.querySelector("template");
263
- if (template) {
264
- this.#template = template;
265
- effect(this.#renderTemplate.bind(this));
266
- }
267
- });
268
- }
269
- #renderTemplate() {
270
- if (!this.#template) return;
271
- const elements = cloneTemplate(this.#template, this.cues.length || 1);
272
- this.setRefs(elements);
273
- }
274
- }
275
-
276
- class SliderSteps extends Component {
277
- }
278
- class MediaSliderStepsElement extends Host(HTMLElement, SliderSteps) {
279
- static tagName = "media-slider-steps";
280
- #template = null;
281
- onConnect(el) {
282
- requestScopedAnimationFrame(() => {
283
- if (!this.connectScope) return;
284
- this.#template = el.querySelector("template");
285
- if (this.#template) effect(this.#render.bind(this));
286
- });
287
- }
288
- #render() {
289
- if (!this.#template) return;
290
- const { min, max, step } = useState(sliderState), steps = (max() - min()) / step();
291
- cloneTemplate(this.#template, Math.floor(steps) + 1);
292
- }
293
- }
294
-
295
- export { MediaAnnouncerElement, MediaAudioGainRadioGroupElement, MediaAudioGainSliderElement, MediaCaptionsElement, MediaChapterTitleElement, MediaChaptersRadioGroupElement, MediaControlsElement, MediaControlsGroupElement, MediaGestureElement, MediaGoogleCastButtonElement, MediaLayoutElement, MediaMenuPortalElement, MediaQualitySliderElement, MediaRadioGroupElement, MediaSliderChaptersElement, MediaSliderElement, MediaSliderStepsElement, MediaSliderVideoElement, MediaSpeedSliderElement, MediaSpinnerElement, MediaTitleElement, MediaToggleButtonElement, MediaTooltipContentElement, MediaTooltipElement, MediaTooltipTriggerElement };