suada-components 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/{components/DailyMotion-B7yDPBbg.js → DailyMotion-DacNkqsi.js} +1 -1
  2. package/dist/{components/DailyMotion-BmnymjR1.esm.js → DailyMotion-gaY-1HqX.esm.js} +1 -1
  3. package/dist/{components/Facebook-D9Ak6ZJU.esm.js → Facebook-C_tH1Bi_.esm.js} +1 -1
  4. package/dist/{components/Facebook-42iqQU2G.js → Facebook-D4wLMJkY.js} +1 -1
  5. package/dist/{components/FilePlayer-CAnHK0Cd.js → FilePlayer-B4s5OcYq.js} +1 -1
  6. package/dist/{components/FilePlayer-wg9lyafD.esm.js → FilePlayer-DqR2mvGK.esm.js} +1 -1
  7. package/dist/{components/Kaltura-DPaEN-dq.esm.js → Kaltura-C9QbmEfO.esm.js} +1 -1
  8. package/dist/{components/Kaltura-Ct6kwbgP.js → Kaltura-kCqUZWuf.js} +1 -1
  9. package/dist/{components/Mixcloud-sBbcL5rG.js → Mixcloud-2c71b3Nf.js} +1 -1
  10. package/dist/{components/Mixcloud-BobSN3YI.esm.js → Mixcloud-ib_DIXF1.esm.js} +1 -1
  11. package/dist/{components/Mux-Cosy8sFO.js → Mux-BsXgGo6C.js} +1 -1
  12. package/dist/{components/Mux-B9YP-rFr.esm.js → Mux-CJ6kEh1R.esm.js} +1 -1
  13. package/dist/{components/Preview-DiVfo6aa.js → Preview-gEkhA4mX.js} +1 -1
  14. package/dist/{components/Preview-XcTlhHT1.esm.js → Preview-kqr7fWet.esm.js} +1 -1
  15. package/dist/{components/SoundCloud-CIWqB-QW.js → SoundCloud-BWup2g--.js} +1 -1
  16. package/dist/{components/SoundCloud-BTHoyFWT.esm.js → SoundCloud-DJM0bsQG.esm.js} +1 -1
  17. package/dist/{components/Streamable-DsfQCy3p.esm.js → Streamable-CJltauTy.esm.js} +1 -1
  18. package/dist/{components/Streamable-9anYiQtU.js → Streamable-UeTHV2nZ.js} +1 -1
  19. package/dist/{components/Twitch-D1BOr8hj.esm.js → Twitch-C9qq_89Q.esm.js} +1 -1
  20. package/dist/{components/Twitch-Dud6e1Rv.js → Twitch-_N8mEsiS.js} +1 -1
  21. package/dist/{components/Vidyard-BuOu85uS.js → Vidyard-CQuxB99Z.js} +1 -1
  22. package/dist/{components/Vidyard-C1csjpQH.esm.js → Vidyard-gtcLQdYd.esm.js} +1 -1
  23. package/dist/{components/Vimeo-CHlHIswX.esm.js → Vimeo-Dzp5eoLi.esm.js} +1 -1
  24. package/dist/{components/Vimeo-DrDJ5O9H.js → Vimeo-nhXVoFTb.js} +1 -1
  25. package/dist/{components/Wistia-fh9U2CA2.js → Wistia-C1DqA9IW.js} +1 -1
  26. package/dist/{components/Wistia-D-eYyONb.esm.js → Wistia-DV3BO3z9.esm.js} +1 -1
  27. package/dist/{components/YouTube-CmnnzZvk.esm.js → YouTube-BKwvJCnt.esm.js} +1 -1
  28. package/dist/{components/YouTube-DC2uZ14c.js → YouTube-DDou5phH.js} +1 -1
  29. package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
  30. package/dist/components/DailyMotion-B8IJNjSc.js +180 -0
  31. package/dist/components/DailyMotion-COg3zgIZ.esm.js +178 -0
  32. package/dist/components/Facebook-DJ7a3Bj8.js +181 -0
  33. package/dist/components/Facebook-NS80Vk6j.esm.js +179 -0
  34. package/dist/components/FilePlayer-D-fc3B0E.esm.js +408 -0
  35. package/dist/components/FilePlayer-SyLt5qGX.js +410 -0
  36. package/dist/components/Kaltura-BTFxSMxP.js +178 -0
  37. package/dist/components/Kaltura-CmFIWSef.esm.js +176 -0
  38. package/dist/components/Mixcloud-CO5MsWUJ.esm.js +164 -0
  39. package/dist/components/Mixcloud-DHAfVpcc.js +166 -0
  40. package/dist/components/Mux-C8-HithD.esm.js +264 -0
  41. package/dist/components/Mux-bycDxP8G.js +266 -0
  42. package/dist/components/Preview-Clg3y6sj.esm.js +173 -0
  43. package/dist/components/Preview-CzpcknZI.js +175 -0
  44. package/dist/components/SoundCloud-Dz9DeIIM.js +183 -0
  45. package/dist/components/SoundCloud-LfWEBVy1.esm.js +181 -0
  46. package/dist/components/Streamable-BpcVhi4M.esm.js +174 -0
  47. package/dist/components/Streamable-Cs_c-7jS.js +176 -0
  48. package/dist/components/Twitch-BJ9aSIM2.esm.js +168 -0
  49. package/dist/components/Twitch-C9bksXF6.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/VideoPlayer/usePlayerControls.js +46 -64
  60. package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -1
  61. package/dist/components/Vidyard-CsUFSBXh.js +174 -0
  62. package/dist/components/Vidyard-Dc8NHJ7p.esm.js +172 -0
  63. package/dist/components/Vimeo-CwlScNtK.esm.js +213 -0
  64. package/dist/components/Vimeo-D6C93592.js +215 -0
  65. package/dist/components/Wistia-Bxvdn3oO.js +190 -0
  66. package/dist/components/Wistia-Cwl4fNWW.esm.js +188 -0
  67. package/dist/components/YouTube-BF85SRPF.js +260 -0
  68. package/dist/components/YouTube-DKkYzN7-.esm.js +258 -0
  69. package/dist/components/components/CourseCard/CourseCard.styles.d.ts +1 -1
  70. package/dist/components/components/VideoPlayer/PiPContext.d.ts +8 -0
  71. package/dist/components/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  72. package/dist/components/components/VideoPlayer/usePiP.d.ts +2 -0
  73. package/dist/components/components/index.d.ts +2 -0
  74. package/dist/components/{index-DetZ05pw.js → index-C08W0lXg.js} +157 -295
  75. package/dist/components/{index-DKAGRUEW.esm.js → index-F6zEoSWf.esm.js} +156 -296
  76. package/dist/components/index.d.ts +2 -0
  77. package/dist/components/index.esm.js +1 -1
  78. package/dist/components/index.js +2 -0
  79. package/dist/components/index.js.map +1 -1
  80. package/dist/icons/components/CourseCard/CourseCard.styles.d.ts +1 -1
  81. package/dist/icons/components/VideoPlayer/PiPContext.d.ts +8 -0
  82. package/dist/icons/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  83. package/dist/icons/components/VideoPlayer/usePiP.d.ts +2 -0
  84. package/dist/icons/components/index.d.ts +2 -0
  85. package/dist/index-CcTTuhg8.esm.js +94920 -0
  86. package/dist/index-Dq4qpx9F.js +95142 -0
  87. package/dist/index.d.ts +2 -0
  88. package/dist/index.esm.js +3 -3
  89. package/dist/index.js +3 -0
  90. package/dist/index.js.map +1 -1
  91. package/package.json +1 -1
  92. package/dist/components/VideoPlayer/pipManager.d.ts +0 -60
  93. package/dist/components/VideoPlayer/pipManager.js +0 -272
  94. package/dist/components/VideoPlayer/pipManager.js.map +0 -1
  95. package/dist/components/components/VideoPlayer/pipManager.d.ts +0 -60
  96. package/dist/icons/components/VideoPlayer/pipManager.d.ts +0 -60
@@ -0,0 +1,410 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C08W0lXg.js');
4
+ var React = require('react');
5
+
6
+ function _mergeNamespaces(n, m) {
7
+ m.forEach(function (e) {
8
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ });
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ var FilePlayer_1;
22
+ var hasRequiredFilePlayer;
23
+
24
+ function requireFilePlayer () {
25
+ if (hasRequiredFilePlayer) return FilePlayer_1;
26
+ hasRequiredFilePlayer = 1;
27
+ var __create = Object.create;
28
+ var __defProp = Object.defineProperty;
29
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
30
+ var __getOwnPropNames = Object.getOwnPropertyNames;
31
+ var __getProtoOf = Object.getPrototypeOf;
32
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
33
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __copyProps = (to, from, except, desc) => {
39
+ if (from && typeof from === "object" || typeof from === "function") {
40
+ for (let key of __getOwnPropNames(from))
41
+ if (!__hasOwnProp.call(to, key) && key !== except)
42
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
43
+ }
44
+ return to;
45
+ };
46
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
47
+ // If the importer is in node compatibility mode or this is not an ESM
48
+ // file that has been converted to a CommonJS file using a Babel-
49
+ // compatible transform (i.e. "__esModule" has not been set), then set
50
+ // "default" to the CommonJS "module.exports" for node compatibility.
51
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
52
+ mod
53
+ ));
54
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
55
+ var __publicField = (obj, key, value) => {
56
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
57
+ return value;
58
+ };
59
+ var FilePlayer_exports = {};
60
+ __export(FilePlayer_exports, {
61
+ default: () => FilePlayer
62
+ });
63
+ FilePlayer_1 = __toCommonJS(FilePlayer_exports);
64
+ var import_react = __toESM(React);
65
+ var import_utils = /*@__PURE__*/ index.requireUtils();
66
+ var import_patterns = /*@__PURE__*/ index.requirePatterns();
67
+ const HAS_NAVIGATOR = typeof navigator !== "undefined";
68
+ const IS_IPAD_PRO = HAS_NAVIGATOR && navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
69
+ const IS_IOS = HAS_NAVIGATOR && (/iPad|iPhone|iPod/.test(navigator.userAgent) || IS_IPAD_PRO) && !window.MSStream;
70
+ const IS_SAFARI = HAS_NAVIGATOR && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !window.MSStream;
71
+ const HLS_SDK_URL = "https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js";
72
+ const HLS_GLOBAL = "Hls";
73
+ const DASH_SDK_URL = "https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js";
74
+ const DASH_GLOBAL = "dashjs";
75
+ const FLV_SDK_URL = "https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js";
76
+ const FLV_GLOBAL = "flvjs";
77
+ const MATCH_DROPBOX_URL = /www\.dropbox\.com\/.+/;
78
+ const MATCH_CLOUDFLARE_STREAM = /https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/;
79
+ const REPLACE_CLOUDFLARE_STREAM = "https://videodelivery.net/{id}/manifest/video.m3u8";
80
+ class FilePlayer extends import_react.Component {
81
+ constructor() {
82
+ super(...arguments);
83
+ // Proxy methods to prevent listener leaks
84
+ __publicField(this, "onReady", (...args) => this.props.onReady(...args));
85
+ __publicField(this, "onPlay", (...args) => this.props.onPlay(...args));
86
+ __publicField(this, "onBuffer", (...args) => this.props.onBuffer(...args));
87
+ __publicField(this, "onBufferEnd", (...args) => this.props.onBufferEnd(...args));
88
+ __publicField(this, "onPause", (...args) => this.props.onPause(...args));
89
+ __publicField(this, "onEnded", (...args) => this.props.onEnded(...args));
90
+ __publicField(this, "onError", (...args) => this.props.onError(...args));
91
+ __publicField(this, "onPlayBackRateChange", (event) => this.props.onPlaybackRateChange(event.target.playbackRate));
92
+ __publicField(this, "onEnablePIP", (...args) => this.props.onEnablePIP(...args));
93
+ __publicField(this, "onDisablePIP", (e) => {
94
+ const { onDisablePIP, playing } = this.props;
95
+ onDisablePIP(e);
96
+ if (playing) {
97
+ this.play();
98
+ }
99
+ });
100
+ __publicField(this, "onPresentationModeChange", (e) => {
101
+ if (this.player && (0, import_utils.supportsWebKitPresentationMode)(this.player)) {
102
+ const { webkitPresentationMode } = this.player;
103
+ if (webkitPresentationMode === "picture-in-picture") {
104
+ this.onEnablePIP(e);
105
+ } else if (webkitPresentationMode === "inline") {
106
+ this.onDisablePIP(e);
107
+ }
108
+ }
109
+ });
110
+ __publicField(this, "onSeek", (e) => {
111
+ this.props.onSeek(e.target.currentTime);
112
+ });
113
+ __publicField(this, "mute", () => {
114
+ this.player.muted = true;
115
+ });
116
+ __publicField(this, "unmute", () => {
117
+ this.player.muted = false;
118
+ });
119
+ __publicField(this, "renderSourceElement", (source, index) => {
120
+ if (typeof source === "string") {
121
+ return /* @__PURE__ */ import_react.default.createElement("source", { key: index, src: source });
122
+ }
123
+ return /* @__PURE__ */ import_react.default.createElement("source", { key: index, ...source });
124
+ });
125
+ __publicField(this, "renderTrack", (track, index) => {
126
+ return /* @__PURE__ */ import_react.default.createElement("track", { key: index, ...track });
127
+ });
128
+ __publicField(this, "ref", (player) => {
129
+ if (this.player) {
130
+ this.prevPlayer = this.player;
131
+ }
132
+ this.player = player;
133
+ });
134
+ }
135
+ componentDidMount() {
136
+ this.props.onMount && this.props.onMount(this);
137
+ this.addListeners(this.player);
138
+ const src = this.getSource(this.props.url);
139
+ if (src) {
140
+ this.player.src = src;
141
+ }
142
+ if (IS_IOS || this.props.config.forceDisableHls) {
143
+ this.player.load();
144
+ }
145
+ }
146
+ componentDidUpdate(prevProps) {
147
+ if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) {
148
+ this.removeListeners(this.prevPlayer, prevProps.url);
149
+ this.addListeners(this.player);
150
+ }
151
+ if (this.props.url !== prevProps.url && !(0, import_utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array)) {
152
+ this.player.srcObject = null;
153
+ }
154
+ }
155
+ componentWillUnmount() {
156
+ this.player.removeAttribute("src");
157
+ this.removeListeners(this.player);
158
+ if (this.hls) {
159
+ this.hls.destroy();
160
+ }
161
+ }
162
+ addListeners(player) {
163
+ const { url, playsinline } = this.props;
164
+ player.addEventListener("play", this.onPlay);
165
+ player.addEventListener("waiting", this.onBuffer);
166
+ player.addEventListener("playing", this.onBufferEnd);
167
+ player.addEventListener("pause", this.onPause);
168
+ player.addEventListener("seeked", this.onSeek);
169
+ player.addEventListener("ended", this.onEnded);
170
+ player.addEventListener("error", this.onError);
171
+ player.addEventListener("ratechange", this.onPlayBackRateChange);
172
+ player.addEventListener("enterpictureinpicture", this.onEnablePIP);
173
+ player.addEventListener("leavepictureinpicture", this.onDisablePIP);
174
+ player.addEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
175
+ if (!this.shouldUseHLS(url)) {
176
+ player.addEventListener("canplay", this.onReady);
177
+ }
178
+ if (playsinline) {
179
+ player.setAttribute("playsinline", "");
180
+ player.setAttribute("webkit-playsinline", "");
181
+ player.setAttribute("x5-playsinline", "");
182
+ }
183
+ }
184
+ removeListeners(player, url) {
185
+ player.removeEventListener("canplay", this.onReady);
186
+ player.removeEventListener("play", this.onPlay);
187
+ player.removeEventListener("waiting", this.onBuffer);
188
+ player.removeEventListener("playing", this.onBufferEnd);
189
+ player.removeEventListener("pause", this.onPause);
190
+ player.removeEventListener("seeked", this.onSeek);
191
+ player.removeEventListener("ended", this.onEnded);
192
+ player.removeEventListener("error", this.onError);
193
+ player.removeEventListener("ratechange", this.onPlayBackRateChange);
194
+ player.removeEventListener("enterpictureinpicture", this.onEnablePIP);
195
+ player.removeEventListener("leavepictureinpicture", this.onDisablePIP);
196
+ player.removeEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
197
+ if (!this.shouldUseHLS(url)) {
198
+ player.removeEventListener("canplay", this.onReady);
199
+ }
200
+ }
201
+ shouldUseAudio(props) {
202
+ if (props.config.forceVideo) {
203
+ return false;
204
+ }
205
+ if (props.config.attributes.poster) {
206
+ return false;
207
+ }
208
+ return import_patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio;
209
+ }
210
+ shouldUseHLS(url) {
211
+ if (IS_SAFARI && this.props.config.forceSafariHLS || this.props.config.forceHLS) {
212
+ return true;
213
+ }
214
+ if (IS_IOS || this.props.config.forceDisableHls) {
215
+ return false;
216
+ }
217
+ return import_patterns.HLS_EXTENSIONS.test(url) || MATCH_CLOUDFLARE_STREAM.test(url);
218
+ }
219
+ shouldUseDASH(url) {
220
+ return import_patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH;
221
+ }
222
+ shouldUseFLV(url) {
223
+ return import_patterns.FLV_EXTENSIONS.test(url) || this.props.config.forceFLV;
224
+ }
225
+ load(url) {
226
+ const { hlsVersion, hlsOptions, dashVersion, flvVersion } = this.props.config;
227
+ if (this.hls) {
228
+ this.hls.destroy();
229
+ }
230
+ if (this.dash) {
231
+ this.dash.reset();
232
+ }
233
+ if (this.shouldUseHLS(url)) {
234
+ (0, import_utils.getSDK)(HLS_SDK_URL.replace("VERSION", hlsVersion), HLS_GLOBAL).then((Hls) => {
235
+ this.hls = new Hls(hlsOptions);
236
+ this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
237
+ this.props.onReady();
238
+ });
239
+ this.hls.on(Hls.Events.ERROR, (e, data) => {
240
+ this.props.onError(e, data, this.hls, Hls);
241
+ });
242
+ if (MATCH_CLOUDFLARE_STREAM.test(url)) {
243
+ const id = url.match(MATCH_CLOUDFLARE_STREAM)[1];
244
+ this.hls.loadSource(REPLACE_CLOUDFLARE_STREAM.replace("{id}", id));
245
+ } else {
246
+ this.hls.loadSource(url);
247
+ }
248
+ this.hls.attachMedia(this.player);
249
+ this.props.onLoaded();
250
+ });
251
+ }
252
+ if (this.shouldUseDASH(url)) {
253
+ (0, import_utils.getSDK)(DASH_SDK_URL.replace("VERSION", dashVersion), DASH_GLOBAL).then((dashjs) => {
254
+ this.dash = dashjs.MediaPlayer().create();
255
+ this.dash.initialize(this.player, url, this.props.playing);
256
+ this.dash.on("error", this.props.onError);
257
+ if (parseInt(dashVersion) < 3) {
258
+ this.dash.getDebug().setLogToBrowserConsole(false);
259
+ } else {
260
+ this.dash.updateSettings({ debug: { logLevel: dashjs.Debug.LOG_LEVEL_NONE } });
261
+ }
262
+ this.props.onLoaded();
263
+ });
264
+ }
265
+ if (this.shouldUseFLV(url)) {
266
+ (0, import_utils.getSDK)(FLV_SDK_URL.replace("VERSION", flvVersion), FLV_GLOBAL).then((flvjs) => {
267
+ this.flv = flvjs.createPlayer({ type: "flv", url });
268
+ this.flv.attachMediaElement(this.player);
269
+ this.flv.on(flvjs.Events.ERROR, (e, data) => {
270
+ this.props.onError(e, data, this.flv, flvjs);
271
+ });
272
+ this.flv.load();
273
+ this.props.onLoaded();
274
+ });
275
+ }
276
+ if (url instanceof Array) {
277
+ this.player.load();
278
+ } else if ((0, import_utils.isMediaStream)(url)) {
279
+ try {
280
+ this.player.srcObject = url;
281
+ } catch (e) {
282
+ this.player.src = window.URL.createObjectURL(url);
283
+ }
284
+ }
285
+ }
286
+ play() {
287
+ const promise = this.player.play();
288
+ if (promise) {
289
+ promise.catch(this.props.onError);
290
+ }
291
+ }
292
+ pause() {
293
+ this.player.pause();
294
+ }
295
+ stop() {
296
+ this.player.removeAttribute("src");
297
+ if (this.dash) {
298
+ this.dash.reset();
299
+ }
300
+ }
301
+ seekTo(seconds, keepPlaying = true) {
302
+ this.player.currentTime = seconds;
303
+ if (!keepPlaying) {
304
+ this.pause();
305
+ }
306
+ }
307
+ setVolume(fraction) {
308
+ this.player.volume = fraction;
309
+ }
310
+ enablePIP() {
311
+ if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
312
+ this.player.requestPictureInPicture();
313
+ } else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "picture-in-picture") {
314
+ this.player.webkitSetPresentationMode("picture-in-picture");
315
+ }
316
+ }
317
+ disablePIP() {
318
+ if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
319
+ document.exitPictureInPicture();
320
+ } else if ((0, import_utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== "inline") {
321
+ this.player.webkitSetPresentationMode("inline");
322
+ }
323
+ }
324
+ setPlaybackRate(rate) {
325
+ try {
326
+ this.player.playbackRate = rate;
327
+ } catch (error) {
328
+ this.props.onError(error);
329
+ }
330
+ }
331
+ getDuration() {
332
+ if (!this.player)
333
+ return null;
334
+ const { duration, seekable } = this.player;
335
+ if (duration === Infinity && seekable.length > 0) {
336
+ return seekable.end(seekable.length - 1);
337
+ }
338
+ return duration;
339
+ }
340
+ getCurrentTime() {
341
+ if (!this.player)
342
+ return null;
343
+ return this.player.currentTime;
344
+ }
345
+ getSecondsLoaded() {
346
+ if (!this.player)
347
+ return null;
348
+ const { buffered } = this.player;
349
+ if (buffered.length === 0) {
350
+ return 0;
351
+ }
352
+ const end = buffered.end(buffered.length - 1);
353
+ const duration = this.getDuration();
354
+ if (end > duration) {
355
+ return duration;
356
+ }
357
+ return end;
358
+ }
359
+ getSource(url) {
360
+ const useHLS = this.shouldUseHLS(url);
361
+ const useDASH = this.shouldUseDASH(url);
362
+ const useFLV = this.shouldUseFLV(url);
363
+ if (url instanceof Array || (0, import_utils.isMediaStream)(url) || useHLS || useDASH || useFLV) {
364
+ return void 0;
365
+ }
366
+ if (MATCH_DROPBOX_URL.test(url)) {
367
+ return url.replace("www.dropbox.com", "dl.dropboxusercontent.com");
368
+ }
369
+ return url;
370
+ }
371
+ render() {
372
+ const { url, playing, loop, controls, muted, config, width, height } = this.props;
373
+ const useAudio = this.shouldUseAudio(this.props);
374
+ const Element = useAudio ? "audio" : "video";
375
+ const style = {
376
+ width: width === "auto" ? width : "100%",
377
+ height: height === "auto" ? height : "100%"
378
+ };
379
+ return /* @__PURE__ */ import_react.default.createElement(
380
+ Element,
381
+ {
382
+ ref: this.ref,
383
+ src: this.getSource(url),
384
+ style,
385
+ preload: "auto",
386
+ autoPlay: playing || void 0,
387
+ controls,
388
+ muted,
389
+ loop,
390
+ ...config.attributes
391
+ },
392
+ url instanceof Array && url.map(this.renderSourceElement),
393
+ config.tracks.map(this.renderTrack)
394
+ );
395
+ }
396
+ }
397
+ __publicField(FilePlayer, "displayName", "FilePlayer");
398
+ __publicField(FilePlayer, "canPlay", import_patterns.canPlay.file);
399
+ return FilePlayer_1;
400
+ }
401
+
402
+ var FilePlayerExports = /*@__PURE__*/ requireFilePlayer();
403
+ var FilePlayer = /*@__PURE__*/index.getDefaultExportFromCjs(FilePlayerExports);
404
+
405
+ var FilePlayer$1 = /*#__PURE__*/_mergeNamespaces({
406
+ __proto__: null,
407
+ default: FilePlayer
408
+ }, [FilePlayerExports]);
409
+
410
+ exports.FilePlayer = FilePlayer$1;
@@ -0,0 +1,178 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C08W0lXg.js');
4
+ var React = require('react');
5
+
6
+ function _mergeNamespaces(n, m) {
7
+ m.forEach(function (e) {
8
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ });
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ var Kaltura_1;
22
+ var hasRequiredKaltura;
23
+
24
+ function requireKaltura () {
25
+ if (hasRequiredKaltura) return Kaltura_1;
26
+ hasRequiredKaltura = 1;
27
+ var __create = Object.create;
28
+ var __defProp = Object.defineProperty;
29
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
30
+ var __getOwnPropNames = Object.getOwnPropertyNames;
31
+ var __getProtoOf = Object.getPrototypeOf;
32
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
33
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __copyProps = (to, from, except, desc) => {
39
+ if (from && typeof from === "object" || typeof from === "function") {
40
+ for (let key of __getOwnPropNames(from))
41
+ if (!__hasOwnProp.call(to, key) && key !== except)
42
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
43
+ }
44
+ return to;
45
+ };
46
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
47
+ // If the importer is in node compatibility mode or this is not an ESM
48
+ // file that has been converted to a CommonJS file using a Babel-
49
+ // compatible transform (i.e. "__esModule" has not been set), then set
50
+ // "default" to the CommonJS "module.exports" for node compatibility.
51
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
52
+ mod
53
+ ));
54
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
55
+ var __publicField = (obj, key, value) => {
56
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
57
+ return value;
58
+ };
59
+ var Kaltura_exports = {};
60
+ __export(Kaltura_exports, {
61
+ default: () => Kaltura
62
+ });
63
+ Kaltura_1 = __toCommonJS(Kaltura_exports);
64
+ var import_react = __toESM(React);
65
+ var import_utils = /*@__PURE__*/ index.requireUtils();
66
+ var import_patterns = /*@__PURE__*/ index.requirePatterns();
67
+ const SDK_URL = "https://cdn.embed.ly/player-0.1.0.min.js";
68
+ const SDK_GLOBAL = "playerjs";
69
+ class Kaltura extends import_react.Component {
70
+ constructor() {
71
+ super(...arguments);
72
+ __publicField(this, "callPlayer", import_utils.callPlayer);
73
+ __publicField(this, "duration", null);
74
+ __publicField(this, "currentTime", null);
75
+ __publicField(this, "secondsLoaded", null);
76
+ __publicField(this, "mute", () => {
77
+ this.callPlayer("mute");
78
+ });
79
+ __publicField(this, "unmute", () => {
80
+ this.callPlayer("unmute");
81
+ });
82
+ __publicField(this, "ref", (iframe) => {
83
+ this.iframe = iframe;
84
+ });
85
+ }
86
+ componentDidMount() {
87
+ this.props.onMount && this.props.onMount(this);
88
+ }
89
+ load(url) {
90
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((playerjs) => {
91
+ if (!this.iframe)
92
+ return;
93
+ this.player = new playerjs.Player(this.iframe);
94
+ this.player.on("ready", () => {
95
+ setTimeout(() => {
96
+ this.player.isReady = true;
97
+ this.player.setLoop(this.props.loop);
98
+ if (this.props.muted) {
99
+ this.player.mute();
100
+ }
101
+ this.addListeners(this.player, this.props);
102
+ this.props.onReady();
103
+ }, 500);
104
+ });
105
+ }, this.props.onError);
106
+ }
107
+ addListeners(player, props) {
108
+ player.on("play", props.onPlay);
109
+ player.on("pause", props.onPause);
110
+ player.on("ended", props.onEnded);
111
+ player.on("error", props.onError);
112
+ player.on("timeupdate", ({ duration, seconds }) => {
113
+ this.duration = duration;
114
+ this.currentTime = seconds;
115
+ });
116
+ }
117
+ play() {
118
+ this.callPlayer("play");
119
+ }
120
+ pause() {
121
+ this.callPlayer("pause");
122
+ }
123
+ stop() {
124
+ }
125
+ seekTo(seconds, keepPlaying = true) {
126
+ this.callPlayer("setCurrentTime", seconds);
127
+ if (!keepPlaying) {
128
+ this.pause();
129
+ }
130
+ }
131
+ setVolume(fraction) {
132
+ this.callPlayer("setVolume", fraction);
133
+ }
134
+ setLoop(loop) {
135
+ this.callPlayer("setLoop", loop);
136
+ }
137
+ getDuration() {
138
+ return this.duration;
139
+ }
140
+ getCurrentTime() {
141
+ return this.currentTime;
142
+ }
143
+ getSecondsLoaded() {
144
+ return this.secondsLoaded;
145
+ }
146
+ render() {
147
+ const style = {
148
+ width: "100%",
149
+ height: "100%"
150
+ };
151
+ return /* @__PURE__ */ import_react.default.createElement(
152
+ "iframe",
153
+ {
154
+ ref: this.ref,
155
+ src: this.props.url,
156
+ frameBorder: "0",
157
+ scrolling: "no",
158
+ style,
159
+ allow: "encrypted-media; autoplay; fullscreen;",
160
+ referrerPolicy: "no-referrer-when-downgrade"
161
+ }
162
+ );
163
+ }
164
+ }
165
+ __publicField(Kaltura, "displayName", "Kaltura");
166
+ __publicField(Kaltura, "canPlay", import_patterns.canPlay.kaltura);
167
+ return Kaltura_1;
168
+ }
169
+
170
+ var KalturaExports = /*@__PURE__*/ requireKaltura();
171
+ var Kaltura = /*@__PURE__*/index.getDefaultExportFromCjs(KalturaExports);
172
+
173
+ var Kaltura$1 = /*#__PURE__*/_mergeNamespaces({
174
+ __proto__: null,
175
+ default: Kaltura
176
+ }, [KalturaExports]);
177
+
178
+ exports.Kaltura = Kaltura$1;