@locpd/vidstack 1.12.14

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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/analyze.json.d.ts +8 -0
  4. package/bundle.d.ts +1 -0
  5. package/cdn/chunks/vidstack-2f5gzOW6.js +1 -0
  6. package/cdn/chunks/vidstack-BYgY9wmd.js +1 -0
  7. package/cdn/chunks/vidstack-BfBBPhXV.js +1 -0
  8. package/cdn/chunks/vidstack-Bjo5esRp.js +1 -0
  9. package/cdn/chunks/vidstack-BuL67v3q.js +1 -0
  10. package/cdn/chunks/vidstack-C0msPRTd.js +3 -0
  11. package/cdn/chunks/vidstack-CJNLoJPa.js +1 -0
  12. package/cdn/chunks/vidstack-CQSpZ7X8.js +16 -0
  13. package/cdn/chunks/vidstack-C_AxqLKV.js +1 -0
  14. package/cdn/chunks/vidstack-CioT3Yw2.js +1 -0
  15. package/cdn/chunks/vidstack-CrqkytHl.js +1 -0
  16. package/cdn/chunks/vidstack-D0M8R0ZU.js +1 -0
  17. package/cdn/chunks/vidstack-D40FSa5B.js +3 -0
  18. package/cdn/chunks/vidstack-DD2JwFVU.js +1 -0
  19. package/cdn/chunks/vidstack-DRH_1tFW.js +1 -0
  20. package/cdn/chunks/vidstack-DfDZuHNP.js +1 -0
  21. package/cdn/chunks/vidstack-DiNS2Vx5.js +1 -0
  22. package/cdn/chunks/vidstack-xjJ-ui_l.js +1 -0
  23. package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +1 -0
  24. package/cdn/providers/vidstack-dash-CUtD4e6q.js +1 -0
  25. package/cdn/providers/vidstack-google-cast-BdORATUX.js +1 -0
  26. package/cdn/providers/vidstack-hls-R25Kb6DP.js +1 -0
  27. package/cdn/providers/vidstack-html-DaAUJYsD.js +1 -0
  28. package/cdn/providers/vidstack-video-Csvox7SO.js +1 -0
  29. package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +1 -0
  30. package/cdn/providers/vidstack-youtube-DiND6h3s.js +1 -0
  31. package/cdn/vidstack.js +1 -0
  32. package/cdn/with-layouts/chunks/vidstack-2f5gzOW6.js +1 -0
  33. package/cdn/with-layouts/chunks/vidstack-45yH5los.js +1 -0
  34. package/cdn/with-layouts/chunks/vidstack-BBVMdOnf.js +1 -0
  35. package/cdn/with-layouts/chunks/vidstack-BB_ulI_T.js +1 -0
  36. package/cdn/with-layouts/chunks/vidstack-BcAewM33.js +1 -0
  37. package/cdn/with-layouts/chunks/vidstack-BfBBPhXV.js +1 -0
  38. package/cdn/with-layouts/chunks/vidstack-Bxv1Qnxe.js +1 -0
  39. package/cdn/with-layouts/chunks/vidstack-C2ZbG62f.js +3 -0
  40. package/cdn/with-layouts/chunks/vidstack-CCYIOKgL.js +1 -0
  41. package/cdn/with-layouts/chunks/vidstack-CL6PeIO1.js +1 -0
  42. package/cdn/with-layouts/chunks/vidstack-C_AxqLKV.js +1 -0
  43. package/cdn/with-layouts/chunks/vidstack-CifDkwDH.js +795 -0
  44. package/cdn/with-layouts/chunks/vidstack-Cry7aD59.js +3 -0
  45. package/cdn/with-layouts/chunks/vidstack-D065okCn.js +1 -0
  46. package/cdn/with-layouts/chunks/vidstack-DGuMoXmI.js +1 -0
  47. package/cdn/with-layouts/chunks/vidstack-DRH_1tFW.js +1 -0
  48. package/cdn/with-layouts/chunks/vidstack-DVBs1XoQ.js +1 -0
  49. package/cdn/with-layouts/chunks/vidstack-Dge3KT8k.js +1 -0
  50. package/cdn/with-layouts/chunks/vidstack-DiNS2Vx5.js +1 -0
  51. package/cdn/with-layouts/chunks/vidstack-HvYfJoen.js +1 -0
  52. package/cdn/with-layouts/providers/vidstack-audio-DE5vKIzW.js +1 -0
  53. package/cdn/with-layouts/providers/vidstack-dash-CA2agUuZ.js +1 -0
  54. package/cdn/with-layouts/providers/vidstack-google-cast-CGs-t8HM.js +1 -0
  55. package/cdn/with-layouts/providers/vidstack-hls-BHMbMFFR.js +1 -0
  56. package/cdn/with-layouts/providers/vidstack-html-Dm9gmNk6.js +1 -0
  57. package/cdn/with-layouts/providers/vidstack-video-C5it_Lbl.js +1 -0
  58. package/cdn/with-layouts/providers/vidstack-vimeo-BabLn9sy.js +1 -0
  59. package/cdn/with-layouts/providers/vidstack-youtube-D8UlccUL.js +1 -0
  60. package/cdn/with-layouts/vidstack.js +1 -0
  61. package/dev/chunks/vidstack-B7Zi3v_O.js +104 -0
  62. package/dev/chunks/vidstack-BFg1ZqiG.js +91 -0
  63. package/dev/chunks/vidstack-BGB2pa9s.js +58 -0
  64. package/dev/chunks/vidstack-BaIbHZE3.js +1519 -0
  65. package/dev/chunks/vidstack-Bb2rASIc.js +5188 -0
  66. package/dev/chunks/vidstack-Bcmx8pmK.js +224 -0
  67. package/dev/chunks/vidstack-Bl4b0Nen.js +29 -0
  68. package/dev/chunks/vidstack-Bo5OTJ06.js +58 -0
  69. package/dev/chunks/vidstack-BoAGnlRt.js +58 -0
  70. package/dev/chunks/vidstack-Bpr4fI4n.js +7 -0
  71. package/dev/chunks/vidstack-Bt8MP2DK.js +204 -0
  72. package/dev/chunks/vidstack-Bu2kfzUd.js +1637 -0
  73. package/dev/chunks/vidstack-C-ffXlSV.js +2995 -0
  74. package/dev/chunks/vidstack-C-ztJq-f.js +109 -0
  75. package/dev/chunks/vidstack-CFNlaVTR.js +55 -0
  76. package/dev/chunks/vidstack-C_l97D5j.js +254 -0
  77. package/dev/chunks/vidstack-CjhKISI0.js +114 -0
  78. package/dev/chunks/vidstack-CofXIJAy.js +57 -0
  79. package/dev/chunks/vidstack-CwTj4H1w.js +18 -0
  80. package/dev/chunks/vidstack-DDwbYVHV.js +66 -0
  81. package/dev/chunks/vidstack-DFImIcIL.js +11 -0
  82. package/dev/chunks/vidstack-DGDvUbvO.js +33 -0
  83. package/dev/chunks/vidstack-DO0kqA99.js +107 -0
  84. package/dev/chunks/vidstack-DXxIKXmd.js +50 -0
  85. package/dev/chunks/vidstack-DajrMUR0.js +297 -0
  86. package/dev/chunks/vidstack-DbBJlz7I.js +10 -0
  87. package/dev/chunks/vidstack-Dihypf8P.js +11 -0
  88. package/dev/chunks/vidstack-DlAhl87f.js +1193 -0
  89. package/dev/chunks/vidstack-Dm1xEU9Q.js +34 -0
  90. package/dev/chunks/vidstack-Dv_LIPFu.js +14 -0
  91. package/dev/chunks/vidstack-igYn0Apa.js +254 -0
  92. package/dev/chunks/vidstack-krOAtKMi.js +32 -0
  93. package/dev/chunks/vidstack-qh1N5_f_.js +26 -0
  94. package/dev/chunks/vidstack-rB-wqXw1.js +107 -0
  95. package/dev/chunks/vidstack-zG6PIeGg.js +66 -0
  96. package/dev/define/plyr-layout.js +51 -0
  97. package/dev/define/templates/plyr-layout.js +571 -0
  98. package/dev/define/templates/vidstack-audio-layout.js +167 -0
  99. package/dev/define/templates/vidstack-video-layout.js +390 -0
  100. package/dev/define/vidstack-icons.js +1 -0
  101. package/dev/define/vidstack-player-default-layout.js +21 -0
  102. package/dev/define/vidstack-player-layouts.js +25 -0
  103. package/dev/define/vidstack-player-ui.js +70 -0
  104. package/dev/define/vidstack-player.js +19 -0
  105. package/dev/global/plyr.js +501 -0
  106. package/dev/global/vidstack-player.js +129 -0
  107. package/dev/providers/vidstack-audio.js +35 -0
  108. package/dev/providers/vidstack-dash.js +516 -0
  109. package/dev/providers/vidstack-google-cast.js +474 -0
  110. package/dev/providers/vidstack-hls.js +408 -0
  111. package/dev/providers/vidstack-html.js +567 -0
  112. package/dev/providers/vidstack-video.js +207 -0
  113. package/dev/providers/vidstack-vimeo.js +554 -0
  114. package/dev/providers/vidstack-youtube.js +286 -0
  115. package/dev/vidstack-elements.js +36 -0
  116. package/dev/vidstack.js +91 -0
  117. package/dom.d.ts +91 -0
  118. package/elements.d.ts +1433 -0
  119. package/empty.vtt +1 -0
  120. package/global/player.d.ts +52 -0
  121. package/global/plyr.d.ts +343 -0
  122. package/google-cast.d.ts +1422 -0
  123. package/icons.d.ts +1 -0
  124. package/index.d.ts +402 -0
  125. package/package.json +199 -0
  126. package/player/index.d.ts +3 -0
  127. package/player/layouts/default.d.ts +3 -0
  128. package/player/layouts/index.d.ts +3 -0
  129. package/player/layouts/plyr.d.ts +3 -0
  130. package/player/styles/base.css +153 -0
  131. package/player/styles/default/buffering.css +55 -0
  132. package/player/styles/default/buttons.css +175 -0
  133. package/player/styles/default/captions.css +181 -0
  134. package/player/styles/default/chapter-title.css +26 -0
  135. package/player/styles/default/controls.css +56 -0
  136. package/player/styles/default/gestures.css +19 -0
  137. package/player/styles/default/icons.css +6 -0
  138. package/player/styles/default/keyboard.css +148 -0
  139. package/player/styles/default/layouts/audio.css +417 -0
  140. package/player/styles/default/layouts/video.css +590 -0
  141. package/player/styles/default/menus.css +959 -0
  142. package/player/styles/default/poster.css +52 -0
  143. package/player/styles/default/sliders.css +391 -0
  144. package/player/styles/default/theme.css +2461 -0
  145. package/player/styles/default/thumbnail.css +40 -0
  146. package/player/styles/default/time.css +45 -0
  147. package/player/styles/default/tooltips.css +141 -0
  148. package/player/styles/plyr/theme.css +1237 -0
  149. package/player/ui.d.ts +3 -0
  150. package/plugins.d.ts +19 -0
  151. package/plugins.js +13 -0
  152. package/prod/chunks/vidstack-B01xzxC4.js +7 -0
  153. package/prod/chunks/vidstack-BCeb7ryV.js +201 -0
  154. package/prod/chunks/vidstack-BGSTndAW.js +1590 -0
  155. package/prod/chunks/vidstack-BPitBBjh.js +1519 -0
  156. package/prod/chunks/vidstack-BQlOPwOu.js +45 -0
  157. package/prod/chunks/vidstack-BSDzlwxO.js +4778 -0
  158. package/prod/chunks/vidstack-BT0m6zEi.js +109 -0
  159. package/prod/chunks/vidstack-BTigPj2h.js +55 -0
  160. package/prod/chunks/vidstack-BiyXcJ_M.js +107 -0
  161. package/prod/chunks/vidstack-BoVf5n1M.js +2985 -0
  162. package/prod/chunks/vidstack-Bq6c3Bam.js +58 -0
  163. package/prod/chunks/vidstack-ByLCIBtB.js +297 -0
  164. package/prod/chunks/vidstack-C2US-gSO.js +248 -0
  165. package/prod/chunks/vidstack-C9vIqaYT.js +10 -0
  166. package/prod/chunks/vidstack-CF6fixCQ.js +1193 -0
  167. package/prod/chunks/vidstack-CTojmhKq.js +66 -0
  168. package/prod/chunks/vidstack-ChQTHmIQ.js +77 -0
  169. package/prod/chunks/vidstack-Cm6_unwd.js +246 -0
  170. package/prod/chunks/vidstack-CwTj4H1w.js +18 -0
  171. package/prod/chunks/vidstack-D3ltXc3a.js +33 -0
  172. package/prod/chunks/vidstack-D5EzK014.js +14 -0
  173. package/prod/chunks/vidstack-DDXt6fpN.js +58 -0
  174. package/prod/chunks/vidstack-DJDnh4xT.js +11 -0
  175. package/prod/chunks/vidstack-DXxIKXmd.js +50 -0
  176. package/prod/chunks/vidstack-D_-9AA6_.js +29 -0
  177. package/prod/chunks/vidstack-DbkZGjSn.js +107 -0
  178. package/prod/chunks/vidstack-Dihypf8P.js +11 -0
  179. package/prod/chunks/vidstack-Dm1xEU9Q.js +34 -0
  180. package/prod/chunks/vidstack-Dq5Yu0Vr.js +205 -0
  181. package/prod/chunks/vidstack-DqAw8m9J.js +26 -0
  182. package/prod/chunks/vidstack-DsPOyKtl.js +57 -0
  183. package/prod/chunks/vidstack-krOAtKMi.js +32 -0
  184. package/prod/chunks/vidstack-nLyr4NEP.js +58 -0
  185. package/prod/chunks/vidstack-xMS8dnYq.js +114 -0
  186. package/prod/chunks/vidstack-yEGTpgeA.js +104 -0
  187. package/prod/define/plyr-layout.js +51 -0
  188. package/prod/define/templates/plyr-layout.js +571 -0
  189. package/prod/define/templates/vidstack-audio-layout.js +167 -0
  190. package/prod/define/templates/vidstack-video-layout.js +390 -0
  191. package/prod/define/vidstack-icons.js +1 -0
  192. package/prod/define/vidstack-player-default-layout.js +21 -0
  193. package/prod/define/vidstack-player-layouts.js +25 -0
  194. package/prod/define/vidstack-player-ui.js +70 -0
  195. package/prod/define/vidstack-player.js +19 -0
  196. package/prod/global/plyr.js +493 -0
  197. package/prod/global/vidstack-player.js +129 -0
  198. package/prod/providers/vidstack-audio.js +35 -0
  199. package/prod/providers/vidstack-dash.js +501 -0
  200. package/prod/providers/vidstack-google-cast.js +468 -0
  201. package/prod/providers/vidstack-hls.js +393 -0
  202. package/prod/providers/vidstack-html.js +555 -0
  203. package/prod/providers/vidstack-video.js +204 -0
  204. package/prod/providers/vidstack-vimeo.js +548 -0
  205. package/prod/providers/vidstack-youtube.js +286 -0
  206. package/prod/vidstack-elements.js +36 -0
  207. package/prod/vidstack.js +158 -0
  208. package/server/chunks/vidstack-6juFdkKy.js +29 -0
  209. package/server/chunks/vidstack-B7iHmv7_.js +307 -0
  210. package/server/chunks/vidstack-BmxyML9v.js +1619 -0
  211. package/server/chunks/vidstack-BskfxwD3.js +566 -0
  212. package/server/chunks/vidstack-BvLV0SMz.js +4642 -0
  213. package/server/chunks/vidstack-BvWwluXZ.js +205 -0
  214. package/server/chunks/vidstack-C-413dj2.js +8 -0
  215. package/server/chunks/vidstack-C26K8z_-.js +55 -0
  216. package/server/chunks/vidstack-CJJiksDz.js +107 -0
  217. package/server/chunks/vidstack-CUNv52x1.js +141 -0
  218. package/server/chunks/vidstack-CqyBCODe.js +295 -0
  219. package/server/chunks/vidstack-CwTj4H1w.js +18 -0
  220. package/server/chunks/vidstack-DHAyGSOl.js +1502 -0
  221. package/server/chunks/vidstack-DLU3cjcp.js +381 -0
  222. package/server/chunks/vidstack-DXxIKXmd.js +50 -0
  223. package/server/chunks/vidstack-DbtDXDS2.js +104 -0
  224. package/server/chunks/vidstack-Dm1xEU9Q.js +34 -0
  225. package/server/chunks/vidstack-DzTHw_bw.js +207 -0
  226. package/server/chunks/vidstack-Wn3NH5Sg.js +1566 -0
  227. package/server/chunks/vidstack-krOAtKMi.js +32 -0
  228. package/server/chunks/vidstack-wNViAkr4.js +3045 -0
  229. package/server/define/plyr-layout.js +16 -0
  230. package/server/define/vidstack-icons.js +1 -0
  231. package/server/define/vidstack-player-default-layout.js +13 -0
  232. package/server/define/vidstack-player-layouts.js +16 -0
  233. package/server/define/vidstack-player-ui.js +11 -0
  234. package/server/define/vidstack-player.js +6 -0
  235. package/server/global/plyr.js +322 -0
  236. package/server/global/vidstack-player.js +58 -0
  237. package/server/vidstack-elements.js +46 -0
  238. package/server/vidstack.js +148 -0
  239. package/tailwind.cjs +101 -0
  240. package/tailwind.d.cts +15 -0
  241. package/types/vidstack-BOvzfZjK.d.ts +1269 -0
  242. package/types/vidstack-Cttpg6GU.d.ts +7474 -0
@@ -0,0 +1,19 @@
1
+ import { defineCustomElement } from '../chunks/vidstack-BGSTndAW.js';
2
+ import { MediaPlayerElement, MediaProviderElement } from '../chunks/vidstack-yEGTpgeA.js';
3
+ import '../chunks/vidstack-BSDzlwxO.js';
4
+ import '../chunks/vidstack-DJDnh4xT.js';
5
+ import '../chunks/vidstack-xMS8dnYq.js';
6
+ import '../chunks/vidstack-ChQTHmIQ.js';
7
+ import '../chunks/vidstack-Cm6_unwd.js';
8
+ import '../chunks/vidstack-CTojmhKq.js';
9
+ import '../chunks/vidstack-nLyr4NEP.js';
10
+ import '../chunks/vidstack-D5EzK014.js';
11
+ import '../chunks/vidstack-B01xzxC4.js';
12
+ import '../chunks/vidstack-C2US-gSO.js';
13
+ import '@floating-ui/dom';
14
+ import '../chunks/vidstack-C9vIqaYT.js';
15
+ import '../chunks/vidstack-Dihypf8P.js';
16
+ import '../chunks/vidstack-DsPOyKtl.js';
17
+
18
+ defineCustomElement(MediaPlayerElement);
19
+ defineCustomElement(MediaProviderElement);
@@ -0,0 +1,493 @@
1
+ import '../define/vidstack-player.js';
2
+ import '../define/plyr-layout.js';
3
+ import { isString, listenEvent, setAttribute, kebabToCamelCase, setStyle, createDisposalBin, isBoolean, DOMEvent } from '../chunks/vidstack-BGSTndAW.js';
4
+ import { mediaState, isHTMLAudioElement, isHTMLVideoElement, isHTMLIFrameElement } from '../chunks/vidstack-BSDzlwxO.js';
5
+ import { isHTMLElement } from '../chunks/vidstack-C2US-gSO.js';
6
+ import { canPlayVideoType } from '../chunks/vidstack-xMS8dnYq.js';
7
+ import '../chunks/vidstack-yEGTpgeA.js';
8
+ import '../chunks/vidstack-DJDnh4xT.js';
9
+ import '../chunks/vidstack-BCeb7ryV.js';
10
+ import '../chunks/vidstack-BoVf5n1M.js';
11
+ import '../chunks/vidstack-Cm6_unwd.js';
12
+ import '../chunks/vidstack-CTojmhKq.js';
13
+ import '../chunks/vidstack-nLyr4NEP.js';
14
+ import '../chunks/vidstack-DsPOyKtl.js';
15
+ import '../chunks/vidstack-Dihypf8P.js';
16
+ import '../chunks/vidstack-C9vIqaYT.js';
17
+ import '../define/templates/plyr-layout.js';
18
+ import 'lit-html';
19
+ import '../chunks/vidstack-DbkZGjSn.js';
20
+ import '../chunks/vidstack-Dq5Yu0Vr.js';
21
+ import 'lit-html/directives/if-defined.js';
22
+ import 'lit-html/directives/unsafe-svg.js';
23
+ import 'lit-html/async-directive.js';
24
+ import '../chunks/vidstack-CwTj4H1w.js';
25
+ import 'lit-html/directives/unsafe-html.js';
26
+ import '../chunks/vidstack-D3ltXc3a.js';
27
+ import '../chunks/vidstack-BiyXcJ_M.js';
28
+ import '../chunks/vidstack-ChQTHmIQ.js';
29
+ import '../chunks/vidstack-D5EzK014.js';
30
+ import '../chunks/vidstack-B01xzxC4.js';
31
+ import '@floating-ui/dom';
32
+
33
+ let activePlyr = null, defaults = mediaState.record, forwardedPlayerState = [
34
+ "playing",
35
+ "paused",
36
+ "ended",
37
+ "currentTime",
38
+ "seeking",
39
+ "duration",
40
+ "volume",
41
+ "muted",
42
+ "loop",
43
+ "poster"
44
+ ], eventMap = {
45
+ ratechange: "rate-change",
46
+ ready: "can-play",
47
+ timeupdate: "time-update",
48
+ volumechange: "volume-change"
49
+ }, icons = [
50
+ "airplay",
51
+ "captions-off",
52
+ "captions-on",
53
+ "download",
54
+ "enter-fullscreen",
55
+ "exit-fullscreen",
56
+ "fast-forward",
57
+ "muted",
58
+ "pause",
59
+ "pip",
60
+ "play",
61
+ "restart",
62
+ "rewind",
63
+ "settings",
64
+ "volume"
65
+ ];
66
+ class Plyr {
67
+ constructor(target, config = {}) {
68
+ this.target = target;
69
+ this.config = config;
70
+ if (isString(target)) {
71
+ target = document.querySelector(target);
72
+ } else if (!isHTMLElement(target)) {
73
+ target = target[0];
74
+ }
75
+ if (!isHTMLElement(target)) {
76
+ throw Error(`[plyr] target must be of type \`HTMLElement\`, found \`${typeof target}\``);
77
+ }
78
+ const dataConfig = target.getAttribute("data-plyr-config");
79
+ if (dataConfig) {
80
+ try {
81
+ config = { ...config, ...JSON.parse(dataConfig) };
82
+ } catch (error) {
83
+ }
84
+ }
85
+ const {
86
+ enabled = true,
87
+ debug = "error",
88
+ autoPause = true,
89
+ ratio = null,
90
+ hideControls = true,
91
+ resetOnEnd = false,
92
+ disableContextMenu = true,
93
+ iconUrl = null,
94
+ iconPrefix = "plyr",
95
+ keyboard = { focused: true, global: false },
96
+ i18n = null,
97
+ tracks,
98
+ ...props
99
+ } = config;
100
+ this.player = document.createElement("media-player");
101
+ this.provider = document.createElement("media-provider");
102
+ this.layout = document.createElement("media-plyr-layout");
103
+ if (!enabled) return;
104
+ for (const prop of forwardedPlayerState) {
105
+ Object.defineProperty(this, prop, {
106
+ get: () => this.player[prop],
107
+ set: (value) => void (this.player[prop] = value)
108
+ });
109
+ }
110
+ if (isString(debug)) {
111
+ this.player.logLevel = debug;
112
+ } else if (debug) {
113
+ this.player.logLevel = "warn";
114
+ }
115
+ if (autoPause) {
116
+ this.#disposal.add(listenEvent(this.player, "play", this.#onPlay.bind(this)));
117
+ }
118
+ this.ratio = ratio;
119
+ this.layout.translations = i18n;
120
+ if (!hideControls) {
121
+ this.player.controls.canIdle = false;
122
+ }
123
+ if (resetOnEnd) {
124
+ this.#disposal.add(listenEvent(this.player, "ended", this.#onReset.bind(this)));
125
+ }
126
+ if (iconUrl) {
127
+ this.layout.customIcons = true;
128
+ const id = `sprite-${iconPrefix}`, exists = document.getElementById(id);
129
+ const addIcons = () => {
130
+ for (const icon of icons) {
131
+ const namepsace = "http://www.w3.org/2000/svg";
132
+ const svg = document.createElementNS(namepsace, "svg");
133
+ setAttribute(svg, "fill", "none");
134
+ setAttribute(svg, "slot", `${icon}-icon`);
135
+ setAttribute(svg, "aria-hidden", "true");
136
+ setAttribute(svg, "viewBox", "0 0 18 18");
137
+ const use = document.createElementNS(namepsace, "use");
138
+ use.setAttributeNS("http://www.w3.org/1999/xlink", "href", `#${iconPrefix}-${icon}`);
139
+ svg.append(use);
140
+ this.layout.append(svg);
141
+ }
142
+ };
143
+ if (!exists) {
144
+ fetch(iconUrl).then((response) => response.text()).then((data) => {
145
+ const container = document.createElement("div");
146
+ setAttribute(container, "id", id);
147
+ setAttribute(container, "hidden", "");
148
+ container.innerHTML = data;
149
+ document.body.insertAdjacentElement("afterbegin", container);
150
+ addIcons();
151
+ }).catch((error) => {
152
+ this.layout.customIcons = false;
153
+ });
154
+ } else {
155
+ addIcons();
156
+ }
157
+ }
158
+ if (keyboard.global) {
159
+ this.player.keyTarget = "document";
160
+ } else if (keyboard.focused) {
161
+ this.player.keyTarget = "player";
162
+ } else {
163
+ this.player.keyDisabled = true;
164
+ }
165
+ target.removeAttribute("controls");
166
+ const title = target.getAttribute("title");
167
+ if (title) this.player.setAttribute("title", title);
168
+ const width = target.getAttribute("width"), height = target.getAttribute("height");
169
+ if (width || height) {
170
+ if (width) this.player.style.width = width;
171
+ if (height) this.player.style.height = height;
172
+ this.player.style.aspectRatio = "unset";
173
+ }
174
+ for (const attr of target.attributes) {
175
+ const name = attr.name.replace("data-", ""), propName = kebabToCamelCase(name);
176
+ if (propName in this.player) {
177
+ this.player.setAttribute(name, attr.value);
178
+ } else if (propName in this.layout) {
179
+ this.layout.setAttribute(name, attr.value);
180
+ }
181
+ }
182
+ for (const [prop, value] of Object.entries(props)) {
183
+ if (prop in this.player) {
184
+ this.player[prop] = value;
185
+ } else if (prop in this.layout) {
186
+ this.layout[prop] = value;
187
+ }
188
+ }
189
+ if (tracks) {
190
+ for (const track of tracks) this.player.textTracks.add(track);
191
+ }
192
+ this.player.append(this.provider, this.layout);
193
+ const isTargetContainer = !isHTMLAudioElement(target) && !isHTMLVideoElement(target) && !isHTMLIFrameElement(target);
194
+ if (isTargetContainer) {
195
+ target.append(this.player);
196
+ } else {
197
+ for (const child of [...target.children]) this.provider.append(child);
198
+ target.replaceWith(this.player);
199
+ }
200
+ const embedProvider = target.getAttribute("data-plyr-provider"), embedId = target.getAttribute("data-plyr-embed-id");
201
+ if (embedProvider && /youtube|vimeo/.test(embedProvider) && embedId) {
202
+ this.player.src = `${embedProvider}/${embedId}`;
203
+ }
204
+ }
205
+ static setup(targets, config) {
206
+ if (isString(targets)) {
207
+ targets = document.querySelectorAll(targets);
208
+ }
209
+ return [...targets].map((target) => new Plyr(target, config));
210
+ }
211
+ static supported(type, provider) {
212
+ return true;
213
+ }
214
+ player;
215
+ provider;
216
+ layout;
217
+ fullscreen = new PlyrFullscreenAdapter(this);
218
+ // These are only included for type defs, props are defined in constructor.
219
+ playing = defaults.playing;
220
+ paused = defaults.paused;
221
+ ended = defaults.ended;
222
+ currentTime = defaults.currentTime;
223
+ seeking = defaults.seeking;
224
+ duration = defaults.duration;
225
+ volume = defaults.volume;
226
+ muted = defaults.muted;
227
+ loop = defaults.loop;
228
+ poster = defaults.poster;
229
+ get type() {
230
+ return this.player.provider?.type ?? "";
231
+ }
232
+ get isHTML5() {
233
+ return /audio|video|hls/.test(this.type);
234
+ }
235
+ get isEmbed() {
236
+ return /youtube|vimeo/.test(this.type);
237
+ }
238
+ get buffered() {
239
+ const { bufferedEnd, seekableEnd } = this.player.state;
240
+ return seekableEnd > 0 ? bufferedEnd / seekableEnd : 0;
241
+ }
242
+ get stopped() {
243
+ return this.paused && this.currentTime === 0;
244
+ }
245
+ get hasAudio() {
246
+ if (!this.isHTML5) return true;
247
+ const media = this.player.provider.media;
248
+ return Boolean(
249
+ media.mozHasAudio || media.webkitAudioDecodedByteCount || media.audioTracks?.length || this.player.audioTracks.length
250
+ );
251
+ }
252
+ get speed() {
253
+ return this.player.playbackRate;
254
+ }
255
+ set speed(speed) {
256
+ this.player.remoteControl.changePlaybackRate(speed);
257
+ }
258
+ get currentTrack() {
259
+ return this.player.textTracks.selectedIndex;
260
+ }
261
+ set currentTrack(index) {
262
+ this.player.remoteControl.changeTextTrackMode(index, "showing");
263
+ }
264
+ get pip() {
265
+ return this.player.state.pictureInPicture;
266
+ }
267
+ set pip(isActive) {
268
+ if (isActive) this.player.enterPictureInPicture();
269
+ else this.player.exitPictureInPicture();
270
+ }
271
+ get quality() {
272
+ return this.player.state.quality?.height ?? null;
273
+ }
274
+ set quality(value) {
275
+ let qualities = this.player.qualities, index = -1;
276
+ if (value !== null) {
277
+ let minScore = Infinity;
278
+ for (let i = 0; i < qualities.length; i++) {
279
+ const score = Math.abs(qualities[i].height - value);
280
+ if (score < minScore) {
281
+ index = i;
282
+ minScore = score;
283
+ }
284
+ }
285
+ }
286
+ this.player.remoteControl.changeQuality(index);
287
+ }
288
+ #source = null;
289
+ get source() {
290
+ return this.#source;
291
+ }
292
+ set source(source) {
293
+ const {
294
+ type: viewType = "video",
295
+ sources = "",
296
+ title = "",
297
+ poster = "",
298
+ thumbnails = "",
299
+ tracks = []
300
+ } = source ?? {};
301
+ this.player.src = sources;
302
+ this.player.viewType = viewType;
303
+ this.player.title = title;
304
+ this.player.poster = poster;
305
+ this.layout.thumbnails = thumbnails;
306
+ this.player.textTracks.clear();
307
+ for (const track of tracks) this.player.textTracks.add(track);
308
+ this.#source = source;
309
+ }
310
+ #ratio = null;
311
+ get ratio() {
312
+ return this.#ratio;
313
+ }
314
+ set ratio(ratio) {
315
+ if (ratio) ratio = ratio.replace(/\s*:\s*/, " / ");
316
+ setStyle(this.player, "aspect-ratio", ratio ?? "unset");
317
+ this.#ratio = ratio;
318
+ }
319
+ get download() {
320
+ return this.layout.download;
321
+ }
322
+ set download(download) {
323
+ this.layout.download = download;
324
+ }
325
+ #disposal = createDisposalBin();
326
+ #onPlay() {
327
+ if (activePlyr !== this) activePlyr?.pause();
328
+ activePlyr = this;
329
+ }
330
+ #onReset() {
331
+ this.currentTime = 0;
332
+ this.paused = true;
333
+ }
334
+ play() {
335
+ return this.player.play();
336
+ }
337
+ pause() {
338
+ return this.player.pause();
339
+ }
340
+ togglePlay(toggle = this.paused) {
341
+ if (toggle) {
342
+ return this.player.play();
343
+ } else {
344
+ return this.player.pause();
345
+ }
346
+ }
347
+ toggleCaptions(toggle = !this.player.textTracks.selected) {
348
+ const controller = this.player.remoteControl;
349
+ if (toggle) {
350
+ controller.showCaptions();
351
+ } else {
352
+ controller.disableCaptions();
353
+ }
354
+ }
355
+ toggleControls(toggle = !this.player.controls.showing) {
356
+ const controls = this.player.controls;
357
+ if (toggle) {
358
+ controls.show();
359
+ } else {
360
+ controls.hide();
361
+ }
362
+ }
363
+ restart() {
364
+ this.currentTime = 0;
365
+ }
366
+ stop() {
367
+ this.pause();
368
+ this.player.currentTime = 0;
369
+ }
370
+ forward(seekTime = this.config.seekTime ?? 10) {
371
+ this.currentTime += seekTime;
372
+ }
373
+ rewind(seekTime = this.config.seekTime ?? 10) {
374
+ this.currentTime -= seekTime;
375
+ }
376
+ increaseVolume(step = 5) {
377
+ this.volume += step;
378
+ }
379
+ decreaseVolume(step = 5) {
380
+ this.volume -= step;
381
+ }
382
+ airplay() {
383
+ return this.player.requestAirPlay();
384
+ }
385
+ on(type, callback) {
386
+ this.#listen(type, callback);
387
+ }
388
+ once(type, callback) {
389
+ this.#listen(type, callback, { once: true });
390
+ }
391
+ off(type, callback) {
392
+ this.#listen(type, callback, { remove: true });
393
+ }
394
+ #listeners = [];
395
+ #listen(type, callback, options = {}) {
396
+ let eventType = type, toggle = null;
397
+ switch (type) {
398
+ case "captionsenabled":
399
+ case "captionsdisabled":
400
+ eventType = "text-track-change";
401
+ toggle = type === "captionsenabled";
402
+ break;
403
+ case "controlsshown":
404
+ case "controlshidden":
405
+ eventType = "controls-change";
406
+ toggle = type === "controlsshown";
407
+ break;
408
+ case "enterfullscreen":
409
+ case "exitfullscreen":
410
+ eventType = "fullscreen-change";
411
+ toggle = type === "enterfullscreen";
412
+ break;
413
+ }
414
+ const mappedEventType = eventMap[eventType] ?? eventType;
415
+ const listener = (event) => {
416
+ if (isBoolean(toggle) && !!event.detail !== toggle) return;
417
+ if (mappedEventType !== type) {
418
+ callback(new DOMEvent(type, { ...event, trigger: event }));
419
+ return;
420
+ }
421
+ callback(event);
422
+ };
423
+ if (options.remove) {
424
+ let index = -1;
425
+ do {
426
+ index = this.#listeners.findIndex((t) => t.type === type && t.callback === callback);
427
+ if (index >= 0) {
428
+ const { listener: listener2 } = this.#listeners[index];
429
+ this.player.removeEventListener(mappedEventType, listener2);
430
+ this.#listeners.splice(index, 1);
431
+ }
432
+ } while (index >= 0);
433
+ } else {
434
+ this.#listeners.push({ type, callback, listener });
435
+ this.player.addEventListener(mappedEventType, listener, { once: options.once });
436
+ }
437
+ }
438
+ supports(type) {
439
+ return !!type && canPlayVideoType(null, type);
440
+ }
441
+ destroy() {
442
+ for (const { type, listener } of this.#listeners) {
443
+ this.player.removeEventListener(eventMap[type] ?? type, listener);
444
+ }
445
+ this.#source = null;
446
+ this.#listeners.length = 0;
447
+ if (activePlyr === this) activePlyr = null;
448
+ this.#disposal.empty();
449
+ this.player.destroy();
450
+ }
451
+ }
452
+ class PlyrFullscreenAdapter {
453
+ #plyr;
454
+ constructor(plyr) {
455
+ this.#plyr = plyr;
456
+ }
457
+ get #player() {
458
+ return this.#plyr.player;
459
+ }
460
+ /**
461
+ * Returns a boolean indicating if the current player has fullscreen enabled.
462
+ */
463
+ get enabled() {
464
+ return this.#player.state.canFullscreen;
465
+ }
466
+ /**
467
+ * Returns a boolean indicating if the current player is in fullscreen mode.
468
+ */
469
+ get active() {
470
+ return this.#player.state.fullscreen;
471
+ }
472
+ /**
473
+ * Request to enter fullscreen.
474
+ */
475
+ enter() {
476
+ return this.#player.requestFullscreen();
477
+ }
478
+ /**
479
+ * Request to exit fullscreen.
480
+ */
481
+ exit() {
482
+ return this.#player.exitFullscreen();
483
+ }
484
+ /**
485
+ * Request to toggle fullscreen.
486
+ */
487
+ toggle() {
488
+ if (this.active) return this.exit();
489
+ else return this.enter();
490
+ }
491
+ }
492
+
493
+ export { Plyr, PlyrFullscreenAdapter };
@@ -0,0 +1,129 @@
1
+ import '../define/vidstack-player.js';
2
+ import { isString, defineCustomElement, kebabToCamelCase } from '../chunks/vidstack-BGSTndAW.js';
3
+ import { isHTMLAudioElement, isHTMLVideoElement, isHTMLIFrameElement } from '../chunks/vidstack-BSDzlwxO.js';
4
+ import { isHTMLElement } from '../chunks/vidstack-C2US-gSO.js';
5
+ import '../chunks/vidstack-yEGTpgeA.js';
6
+ import '../chunks/vidstack-DJDnh4xT.js';
7
+ import '../chunks/vidstack-xMS8dnYq.js';
8
+ import '../chunks/vidstack-ChQTHmIQ.js';
9
+ import '../chunks/vidstack-Cm6_unwd.js';
10
+ import '../chunks/vidstack-CTojmhKq.js';
11
+ import '../chunks/vidstack-nLyr4NEP.js';
12
+ import '../chunks/vidstack-D5EzK014.js';
13
+ import '../chunks/vidstack-B01xzxC4.js';
14
+ import '@floating-ui/dom';
15
+ import '../chunks/vidstack-C9vIqaYT.js';
16
+ import '../chunks/vidstack-Dihypf8P.js';
17
+ import '../chunks/vidstack-DsPOyKtl.js';
18
+
19
+ class VidstackPlayerLayout {
20
+ constructor(props) {
21
+ this.props = props;
22
+ }
23
+ name = "vidstack";
24
+ async load() {
25
+ await import('../define/vidstack-player-default-layout.js');
26
+ await import('../define/vidstack-player-ui.js');
27
+ }
28
+ create() {
29
+ const layouts = [
30
+ document.createElement("media-audio-layout"),
31
+ document.createElement("media-video-layout")
32
+ ];
33
+ if (this.props) {
34
+ for (const [prop, value] of Object.entries(this.props)) {
35
+ for (const el of layouts) el[prop] = value;
36
+ }
37
+ }
38
+ return layouts;
39
+ }
40
+ }
41
+
42
+ class PlyrLayout {
43
+ constructor(props) {
44
+ this.props = props;
45
+ }
46
+ name = "plyr";
47
+ async load() {
48
+ await import('../define/plyr-layout.js');
49
+ }
50
+ create() {
51
+ const layout = document.createElement("media-plyr-layout");
52
+ if (this.props) {
53
+ for (const [prop, value] of Object.entries(this.props)) {
54
+ layout[prop] = value;
55
+ }
56
+ }
57
+ return [layout];
58
+ }
59
+ }
60
+
61
+ const LAYOUT_LOADED = Symbol();
62
+ class VidstackPlayer {
63
+ static async create({ target, layout, tracks, ...props }) {
64
+ if (isString(target)) {
65
+ target = document.querySelector(target);
66
+ }
67
+ if (!isHTMLElement(target)) {
68
+ throw Error(`[vidstack] target must be of type \`HTMLElement\`, found \`${typeof target}\``);
69
+ }
70
+ let player = document.createElement("media-player"), provider = document.createElement("media-provider"), layouts, isTargetContainer = !isHTMLAudioElement(target) && !isHTMLVideoElement(target) && !isHTMLIFrameElement(target);
71
+ player.setAttribute("keep-alive", "");
72
+ if (props.poster && layout?.name !== "plyr") {
73
+ if (!customElements.get("media-poster")) {
74
+ const { MediaPosterElement } = await import('../chunks/vidstack-D3ltXc3a.js');
75
+ defineCustomElement(MediaPosterElement);
76
+ }
77
+ const poster = document.createElement("media-poster");
78
+ if (layout?.name === "vidstack") poster.classList.add("vds-poster");
79
+ provider.append(poster);
80
+ }
81
+ if (layout) {
82
+ target.removeAttribute("controls");
83
+ if (!layout[LAYOUT_LOADED]) {
84
+ await layout.load();
85
+ layout[LAYOUT_LOADED] = true;
86
+ }
87
+ layouts = await layout.create();
88
+ }
89
+ const title = target.getAttribute("title");
90
+ if (title) player.setAttribute("title", title);
91
+ const width = target.getAttribute("width"), height = target.getAttribute("height");
92
+ if (width || height) {
93
+ if (width) player.style.width = width;
94
+ if (height) player.style.height = height;
95
+ player.style.aspectRatio = "unset";
96
+ }
97
+ for (const attr of target.attributes) {
98
+ const name = attr.name.replace("data-", ""), propName = kebabToCamelCase(name);
99
+ if (propName in player) {
100
+ player.setAttribute(name, attr.value);
101
+ } else if (layouts?.length) {
102
+ for (const layout2 of layouts) {
103
+ if (propName in layout2) {
104
+ layout2.setAttribute(name, attr.value);
105
+ }
106
+ }
107
+ }
108
+ }
109
+ for (const [prop, value] of Object.entries(props)) {
110
+ player[prop] = value;
111
+ }
112
+ if (tracks) {
113
+ for (const track of tracks) player.textTracks.add(track);
114
+ }
115
+ player.append(provider);
116
+ if (layouts) {
117
+ for (const layout2 of layouts) player.append(layout2);
118
+ }
119
+ if (isTargetContainer) {
120
+ target.append(player);
121
+ } else {
122
+ for (const child of [...target.children]) provider.append(child);
123
+ target.replaceWith(player);
124
+ }
125
+ return player;
126
+ }
127
+ }
128
+
129
+ export { PlyrLayout, VidstackPlayer, VidstackPlayerLayout };
@@ -0,0 +1,35 @@
1
+ import { scoped } from '../chunks/vidstack-BGSTndAW.js';
2
+ import { HTMLMediaProvider } from './vidstack-html.js';
3
+ import { HTMLAirPlayAdapter } from '../chunks/vidstack-Bq6c3Bam.js';
4
+ import '../chunks/vidstack-xMS8dnYq.js';
5
+ import '../chunks/vidstack-DqAw8m9J.js';
6
+ import '../chunks/vidstack-Dihypf8P.js';
7
+ import '../chunks/vidstack-D5EzK014.js';
8
+
9
+ class AudioProvider extends HTMLMediaProvider {
10
+ $$PROVIDER_TYPE = "AUDIO";
11
+ get type() {
12
+ return "audio";
13
+ }
14
+ airPlay;
15
+ constructor(audio, ctx) {
16
+ super(audio, ctx);
17
+ scoped(() => {
18
+ this.airPlay = new HTMLAirPlayAdapter(this.media, ctx);
19
+ }, this.scope);
20
+ }
21
+ setup() {
22
+ super.setup();
23
+ if (this.type === "audio") this.ctx.notify("provider-setup", this);
24
+ }
25
+ /**
26
+ * The native HTML `<audio>` element.
27
+ *
28
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement}
29
+ */
30
+ get audio() {
31
+ return this.media;
32
+ }
33
+ }
34
+
35
+ export { AudioProvider };