@ilo-org/react 0.1.2 → 0.2.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 (74) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/cjs/{DailyMotion-4f88e10b.js → DailyMotion-2aa7f048.js} +4 -5
  3. package/lib/cjs/{Facebook-d993b91c.js → Facebook-87e24af8.js} +4 -5
  4. package/lib/cjs/{FilePlayer-8272a6ea.js → FilePlayer-e1216cc8.js} +4 -5
  5. package/lib/cjs/{Kaltura-fbd2c46f.js → Kaltura-a673a8e9.js} +4 -5
  6. package/lib/cjs/{Mixcloud-2b4ffb85.js → Mixcloud-f9575c31.js} +4 -5
  7. package/lib/cjs/{Preview-8238ea6e.js → Preview-468c3a7f.js} +2 -2
  8. package/lib/cjs/{SoundCloud-356fd92d.js → SoundCloud-7c59f293.js} +4 -5
  9. package/lib/cjs/{Streamable-407ca855.js → Streamable-83e516e5.js} +4 -5
  10. package/lib/cjs/{Twitch-ca00faaf.js → Twitch-fdfa1c77.js} +4 -5
  11. package/lib/cjs/VideoPlayer-9ce35136.js +2059 -0
  12. package/lib/cjs/{Vidyard-9d037503.js → Vidyard-096bba3c.js} +4 -5
  13. package/lib/cjs/{Vimeo-6898bfd9.js → Vimeo-2cb7476f.js} +4 -5
  14. package/lib/cjs/{Wistia-ed77bf25.js → Wistia-5e830ac8.js} +4 -5
  15. package/lib/cjs/{YouTube-909bd761.js → YouTube-25a1d9a0.js} +4 -5
  16. package/lib/cjs/components/Footer/Footer.js +23 -0
  17. package/lib/cjs/components/Footer/index.js +18 -0
  18. package/lib/cjs/components/LocalNav/LocalNav.js +102 -0
  19. package/lib/cjs/components/LocalNav/index.js +14 -0
  20. package/lib/cjs/components/Video/Video.js +2 -4
  21. package/lib/cjs/components/Video/VideoPlayer.js +10 -1445
  22. package/lib/cjs/components/Video/index.js +1 -3
  23. package/lib/cjs/components/index.js +6 -4
  24. package/lib/cjs/index.js +5 -3
  25. package/lib/esm/{DailyMotion-9a7aeab5.js → DailyMotion-66b6eff2.js} +1 -2
  26. package/lib/esm/{Facebook-eb35da52.js → Facebook-dbd1003d.js} +1 -2
  27. package/lib/esm/{FilePlayer-22314795.js → FilePlayer-617ed2ce.js} +1 -2
  28. package/lib/esm/{Kaltura-b97bb455.js → Kaltura-bbcec33d.js} +1 -2
  29. package/lib/esm/{Mixcloud-41d6dc0b.js → Mixcloud-a681ec69.js} +1 -2
  30. package/lib/esm/{Preview-6d2a6792.js → Preview-407cc648.js} +1 -1
  31. package/lib/esm/{SoundCloud-0fac2e7a.js → SoundCloud-16e78ee5.js} +1 -2
  32. package/lib/esm/{Streamable-46f19a16.js → Streamable-ecb225c1.js} +1 -2
  33. package/lib/esm/{Twitch-1be39438.js → Twitch-8d1b6769.js} +1 -2
  34. package/lib/esm/VideoPlayer-62e0ce79.js +2054 -0
  35. package/lib/esm/{Vidyard-6185c490.js → Vidyard-57e2834a.js} +1 -2
  36. package/lib/esm/{Vimeo-a807e7e1.js → Vimeo-faa058a2.js} +1 -2
  37. package/lib/esm/{Wistia-eef03ce2.js → Wistia-24fb5120.js} +1 -2
  38. package/lib/esm/{YouTube-e030042e.js → YouTube-01b3e51f.js} +1 -2
  39. package/lib/esm/components/Footer/Footer.js +21 -0
  40. package/lib/esm/components/Footer/index.js +12 -0
  41. package/lib/esm/components/LocalNav/LocalNav.js +100 -0
  42. package/lib/esm/components/LocalNav/index.js +8 -0
  43. package/lib/esm/components/Video/Video.js +1 -3
  44. package/lib/esm/components/Video/VideoPlayer.js +9 -1448
  45. package/lib/esm/components/Video/index.js +1 -3
  46. package/lib/esm/components/index.js +4 -4
  47. package/lib/esm/index.js +3 -3
  48. package/lib/types/react/src/components/ContextMenu/ContextMenu.props.d.ts +1 -2
  49. package/lib/types/react/src/components/Footer/Footer.d.ts +4 -0
  50. package/lib/types/react/src/components/Footer/Footer.props.d.ts +70 -0
  51. package/lib/types/react/src/components/Footer/index.d.ts +1 -0
  52. package/lib/types/react/src/components/LinkList/LinkList.props.d.ts +2 -3
  53. package/lib/types/react/src/components/LocalNav/LocalNav.d.ts +4 -0
  54. package/lib/types/react/src/components/LocalNav/LocalNav.props.d.ts +50 -0
  55. package/lib/types/react/src/components/LocalNav/index.d.ts +1 -0
  56. package/lib/types/react/src/components/index.d.ts +2 -0
  57. package/lib/types/react/src/types/index.d.ts +1 -0
  58. package/package.json +4 -4
  59. package/src/components/ContextMenu/ContextMenu.props.ts +1 -1
  60. package/src/components/Footer/Footer.args.ts +105 -0
  61. package/src/components/Footer/Footer.props.ts +84 -0
  62. package/src/components/Footer/Footer.tsx +107 -0
  63. package/src/components/Footer/index.ts +1 -0
  64. package/src/components/LinkList/LinkList.props.ts +2 -2
  65. package/src/components/LocalNav/LocalNav.args.ts +64 -0
  66. package/src/components/LocalNav/LocalNav.props.ts +60 -0
  67. package/src/components/LocalNav/LocalNav.tsx +175 -0
  68. package/src/components/LocalNav/index.ts +1 -0
  69. package/src/components/index.ts +2 -0
  70. package/src/types/index.ts +1 -0
  71. package/lib/cjs/_commonjsHelpers-9f9f50a8.js +0 -39
  72. package/lib/cjs/patterns-975adf3c.js +0 -579
  73. package/lib/esm/_commonjsHelpers-849bcf65.js +0 -35
  74. package/lib/esm/patterns-53247c1d.js +0 -575
@@ -1,1450 +1,11 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import require$$0, { useState, createRef } from 'react';
3
- import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs } from '../../_commonjsHelpers-849bcf65.js';
4
- import { u as utils, p as patterns, c as cjs } from '../../patterns-53247c1d.js';
5
- import { p as propTypesExports } from '../../index-8ebb2cc1.js';
6
- import { findDOMNode } from 'react-dom';
7
- import classNames from 'classnames';
8
- import useGlobalSettings from '../../hooks/useGlobalSettings.js';
9
- import hoursMinutesSeconds from '../../utils/hoursMinutesSeconds.js';
10
- import screenfull from 'screenfull';
1
+ import 'react/jsx-runtime';
2
+ import 'react';
3
+ export { V as default } from '../../VideoPlayer-62e0ce79.js';
4
+ import 'react-dom';
5
+ import 'classnames';
6
+ import '../../hooks/useGlobalSettings.js';
7
+ import '../../utils/hoursMinutesSeconds.js';
8
+ import 'screenfull';
9
+ import '../../index-8ebb2cc1.js';
11
10
  import 'tslib';
12
11
  import '../../GlobalCtx-7fb23cfa.js';
13
-
14
- var lazy = {};
15
-
16
- var players = {};
17
-
18
- (function (exports) {
19
-
20
- Object.defineProperty(exports, "__esModule", {
21
- value: true
22
- });
23
- exports["default"] = void 0;
24
-
25
- var _react = require$$0;
26
-
27
- var _utils = utils;
28
-
29
- var _patterns = patterns;
30
-
31
- var _default = [{
32
- key: 'youtube',
33
- name: 'YouTube',
34
- canPlay: _patterns.canPlay.youtube,
35
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
36
- return import(
37
- /* webpackChunkName: 'reactPlayerYouTube' */
38
- '../../YouTube-e030042e.js').then(function (n) { return n.Y; });
39
- })
40
- }, {
41
- key: 'soundcloud',
42
- name: 'SoundCloud',
43
- canPlay: _patterns.canPlay.soundcloud,
44
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
45
- return import(
46
- /* webpackChunkName: 'reactPlayerSoundCloud' */
47
- '../../SoundCloud-0fac2e7a.js').then(function (n) { return n.S; });
48
- })
49
- }, {
50
- key: 'vimeo',
51
- name: 'Vimeo',
52
- canPlay: _patterns.canPlay.vimeo,
53
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
54
- return import(
55
- /* webpackChunkName: 'reactPlayerVimeo' */
56
- '../../Vimeo-a807e7e1.js').then(function (n) { return n.V; });
57
- })
58
- }, {
59
- key: 'facebook',
60
- name: 'Facebook',
61
- canPlay: _patterns.canPlay.facebook,
62
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
63
- return import(
64
- /* webpackChunkName: 'reactPlayerFacebook' */
65
- '../../Facebook-eb35da52.js').then(function (n) { return n.F; });
66
- })
67
- }, {
68
- key: 'streamable',
69
- name: 'Streamable',
70
- canPlay: _patterns.canPlay.streamable,
71
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
72
- return import(
73
- /* webpackChunkName: 'reactPlayerStreamable' */
74
- '../../Streamable-46f19a16.js').then(function (n) { return n.S; });
75
- })
76
- }, {
77
- key: 'wistia',
78
- name: 'Wistia',
79
- canPlay: _patterns.canPlay.wistia,
80
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
81
- return import(
82
- /* webpackChunkName: 'reactPlayerWistia' */
83
- '../../Wistia-eef03ce2.js').then(function (n) { return n.W; });
84
- })
85
- }, {
86
- key: 'twitch',
87
- name: 'Twitch',
88
- canPlay: _patterns.canPlay.twitch,
89
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
90
- return import(
91
- /* webpackChunkName: 'reactPlayerTwitch' */
92
- '../../Twitch-1be39438.js').then(function (n) { return n.T; });
93
- })
94
- }, {
95
- key: 'dailymotion',
96
- name: 'DailyMotion',
97
- canPlay: _patterns.canPlay.dailymotion,
98
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
99
- return import(
100
- /* webpackChunkName: 'reactPlayerDailyMotion' */
101
- '../../DailyMotion-9a7aeab5.js').then(function (n) { return n.D; });
102
- })
103
- }, {
104
- key: 'mixcloud',
105
- name: 'Mixcloud',
106
- canPlay: _patterns.canPlay.mixcloud,
107
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
108
- return import(
109
- /* webpackChunkName: 'reactPlayerMixcloud' */
110
- '../../Mixcloud-41d6dc0b.js').then(function (n) { return n.M; });
111
- })
112
- }, {
113
- key: 'vidyard',
114
- name: 'Vidyard',
115
- canPlay: _patterns.canPlay.vidyard,
116
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
117
- return import(
118
- /* webpackChunkName: 'reactPlayerVidyard' */
119
- '../../Vidyard-6185c490.js').then(function (n) { return n.V; });
120
- })
121
- }, {
122
- key: 'kaltura',
123
- name: 'Kaltura',
124
- canPlay: _patterns.canPlay.kaltura,
125
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
126
- return import(
127
- /* webpackChunkName: 'reactPlayerKaltura' */
128
- '../../Kaltura-b97bb455.js').then(function (n) { return n.K; });
129
- })
130
- }, {
131
- key: 'file',
132
- name: 'FilePlayer',
133
- canPlay: _patterns.canPlay.file,
134
- canEnablePIP: function canEnablePIP(url) {
135
- return _patterns.canPlay.file(url) && (document.pictureInPictureEnabled || (0, _utils.supportsWebKitPresentationMode)()) && !_patterns.AUDIO_EXTENSIONS.test(url);
136
- },
137
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
138
- return import(
139
- /* webpackChunkName: 'reactPlayerFilePlayer' */
140
- '../../FilePlayer-22314795.js').then(function (n) { return n.F; });
141
- })
142
- }];
143
- exports["default"] = _default;
144
- } (players));
145
-
146
- var ReactPlayer$1 = {};
147
-
148
- var safeIsNaN = Number.isNaN ||
149
- function ponyfill(value) {
150
- return typeof value === 'number' && value !== value;
151
- };
152
- function isEqual(first, second) {
153
- if (first === second) {
154
- return true;
155
- }
156
- if (safeIsNaN(first) && safeIsNaN(second)) {
157
- return true;
158
- }
159
- return false;
160
- }
161
- function areInputsEqual(newInputs, lastInputs) {
162
- if (newInputs.length !== lastInputs.length) {
163
- return false;
164
- }
165
- for (var i = 0; i < newInputs.length; i++) {
166
- if (!isEqual(newInputs[i], lastInputs[i])) {
167
- return false;
168
- }
169
- }
170
- return true;
171
- }
172
-
173
- function memoizeOne(resultFn, isEqual) {
174
- if (isEqual === void 0) { isEqual = areInputsEqual; }
175
- var lastThis;
176
- var lastArgs = [];
177
- var lastResult;
178
- var calledOnce = false;
179
- function memoized() {
180
- var newArgs = [];
181
- for (var _i = 0; _i < arguments.length; _i++) {
182
- newArgs[_i] = arguments[_i];
183
- }
184
- if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
185
- return lastResult;
186
- }
187
- lastResult = resultFn.apply(this, newArgs);
188
- calledOnce = true;
189
- lastThis = this;
190
- lastArgs = newArgs;
191
- return lastResult;
192
- }
193
- return memoized;
194
- }
195
-
196
- var memoizeOne_esm = /*#__PURE__*/Object.freeze({
197
- __proto__: null,
198
- default: memoizeOne
199
- });
200
-
201
- var require$$2 = /*@__PURE__*/getAugmentedNamespace(memoizeOne_esm);
202
-
203
- /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
204
-
205
- var hasElementType = typeof Element !== 'undefined';
206
- var hasMap = typeof Map === 'function';
207
- var hasSet = typeof Set === 'function';
208
- var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
209
-
210
- // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
211
-
212
- function equal(a, b) {
213
- // START: fast-deep-equal es6/index.js 3.1.1
214
- if (a === b) return true;
215
-
216
- if (a && b && typeof a == 'object' && typeof b == 'object') {
217
- if (a.constructor !== b.constructor) return false;
218
-
219
- var length, i, keys;
220
- if (Array.isArray(a)) {
221
- length = a.length;
222
- if (length != b.length) return false;
223
- for (i = length; i-- !== 0;)
224
- if (!equal(a[i], b[i])) return false;
225
- return true;
226
- }
227
-
228
- // START: Modifications:
229
- // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
230
- // to co-exist with es5.
231
- // 2. Replace `for of` with es5 compliant iteration using `for`.
232
- // Basically, take:
233
- //
234
- // ```js
235
- // for (i of a.entries())
236
- // if (!b.has(i[0])) return false;
237
- // ```
238
- //
239
- // ... and convert to:
240
- //
241
- // ```js
242
- // it = a.entries();
243
- // while (!(i = it.next()).done)
244
- // if (!b.has(i.value[0])) return false;
245
- // ```
246
- //
247
- // **Note**: `i` access switches to `i.value`.
248
- var it;
249
- if (hasMap && (a instanceof Map) && (b instanceof Map)) {
250
- if (a.size !== b.size) return false;
251
- it = a.entries();
252
- while (!(i = it.next()).done)
253
- if (!b.has(i.value[0])) return false;
254
- it = a.entries();
255
- while (!(i = it.next()).done)
256
- if (!equal(i.value[1], b.get(i.value[0]))) return false;
257
- return true;
258
- }
259
-
260
- if (hasSet && (a instanceof Set) && (b instanceof Set)) {
261
- if (a.size !== b.size) return false;
262
- it = a.entries();
263
- while (!(i = it.next()).done)
264
- if (!b.has(i.value[0])) return false;
265
- return true;
266
- }
267
- // END: Modifications
268
-
269
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
270
- length = a.length;
271
- if (length != b.length) return false;
272
- for (i = length; i-- !== 0;)
273
- if (a[i] !== b[i]) return false;
274
- return true;
275
- }
276
-
277
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
278
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
279
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
280
-
281
- keys = Object.keys(a);
282
- length = keys.length;
283
- if (length !== Object.keys(b).length) return false;
284
-
285
- for (i = length; i-- !== 0;)
286
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
287
- // END: fast-deep-equal
288
-
289
- // START: react-fast-compare
290
- // custom handling for DOM elements
291
- if (hasElementType && a instanceof Element) return false;
292
-
293
- // custom handling for React/Preact
294
- for (i = length; i-- !== 0;) {
295
- if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
296
- // React-specific: avoid traversing React elements' _owner
297
- // Preact-specific: avoid traversing Preact elements' __v and __o
298
- // __v = $_original / $_vnode
299
- // __o = $_owner
300
- // These properties contain circular references and are not needed when
301
- // comparing the actual elements (and not their owners)
302
- // .$$typeof and ._store on just reasonable markers of elements
303
-
304
- continue;
305
- }
306
-
307
- // all other properties should be traversed as usual
308
- if (!equal(a[keys[i]], b[keys[i]])) return false;
309
- }
310
- // END: react-fast-compare
311
-
312
- // START: fast-deep-equal
313
- return true;
314
- }
315
-
316
- return a !== a && b !== b;
317
- }
318
- // end fast-deep-equal
319
-
320
- var reactFastCompare = function isEqual(a, b) {
321
- try {
322
- return equal(a, b);
323
- } catch (error) {
324
- if (((error.message || '').match(/stack|recursion/i))) {
325
- // warn on circular references, don't crash
326
- // browsers give this different errors name and messages:
327
- // chrome/safari: "RangeError", "Maximum call stack size exceeded"
328
- // firefox: "InternalError", too much recursion"
329
- // edge: "Error", "Out of stack space"
330
- console.warn('react-fast-compare cannot handle circular refs');
331
- return false;
332
- }
333
- // some other error. we should definitely know about these
334
- throw error;
335
- }
336
- };
337
-
338
- var props = {};
339
-
340
- Object.defineProperty(props, "__esModule", {
341
- value: true
342
- });
343
- props.defaultProps = props.propTypes = void 0;
344
-
345
- var _propTypes = _interopRequireDefault$1(propTypesExports);
346
-
347
- function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
348
-
349
- var string = _propTypes["default"].string,
350
- bool = _propTypes["default"].bool,
351
- number = _propTypes["default"].number,
352
- array = _propTypes["default"].array,
353
- oneOfType = _propTypes["default"].oneOfType,
354
- shape = _propTypes["default"].shape,
355
- object = _propTypes["default"].object,
356
- func = _propTypes["default"].func,
357
- node = _propTypes["default"].node;
358
- var propTypes = {
359
- url: oneOfType([string, array, object]),
360
- playing: bool,
361
- loop: bool,
362
- controls: bool,
363
- volume: number,
364
- muted: bool,
365
- playbackRate: number,
366
- width: oneOfType([string, number]),
367
- height: oneOfType([string, number]),
368
- style: object,
369
- progressInterval: number,
370
- playsinline: bool,
371
- pip: bool,
372
- stopOnUnmount: bool,
373
- light: oneOfType([bool, string]),
374
- playIcon: node,
375
- previewTabIndex: number,
376
- fallback: node,
377
- oEmbedUrl: string,
378
- wrapper: oneOfType([string, func, shape({
379
- render: func.isRequired
380
- })]),
381
- config: shape({
382
- soundcloud: shape({
383
- options: object
384
- }),
385
- youtube: shape({
386
- playerVars: object,
387
- embedOptions: object,
388
- onUnstarted: func
389
- }),
390
- facebook: shape({
391
- appId: string,
392
- version: string,
393
- playerId: string,
394
- attributes: object
395
- }),
396
- dailymotion: shape({
397
- params: object
398
- }),
399
- vimeo: shape({
400
- playerOptions: object,
401
- title: string
402
- }),
403
- file: shape({
404
- attributes: object,
405
- tracks: array,
406
- forceVideo: bool,
407
- forceAudio: bool,
408
- forceHLS: bool,
409
- forceDASH: bool,
410
- forceFLV: bool,
411
- hlsOptions: object,
412
- hlsVersion: string,
413
- dashVersion: string,
414
- flvVersion: string
415
- }),
416
- wistia: shape({
417
- options: object,
418
- playerId: string,
419
- customControls: array
420
- }),
421
- mixcloud: shape({
422
- options: object
423
- }),
424
- twitch: shape({
425
- options: object,
426
- playerId: string
427
- }),
428
- vidyard: shape({
429
- options: object
430
- })
431
- }),
432
- onReady: func,
433
- onStart: func,
434
- onPlay: func,
435
- onPause: func,
436
- onBuffer: func,
437
- onBufferEnd: func,
438
- onEnded: func,
439
- onError: func,
440
- onDuration: func,
441
- onSeek: func,
442
- onPlaybackRateChange: func,
443
- onProgress: func,
444
- onClickPreview: func,
445
- onEnablePIP: func,
446
- onDisablePIP: func
447
- };
448
- props.propTypes = propTypes;
449
-
450
- var noop = function noop() {};
451
-
452
- var defaultProps = {
453
- playing: false,
454
- loop: false,
455
- controls: false,
456
- volume: null,
457
- muted: false,
458
- playbackRate: 1,
459
- width: '640px',
460
- height: '360px',
461
- style: {},
462
- progressInterval: 1000,
463
- playsinline: false,
464
- pip: false,
465
- stopOnUnmount: true,
466
- light: false,
467
- fallback: null,
468
- wrapper: 'div',
469
- previewTabIndex: 0,
470
- oEmbedUrl: 'https://noembed.com/embed?url={url}',
471
- config: {
472
- soundcloud: {
473
- options: {
474
- visual: true,
475
- // Undocumented, but makes player fill container and look better
476
- buying: false,
477
- liking: false,
478
- download: false,
479
- sharing: false,
480
- show_comments: false,
481
- show_playcount: false
482
- }
483
- },
484
- youtube: {
485
- playerVars: {
486
- playsinline: 1,
487
- showinfo: 0,
488
- rel: 0,
489
- iv_load_policy: 3,
490
- modestbranding: 1
491
- },
492
- embedOptions: {},
493
- onUnstarted: noop
494
- },
495
- facebook: {
496
- appId: '1309697205772819',
497
- version: 'v3.3',
498
- playerId: null,
499
- attributes: {}
500
- },
501
- dailymotion: {
502
- params: {
503
- api: 1,
504
- 'endscreen-enable': false
505
- }
506
- },
507
- vimeo: {
508
- playerOptions: {
509
- autopause: false,
510
- byline: false,
511
- portrait: false,
512
- title: false
513
- },
514
- title: null
515
- },
516
- file: {
517
- attributes: {},
518
- tracks: [],
519
- forceVideo: false,
520
- forceAudio: false,
521
- forceHLS: false,
522
- forceDASH: false,
523
- forceFLV: false,
524
- hlsOptions: {},
525
- hlsVersion: '1.1.4',
526
- dashVersion: '3.1.3',
527
- flvVersion: '1.5.0'
528
- },
529
- wistia: {
530
- options: {},
531
- playerId: null,
532
- customControls: null
533
- },
534
- mixcloud: {
535
- options: {
536
- hide_cover: 1
537
- }
538
- },
539
- twitch: {
540
- options: {},
541
- playerId: null
542
- },
543
- vidyard: {
544
- options: {}
545
- }
546
- },
547
- onReady: noop,
548
- onStart: noop,
549
- onPlay: noop,
550
- onPause: noop,
551
- onBuffer: noop,
552
- onBufferEnd: noop,
553
- onEnded: noop,
554
- onError: noop,
555
- onDuration: noop,
556
- onSeek: noop,
557
- onPlaybackRateChange: noop,
558
- onProgress: noop,
559
- onClickPreview: noop,
560
- onEnablePIP: noop,
561
- onDisablePIP: noop
562
- };
563
- props.defaultProps = defaultProps;
564
-
565
- var Player = {};
566
-
567
- (function (exports) {
568
-
569
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
570
-
571
- Object.defineProperty(exports, "__esModule", {
572
- value: true
573
- });
574
- exports["default"] = void 0;
575
-
576
- var _react = _interopRequireWildcard(require$$0);
577
-
578
- var _reactFastCompare = _interopRequireDefault(reactFastCompare);
579
-
580
- var _props = props;
581
-
582
- var _utils = utils;
583
-
584
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
585
-
586
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
587
-
588
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
589
-
590
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
591
-
592
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
593
-
594
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
595
-
596
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
597
-
598
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
599
-
600
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
601
-
602
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
603
-
604
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
605
-
606
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
607
-
608
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
609
-
610
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
611
-
612
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
613
-
614
- var SEEK_ON_PLAY_EXPIRY = 5000;
615
-
616
- var Player = /*#__PURE__*/function (_Component) {
617
- _inherits(Player, _Component);
618
-
619
- var _super = _createSuper(Player);
620
-
621
- function Player() {
622
- var _this;
623
-
624
- _classCallCheck(this, Player);
625
-
626
- for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
627
- _args[_key] = arguments[_key];
628
- }
629
-
630
- _this = _super.call.apply(_super, [this].concat(_args));
631
-
632
- _defineProperty(_assertThisInitialized(_this), "mounted", false);
633
-
634
- _defineProperty(_assertThisInitialized(_this), "isReady", false);
635
-
636
- _defineProperty(_assertThisInitialized(_this), "isPlaying", false);
637
-
638
- _defineProperty(_assertThisInitialized(_this), "isLoading", true);
639
-
640
- _defineProperty(_assertThisInitialized(_this), "loadOnReady", null);
641
-
642
- _defineProperty(_assertThisInitialized(_this), "startOnPlay", true);
643
-
644
- _defineProperty(_assertThisInitialized(_this), "seekOnPlay", null);
645
-
646
- _defineProperty(_assertThisInitialized(_this), "onDurationCalled", false);
647
-
648
- _defineProperty(_assertThisInitialized(_this), "handlePlayerMount", function (player) {
649
- if (_this.player) return; // Prevent loading twice in strict mode
650
-
651
- _this.player = player;
652
-
653
- _this.player.load(_this.props.url);
654
-
655
- _this.progress();
656
- });
657
-
658
- _defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function (key) {
659
- if (!_this.player) return null;
660
- return _this.player[key];
661
- });
662
-
663
- _defineProperty(_assertThisInitialized(_this), "progress", function () {
664
- if (_this.props.url && _this.player && _this.isReady) {
665
- var playedSeconds = _this.getCurrentTime() || 0;
666
-
667
- var loadedSeconds = _this.getSecondsLoaded();
668
-
669
- var duration = _this.getDuration();
670
-
671
- if (duration) {
672
- var progress = {
673
- playedSeconds: playedSeconds,
674
- played: playedSeconds / duration
675
- };
676
-
677
- if (loadedSeconds !== null) {
678
- progress.loadedSeconds = loadedSeconds;
679
- progress.loaded = loadedSeconds / duration;
680
- } // Only call onProgress if values have changed
681
-
682
-
683
- if (progress.playedSeconds !== _this.prevPlayed || progress.loadedSeconds !== _this.prevLoaded) {
684
- _this.props.onProgress(progress);
685
- }
686
-
687
- _this.prevPlayed = progress.playedSeconds;
688
- _this.prevLoaded = progress.loadedSeconds;
689
- }
690
- }
691
-
692
- _this.progressTimeout = setTimeout(_this.progress, _this.props.progressFrequency || _this.props.progressInterval);
693
- });
694
-
695
- _defineProperty(_assertThisInitialized(_this), "handleReady", function () {
696
- if (!_this.mounted) return;
697
- _this.isReady = true;
698
- _this.isLoading = false;
699
- var _this$props = _this.props,
700
- onReady = _this$props.onReady,
701
- playing = _this$props.playing,
702
- volume = _this$props.volume,
703
- muted = _this$props.muted;
704
- onReady();
705
-
706
- if (!muted && volume !== null) {
707
- _this.player.setVolume(volume);
708
- }
709
-
710
- if (_this.loadOnReady) {
711
- _this.player.load(_this.loadOnReady, true);
712
-
713
- _this.loadOnReady = null;
714
- } else if (playing) {
715
- _this.player.play();
716
- }
717
-
718
- _this.handleDurationCheck();
719
- });
720
-
721
- _defineProperty(_assertThisInitialized(_this), "handlePlay", function () {
722
- _this.isPlaying = true;
723
- _this.isLoading = false;
724
- var _this$props2 = _this.props,
725
- onStart = _this$props2.onStart,
726
- onPlay = _this$props2.onPlay,
727
- playbackRate = _this$props2.playbackRate;
728
-
729
- if (_this.startOnPlay) {
730
- if (_this.player.setPlaybackRate && playbackRate !== 1) {
731
- _this.player.setPlaybackRate(playbackRate);
732
- }
733
-
734
- onStart();
735
- _this.startOnPlay = false;
736
- }
737
-
738
- onPlay();
739
-
740
- if (_this.seekOnPlay) {
741
- _this.seekTo(_this.seekOnPlay);
742
-
743
- _this.seekOnPlay = null;
744
- }
745
-
746
- _this.handleDurationCheck();
747
- });
748
-
749
- _defineProperty(_assertThisInitialized(_this), "handlePause", function (e) {
750
- _this.isPlaying = false;
751
-
752
- if (!_this.isLoading) {
753
- _this.props.onPause(e);
754
- }
755
- });
756
-
757
- _defineProperty(_assertThisInitialized(_this), "handleEnded", function () {
758
- var _this$props3 = _this.props,
759
- activePlayer = _this$props3.activePlayer,
760
- loop = _this$props3.loop,
761
- onEnded = _this$props3.onEnded;
762
-
763
- if (activePlayer.loopOnEnded && loop) {
764
- _this.seekTo(0);
765
- }
766
-
767
- if (!loop) {
768
- _this.isPlaying = false;
769
- onEnded();
770
- }
771
- });
772
-
773
- _defineProperty(_assertThisInitialized(_this), "handleError", function () {
774
- var _this$props4;
775
-
776
- _this.isLoading = false;
777
-
778
- (_this$props4 = _this.props).onError.apply(_this$props4, arguments);
779
- });
780
-
781
- _defineProperty(_assertThisInitialized(_this), "handleDurationCheck", function () {
782
- clearTimeout(_this.durationCheckTimeout);
783
-
784
- var duration = _this.getDuration();
785
-
786
- if (duration) {
787
- if (!_this.onDurationCalled) {
788
- _this.props.onDuration(duration);
789
-
790
- _this.onDurationCalled = true;
791
- }
792
- } else {
793
- _this.durationCheckTimeout = setTimeout(_this.handleDurationCheck, 100);
794
- }
795
- });
796
-
797
- _defineProperty(_assertThisInitialized(_this), "handleLoaded", function () {
798
- // Sometimes we know loading has stopped but onReady/onPlay are never called
799
- // so this provides a way for players to avoid getting stuck
800
- _this.isLoading = false;
801
- });
802
-
803
- return _this;
804
- }
805
-
806
- _createClass(Player, [{
807
- key: "componentDidMount",
808
- value: function componentDidMount() {
809
- this.mounted = true;
810
- }
811
- }, {
812
- key: "componentWillUnmount",
813
- value: function componentWillUnmount() {
814
- clearTimeout(this.progressTimeout);
815
- clearTimeout(this.durationCheckTimeout);
816
-
817
- if (this.isReady && this.props.stopOnUnmount) {
818
- this.player.stop();
819
-
820
- if (this.player.disablePIP) {
821
- this.player.disablePIP();
822
- }
823
- }
824
-
825
- this.mounted = false;
826
- }
827
- }, {
828
- key: "componentDidUpdate",
829
- value: function componentDidUpdate(prevProps) {
830
- var _this2 = this;
831
-
832
- // If there isn’t a player available, don’t do anything
833
- if (!this.player) {
834
- return;
835
- } // Invoke player methods based on changed props
836
-
837
-
838
- var _this$props5 = this.props,
839
- url = _this$props5.url,
840
- playing = _this$props5.playing,
841
- volume = _this$props5.volume,
842
- muted = _this$props5.muted,
843
- playbackRate = _this$props5.playbackRate,
844
- pip = _this$props5.pip,
845
- loop = _this$props5.loop,
846
- activePlayer = _this$props5.activePlayer,
847
- disableDeferredLoading = _this$props5.disableDeferredLoading;
848
-
849
- if (!(0, _reactFastCompare["default"])(prevProps.url, url)) {
850
- if (this.isLoading && !activePlayer.forceLoad && !disableDeferredLoading && !(0, _utils.isMediaStream)(url)) {
851
- console.warn("ReactPlayer: the attempt to load ".concat(url, " is being deferred until the player has loaded"));
852
- this.loadOnReady = url;
853
- return;
854
- }
855
-
856
- this.isLoading = true;
857
- this.startOnPlay = true;
858
- this.onDurationCalled = false;
859
- this.player.load(url, this.isReady);
860
- }
861
-
862
- if (!prevProps.playing && playing && !this.isPlaying) {
863
- this.player.play();
864
- }
865
-
866
- if (prevProps.playing && !playing && this.isPlaying) {
867
- this.player.pause();
868
- }
869
-
870
- if (!prevProps.pip && pip && this.player.enablePIP) {
871
- this.player.enablePIP();
872
- }
873
-
874
- if (prevProps.pip && !pip && this.player.disablePIP) {
875
- this.player.disablePIP();
876
- }
877
-
878
- if (prevProps.volume !== volume && volume !== null) {
879
- this.player.setVolume(volume);
880
- }
881
-
882
- if (prevProps.muted !== muted) {
883
- if (muted) {
884
- this.player.mute();
885
- } else {
886
- this.player.unmute();
887
-
888
- if (volume !== null) {
889
- // Set volume next tick to fix a bug with DailyMotion
890
- setTimeout(function () {
891
- return _this2.player.setVolume(volume);
892
- });
893
- }
894
- }
895
- }
896
-
897
- if (prevProps.playbackRate !== playbackRate && this.player.setPlaybackRate) {
898
- this.player.setPlaybackRate(playbackRate);
899
- }
900
-
901
- if (prevProps.loop !== loop && this.player.setLoop) {
902
- this.player.setLoop(loop);
903
- }
904
- }
905
- }, {
906
- key: "getDuration",
907
- value: function getDuration() {
908
- if (!this.isReady) return null;
909
- return this.player.getDuration();
910
- }
911
- }, {
912
- key: "getCurrentTime",
913
- value: function getCurrentTime() {
914
- if (!this.isReady) return null;
915
- return this.player.getCurrentTime();
916
- }
917
- }, {
918
- key: "getSecondsLoaded",
919
- value: function getSecondsLoaded() {
920
- if (!this.isReady) return null;
921
- return this.player.getSecondsLoaded();
922
- }
923
- }, {
924
- key: "seekTo",
925
- value: function seekTo(amount, type) {
926
- var _this3 = this;
927
-
928
- // When seeking before player is ready, store value and seek later
929
- if (!this.isReady) {
930
- if (amount !== 0) {
931
- this.seekOnPlay = amount;
932
- setTimeout(function () {
933
- _this3.seekOnPlay = null;
934
- }, SEEK_ON_PLAY_EXPIRY);
935
- }
936
-
937
- return;
938
- }
939
-
940
- var isFraction = !type ? amount > 0 && amount < 1 : type === 'fraction';
941
-
942
- if (isFraction) {
943
- // Convert fraction to seconds based on duration
944
- var duration = this.player.getDuration();
945
-
946
- if (!duration) {
947
- console.warn('ReactPlayer: could not seek using fraction – duration not yet available');
948
- return;
949
- }
950
-
951
- this.player.seekTo(duration * amount);
952
- return;
953
- }
954
-
955
- this.player.seekTo(amount);
956
- }
957
- }, {
958
- key: "render",
959
- value: function render() {
960
- var Player = this.props.activePlayer;
961
-
962
- if (!Player) {
963
- return null;
964
- }
965
-
966
- return /*#__PURE__*/_react["default"].createElement(Player, _extends({}, this.props, {
967
- onMount: this.handlePlayerMount,
968
- onReady: this.handleReady,
969
- onPlay: this.handlePlay,
970
- onPause: this.handlePause,
971
- onEnded: this.handleEnded,
972
- onLoaded: this.handleLoaded,
973
- onError: this.handleError
974
- }));
975
- }
976
- }]);
977
-
978
- return Player;
979
- }(_react.Component);
980
-
981
- exports["default"] = Player;
982
-
983
- _defineProperty(Player, "displayName", 'Player');
984
-
985
- _defineProperty(Player, "propTypes", _props.propTypes);
986
-
987
- _defineProperty(Player, "defaultProps", _props.defaultProps);
988
- } (Player));
989
-
990
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
991
-
992
- Object.defineProperty(ReactPlayer$1, "__esModule", {
993
- value: true
994
- });
995
- ReactPlayer$1.createReactPlayer = void 0;
996
-
997
- var _react = _interopRequireWildcard(require$$0);
998
-
999
- var _deepmerge = _interopRequireDefault(cjs);
1000
-
1001
- var _memoizeOne = _interopRequireDefault(require$$2);
1002
-
1003
- var _reactFastCompare = _interopRequireDefault(reactFastCompare);
1004
-
1005
- var _props = props;
1006
-
1007
- var _utils = utils;
1008
-
1009
- var _Player3 = _interopRequireDefault(Player);
1010
-
1011
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1012
-
1013
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
1014
-
1015
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1016
-
1017
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1018
-
1019
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1020
-
1021
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1022
-
1023
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1024
-
1025
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1026
-
1027
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1028
-
1029
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
1030
-
1031
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1032
-
1033
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1034
-
1035
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1036
-
1037
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1038
-
1039
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1040
-
1041
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
1042
-
1043
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1044
-
1045
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1046
-
1047
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1048
-
1049
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1050
-
1051
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
1052
-
1053
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1054
-
1055
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1056
-
1057
- var Preview = /*#__PURE__*/(0, _react.lazy)(function () {
1058
- return import(
1059
- /* webpackChunkName: 'reactPlayerPreview' */
1060
- '../../Preview-6d2a6792.js').then(function (n) { return n.P; });
1061
- });
1062
- var IS_BROWSER = typeof window !== 'undefined' && window.document;
1063
- var IS_GLOBAL = typeof commonjsGlobal !== 'undefined' && commonjsGlobal.window && commonjsGlobal.window.document;
1064
- var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server
1065
- // as Suspense is not supported yet
1066
-
1067
- var UniversalSuspense = IS_BROWSER || IS_GLOBAL ? _react.Suspense : function () {
1068
- return null;
1069
- };
1070
- var customPlayers = [];
1071
-
1072
- var createReactPlayer = function createReactPlayer(players, fallback) {
1073
- var _class, _temp;
1074
-
1075
- return _temp = _class = /*#__PURE__*/function (_Component) {
1076
- _inherits(ReactPlayer, _Component);
1077
-
1078
- var _super = _createSuper(ReactPlayer);
1079
-
1080
- function ReactPlayer() {
1081
- var _this;
1082
-
1083
- _classCallCheck(this, ReactPlayer);
1084
-
1085
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1086
- args[_key] = arguments[_key];
1087
- }
1088
-
1089
- _this = _super.call.apply(_super, [this].concat(args));
1090
-
1091
- _defineProperty(_assertThisInitialized(_this), "state", {
1092
- showPreview: !!_this.props.light
1093
- });
1094
-
1095
- _defineProperty(_assertThisInitialized(_this), "references", {
1096
- wrapper: function wrapper(_wrapper) {
1097
- _this.wrapper = _wrapper;
1098
- },
1099
- player: function player(_player) {
1100
- _this.player = _player;
1101
- }
1102
- });
1103
-
1104
- _defineProperty(_assertThisInitialized(_this), "handleClickPreview", function (e) {
1105
- _this.setState({
1106
- showPreview: false
1107
- });
1108
-
1109
- _this.props.onClickPreview(e);
1110
- });
1111
-
1112
- _defineProperty(_assertThisInitialized(_this), "showPreview", function () {
1113
- _this.setState({
1114
- showPreview: true
1115
- });
1116
- });
1117
-
1118
- _defineProperty(_assertThisInitialized(_this), "getDuration", function () {
1119
- if (!_this.player) return null;
1120
- return _this.player.getDuration();
1121
- });
1122
-
1123
- _defineProperty(_assertThisInitialized(_this), "getCurrentTime", function () {
1124
- if (!_this.player) return null;
1125
- return _this.player.getCurrentTime();
1126
- });
1127
-
1128
- _defineProperty(_assertThisInitialized(_this), "getSecondsLoaded", function () {
1129
- if (!_this.player) return null;
1130
- return _this.player.getSecondsLoaded();
1131
- });
1132
-
1133
- _defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function () {
1134
- var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'player';
1135
- if (!_this.player) return null;
1136
- return _this.player.getInternalPlayer(key);
1137
- });
1138
-
1139
- _defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type) {
1140
- if (!_this.player) return null;
1141
-
1142
- _this.player.seekTo(fraction, type);
1143
- });
1144
-
1145
- _defineProperty(_assertThisInitialized(_this), "handleReady", function () {
1146
- _this.props.onReady(_assertThisInitialized(_this));
1147
- });
1148
-
1149
- _defineProperty(_assertThisInitialized(_this), "getActivePlayer", (0, _memoizeOne["default"])(function (url) {
1150
- for (var _i = 0, _arr = [].concat(customPlayers, _toConsumableArray(players)); _i < _arr.length; _i++) {
1151
- var player = _arr[_i];
1152
-
1153
- if (player.canPlay(url)) {
1154
- return player;
1155
- }
1156
- }
1157
-
1158
- if (fallback) {
1159
- return fallback;
1160
- }
1161
-
1162
- return null;
1163
- }));
1164
-
1165
- _defineProperty(_assertThisInitialized(_this), "getConfig", (0, _memoizeOne["default"])(function (url, key) {
1166
- var config = _this.props.config;
1167
- return _deepmerge["default"].all([_props.defaultProps.config, _props.defaultProps.config[key] || {}, config, config[key] || {}]);
1168
- }));
1169
-
1170
- _defineProperty(_assertThisInitialized(_this), "getAttributes", (0, _memoizeOne["default"])(function (url) {
1171
- return (0, _utils.omit)(_this.props, SUPPORTED_PROPS);
1172
- }));
1173
-
1174
- _defineProperty(_assertThisInitialized(_this), "renderActivePlayer", function (url) {
1175
- if (!url) return null;
1176
-
1177
- var player = _this.getActivePlayer(url);
1178
-
1179
- if (!player) return null;
1180
-
1181
- var config = _this.getConfig(url, player.key);
1182
-
1183
- return /*#__PURE__*/_react["default"].createElement(_Player3["default"], _extends({}, _this.props, {
1184
- key: player.key,
1185
- ref: _this.references.player,
1186
- config: config,
1187
- activePlayer: player.lazyPlayer || player,
1188
- onReady: _this.handleReady
1189
- }));
1190
- });
1191
-
1192
- return _this;
1193
- }
1194
-
1195
- _createClass(ReactPlayer, [{
1196
- key: "shouldComponentUpdate",
1197
- value: function shouldComponentUpdate(nextProps, nextState) {
1198
- return !(0, _reactFastCompare["default"])(this.props, nextProps) || !(0, _reactFastCompare["default"])(this.state, nextState);
1199
- }
1200
- }, {
1201
- key: "componentDidUpdate",
1202
- value: function componentDidUpdate(prevProps) {
1203
- var light = this.props.light;
1204
-
1205
- if (!prevProps.light && light) {
1206
- this.setState({
1207
- showPreview: true
1208
- });
1209
- }
1210
-
1211
- if (prevProps.light && !light) {
1212
- this.setState({
1213
- showPreview: false
1214
- });
1215
- }
1216
- }
1217
- }, {
1218
- key: "renderPreview",
1219
- value: function renderPreview(url) {
1220
- if (!url) return null;
1221
- var _this$props = this.props,
1222
- light = _this$props.light,
1223
- playIcon = _this$props.playIcon,
1224
- previewTabIndex = _this$props.previewTabIndex,
1225
- oEmbedUrl = _this$props.oEmbedUrl;
1226
- return /*#__PURE__*/_react["default"].createElement(Preview, {
1227
- url: url,
1228
- light: light,
1229
- playIcon: playIcon,
1230
- previewTabIndex: previewTabIndex,
1231
- oEmbedUrl: oEmbedUrl,
1232
- onClick: this.handleClickPreview
1233
- });
1234
- }
1235
- }, {
1236
- key: "render",
1237
- value: function render() {
1238
- var _this$props2 = this.props,
1239
- url = _this$props2.url,
1240
- style = _this$props2.style,
1241
- width = _this$props2.width,
1242
- height = _this$props2.height,
1243
- fallback = _this$props2.fallback,
1244
- Wrapper = _this$props2.wrapper;
1245
- var showPreview = this.state.showPreview;
1246
- var attributes = this.getAttributes(url);
1247
- return /*#__PURE__*/_react["default"].createElement(Wrapper, _extends({
1248
- ref: this.references.wrapper,
1249
- style: _objectSpread(_objectSpread({}, style), {}, {
1250
- width: width,
1251
- height: height
1252
- })
1253
- }, attributes), /*#__PURE__*/_react["default"].createElement(UniversalSuspense, {
1254
- fallback: fallback
1255
- }, showPreview ? this.renderPreview(url) : this.renderActivePlayer(url)));
1256
- }
1257
- }]);
1258
-
1259
- return ReactPlayer;
1260
- }(_react.Component), _defineProperty(_class, "displayName", 'ReactPlayer'), _defineProperty(_class, "propTypes", _props.propTypes), _defineProperty(_class, "defaultProps", _props.defaultProps), _defineProperty(_class, "addCustomPlayer", function (player) {
1261
- customPlayers.push(player);
1262
- }), _defineProperty(_class, "removeCustomPlayers", function () {
1263
- customPlayers.length = 0;
1264
- }), _defineProperty(_class, "canPlay", function (url) {
1265
- for (var _i2 = 0, _arr2 = [].concat(customPlayers, _toConsumableArray(players)); _i2 < _arr2.length; _i2++) {
1266
- var _Player = _arr2[_i2];
1267
-
1268
- if (_Player.canPlay(url)) {
1269
- return true;
1270
- }
1271
- }
1272
-
1273
- return false;
1274
- }), _defineProperty(_class, "canEnablePIP", function (url) {
1275
- for (var _i3 = 0, _arr3 = [].concat(customPlayers, _toConsumableArray(players)); _i3 < _arr3.length; _i3++) {
1276
- var _Player2 = _arr3[_i3];
1277
-
1278
- if (_Player2.canEnablePIP && _Player2.canEnablePIP(url)) {
1279
- return true;
1280
- }
1281
- }
1282
-
1283
- return false;
1284
- }), _temp;
1285
- };
1286
-
1287
- ReactPlayer$1.createReactPlayer = createReactPlayer;
1288
-
1289
- (function (exports) {
1290
-
1291
- Object.defineProperty(exports, "__esModule", {
1292
- value: true
1293
- });
1294
- exports["default"] = void 0;
1295
-
1296
- var _players = _interopRequireDefault(players);
1297
-
1298
- var _ReactPlayer = ReactPlayer$1;
1299
-
1300
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1301
-
1302
- // Fall back to FilePlayer if nothing else can play the URL
1303
- var fallback = _players["default"][_players["default"].length - 1];
1304
-
1305
- var _default = (0, _ReactPlayer.createReactPlayer)(_players["default"], fallback);
1306
-
1307
- exports["default"] = _default;
1308
- } (lazy));
1309
-
1310
- var RP = /*@__PURE__*/getDefaultExportFromCjs(lazy);
1311
-
1312
- const ReactPlayer = RP;
1313
- const VideoPlayer = ({ controls, src, poster, youtube, tracks, }) => {
1314
- var _a;
1315
- const { prefix } = useGlobalSettings();
1316
- const baseClass = `${prefix}--video`;
1317
- const playerClasses = classNames("", {
1318
- [`${baseClass}--player`]: true,
1319
- [`youtube`]: youtube,
1320
- });
1321
- const controlsClasses = classNames("", {
1322
- [`${baseClass}--controls`]: true,
1323
- });
1324
- /**
1325
- * State hooks for our player controls
1326
- */
1327
- const [duration, setDuration] = useState("0:00");
1328
- const [playedtime, setPlayedtime] = useState("0:00");
1329
- const [buffer, setBuffer] = useState(0);
1330
- const [playing, setPlaying] = useState(false);
1331
- const [playhead, setPlayhead] = useState(0);
1332
- const [volume, setVolume] = useState(0.8);
1333
- const [muted, setMute] = useState(false);
1334
- const [showposter, showPoster] = useState(true);
1335
- const [showvolume, showVolume] = useState(false);
1336
- const [seeking, setSeeking] = useState(false);
1337
- /**
1338
- * Ref for the video element
1339
- */
1340
- const videoElement = createRef();
1341
- /**
1342
- * Ref for the video container
1343
- */
1344
- const videoContainer = createRef();
1345
- const youtubeparams = {
1346
- controls: 0,
1347
- modestbranding: 1,
1348
- };
1349
- const playerconfig = {
1350
- file: {
1351
- tracks: tracks || [],
1352
- },
1353
- youtube: youtube ? { playerVars: youtubeparams } : {},
1354
- };
1355
- /**
1356
- * Fullscreen functionality
1357
- */
1358
- const toggleFullscreen = () => {
1359
- /* This is a known issue with ReactPlayer */
1360
- /* @ts-ignore */
1361
- screenfull.request(findDOMNode(videoContainer.current));
1362
- };
1363
- /**
1364
- * Play/pause functionality
1365
- */
1366
- const togglePlay = () => {
1367
- setPlaying(!playing);
1368
- showPoster(false);
1369
- };
1370
- /**
1371
- * Show volume slider
1372
- */
1373
- const showVolumeSlider = () => {
1374
- showVolume(true);
1375
- };
1376
- /**
1377
- * Hide volume slider
1378
- */
1379
- const hideVolumeSlider = () => {
1380
- setTimeout(() => {
1381
- showVolume(false);
1382
- }, 2000);
1383
- };
1384
- /**
1385
- * Mute/unmute
1386
- */
1387
- const toggleMute = () => {
1388
- setMute(!muted);
1389
- hideVolumeSlider();
1390
- };
1391
- /**
1392
- * Volume change
1393
- */
1394
- const handleVolumeChange = (event) => {
1395
- console.log("handleVolumeChange", event.target.value);
1396
- setVolume(event.target.value * 0.1);
1397
- };
1398
- /**
1399
- * Begin seek
1400
- */
1401
- const handleSeekMouseDown = () => {
1402
- setSeeking(true);
1403
- };
1404
- /**
1405
- * Seek
1406
- */
1407
- const handleSeekChange = (event) => {
1408
- setPlayhead(parseFloat(event.target.value));
1409
- };
1410
- /**
1411
- * End seek
1412
- */
1413
- const handleSeekMouseUp = (event) => {
1414
- setSeeking(false);
1415
- /* This is a known issue with ReactPlayer */
1416
- /* @ts-ignore */
1417
- videoElement.current.seekTo(parseFloat(event.target.value));
1418
- };
1419
- /**
1420
- * handle display of progress
1421
- */
1422
- const handleProgress = (state) => {
1423
- if (!seeking) {
1424
- setPlayhead(state.played);
1425
- setBuffer(state.loaded);
1426
- setPlayedtime(hoursMinutesSeconds(state.playedSeconds));
1427
- }
1428
- };
1429
- /**
1430
- * get the duration to display
1431
- */
1432
- const handleDuration = (duration) => {
1433
- setDuration(hoursMinutesSeconds(duration));
1434
- };
1435
- /**
1436
- * on video end
1437
- */
1438
- const handleEnded = () => {
1439
- setPlaying(false);
1440
- setSeeking(false);
1441
- };
1442
- return (jsxs("div", Object.assign({ className: `${baseClass}--container`, ref: videoContainer }, { children: [jsx(ReactPlayer, { className: playerClasses, config: playerconfig, loop: false, muted: muted, playing: playing, ref: videoElement, url: src, width: "100%", height: "100%", progressInterval: 30, volume: volume, onProgress: handleProgress, onDuration: handleDuration, onEnded: handleEnded }), jsxs("picture", Object.assign({ className: `${baseClass}--poster ${showposter ? "show" : ""}` }, { children: [(poster === null || poster === void 0 ? void 0 : poster.url) &&
1443
- poster.url
1444
- .sort((a, b) => parseFloat(a.breakpoint) - parseFloat(b.breakpoint))
1445
- .slice(1)
1446
- .reverse()
1447
- .map((item, index) => (jsx("source", { srcSet: item.src, media: `(min-width: ${item.breakpoint}px)` }, index))), jsx("img", { src: (_a = poster === null || poster === void 0 ? void 0 : poster.url[0]) === null || _a === void 0 ? void 0 : _a.src, alt: poster === null || poster === void 0 ? void 0 : poster.alt })] })), jsxs("div", Object.assign({ className: `${controlsClasses} ${showposter ? "notplayed" : ""}` }, { children: [jsx("label", Object.assign({ className: `${controlsClasses}--duration ${showposter ? "show" : ""}` }, { children: duration })), jsx("button", Object.assign({ className: `${controlsClasses}--${!playing ? "play" : "pause"}`, onClick: togglePlay }, { children: jsx("span", { children: !playing ? controls && controls.play : controls && controls.pause }) })), jsxs("div", Object.assign({ className: `${controlsClasses}--progress ${showposter ? "" : "show"}` }, { children: [jsx("input", { type: "range", min: 0, max: 0.999999, step: "any", value: playhead, onMouseDown: handleSeekMouseDown, onChange: handleSeekChange, onMouseUp: handleSeekMouseUp, className: `${controlsClasses}--progress-playhead` }), jsx("progress", { className: `${controlsClasses}--progress-current`, max: 1, value: playhead }), jsx("progress", { className: `${controlsClasses}--progress-loaded`, max: 1, value: buffer }), jsx("div", Object.assign({ className: `${controlsClasses}--progress-played-container` }, { children: jsx("label", Object.assign({ className: `${controlsClasses}--progress-played`, style: { ["--playhead"]: `${playhead * 100}%` } }, { children: playedtime })) }))] })), jsxs("div", Object.assign({ className: `${controlsClasses}--volume ${showposter ? "" : "show"}`, onMouseEnter: showVolumeSlider, onMouseLeave: hideVolumeSlider }, { children: [jsx("button", Object.assign({ className: `${controlsClasses}--showvolume ${muted ? "muted" : ""}`, onClick: toggleMute }, { children: jsx("span", { children: controls && controls.volume }) })), jsx("div", Object.assign({ className: `${controlsClasses}--setvolume-container` }, { children: jsx("input", { className: `${controlsClasses}--setvolume ${showvolume ? "show" : ""}`, type: "range", step: "0.5", defaultValue: volume, min: "1", max: "10", onChange: handleVolumeChange, onMouseLeave: hideVolumeSlider }) }))] })), jsx("button", Object.assign({ className: `${controlsClasses}--fullscreen ${showposter ? "" : "show"}`, onClick: toggleFullscreen }, { children: jsx("span", { children: controls && controls.fullscreen }) }))] }))] })));
1448
- };
1449
-
1450
- export { VideoPlayer as default };