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