suada-components 1.8.0 → 1.9.1

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 (89) hide show
  1. package/dist/{components/DailyMotion-SZKPSpD1.js → DailyMotion-B-Q4fBEb.js} +1 -1
  2. package/dist/{components/DailyMotion-jrl4eEA1.esm.js → DailyMotion-BAvo3Toe.esm.js} +1 -1
  3. package/dist/{components/Facebook-Ha24RKIX.esm.js → Facebook-C8GOujDt.esm.js} +1 -1
  4. package/dist/{components/Facebook-DS0ye_bL.js → Facebook-CASik-P5.js} +1 -1
  5. package/dist/{components/FilePlayer-D-n083nK.esm.js → FilePlayer-BOZIvaDy.esm.js} +1 -1
  6. package/dist/{components/FilePlayer-B4_DDZXQ.js → FilePlayer-CQ80KWY2.js} +1 -1
  7. package/dist/{components/Kaltura-BlDrsjbp.esm.js → Kaltura-B12Xdl6X.esm.js} +1 -1
  8. package/dist/{components/Kaltura-DAMolg_c.js → Kaltura-nYc5k7UB.js} +1 -1
  9. package/dist/{components/Mixcloud-C1z9BVJ8.js → Mixcloud-DGQnlDAK.js} +1 -1
  10. package/dist/{components/Mixcloud-B5AIgf8e.esm.js → Mixcloud-JfeQIOki.esm.js} +1 -1
  11. package/dist/{components/Mux-f77ctQXE.esm.js → Mux-BHWzpAR-.esm.js} +1 -1
  12. package/dist/{components/Mux-Bgsc5vvM.js → Mux-CiKZc8gj.js} +1 -1
  13. package/dist/{components/Preview-DhMMn7e2.esm.js → Preview-DSovY9gr.esm.js} +1 -1
  14. package/dist/{components/Preview-CKXk6Axz.js → Preview-DvZKrgm5.js} +1 -1
  15. package/dist/{components/SoundCloud-DHLHmaaB.js → SoundCloud-Di7z3nmP.js} +1 -1
  16. package/dist/{components/SoundCloud-DyYFhGe5.esm.js → SoundCloud-j_R0lK8D.esm.js} +1 -1
  17. package/dist/{components/Streamable-BBygdIqb.esm.js → Streamable-CRhXZIKP.esm.js} +1 -1
  18. package/dist/{components/Streamable-BDhbB3m3.js → Streamable-CV1mgzRv.js} +1 -1
  19. package/dist/{components/Twitch-CAbFCb5f.esm.js → Twitch-6icfp-ZE.esm.js} +1 -1
  20. package/dist/{components/Twitch-ZG7WuoXD.js → Twitch-Dj66vkCD.js} +1 -1
  21. package/dist/{components/Vidyard-BsU5Ayr6.esm.js → Vidyard--KX47pZ0.esm.js} +1 -1
  22. package/dist/{components/Vidyard-CkSCnLg5.js → Vidyard-B-qmApe9.js} +1 -1
  23. package/dist/{components/Vimeo-4uslT7bX.esm.js → Vimeo-Ba9C6utC.esm.js} +1 -1
  24. package/dist/{components/Vimeo-DKpnTiZ8.js → Vimeo-DePzl7Sn.js} +1 -1
  25. package/dist/{components/Wistia-DKdMEz2a.js → Wistia-CXYB3Yus.js} +1 -1
  26. package/dist/{components/Wistia-BxvIPVO7.esm.js → Wistia-DWJcdcY2.esm.js} +1 -1
  27. package/dist/{components/YouTube-Cd4b1iuA.esm.js → YouTube-DdBVPxzz.esm.js} +1 -1
  28. package/dist/{components/YouTube-JSWV2_hs.js → YouTube-vwMoW93C.js} +1 -1
  29. package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
  30. package/dist/components/DailyMotion-Cr_8IZRR.js +180 -0
  31. package/dist/components/DailyMotion-D2n1NDDi.esm.js +178 -0
  32. package/dist/components/Facebook-CDrTA2_L.esm.js +179 -0
  33. package/dist/components/Facebook-YxZce26V.js +181 -0
  34. package/dist/components/FilePlayer-BzkVMbQ8.esm.js +408 -0
  35. package/dist/components/FilePlayer-DqqTufgX.js +410 -0
  36. package/dist/components/Kaltura-B0UZLr6g.esm.js +176 -0
  37. package/dist/components/Kaltura-krSxvIBr.js +178 -0
  38. package/dist/components/Mixcloud-BCT5e47d.js +166 -0
  39. package/dist/components/Mixcloud-D9qk3D6i.esm.js +164 -0
  40. package/dist/components/Mux-BZleoaJh.esm.js +264 -0
  41. package/dist/components/Mux-D_si09u2.js +266 -0
  42. package/dist/components/Preview-CmduMeEZ.js +175 -0
  43. package/dist/components/Preview-DQLbQ8_C.esm.js +173 -0
  44. package/dist/components/SoundCloud-BHgTfaW7.js +183 -0
  45. package/dist/components/SoundCloud-BgnX8kOF.esm.js +181 -0
  46. package/dist/components/Streamable-DTAzjVwd.js +176 -0
  47. package/dist/components/Streamable-DbRbUflP.esm.js +174 -0
  48. package/dist/components/Twitch-CXOhay4a.esm.js +168 -0
  49. package/dist/components/Twitch-CnEk-l9R.js +170 -0
  50. package/dist/components/VideoPlayer/PiPContext.d.ts +8 -0
  51. package/dist/components/VideoPlayer/PiPContext.js +149 -0
  52. package/dist/components/VideoPlayer/PiPContext.js.map +1 -0
  53. package/dist/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  54. package/dist/components/VideoPlayer/PiPContext.types.js +2 -0
  55. package/dist/components/VideoPlayer/PiPContext.types.js.map +1 -0
  56. package/dist/components/VideoPlayer/usePiP.d.ts +2 -0
  57. package/dist/components/VideoPlayer/usePiP.js +10 -0
  58. package/dist/components/VideoPlayer/usePiP.js.map +1 -0
  59. package/dist/components/Vidyard-Cn_LcGwi.js +174 -0
  60. package/dist/components/Vidyard-YcZH6kkW.esm.js +172 -0
  61. package/dist/components/Vimeo-BUVxWt7t.js +215 -0
  62. package/dist/components/Vimeo-Cv0qx3aR.esm.js +213 -0
  63. package/dist/components/Wistia-COWrV8QC.js +190 -0
  64. package/dist/components/Wistia-PneZ48dn.esm.js +188 -0
  65. package/dist/components/YouTube-BUyvzJQw.esm.js +258 -0
  66. package/dist/components/YouTube-DeQdfkWm.js +260 -0
  67. package/dist/components/components/CourseCard/CourseCard.styles.d.ts +1 -1
  68. package/dist/components/components/VideoPlayer/PiPContext.d.ts +8 -0
  69. package/dist/components/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  70. package/dist/components/components/VideoPlayer/usePiP.d.ts +2 -0
  71. package/dist/components/components/index.d.ts +2 -0
  72. package/dist/components/{index-XiB9Yp2-.js → index-Bs-XxxV4.js} +141 -14
  73. package/dist/components/{index-BTR541gv.esm.js → index-C4Mk2H3N.esm.js} +140 -15
  74. package/dist/components/index.d.ts +2 -0
  75. package/dist/components/index.esm.js +1 -1
  76. package/dist/components/index.js +2 -0
  77. package/dist/components/index.js.map +1 -1
  78. package/dist/icons/components/CourseCard/CourseCard.styles.d.ts +1 -1
  79. package/dist/icons/components/VideoPlayer/PiPContext.d.ts +8 -0
  80. package/dist/icons/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  81. package/dist/icons/components/VideoPlayer/usePiP.d.ts +2 -0
  82. package/dist/icons/components/index.d.ts +2 -0
  83. package/dist/index-Bp-idbg5.esm.js +94907 -0
  84. package/dist/index-CSj9NYxJ.js +95129 -0
  85. package/dist/index.d.ts +2 -0
  86. package/dist/index.esm.js +3 -3
  87. package/dist/index.js +3 -0
  88. package/dist/index.js.map +1 -1
  89. package/package.json +1 -1
@@ -0,0 +1,408 @@
1
+ import { r as requireUtils, a as requirePatterns, g as getDefaultExportFromCjs } from './index-C4Mk2H3N.esm.js';
2
+ import React__default from 'react';
3
+
4
+ function _mergeNamespaces(n, m) {
5
+ m.forEach(function (e) {
6
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
7
+ if (k !== 'default' && !(k in n)) {
8
+ var d = Object.getOwnPropertyDescriptor(e, k);
9
+ Object.defineProperty(n, k, d.get ? d : {
10
+ enumerable: true,
11
+ get: function () { return e[k]; }
12
+ });
13
+ }
14
+ });
15
+ });
16
+ return Object.freeze(n);
17
+ }
18
+
19
+ var FilePlayer_1;
20
+ var hasRequiredFilePlayer;
21
+
22
+ function requireFilePlayer () {
23
+ if (hasRequiredFilePlayer) return FilePlayer_1;
24
+ hasRequiredFilePlayer = 1;
25
+ var __create = Object.create;
26
+ var __defProp = Object.defineProperty;
27
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
28
+ var __getOwnPropNames = Object.getOwnPropertyNames;
29
+ var __getProtoOf = Object.getPrototypeOf;
30
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
31
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+ var __copyProps = (to, from, except, desc) => {
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (let key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(to, key) && key !== except)
40
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
41
+ }
42
+ return to;
43
+ };
44
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
45
+ // If the importer is in node compatibility mode or this is not an ESM
46
+ // file that has been converted to a CommonJS file using a Babel-
47
+ // compatible transform (i.e. "__esModule" has not been set), then set
48
+ // "default" to the CommonJS "module.exports" for node compatibility.
49
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
50
+ mod
51
+ ));
52
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
53
+ var __publicField = (obj, key, value) => {
54
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
55
+ return value;
56
+ };
57
+ var FilePlayer_exports = {};
58
+ __export(FilePlayer_exports, {
59
+ default: () => FilePlayer
60
+ });
61
+ FilePlayer_1 = __toCommonJS(FilePlayer_exports);
62
+ var import_react = __toESM(React__default);
63
+ var import_utils = /*@__PURE__*/ requireUtils();
64
+ var import_patterns = /*@__PURE__*/ requirePatterns();
65
+ const HAS_NAVIGATOR = typeof navigator !== "undefined";
66
+ const IS_IPAD_PRO = HAS_NAVIGATOR && navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
67
+ const IS_IOS = HAS_NAVIGATOR && (/iPad|iPhone|iPod/.test(navigator.userAgent) || IS_IPAD_PRO) && !window.MSStream;
68
+ const IS_SAFARI = HAS_NAVIGATOR && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !window.MSStream;
69
+ const HLS_SDK_URL = "https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js";
70
+ const HLS_GLOBAL = "Hls";
71
+ const DASH_SDK_URL = "https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js";
72
+ const DASH_GLOBAL = "dashjs";
73
+ const FLV_SDK_URL = "https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js";
74
+ const FLV_GLOBAL = "flvjs";
75
+ const MATCH_DROPBOX_URL = /www\.dropbox\.com\/.+/;
76
+ const MATCH_CLOUDFLARE_STREAM = /https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/;
77
+ const REPLACE_CLOUDFLARE_STREAM = "https://videodelivery.net/{id}/manifest/video.m3u8";
78
+ class FilePlayer extends import_react.Component {
79
+ constructor() {
80
+ super(...arguments);
81
+ // Proxy methods to prevent listener leaks
82
+ __publicField(this, "onReady", (...args) => this.props.onReady(...args));
83
+ __publicField(this, "onPlay", (...args) => this.props.onPlay(...args));
84
+ __publicField(this, "onBuffer", (...args) => this.props.onBuffer(...args));
85
+ __publicField(this, "onBufferEnd", (...args) => this.props.onBufferEnd(...args));
86
+ __publicField(this, "onPause", (...args) => this.props.onPause(...args));
87
+ __publicField(this, "onEnded", (...args) => this.props.onEnded(...args));
88
+ __publicField(this, "onError", (...args) => this.props.onError(...args));
89
+ __publicField(this, "onPlayBackRateChange", (event) => this.props.onPlaybackRateChange(event.target.playbackRate));
90
+ __publicField(this, "onEnablePIP", (...args) => this.props.onEnablePIP(...args));
91
+ __publicField(this, "onDisablePIP", (e) => {
92
+ const { onDisablePIP, playing } = this.props;
93
+ onDisablePIP(e);
94
+ if (playing) {
95
+ this.play();
96
+ }
97
+ });
98
+ __publicField(this, "onPresentationModeChange", (e) => {
99
+ if (this.player && (0, import_utils.supportsWebKitPresentationMode)(this.player)) {
100
+ const { webkitPresentationMode } = this.player;
101
+ if (webkitPresentationMode === "picture-in-picture") {
102
+ this.onEnablePIP(e);
103
+ } else if (webkitPresentationMode === "inline") {
104
+ this.onDisablePIP(e);
105
+ }
106
+ }
107
+ });
108
+ __publicField(this, "onSeek", (e) => {
109
+ this.props.onSeek(e.target.currentTime);
110
+ });
111
+ __publicField(this, "mute", () => {
112
+ this.player.muted = true;
113
+ });
114
+ __publicField(this, "unmute", () => {
115
+ this.player.muted = false;
116
+ });
117
+ __publicField(this, "renderSourceElement", (source, index) => {
118
+ if (typeof source === "string") {
119
+ return /* @__PURE__ */ import_react.default.createElement("source", { key: index, src: source });
120
+ }
121
+ return /* @__PURE__ */ import_react.default.createElement("source", { key: index, ...source });
122
+ });
123
+ __publicField(this, "renderTrack", (track, index) => {
124
+ return /* @__PURE__ */ import_react.default.createElement("track", { key: index, ...track });
125
+ });
126
+ __publicField(this, "ref", (player) => {
127
+ if (this.player) {
128
+ this.prevPlayer = this.player;
129
+ }
130
+ this.player = player;
131
+ });
132
+ }
133
+ componentDidMount() {
134
+ this.props.onMount && this.props.onMount(this);
135
+ this.addListeners(this.player);
136
+ const src = this.getSource(this.props.url);
137
+ if (src) {
138
+ this.player.src = src;
139
+ }
140
+ if (IS_IOS || this.props.config.forceDisableHls) {
141
+ this.player.load();
142
+ }
143
+ }
144
+ componentDidUpdate(prevProps) {
145
+ if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) {
146
+ this.removeListeners(this.prevPlayer, prevProps.url);
147
+ this.addListeners(this.player);
148
+ }
149
+ if (this.props.url !== prevProps.url && !(0, import_utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array)) {
150
+ this.player.srcObject = null;
151
+ }
152
+ }
153
+ componentWillUnmount() {
154
+ this.player.removeAttribute("src");
155
+ this.removeListeners(this.player);
156
+ if (this.hls) {
157
+ this.hls.destroy();
158
+ }
159
+ }
160
+ addListeners(player) {
161
+ const { url, playsinline } = this.props;
162
+ player.addEventListener("play", this.onPlay);
163
+ player.addEventListener("waiting", this.onBuffer);
164
+ player.addEventListener("playing", this.onBufferEnd);
165
+ player.addEventListener("pause", this.onPause);
166
+ player.addEventListener("seeked", this.onSeek);
167
+ player.addEventListener("ended", this.onEnded);
168
+ player.addEventListener("error", this.onError);
169
+ player.addEventListener("ratechange", this.onPlayBackRateChange);
170
+ player.addEventListener("enterpictureinpicture", this.onEnablePIP);
171
+ player.addEventListener("leavepictureinpicture", this.onDisablePIP);
172
+ player.addEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
173
+ if (!this.shouldUseHLS(url)) {
174
+ player.addEventListener("canplay", this.onReady);
175
+ }
176
+ if (playsinline) {
177
+ player.setAttribute("playsinline", "");
178
+ player.setAttribute("webkit-playsinline", "");
179
+ player.setAttribute("x5-playsinline", "");
180
+ }
181
+ }
182
+ removeListeners(player, url) {
183
+ player.removeEventListener("canplay", this.onReady);
184
+ player.removeEventListener("play", this.onPlay);
185
+ player.removeEventListener("waiting", this.onBuffer);
186
+ player.removeEventListener("playing", this.onBufferEnd);
187
+ player.removeEventListener("pause", this.onPause);
188
+ player.removeEventListener("seeked", this.onSeek);
189
+ player.removeEventListener("ended", this.onEnded);
190
+ player.removeEventListener("error", this.onError);
191
+ player.removeEventListener("ratechange", this.onPlayBackRateChange);
192
+ player.removeEventListener("enterpictureinpicture", this.onEnablePIP);
193
+ player.removeEventListener("leavepictureinpicture", this.onDisablePIP);
194
+ player.removeEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
195
+ if (!this.shouldUseHLS(url)) {
196
+ player.removeEventListener("canplay", this.onReady);
197
+ }
198
+ }
199
+ shouldUseAudio(props) {
200
+ if (props.config.forceVideo) {
201
+ return false;
202
+ }
203
+ if (props.config.attributes.poster) {
204
+ return false;
205
+ }
206
+ return import_patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio;
207
+ }
208
+ shouldUseHLS(url) {
209
+ if (IS_SAFARI && this.props.config.forceSafariHLS || this.props.config.forceHLS) {
210
+ return true;
211
+ }
212
+ if (IS_IOS || this.props.config.forceDisableHls) {
213
+ return false;
214
+ }
215
+ return import_patterns.HLS_EXTENSIONS.test(url) || MATCH_CLOUDFLARE_STREAM.test(url);
216
+ }
217
+ shouldUseDASH(url) {
218
+ return import_patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH;
219
+ }
220
+ shouldUseFLV(url) {
221
+ return import_patterns.FLV_EXTENSIONS.test(url) || this.props.config.forceFLV;
222
+ }
223
+ load(url) {
224
+ const { hlsVersion, hlsOptions, dashVersion, flvVersion } = this.props.config;
225
+ if (this.hls) {
226
+ this.hls.destroy();
227
+ }
228
+ if (this.dash) {
229
+ this.dash.reset();
230
+ }
231
+ if (this.shouldUseHLS(url)) {
232
+ (0, import_utils.getSDK)(HLS_SDK_URL.replace("VERSION", hlsVersion), HLS_GLOBAL).then((Hls) => {
233
+ this.hls = new Hls(hlsOptions);
234
+ this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
235
+ this.props.onReady();
236
+ });
237
+ this.hls.on(Hls.Events.ERROR, (e, data) => {
238
+ this.props.onError(e, data, this.hls, Hls);
239
+ });
240
+ if (MATCH_CLOUDFLARE_STREAM.test(url)) {
241
+ const id = url.match(MATCH_CLOUDFLARE_STREAM)[1];
242
+ this.hls.loadSource(REPLACE_CLOUDFLARE_STREAM.replace("{id}", id));
243
+ } else {
244
+ this.hls.loadSource(url);
245
+ }
246
+ this.hls.attachMedia(this.player);
247
+ this.props.onLoaded();
248
+ });
249
+ }
250
+ if (this.shouldUseDASH(url)) {
251
+ (0, import_utils.getSDK)(DASH_SDK_URL.replace("VERSION", dashVersion), DASH_GLOBAL).then((dashjs) => {
252
+ this.dash = dashjs.MediaPlayer().create();
253
+ this.dash.initialize(this.player, url, this.props.playing);
254
+ this.dash.on("error", this.props.onError);
255
+ if (parseInt(dashVersion) < 3) {
256
+ this.dash.getDebug().setLogToBrowserConsole(false);
257
+ } else {
258
+ this.dash.updateSettings({ debug: { logLevel: dashjs.Debug.LOG_LEVEL_NONE } });
259
+ }
260
+ this.props.onLoaded();
261
+ });
262
+ }
263
+ if (this.shouldUseFLV(url)) {
264
+ (0, import_utils.getSDK)(FLV_SDK_URL.replace("VERSION", flvVersion), FLV_GLOBAL).then((flvjs) => {
265
+ this.flv = flvjs.createPlayer({ type: "flv", url });
266
+ this.flv.attachMediaElement(this.player);
267
+ this.flv.on(flvjs.Events.ERROR, (e, data) => {
268
+ this.props.onError(e, data, this.flv, flvjs);
269
+ });
270
+ this.flv.load();
271
+ this.props.onLoaded();
272
+ });
273
+ }
274
+ if (url instanceof Array) {
275
+ this.player.load();
276
+ } else if ((0, import_utils.isMediaStream)(url)) {
277
+ try {
278
+ this.player.srcObject = url;
279
+ } catch (e) {
280
+ this.player.src = window.URL.createObjectURL(url);
281
+ }
282
+ }
283
+ }
284
+ play() {
285
+ const promise = this.player.play();
286
+ if (promise) {
287
+ promise.catch(this.props.onError);
288
+ }
289
+ }
290
+ pause() {
291
+ this.player.pause();
292
+ }
293
+ stop() {
294
+ this.player.removeAttribute("src");
295
+ if (this.dash) {
296
+ this.dash.reset();
297
+ }
298
+ }
299
+ seekTo(seconds, keepPlaying = true) {
300
+ this.player.currentTime = seconds;
301
+ if (!keepPlaying) {
302
+ this.pause();
303
+ }
304
+ }
305
+ setVolume(fraction) {
306
+ this.player.volume = fraction;
307
+ }
308
+ enablePIP() {
309
+ if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
310
+ this.player.requestPictureInPicture();
311
+ } else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "picture-in-picture") {
312
+ this.player.webkitSetPresentationMode("picture-in-picture");
313
+ }
314
+ }
315
+ disablePIP() {
316
+ if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
317
+ document.exitPictureInPicture();
318
+ } else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "inline") {
319
+ this.player.webkitSetPresentationMode("inline");
320
+ }
321
+ }
322
+ setPlaybackRate(rate) {
323
+ try {
324
+ this.player.playbackRate = rate;
325
+ } catch (error) {
326
+ this.props.onError(error);
327
+ }
328
+ }
329
+ getDuration() {
330
+ if (!this.player)
331
+ return null;
332
+ const { duration, seekable } = this.player;
333
+ if (duration === Infinity && seekable.length > 0) {
334
+ return seekable.end(seekable.length - 1);
335
+ }
336
+ return duration;
337
+ }
338
+ getCurrentTime() {
339
+ if (!this.player)
340
+ return null;
341
+ return this.player.currentTime;
342
+ }
343
+ getSecondsLoaded() {
344
+ if (!this.player)
345
+ return null;
346
+ const { buffered } = this.player;
347
+ if (buffered.length === 0) {
348
+ return 0;
349
+ }
350
+ const end = buffered.end(buffered.length - 1);
351
+ const duration = this.getDuration();
352
+ if (end > duration) {
353
+ return duration;
354
+ }
355
+ return end;
356
+ }
357
+ getSource(url) {
358
+ const useHLS = this.shouldUseHLS(url);
359
+ const useDASH = this.shouldUseDASH(url);
360
+ const useFLV = this.shouldUseFLV(url);
361
+ if (url instanceof Array || (0, import_utils.isMediaStream)(url) || useHLS || useDASH || useFLV) {
362
+ return void 0;
363
+ }
364
+ if (MATCH_DROPBOX_URL.test(url)) {
365
+ return url.replace("www.dropbox.com", "dl.dropboxusercontent.com");
366
+ }
367
+ return url;
368
+ }
369
+ render() {
370
+ const { url, playing, loop, controls, muted, config, width, height } = this.props;
371
+ const useAudio = this.shouldUseAudio(this.props);
372
+ const Element = useAudio ? "audio" : "video";
373
+ const style = {
374
+ width: width === "auto" ? width : "100%",
375
+ height: height === "auto" ? height : "100%"
376
+ };
377
+ return /* @__PURE__ */ import_react.default.createElement(
378
+ Element,
379
+ {
380
+ ref: this.ref,
381
+ src: this.getSource(url),
382
+ style,
383
+ preload: "auto",
384
+ autoPlay: playing || void 0,
385
+ controls,
386
+ muted,
387
+ loop,
388
+ ...config.attributes
389
+ },
390
+ url instanceof Array && url.map(this.renderSourceElement),
391
+ config.tracks.map(this.renderTrack)
392
+ );
393
+ }
394
+ }
395
+ __publicField(FilePlayer, "displayName", "FilePlayer");
396
+ __publicField(FilePlayer, "canPlay", import_patterns.canPlay.file);
397
+ return FilePlayer_1;
398
+ }
399
+
400
+ var FilePlayerExports = /*@__PURE__*/ requireFilePlayer();
401
+ var FilePlayer = /*@__PURE__*/getDefaultExportFromCjs(FilePlayerExports);
402
+
403
+ var FilePlayer$1 = /*#__PURE__*/_mergeNamespaces({
404
+ __proto__: null,
405
+ default: FilePlayer
406
+ }, [FilePlayerExports]);
407
+
408
+ export { FilePlayer$1 as F };