@ilo-org/react 0.10.6 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/cjs/AccordionCtx-be704051.js +9 -0
  3. package/lib/cjs/{GlobalCtx-97e4b433.js → GlobalCtx-10114bdd.js} +2 -2
  4. package/lib/cjs/ListCtx-14aa546f.js +9 -0
  5. package/lib/cjs/TagCtx-690a1d54.js +7 -0
  6. package/lib/cjs/components/Accordion/Accordion.js +6 -6
  7. package/lib/cjs/components/Accordion/AccordionButton.js +5 -5
  8. package/lib/cjs/components/Accordion/AccordionItem.js +2 -2
  9. package/lib/cjs/components/Accordion/AccordionPanel.js +8 -8
  10. package/lib/cjs/components/Accordion/index.js +2 -2
  11. package/lib/cjs/components/Breadcrumb/Breadcrumb.js +5 -5
  12. package/lib/cjs/components/Breadcrumb/index.js +1 -1
  13. package/lib/cjs/components/Button/Button.js +1 -1
  14. package/lib/cjs/components/Button/index.js +1 -1
  15. package/lib/cjs/components/Callout/Callout.js +4 -4
  16. package/lib/cjs/components/Callout/index.js +1 -1
  17. package/lib/cjs/components/Card/Card.js +2 -2
  18. package/lib/cjs/components/Card/CardGroup.js +2 -2
  19. package/lib/cjs/components/Card/index.js +2 -2
  20. package/lib/cjs/components/Checkbox/Checkbox.js +5 -5
  21. package/lib/cjs/components/Checkbox/index.js +1 -1
  22. package/lib/cjs/components/Collapse/Collapse.js +1194 -44
  23. package/lib/cjs/components/Collapse/index.js +0 -1
  24. package/lib/cjs/components/ContextMenu/ContextMenu.js +1 -1
  25. package/lib/cjs/components/ContextMenu/index.js +1 -1
  26. package/lib/cjs/components/Credit/Credit.js +3 -3
  27. package/lib/cjs/components/Credit/index.js +1 -1
  28. package/lib/cjs/components/DatePicker/DatePicker.js +4 -4
  29. package/lib/cjs/components/DatePicker/index.js +1 -1
  30. package/lib/cjs/components/Dropdown/Dropdown.js +5 -5
  31. package/lib/cjs/components/Dropdown/index.js +1 -1
  32. package/lib/cjs/components/Empty/Empty.js +1 -1
  33. package/lib/cjs/components/Empty/index.js +1 -1
  34. package/lib/cjs/components/Fieldset/Fieldset.js +5 -5
  35. package/lib/cjs/components/Fieldset/index.js +1 -1
  36. package/lib/cjs/components/FileUpload/FileUpload.js +5 -5
  37. package/lib/cjs/components/FileUpload/index.js +1 -1
  38. package/lib/cjs/components/Footer/Footer.js +1 -1
  39. package/lib/cjs/components/Footer/index.js +1 -1
  40. package/lib/cjs/components/Form/Form.js +3 -3
  41. package/lib/cjs/components/Form/index.js +1 -1
  42. package/lib/cjs/components/FormControl/FormControl.js +7 -7
  43. package/lib/cjs/components/FormControl/index.js +1 -1
  44. package/lib/cjs/components/GlobalProvider/GlobalProvider.js +1 -1
  45. package/lib/cjs/components/GlobalProvider/index.js +1 -1
  46. package/lib/cjs/components/Heading/Heading.js +1 -1
  47. package/lib/cjs/components/Heading/index.js +1 -1
  48. package/lib/cjs/components/Hero/Hero.js +1 -1
  49. package/lib/cjs/components/Hero/HeroCard.js +1 -1
  50. package/lib/cjs/components/Hero/index.js +1 -1
  51. package/lib/cjs/components/Icon/Icon.js +3 -3
  52. package/lib/cjs/components/Icon/index.js +1 -1
  53. package/lib/cjs/components/Image/Image.js +1 -1
  54. package/lib/cjs/components/Image/index.js +1 -1
  55. package/lib/cjs/components/Input/Input.js +1 -1
  56. package/lib/cjs/components/Input/index.js +1 -1
  57. package/lib/cjs/components/Link/Link.js +1 -1
  58. package/lib/cjs/components/Link/index.js +1 -1
  59. package/lib/cjs/components/LinkList/LinkList.js +1 -1
  60. package/lib/cjs/components/LinkList/index.js +1 -1
  61. package/lib/cjs/components/List/List.js +4 -4
  62. package/lib/cjs/components/List/ListItem.js +2 -2
  63. package/lib/cjs/components/List/index.js +2 -2
  64. package/lib/cjs/components/Loading/Loading.js +1 -1
  65. package/lib/cjs/components/Loading/index.js +1 -1
  66. package/lib/cjs/components/LocalNav/LocalNav.js +4 -4
  67. package/lib/cjs/components/LocalNav/index.js +1 -1
  68. package/lib/cjs/components/Logo/Logo.js +15 -15
  69. package/lib/cjs/components/Logo/index.js +1 -1
  70. package/lib/cjs/components/LogoGrid/LogoGrid.js +1 -1
  71. package/lib/cjs/components/LogoGrid/index.js +1 -1
  72. package/lib/cjs/components/Navigation/Navigation.js +6 -6
  73. package/lib/cjs/components/Navigation/index.js +1 -1
  74. package/lib/cjs/components/Notification/Notification.js +3 -3
  75. package/lib/cjs/components/Notification/index.js +1 -1
  76. package/lib/cjs/components/NumberPicker/NumberPicker.js +4 -4
  77. package/lib/cjs/components/NumberPicker/index.js +1 -1
  78. package/lib/cjs/components/Pagination/Pagination.js +1 -1
  79. package/lib/cjs/components/Pagination/index.js +1 -1
  80. package/lib/cjs/components/Profile/Profile.js +1 -1
  81. package/lib/cjs/components/Profile/index.js +1 -1
  82. package/lib/cjs/components/Radio/Radio.js +5 -5
  83. package/lib/cjs/components/Radio/index.js +1 -1
  84. package/lib/cjs/components/ReadMore/ReadMore.js +4 -4
  85. package/lib/cjs/components/ReadMore/index.js +1 -1
  86. package/lib/cjs/components/RichText/RichText.js +1 -1
  87. package/lib/cjs/components/RichText/index.js +1 -1
  88. package/lib/cjs/components/SearchField/SearchField.js +3 -3
  89. package/lib/cjs/components/SearchField/index.js +1 -1
  90. package/lib/cjs/components/SocialMedia/SocialMedia.js +1 -1
  91. package/lib/cjs/components/SocialMedia/index.js +1 -1
  92. package/lib/cjs/components/TableOfContents/TableOfContents.js +1 -1
  93. package/lib/cjs/components/TableOfContents/index.js +1 -1
  94. package/lib/cjs/components/Tabs/Tabs.args.js +156 -0
  95. package/lib/cjs/components/Tabs/Tabs.js +24 -0
  96. package/lib/cjs/components/Tabs/index.js +15 -0
  97. package/lib/cjs/components/Tag/Tag.js +4 -4
  98. package/lib/cjs/components/Tag/TagSet.js +6 -6
  99. package/lib/cjs/components/Tag/index.js +2 -2
  100. package/lib/cjs/components/TextInput/TextInput.js +4 -4
  101. package/lib/cjs/components/TextInput/index.js +1 -1
  102. package/lib/cjs/components/Textarea/Textarea.js +4 -4
  103. package/lib/cjs/components/Textarea/index.js +1 -1
  104. package/lib/cjs/components/Toggle/Toggle.js +4 -4
  105. package/lib/cjs/components/Toggle/index.js +1 -1
  106. package/lib/cjs/components/Tooltip/Tooltip.js +5 -5
  107. package/lib/cjs/components/Tooltip/index.js +1 -1
  108. package/lib/cjs/components/Video/Video.js +11 -12
  109. package/lib/cjs/components/Video/VideoPlayer.js +55 -13
  110. package/lib/cjs/components/Video/index.js +6 -8
  111. package/lib/cjs/components/index.js +9 -8
  112. package/lib/cjs/hooks/index.js +1 -1
  113. package/lib/cjs/hooks/useGlobalSettings.js +3 -3
  114. package/lib/cjs/hooks/usePrevious.js +3 -3
  115. package/lib/cjs/hooks/useVideoPlayer.js +7 -7
  116. package/lib/cjs/index.js +9 -8
  117. package/lib/esm/components/Collapse/Collapse.js +1156 -6
  118. package/lib/esm/components/Collapse/index.js +0 -1
  119. package/lib/esm/components/FileUpload/FileUpload.js +3 -3
  120. package/lib/esm/components/NumberPicker/NumberPicker.js +3 -3
  121. package/lib/esm/components/Radio/Radio.js +3 -3
  122. package/lib/esm/components/Tabs/Tabs.args.js +154 -0
  123. package/lib/esm/components/Tabs/Tabs.js +22 -0
  124. package/lib/esm/components/Tabs/index.js +9 -0
  125. package/lib/esm/components/TextInput/TextInput.js +3 -3
  126. package/lib/esm/components/Textarea/Textarea.js +3 -3
  127. package/lib/esm/components/Video/Video.js +10 -11
  128. package/lib/esm/components/Video/VideoPlayer.js +57 -11
  129. package/lib/esm/components/Video/index.js +5 -7
  130. package/lib/esm/components/index.js +4 -4
  131. package/lib/esm/index.js +4 -4
  132. package/lib/types/react/src/components/Tabs/Tabs.args.d.ts +10 -0
  133. package/lib/types/react/src/components/Tabs/Tabs.d.ts +4 -0
  134. package/lib/types/react/src/components/Tabs/Tabs.props.d.ts +12 -0
  135. package/lib/types/react/src/components/Tabs/index.d.ts +1 -0
  136. package/lib/types/react/src/components/Video/Video.d.ts +2 -2
  137. package/lib/types/react/src/components/Video/Video.props.d.ts +5 -43
  138. package/lib/types/react/src/components/Video/VideoPlayer.d.ts +3 -3
  139. package/lib/types/react/src/components/Video/VideoPlayer.props.d.ts +6 -31
  140. package/lib/types/react/src/components/index.d.ts +1 -0
  141. package/package.json +9 -7
  142. package/src/components/Tabs/Tabs.args.tsx +201 -0
  143. package/src/components/Tabs/Tabs.props.ts +13 -0
  144. package/src/components/Tabs/Tabs.tsx +60 -0
  145. package/src/components/Tabs/index.ts +1 -0
  146. package/src/components/Video/Video.args.ts +18 -24
  147. package/src/components/Video/Video.props.ts +5 -47
  148. package/src/components/Video/Video.tsx +24 -19
  149. package/src/components/Video/VideoPlayer.props.ts +7 -38
  150. package/src/components/Video/VideoPlayer.tsx +67 -322
  151. package/src/components/index.ts +1 -0
  152. package/src/declarations.d.ts +22 -0
  153. package/lib/cjs/AccordionCtx-fe08ff45.js +0 -9
  154. package/lib/cjs/DailyMotion-17b56ecb.js +0 -259
  155. package/lib/cjs/Facebook-0c8d86ee.js +0 -239
  156. package/lib/cjs/FilePlayer-01d6dc08.js +0 -596
  157. package/lib/cjs/Kaltura-40e8e581.js +0 -235
  158. package/lib/cjs/ListCtx-7db7fe04.js +0 -9
  159. package/lib/cjs/Mixcloud-e23f49d6.js +0 -222
  160. package/lib/cjs/Preview-8e490f54.js +0 -227
  161. package/lib/cjs/SoundCloud-2500b6cb.js +0 -249
  162. package/lib/cjs/Streamable-00723065.js +0 -234
  163. package/lib/cjs/TagCtx-929c7753.js +0 -7
  164. package/lib/cjs/Twitch-2c5c5733.js +0 -244
  165. package/lib/cjs/VideoPlayer-5f0a64c6.js +0 -2067
  166. package/lib/cjs/Vidyard-d36d6c45.js +0 -237
  167. package/lib/cjs/Vimeo-d311e3b8.js +0 -285
  168. package/lib/cjs/Wistia-318b4e43.js +0 -288
  169. package/lib/cjs/YouTube-a3796a55.js +0 -377
  170. package/lib/cjs/index-0af02e81.js +0 -1154
  171. package/lib/esm/DailyMotion-989c2db3.js +0 -257
  172. package/lib/esm/Facebook-04e9cc59.js +0 -237
  173. package/lib/esm/FilePlayer-0789336d.js +0 -594
  174. package/lib/esm/Kaltura-a9ed37a9.js +0 -233
  175. package/lib/esm/Mixcloud-5a3b4353.js +0 -220
  176. package/lib/esm/Preview-7ca1835e.js +0 -225
  177. package/lib/esm/SoundCloud-47bccd79.js +0 -247
  178. package/lib/esm/Streamable-ee762126.js +0 -232
  179. package/lib/esm/Twitch-3cd4b54b.js +0 -242
  180. package/lib/esm/VideoPlayer-96c2b20c.js +0 -2062
  181. package/lib/esm/Vidyard-258ab0ef.js +0 -235
  182. package/lib/esm/Vimeo-4b29b580.js +0 -283
  183. package/lib/esm/Wistia-3cbce669.js +0 -286
  184. package/lib/esm/YouTube-db52da1c.js +0 -375
  185. package/lib/esm/index-623ce3f5.js +0 -1152
@@ -1,2062 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import require$$0, { useState, createRef, useCallback } from 'react';
3
- import { p as propTypes$1 } from './index-623ce3f5.js';
4
- import { findDOMNode } from 'react-dom';
5
- import classNames from 'classnames';
6
- import useGlobalSettings from './hooks/useGlobalSettings.js';
7
- import hoursMinutesSeconds from './utils/hoursMinutesSeconds.js';
8
- import screenfull from 'screenfull';
9
-
10
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11
-
12
- function getDefaultExportFromCjs (x) {
13
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
- }
15
-
16
- function getAugmentedNamespace(n) {
17
- var f = n.default;
18
- if (typeof f == "function") {
19
- var a = function () {
20
- return f.apply(this, arguments);
21
- };
22
- a.prototype = f.prototype;
23
- } else a = {};
24
- Object.defineProperty(a, '__esModule', {value: true});
25
- Object.keys(n).forEach(function (k) {
26
- var d = Object.getOwnPropertyDescriptor(n, k);
27
- Object.defineProperty(a, k, d.get ? d : {
28
- enumerable: true,
29
- get: function () {
30
- return n[k];
31
- }
32
- });
33
- });
34
- return a;
35
- }
36
-
37
- var lazy = {};
38
-
39
- var players = {};
40
-
41
- var utils = {};
42
-
43
- var loadScript = function load (src, opts, cb) {
44
- var head = document.head || document.getElementsByTagName('head')[0];
45
- var script = document.createElement('script');
46
-
47
- if (typeof opts === 'function') {
48
- cb = opts;
49
- opts = {};
50
- }
51
-
52
- opts = opts || {};
53
- cb = cb || function() {};
54
-
55
- script.type = opts.type || 'text/javascript';
56
- script.charset = opts.charset || 'utf8';
57
- script.async = 'async' in opts ? !!opts.async : true;
58
- script.src = src;
59
-
60
- if (opts.attrs) {
61
- setAttributes(script, opts.attrs);
62
- }
63
-
64
- if (opts.text) {
65
- script.text = '' + opts.text;
66
- }
67
-
68
- var onend = 'onload' in script ? stdOnEnd : ieOnEnd;
69
- onend(script, cb);
70
-
71
- // some good legacy browsers (firefox) fail the 'in' detection above
72
- // so as a fallback we always set onload
73
- // old IE will ignore this and new IE will set onload
74
- if (!script.onload) {
75
- stdOnEnd(script, cb);
76
- }
77
-
78
- head.appendChild(script);
79
- };
80
-
81
- function setAttributes(script, attrs) {
82
- for (var attr in attrs) {
83
- script.setAttribute(attr, attrs[attr]);
84
- }
85
- }
86
-
87
- function stdOnEnd (script, cb) {
88
- script.onload = function () {
89
- this.onerror = this.onload = null;
90
- cb(null, script);
91
- };
92
- script.onerror = function () {
93
- // this.onload = null here is necessary
94
- // because even IE9 works not like others
95
- this.onerror = this.onload = null;
96
- cb(new Error('Failed to load ' + this.src), script);
97
- };
98
- }
99
-
100
- function ieOnEnd (script, cb) {
101
- script.onreadystatechange = function () {
102
- if (this.readyState != 'complete' && this.readyState != 'loaded') return
103
- this.onreadystatechange = null;
104
- cb(null, script); // there is no way to catch loading errors in IE8
105
- };
106
- }
107
-
108
- var isMergeableObject = function isMergeableObject(value) {
109
- return isNonNullObject(value)
110
- && !isSpecial(value)
111
- };
112
-
113
- function isNonNullObject(value) {
114
- return !!value && typeof value === 'object'
115
- }
116
-
117
- function isSpecial(value) {
118
- var stringValue = Object.prototype.toString.call(value);
119
-
120
- return stringValue === '[object RegExp]'
121
- || stringValue === '[object Date]'
122
- || isReactElement(value)
123
- }
124
-
125
- // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
126
- var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
127
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
128
-
129
- function isReactElement(value) {
130
- return value.$$typeof === REACT_ELEMENT_TYPE
131
- }
132
-
133
- function emptyTarget(val) {
134
- return Array.isArray(val) ? [] : {}
135
- }
136
-
137
- function cloneUnlessOtherwiseSpecified(value, options) {
138
- return (options.clone !== false && options.isMergeableObject(value))
139
- ? deepmerge(emptyTarget(value), value, options)
140
- : value
141
- }
142
-
143
- function defaultArrayMerge(target, source, options) {
144
- return target.concat(source).map(function(element) {
145
- return cloneUnlessOtherwiseSpecified(element, options)
146
- })
147
- }
148
-
149
- function getMergeFunction(key, options) {
150
- if (!options.customMerge) {
151
- return deepmerge
152
- }
153
- var customMerge = options.customMerge(key);
154
- return typeof customMerge === 'function' ? customMerge : deepmerge
155
- }
156
-
157
- function getEnumerableOwnPropertySymbols(target) {
158
- return Object.getOwnPropertySymbols
159
- ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
160
- return Object.propertyIsEnumerable.call(target, symbol)
161
- })
162
- : []
163
- }
164
-
165
- function getKeys(target) {
166
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
167
- }
168
-
169
- function propertyIsOnObject(object, property) {
170
- try {
171
- return property in object
172
- } catch(_) {
173
- return false
174
- }
175
- }
176
-
177
- // Protects from prototype poisoning and unexpected merging up the prototype chain.
178
- function propertyIsUnsafe(target, key) {
179
- return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
180
- && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
181
- && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
182
- }
183
-
184
- function mergeObject(target, source, options) {
185
- var destination = {};
186
- if (options.isMergeableObject(target)) {
187
- getKeys(target).forEach(function(key) {
188
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
189
- });
190
- }
191
- getKeys(source).forEach(function(key) {
192
- if (propertyIsUnsafe(target, key)) {
193
- return
194
- }
195
-
196
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
197
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
198
- } else {
199
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
200
- }
201
- });
202
- return destination
203
- }
204
-
205
- function deepmerge(target, source, options) {
206
- options = options || {};
207
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
208
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
209
- // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
210
- // implementations can use it. The caller may not replace it.
211
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
212
-
213
- var sourceIsArray = Array.isArray(source);
214
- var targetIsArray = Array.isArray(target);
215
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
216
-
217
- if (!sourceAndTargetTypesMatch) {
218
- return cloneUnlessOtherwiseSpecified(source, options)
219
- } else if (sourceIsArray) {
220
- return options.arrayMerge(target, source, options)
221
- } else {
222
- return mergeObject(target, source, options)
223
- }
224
- }
225
-
226
- deepmerge.all = function deepmergeAll(array, options) {
227
- if (!Array.isArray(array)) {
228
- throw new Error('first argument should be an array')
229
- }
230
-
231
- return array.reduce(function(prev, next) {
232
- return deepmerge(prev, next, options)
233
- }, {})
234
- };
235
-
236
- var deepmerge_1 = deepmerge;
237
-
238
- var cjs = deepmerge_1;
239
-
240
- Object.defineProperty(utils, "__esModule", {
241
- value: true
242
- });
243
- utils.parseStartTime = parseStartTime;
244
- utils.parseEndTime = parseEndTime;
245
- utils.randomString = randomString;
246
- utils.queryString = queryString;
247
- utils.getSDK = getSDK;
248
- utils.getConfig = getConfig;
249
- utils.omit = omit;
250
- utils.callPlayer = callPlayer;
251
- utils.isMediaStream = isMediaStream;
252
- utils.isBlobUrl = isBlobUrl;
253
- utils.supportsWebKitPresentationMode = supportsWebKitPresentationMode;
254
-
255
- var _loadScript = _interopRequireDefault$2(loadScript);
256
-
257
- var _deepmerge$1 = _interopRequireDefault$2(cjs);
258
-
259
- function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
260
-
261
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest(); }
262
-
263
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
264
-
265
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(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$2(o, minLen); }
266
-
267
- function _arrayLikeToArray$2(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; }
268
-
269
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
270
-
271
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
272
-
273
- var MATCH_START_QUERY = /[?&#](?:start|t)=([0-9hms]+)/;
274
- var MATCH_END_QUERY = /[?&#]end=([0-9hms]+)/;
275
- var MATCH_START_STAMP = /(\d+)(h|m|s)/g;
276
- var MATCH_NUMERIC = /^\d+$/; // Parse YouTube URL for a start time param, ie ?t=1h14m30s
277
- // and return the start time in seconds
278
-
279
- function parseTimeParam(url, pattern) {
280
- if (url instanceof Array) {
281
- return undefined;
282
- }
283
-
284
- var match = url.match(pattern);
285
-
286
- if (match) {
287
- var stamp = match[1];
288
-
289
- if (stamp.match(MATCH_START_STAMP)) {
290
- return parseTimeString(stamp);
291
- }
292
-
293
- if (MATCH_NUMERIC.test(stamp)) {
294
- return parseInt(stamp);
295
- }
296
- }
297
-
298
- return undefined;
299
- }
300
-
301
- function parseTimeString(stamp) {
302
- var seconds = 0;
303
- var array = MATCH_START_STAMP.exec(stamp);
304
-
305
- while (array !== null) {
306
- var _array = array,
307
- _array2 = _slicedToArray(_array, 3),
308
- count = _array2[1],
309
- period = _array2[2];
310
-
311
- if (period === 'h') seconds += parseInt(count, 10) * 60 * 60;
312
- if (period === 'm') seconds += parseInt(count, 10) * 60;
313
- if (period === 's') seconds += parseInt(count, 10);
314
- array = MATCH_START_STAMP.exec(stamp);
315
- }
316
-
317
- return seconds;
318
- }
319
-
320
- function parseStartTime(url) {
321
- return parseTimeParam(url, MATCH_START_QUERY);
322
- }
323
-
324
- function parseEndTime(url) {
325
- return parseTimeParam(url, MATCH_END_QUERY);
326
- } // http://stackoverflow.com/a/38622545
327
-
328
-
329
- function randomString() {
330
- return Math.random().toString(36).substr(2, 5);
331
- }
332
-
333
- function queryString(object) {
334
- return Object.keys(object).map(function (key) {
335
- return "".concat(key, "=").concat(object[key]);
336
- }).join('&');
337
- }
338
-
339
- function getGlobal(key) {
340
- if (window[key]) {
341
- return window[key];
342
- }
343
-
344
- if (window.exports && window.exports[key]) {
345
- return window.exports[key];
346
- }
347
-
348
- if (window.module && window.module.exports && window.module.exports[key]) {
349
- return window.module.exports[key];
350
- }
351
-
352
- return null;
353
- } // Util function to load an external SDK
354
- // or return the SDK if it is already loaded
355
-
356
-
357
- var requests = {};
358
-
359
- function getSDK(url, sdkGlobal) {
360
- var sdkReady = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
361
- var isLoaded = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
362
- return true;
363
- };
364
- var fetchScript = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _loadScript["default"];
365
- var existingGlobal = getGlobal(sdkGlobal);
366
-
367
- if (existingGlobal && isLoaded(existingGlobal)) {
368
- return Promise.resolve(existingGlobal);
369
- }
370
-
371
- return new Promise(function (resolve, reject) {
372
- // If we are already loading the SDK, add the resolve and reject
373
- // functions to the existing array of requests
374
- if (requests[url]) {
375
- requests[url].push({
376
- resolve: resolve,
377
- reject: reject
378
- });
379
- return;
380
- }
381
-
382
- requests[url] = [{
383
- resolve: resolve,
384
- reject: reject
385
- }];
386
-
387
- var onLoaded = function onLoaded(sdk) {
388
- // When loaded, resolve all pending request promises
389
- requests[url].forEach(function (request) {
390
- return request.resolve(sdk);
391
- });
392
- };
393
-
394
- if (sdkReady) {
395
- var previousOnReady = window[sdkReady];
396
-
397
- window[sdkReady] = function () {
398
- if (previousOnReady) previousOnReady();
399
- onLoaded(getGlobal(sdkGlobal));
400
- };
401
- }
402
-
403
- fetchScript(url, function (err) {
404
- if (err) {
405
- // Loading the SDK failed – reject all requests and
406
- // reset the array of requests for this SDK
407
- requests[url].forEach(function (request) {
408
- return request.reject(err);
409
- });
410
- requests[url] = null;
411
- } else if (!sdkReady) {
412
- onLoaded(getGlobal(sdkGlobal));
413
- }
414
- });
415
- });
416
- }
417
-
418
- function getConfig(props, defaultProps) {
419
- return (0, _deepmerge$1["default"])(defaultProps.config, props.config);
420
- }
421
-
422
- function omit(object) {
423
- var _ref;
424
-
425
- for (var _len = arguments.length, arrays = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
426
- arrays[_key - 1] = arguments[_key];
427
- }
428
-
429
- var omitKeys = (_ref = []).concat.apply(_ref, arrays);
430
-
431
- var output = {};
432
- var keys = Object.keys(object);
433
-
434
- for (var _i2 = 0, _keys = keys; _i2 < _keys.length; _i2++) {
435
- var key = _keys[_i2];
436
-
437
- if (omitKeys.indexOf(key) === -1) {
438
- output[key] = object[key];
439
- }
440
- }
441
-
442
- return output;
443
- }
444
-
445
- function callPlayer(method) {
446
- var _this$player;
447
-
448
- // Util method for calling a method on this.player
449
- // but guard against errors and console.warn instead
450
- if (!this.player || !this.player[method]) {
451
- var message = "ReactPlayer: ".concat(this.constructor.displayName, " player could not call %c").concat(method, "%c \u2013 ");
452
-
453
- if (!this.player) {
454
- message += 'The player was not available';
455
- } else if (!this.player[method]) {
456
- message += 'The method was not available';
457
- }
458
-
459
- console.warn(message, 'font-weight: bold', '');
460
- return null;
461
- }
462
-
463
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
464
- args[_key2 - 1] = arguments[_key2];
465
- }
466
-
467
- return (_this$player = this.player)[method].apply(_this$player, args);
468
- }
469
-
470
- function isMediaStream(url) {
471
- return typeof window !== 'undefined' && typeof window.MediaStream !== 'undefined' && url instanceof window.MediaStream;
472
- }
473
-
474
- function isBlobUrl(url) {
475
- return /^blob:/.test(url);
476
- }
477
-
478
- function supportsWebKitPresentationMode() {
479
- var video = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.createElement('video');
480
- // Check if Safari supports PiP, and is not on mobile (other than iPad)
481
- // iPhone safari appears to "support" PiP through the check, however PiP does not function
482
- var notMobile = /iPhone|iPod/.test(navigator.userAgent) === false;
483
- return video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function' && notMobile;
484
- }
485
-
486
- var patterns = {};
487
-
488
- Object.defineProperty(patterns, "__esModule", {
489
- value: true
490
- });
491
- patterns.canPlay = patterns.FLV_EXTENSIONS = patterns.DASH_EXTENSIONS = patterns.HLS_EXTENSIONS = patterns.VIDEO_EXTENSIONS = patterns.AUDIO_EXTENSIONS = patterns.MATCH_URL_KALTURA = patterns.MATCH_URL_VIDYARD = patterns.MATCH_URL_MIXCLOUD = patterns.MATCH_URL_DAILYMOTION = patterns.MATCH_URL_TWITCH_CHANNEL = patterns.MATCH_URL_TWITCH_VIDEO = patterns.MATCH_URL_WISTIA = patterns.MATCH_URL_STREAMABLE = patterns.MATCH_URL_FACEBOOK_WATCH = patterns.MATCH_URL_FACEBOOK = patterns.MATCH_URL_VIMEO = patterns.MATCH_URL_SOUNDCLOUD = patterns.MATCH_URL_YOUTUBE = void 0;
492
-
493
- var _utils$1 = utils;
494
-
495
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
496
-
497
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(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$1(o, minLen); }
498
-
499
- function _arrayLikeToArray$1(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; }
500
-
501
- var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
502
- patterns.MATCH_URL_YOUTUBE = MATCH_URL_YOUTUBE;
503
- var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/;
504
- patterns.MATCH_URL_SOUNDCLOUD = MATCH_URL_SOUNDCLOUD;
505
- var MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/;
506
- patterns.MATCH_URL_VIMEO = MATCH_URL_VIMEO;
507
- var MATCH_URL_FACEBOOK = /^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/;
508
- patterns.MATCH_URL_FACEBOOK = MATCH_URL_FACEBOOK;
509
- var MATCH_URL_FACEBOOK_WATCH = /^https?:\/\/fb\.watch\/.+$/;
510
- patterns.MATCH_URL_FACEBOOK_WATCH = MATCH_URL_FACEBOOK_WATCH;
511
- var MATCH_URL_STREAMABLE = /streamable\.com\/([a-z0-9]+)$/;
512
- patterns.MATCH_URL_STREAMABLE = MATCH_URL_STREAMABLE;
513
- var MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?(.*)$/;
514
- patterns.MATCH_URL_WISTIA = MATCH_URL_WISTIA;
515
- var MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/;
516
- patterns.MATCH_URL_TWITCH_VIDEO = MATCH_URL_TWITCH_VIDEO;
517
- var MATCH_URL_TWITCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/;
518
- patterns.MATCH_URL_TWITCH_CHANNEL = MATCH_URL_TWITCH_CHANNEL;
519
- var MATCH_URL_DAILYMOTION = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?$/;
520
- patterns.MATCH_URL_DAILYMOTION = MATCH_URL_DAILYMOTION;
521
- var MATCH_URL_MIXCLOUD = /mixcloud\.com\/([^/]+\/[^/]+)/;
522
- patterns.MATCH_URL_MIXCLOUD = MATCH_URL_MIXCLOUD;
523
- var MATCH_URL_VIDYARD = /vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/;
524
- patterns.MATCH_URL_VIDYARD = MATCH_URL_VIDYARD;
525
- var MATCH_URL_KALTURA = /^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/;
526
- patterns.MATCH_URL_KALTURA = MATCH_URL_KALTURA;
527
- var AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i;
528
- patterns.AUDIO_EXTENSIONS = AUDIO_EXTENSIONS;
529
- var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
530
- patterns.VIDEO_EXTENSIONS = VIDEO_EXTENSIONS;
531
- var HLS_EXTENSIONS = /\.(m3u8)($|\?)/i;
532
- patterns.HLS_EXTENSIONS = HLS_EXTENSIONS;
533
- var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
534
- patterns.DASH_EXTENSIONS = DASH_EXTENSIONS;
535
- var FLV_EXTENSIONS = /\.(flv)($|\?)/i;
536
- patterns.FLV_EXTENSIONS = FLV_EXTENSIONS;
537
-
538
- var canPlayFile = function canPlayFile(url) {
539
- if (url instanceof Array) {
540
- var _iterator = _createForOfIteratorHelper(url),
541
- _step;
542
-
543
- try {
544
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
545
- var item = _step.value;
546
-
547
- if (typeof item === 'string' && canPlayFile(item)) {
548
- return true;
549
- }
550
-
551
- if (canPlayFile(item.src)) {
552
- return true;
553
- }
554
- }
555
- } catch (err) {
556
- _iterator.e(err);
557
- } finally {
558
- _iterator.f();
559
- }
560
-
561
- return false;
562
- }
563
-
564
- if ((0, _utils$1.isMediaStream)(url) || (0, _utils$1.isBlobUrl)(url)) {
565
- return true;
566
- }
567
-
568
- return AUDIO_EXTENSIONS.test(url) || VIDEO_EXTENSIONS.test(url) || HLS_EXTENSIONS.test(url) || DASH_EXTENSIONS.test(url) || FLV_EXTENSIONS.test(url);
569
- };
570
-
571
- var canPlay = {
572
- youtube: function youtube(url) {
573
- if (url instanceof Array) {
574
- return url.every(function (item) {
575
- return MATCH_URL_YOUTUBE.test(item);
576
- });
577
- }
578
-
579
- return MATCH_URL_YOUTUBE.test(url);
580
- },
581
- soundcloud: function soundcloud(url) {
582
- return MATCH_URL_SOUNDCLOUD.test(url) && !AUDIO_EXTENSIONS.test(url);
583
- },
584
- vimeo: function vimeo(url) {
585
- return MATCH_URL_VIMEO.test(url) && !VIDEO_EXTENSIONS.test(url) && !HLS_EXTENSIONS.test(url);
586
- },
587
- facebook: function facebook(url) {
588
- return MATCH_URL_FACEBOOK.test(url) || MATCH_URL_FACEBOOK_WATCH.test(url);
589
- },
590
- streamable: function streamable(url) {
591
- return MATCH_URL_STREAMABLE.test(url);
592
- },
593
- wistia: function wistia(url) {
594
- return MATCH_URL_WISTIA.test(url);
595
- },
596
- twitch: function twitch(url) {
597
- return MATCH_URL_TWITCH_VIDEO.test(url) || MATCH_URL_TWITCH_CHANNEL.test(url);
598
- },
599
- dailymotion: function dailymotion(url) {
600
- return MATCH_URL_DAILYMOTION.test(url);
601
- },
602
- mixcloud: function mixcloud(url) {
603
- return MATCH_URL_MIXCLOUD.test(url);
604
- },
605
- vidyard: function vidyard(url) {
606
- return MATCH_URL_VIDYARD.test(url);
607
- },
608
- kaltura: function kaltura(url) {
609
- return MATCH_URL_KALTURA.test(url);
610
- },
611
- file: canPlayFile
612
- };
613
- patterns.canPlay = canPlay;
614
-
615
- (function (exports) {
616
-
617
- Object.defineProperty(exports, "__esModule", {
618
- value: true
619
- });
620
- exports["default"] = void 0;
621
-
622
- var _react = require$$0;
623
-
624
- var _utils = utils;
625
-
626
- var _patterns = patterns;
627
-
628
- var _default = [{
629
- key: 'youtube',
630
- name: 'YouTube',
631
- canPlay: _patterns.canPlay.youtube,
632
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
633
- return import(
634
- /* webpackChunkName: 'reactPlayerYouTube' */
635
- './YouTube-db52da1c.js').then(function (n) { return n.Y; });
636
- })
637
- }, {
638
- key: 'soundcloud',
639
- name: 'SoundCloud',
640
- canPlay: _patterns.canPlay.soundcloud,
641
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
642
- return import(
643
- /* webpackChunkName: 'reactPlayerSoundCloud' */
644
- './SoundCloud-47bccd79.js').then(function (n) { return n.S; });
645
- })
646
- }, {
647
- key: 'vimeo',
648
- name: 'Vimeo',
649
- canPlay: _patterns.canPlay.vimeo,
650
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
651
- return import(
652
- /* webpackChunkName: 'reactPlayerVimeo' */
653
- './Vimeo-4b29b580.js').then(function (n) { return n.V; });
654
- })
655
- }, {
656
- key: 'facebook',
657
- name: 'Facebook',
658
- canPlay: _patterns.canPlay.facebook,
659
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
660
- return import(
661
- /* webpackChunkName: 'reactPlayerFacebook' */
662
- './Facebook-04e9cc59.js').then(function (n) { return n.F; });
663
- })
664
- }, {
665
- key: 'streamable',
666
- name: 'Streamable',
667
- canPlay: _patterns.canPlay.streamable,
668
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
669
- return import(
670
- /* webpackChunkName: 'reactPlayerStreamable' */
671
- './Streamable-ee762126.js').then(function (n) { return n.S; });
672
- })
673
- }, {
674
- key: 'wistia',
675
- name: 'Wistia',
676
- canPlay: _patterns.canPlay.wistia,
677
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
678
- return import(
679
- /* webpackChunkName: 'reactPlayerWistia' */
680
- './Wistia-3cbce669.js').then(function (n) { return n.W; });
681
- })
682
- }, {
683
- key: 'twitch',
684
- name: 'Twitch',
685
- canPlay: _patterns.canPlay.twitch,
686
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
687
- return import(
688
- /* webpackChunkName: 'reactPlayerTwitch' */
689
- './Twitch-3cd4b54b.js').then(function (n) { return n.T; });
690
- })
691
- }, {
692
- key: 'dailymotion',
693
- name: 'DailyMotion',
694
- canPlay: _patterns.canPlay.dailymotion,
695
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
696
- return import(
697
- /* webpackChunkName: 'reactPlayerDailyMotion' */
698
- './DailyMotion-989c2db3.js').then(function (n) { return n.D; });
699
- })
700
- }, {
701
- key: 'mixcloud',
702
- name: 'Mixcloud',
703
- canPlay: _patterns.canPlay.mixcloud,
704
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
705
- return import(
706
- /* webpackChunkName: 'reactPlayerMixcloud' */
707
- './Mixcloud-5a3b4353.js').then(function (n) { return n.M; });
708
- })
709
- }, {
710
- key: 'vidyard',
711
- name: 'Vidyard',
712
- canPlay: _patterns.canPlay.vidyard,
713
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
714
- return import(
715
- /* webpackChunkName: 'reactPlayerVidyard' */
716
- './Vidyard-258ab0ef.js').then(function (n) { return n.V; });
717
- })
718
- }, {
719
- key: 'kaltura',
720
- name: 'Kaltura',
721
- canPlay: _patterns.canPlay.kaltura,
722
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
723
- return import(
724
- /* webpackChunkName: 'reactPlayerKaltura' */
725
- './Kaltura-a9ed37a9.js').then(function (n) { return n.K; });
726
- })
727
- }, {
728
- key: 'file',
729
- name: 'FilePlayer',
730
- canPlay: _patterns.canPlay.file,
731
- canEnablePIP: function canEnablePIP(url) {
732
- return _patterns.canPlay.file(url) && (document.pictureInPictureEnabled || (0, _utils.supportsWebKitPresentationMode)()) && !_patterns.AUDIO_EXTENSIONS.test(url);
733
- },
734
- lazyPlayer: /*#__PURE__*/(0, _react.lazy)(function () {
735
- return import(
736
- /* webpackChunkName: 'reactPlayerFilePlayer' */
737
- './FilePlayer-0789336d.js').then(function (n) { return n.F; });
738
- })
739
- }];
740
- exports["default"] = _default;
741
- } (players));
742
-
743
- var ReactPlayer$1 = {};
744
-
745
- var safeIsNaN = Number.isNaN ||
746
- function ponyfill(value) {
747
- return typeof value === 'number' && value !== value;
748
- };
749
- function isEqual(first, second) {
750
- if (first === second) {
751
- return true;
752
- }
753
- if (safeIsNaN(first) && safeIsNaN(second)) {
754
- return true;
755
- }
756
- return false;
757
- }
758
- function areInputsEqual(newInputs, lastInputs) {
759
- if (newInputs.length !== lastInputs.length) {
760
- return false;
761
- }
762
- for (var i = 0; i < newInputs.length; i++) {
763
- if (!isEqual(newInputs[i], lastInputs[i])) {
764
- return false;
765
- }
766
- }
767
- return true;
768
- }
769
-
770
- function memoizeOne(resultFn, isEqual) {
771
- if (isEqual === void 0) { isEqual = areInputsEqual; }
772
- var lastThis;
773
- var lastArgs = [];
774
- var lastResult;
775
- var calledOnce = false;
776
- function memoized() {
777
- var newArgs = [];
778
- for (var _i = 0; _i < arguments.length; _i++) {
779
- newArgs[_i] = arguments[_i];
780
- }
781
- if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
782
- return lastResult;
783
- }
784
- lastResult = resultFn.apply(this, newArgs);
785
- calledOnce = true;
786
- lastThis = this;
787
- lastArgs = newArgs;
788
- return lastResult;
789
- }
790
- return memoized;
791
- }
792
-
793
- var memoizeOne_esm = /*#__PURE__*/Object.freeze({
794
- __proto__: null,
795
- default: memoizeOne
796
- });
797
-
798
- var require$$2 = /*@__PURE__*/getAugmentedNamespace(memoizeOne_esm);
799
-
800
- /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */
801
-
802
- var hasElementType = typeof Element !== 'undefined';
803
- var hasMap = typeof Map === 'function';
804
- var hasSet = typeof Set === 'function';
805
- var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;
806
-
807
- // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js
808
-
809
- function equal(a, b) {
810
- // START: fast-deep-equal es6/index.js 3.1.3
811
- if (a === b) return true;
812
-
813
- if (a && b && typeof a == 'object' && typeof b == 'object') {
814
- if (a.constructor !== b.constructor) return false;
815
-
816
- var length, i, keys;
817
- if (Array.isArray(a)) {
818
- length = a.length;
819
- if (length != b.length) return false;
820
- for (i = length; i-- !== 0;)
821
- if (!equal(a[i], b[i])) return false;
822
- return true;
823
- }
824
-
825
- // START: Modifications:
826
- // 1. Extra `has<Type> &&` helpers in initial condition allow es6 code
827
- // to co-exist with es5.
828
- // 2. Replace `for of` with es5 compliant iteration using `for`.
829
- // Basically, take:
830
- //
831
- // ```js
832
- // for (i of a.entries())
833
- // if (!b.has(i[0])) return false;
834
- // ```
835
- //
836
- // ... and convert to:
837
- //
838
- // ```js
839
- // it = a.entries();
840
- // while (!(i = it.next()).done)
841
- // if (!b.has(i.value[0])) return false;
842
- // ```
843
- //
844
- // **Note**: `i` access switches to `i.value`.
845
- var it;
846
- if (hasMap && (a instanceof Map) && (b instanceof Map)) {
847
- if (a.size !== b.size) return false;
848
- it = a.entries();
849
- while (!(i = it.next()).done)
850
- if (!b.has(i.value[0])) return false;
851
- it = a.entries();
852
- while (!(i = it.next()).done)
853
- if (!equal(i.value[1], b.get(i.value[0]))) return false;
854
- return true;
855
- }
856
-
857
- if (hasSet && (a instanceof Set) && (b instanceof Set)) {
858
- if (a.size !== b.size) return false;
859
- it = a.entries();
860
- while (!(i = it.next()).done)
861
- if (!b.has(i.value[0])) return false;
862
- return true;
863
- }
864
- // END: Modifications
865
-
866
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
867
- length = a.length;
868
- if (length != b.length) return false;
869
- for (i = length; i-- !== 0;)
870
- if (a[i] !== b[i]) return false;
871
- return true;
872
- }
873
-
874
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
875
- // START: Modifications:
876
- // Apply guards for `Object.create(null)` handling. See:
877
- // - https://github.com/FormidableLabs/react-fast-compare/issues/64
878
- // - https://github.com/epoberezkin/fast-deep-equal/issues/49
879
- if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf();
880
- if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString();
881
- // END: Modifications
882
-
883
- keys = Object.keys(a);
884
- length = keys.length;
885
- if (length !== Object.keys(b).length) return false;
886
-
887
- for (i = length; i-- !== 0;)
888
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
889
- // END: fast-deep-equal
890
-
891
- // START: react-fast-compare
892
- // custom handling for DOM elements
893
- if (hasElementType && a instanceof Element) return false;
894
-
895
- // custom handling for React/Preact
896
- for (i = length; i-- !== 0;) {
897
- if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {
898
- // React-specific: avoid traversing React elements' _owner
899
- // Preact-specific: avoid traversing Preact elements' __v and __o
900
- // __v = $_original / $_vnode
901
- // __o = $_owner
902
- // These properties contain circular references and are not needed when
903
- // comparing the actual elements (and not their owners)
904
- // .$$typeof and ._store on just reasonable markers of elements
905
-
906
- continue;
907
- }
908
-
909
- // all other properties should be traversed as usual
910
- if (!equal(a[keys[i]], b[keys[i]])) return false;
911
- }
912
- // END: react-fast-compare
913
-
914
- // START: fast-deep-equal
915
- return true;
916
- }
917
-
918
- return a !== a && b !== b;
919
- }
920
- // end fast-deep-equal
921
-
922
- var reactFastCompare = function isEqual(a, b) {
923
- try {
924
- return equal(a, b);
925
- } catch (error) {
926
- if (((error.message || '').match(/stack|recursion/i))) {
927
- // warn on circular references, don't crash
928
- // browsers give this different errors name and messages:
929
- // chrome/safari: "RangeError", "Maximum call stack size exceeded"
930
- // firefox: "InternalError", too much recursion"
931
- // edge: "Error", "Out of stack space"
932
- console.warn('react-fast-compare cannot handle circular refs');
933
- return false;
934
- }
935
- // some other error. we should definitely know about these
936
- throw error;
937
- }
938
- };
939
-
940
- var props = {};
941
-
942
- Object.defineProperty(props, "__esModule", {
943
- value: true
944
- });
945
- props.defaultProps = props.propTypes = void 0;
946
-
947
- var _propTypes = _interopRequireDefault$1(propTypes$1.exports);
948
-
949
- function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
950
-
951
- var string = _propTypes["default"].string,
952
- bool = _propTypes["default"].bool,
953
- number = _propTypes["default"].number,
954
- array = _propTypes["default"].array,
955
- oneOfType = _propTypes["default"].oneOfType,
956
- shape = _propTypes["default"].shape,
957
- object = _propTypes["default"].object,
958
- func = _propTypes["default"].func,
959
- node = _propTypes["default"].node;
960
- var propTypes = {
961
- url: oneOfType([string, array, object]),
962
- playing: bool,
963
- loop: bool,
964
- controls: bool,
965
- volume: number,
966
- muted: bool,
967
- playbackRate: number,
968
- width: oneOfType([string, number]),
969
- height: oneOfType([string, number]),
970
- style: object,
971
- progressInterval: number,
972
- playsinline: bool,
973
- pip: bool,
974
- stopOnUnmount: bool,
975
- light: oneOfType([bool, string]),
976
- playIcon: node,
977
- previewTabIndex: number,
978
- fallback: node,
979
- oEmbedUrl: string,
980
- wrapper: oneOfType([string, func, shape({
981
- render: func.isRequired
982
- })]),
983
- config: shape({
984
- soundcloud: shape({
985
- options: object
986
- }),
987
- youtube: shape({
988
- playerVars: object,
989
- embedOptions: object,
990
- onUnstarted: func
991
- }),
992
- facebook: shape({
993
- appId: string,
994
- version: string,
995
- playerId: string,
996
- attributes: object
997
- }),
998
- dailymotion: shape({
999
- params: object
1000
- }),
1001
- vimeo: shape({
1002
- playerOptions: object,
1003
- title: string
1004
- }),
1005
- file: shape({
1006
- attributes: object,
1007
- tracks: array,
1008
- forceVideo: bool,
1009
- forceAudio: bool,
1010
- forceHLS: bool,
1011
- forceDASH: bool,
1012
- forceFLV: bool,
1013
- hlsOptions: object,
1014
- hlsVersion: string,
1015
- dashVersion: string,
1016
- flvVersion: string
1017
- }),
1018
- wistia: shape({
1019
- options: object,
1020
- playerId: string,
1021
- customControls: array
1022
- }),
1023
- mixcloud: shape({
1024
- options: object
1025
- }),
1026
- twitch: shape({
1027
- options: object,
1028
- playerId: string
1029
- }),
1030
- vidyard: shape({
1031
- options: object
1032
- })
1033
- }),
1034
- onReady: func,
1035
- onStart: func,
1036
- onPlay: func,
1037
- onPause: func,
1038
- onBuffer: func,
1039
- onBufferEnd: func,
1040
- onEnded: func,
1041
- onError: func,
1042
- onDuration: func,
1043
- onSeek: func,
1044
- onPlaybackRateChange: func,
1045
- onProgress: func,
1046
- onClickPreview: func,
1047
- onEnablePIP: func,
1048
- onDisablePIP: func
1049
- };
1050
- props.propTypes = propTypes;
1051
-
1052
- var noop = function noop() {};
1053
-
1054
- var defaultProps = {
1055
- playing: false,
1056
- loop: false,
1057
- controls: false,
1058
- volume: null,
1059
- muted: false,
1060
- playbackRate: 1,
1061
- width: '640px',
1062
- height: '360px',
1063
- style: {},
1064
- progressInterval: 1000,
1065
- playsinline: false,
1066
- pip: false,
1067
- stopOnUnmount: true,
1068
- light: false,
1069
- fallback: null,
1070
- wrapper: 'div',
1071
- previewTabIndex: 0,
1072
- oEmbedUrl: 'https://noembed.com/embed?url={url}',
1073
- config: {
1074
- soundcloud: {
1075
- options: {
1076
- visual: true,
1077
- // Undocumented, but makes player fill container and look better
1078
- buying: false,
1079
- liking: false,
1080
- download: false,
1081
- sharing: false,
1082
- show_comments: false,
1083
- show_playcount: false
1084
- }
1085
- },
1086
- youtube: {
1087
- playerVars: {
1088
- playsinline: 1,
1089
- showinfo: 0,
1090
- rel: 0,
1091
- iv_load_policy: 3,
1092
- modestbranding: 1
1093
- },
1094
- embedOptions: {},
1095
- onUnstarted: noop
1096
- },
1097
- facebook: {
1098
- appId: '1309697205772819',
1099
- version: 'v3.3',
1100
- playerId: null,
1101
- attributes: {}
1102
- },
1103
- dailymotion: {
1104
- params: {
1105
- api: 1,
1106
- 'endscreen-enable': false
1107
- }
1108
- },
1109
- vimeo: {
1110
- playerOptions: {
1111
- autopause: false,
1112
- byline: false,
1113
- portrait: false,
1114
- title: false
1115
- },
1116
- title: null
1117
- },
1118
- file: {
1119
- attributes: {},
1120
- tracks: [],
1121
- forceVideo: false,
1122
- forceAudio: false,
1123
- forceHLS: false,
1124
- forceDASH: false,
1125
- forceFLV: false,
1126
- hlsOptions: {},
1127
- hlsVersion: '1.1.4',
1128
- dashVersion: '3.1.3',
1129
- flvVersion: '1.5.0'
1130
- },
1131
- wistia: {
1132
- options: {},
1133
- playerId: null,
1134
- customControls: null
1135
- },
1136
- mixcloud: {
1137
- options: {
1138
- hide_cover: 1
1139
- }
1140
- },
1141
- twitch: {
1142
- options: {},
1143
- playerId: null
1144
- },
1145
- vidyard: {
1146
- options: {}
1147
- }
1148
- },
1149
- onReady: noop,
1150
- onStart: noop,
1151
- onPlay: noop,
1152
- onPause: noop,
1153
- onBuffer: noop,
1154
- onBufferEnd: noop,
1155
- onEnded: noop,
1156
- onError: noop,
1157
- onDuration: noop,
1158
- onSeek: noop,
1159
- onPlaybackRateChange: noop,
1160
- onProgress: noop,
1161
- onClickPreview: noop,
1162
- onEnablePIP: noop,
1163
- onDisablePIP: noop
1164
- };
1165
- props.defaultProps = defaultProps;
1166
-
1167
- var Player = {};
1168
-
1169
- (function (exports) {
1170
-
1171
- 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); }
1172
-
1173
- Object.defineProperty(exports, "__esModule", {
1174
- value: true
1175
- });
1176
- exports["default"] = void 0;
1177
-
1178
- var _react = _interopRequireWildcard(require$$0);
1179
-
1180
- var _reactFastCompare = _interopRequireDefault(reactFastCompare);
1181
-
1182
- var _props = props;
1183
-
1184
- var _utils = utils;
1185
-
1186
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1187
-
1188
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
1189
-
1190
- 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; }
1191
-
1192
- 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); }
1193
-
1194
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1195
-
1196
- 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); } }
1197
-
1198
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1199
-
1200
- 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); }
1201
-
1202
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1203
-
1204
- 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); }; }
1205
-
1206
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1207
-
1208
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1209
-
1210
- 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; } }
1211
-
1212
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1213
-
1214
- 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; }
1215
-
1216
- var SEEK_ON_PLAY_EXPIRY = 5000;
1217
-
1218
- var Player = /*#__PURE__*/function (_Component) {
1219
- _inherits(Player, _Component);
1220
-
1221
- var _super = _createSuper(Player);
1222
-
1223
- function Player() {
1224
- var _this;
1225
-
1226
- _classCallCheck(this, Player);
1227
-
1228
- for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
1229
- _args[_key] = arguments[_key];
1230
- }
1231
-
1232
- _this = _super.call.apply(_super, [this].concat(_args));
1233
-
1234
- _defineProperty(_assertThisInitialized(_this), "mounted", false);
1235
-
1236
- _defineProperty(_assertThisInitialized(_this), "isReady", false);
1237
-
1238
- _defineProperty(_assertThisInitialized(_this), "isPlaying", false);
1239
-
1240
- _defineProperty(_assertThisInitialized(_this), "isLoading", true);
1241
-
1242
- _defineProperty(_assertThisInitialized(_this), "loadOnReady", null);
1243
-
1244
- _defineProperty(_assertThisInitialized(_this), "startOnPlay", true);
1245
-
1246
- _defineProperty(_assertThisInitialized(_this), "seekOnPlay", null);
1247
-
1248
- _defineProperty(_assertThisInitialized(_this), "onDurationCalled", false);
1249
-
1250
- _defineProperty(_assertThisInitialized(_this), "handlePlayerMount", function (player) {
1251
- if (_this.player) return; // Prevent loading twice in strict mode
1252
-
1253
- _this.player = player;
1254
-
1255
- _this.player.load(_this.props.url);
1256
-
1257
- _this.progress();
1258
- });
1259
-
1260
- _defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function (key) {
1261
- if (!_this.player) return null;
1262
- return _this.player[key];
1263
- });
1264
-
1265
- _defineProperty(_assertThisInitialized(_this), "progress", function () {
1266
- if (_this.props.url && _this.player && _this.isReady) {
1267
- var playedSeconds = _this.getCurrentTime() || 0;
1268
-
1269
- var loadedSeconds = _this.getSecondsLoaded();
1270
-
1271
- var duration = _this.getDuration();
1272
-
1273
- if (duration) {
1274
- var progress = {
1275
- playedSeconds: playedSeconds,
1276
- played: playedSeconds / duration
1277
- };
1278
-
1279
- if (loadedSeconds !== null) {
1280
- progress.loadedSeconds = loadedSeconds;
1281
- progress.loaded = loadedSeconds / duration;
1282
- } // Only call onProgress if values have changed
1283
-
1284
-
1285
- if (progress.playedSeconds !== _this.prevPlayed || progress.loadedSeconds !== _this.prevLoaded) {
1286
- _this.props.onProgress(progress);
1287
- }
1288
-
1289
- _this.prevPlayed = progress.playedSeconds;
1290
- _this.prevLoaded = progress.loadedSeconds;
1291
- }
1292
- }
1293
-
1294
- _this.progressTimeout = setTimeout(_this.progress, _this.props.progressFrequency || _this.props.progressInterval);
1295
- });
1296
-
1297
- _defineProperty(_assertThisInitialized(_this), "handleReady", function () {
1298
- if (!_this.mounted) return;
1299
- _this.isReady = true;
1300
- _this.isLoading = false;
1301
- var _this$props = _this.props,
1302
- onReady = _this$props.onReady,
1303
- playing = _this$props.playing,
1304
- volume = _this$props.volume,
1305
- muted = _this$props.muted;
1306
- onReady();
1307
-
1308
- if (!muted && volume !== null) {
1309
- _this.player.setVolume(volume);
1310
- }
1311
-
1312
- if (_this.loadOnReady) {
1313
- _this.player.load(_this.loadOnReady, true);
1314
-
1315
- _this.loadOnReady = null;
1316
- } else if (playing) {
1317
- _this.player.play();
1318
- }
1319
-
1320
- _this.handleDurationCheck();
1321
- });
1322
-
1323
- _defineProperty(_assertThisInitialized(_this), "handlePlay", function () {
1324
- _this.isPlaying = true;
1325
- _this.isLoading = false;
1326
- var _this$props2 = _this.props,
1327
- onStart = _this$props2.onStart,
1328
- onPlay = _this$props2.onPlay,
1329
- playbackRate = _this$props2.playbackRate;
1330
-
1331
- if (_this.startOnPlay) {
1332
- if (_this.player.setPlaybackRate && playbackRate !== 1) {
1333
- _this.player.setPlaybackRate(playbackRate);
1334
- }
1335
-
1336
- onStart();
1337
- _this.startOnPlay = false;
1338
- }
1339
-
1340
- onPlay();
1341
-
1342
- if (_this.seekOnPlay) {
1343
- _this.seekTo(_this.seekOnPlay);
1344
-
1345
- _this.seekOnPlay = null;
1346
- }
1347
-
1348
- _this.handleDurationCheck();
1349
- });
1350
-
1351
- _defineProperty(_assertThisInitialized(_this), "handlePause", function (e) {
1352
- _this.isPlaying = false;
1353
-
1354
- if (!_this.isLoading) {
1355
- _this.props.onPause(e);
1356
- }
1357
- });
1358
-
1359
- _defineProperty(_assertThisInitialized(_this), "handleEnded", function () {
1360
- var _this$props3 = _this.props,
1361
- activePlayer = _this$props3.activePlayer,
1362
- loop = _this$props3.loop,
1363
- onEnded = _this$props3.onEnded;
1364
-
1365
- if (activePlayer.loopOnEnded && loop) {
1366
- _this.seekTo(0);
1367
- }
1368
-
1369
- if (!loop) {
1370
- _this.isPlaying = false;
1371
- onEnded();
1372
- }
1373
- });
1374
-
1375
- _defineProperty(_assertThisInitialized(_this), "handleError", function () {
1376
- var _this$props4;
1377
-
1378
- _this.isLoading = false;
1379
-
1380
- (_this$props4 = _this.props).onError.apply(_this$props4, arguments);
1381
- });
1382
-
1383
- _defineProperty(_assertThisInitialized(_this), "handleDurationCheck", function () {
1384
- clearTimeout(_this.durationCheckTimeout);
1385
-
1386
- var duration = _this.getDuration();
1387
-
1388
- if (duration) {
1389
- if (!_this.onDurationCalled) {
1390
- _this.props.onDuration(duration);
1391
-
1392
- _this.onDurationCalled = true;
1393
- }
1394
- } else {
1395
- _this.durationCheckTimeout = setTimeout(_this.handleDurationCheck, 100);
1396
- }
1397
- });
1398
-
1399
- _defineProperty(_assertThisInitialized(_this), "handleLoaded", function () {
1400
- // Sometimes we know loading has stopped but onReady/onPlay are never called
1401
- // so this provides a way for players to avoid getting stuck
1402
- _this.isLoading = false;
1403
- });
1404
-
1405
- return _this;
1406
- }
1407
-
1408
- _createClass(Player, [{
1409
- key: "componentDidMount",
1410
- value: function componentDidMount() {
1411
- this.mounted = true;
1412
- }
1413
- }, {
1414
- key: "componentWillUnmount",
1415
- value: function componentWillUnmount() {
1416
- clearTimeout(this.progressTimeout);
1417
- clearTimeout(this.durationCheckTimeout);
1418
-
1419
- if (this.isReady && this.props.stopOnUnmount) {
1420
- this.player.stop();
1421
-
1422
- if (this.player.disablePIP) {
1423
- this.player.disablePIP();
1424
- }
1425
- }
1426
-
1427
- this.mounted = false;
1428
- }
1429
- }, {
1430
- key: "componentDidUpdate",
1431
- value: function componentDidUpdate(prevProps) {
1432
- var _this2 = this;
1433
-
1434
- // If there isn’t a player available, don’t do anything
1435
- if (!this.player) {
1436
- return;
1437
- } // Invoke player methods based on changed props
1438
-
1439
-
1440
- var _this$props5 = this.props,
1441
- url = _this$props5.url,
1442
- playing = _this$props5.playing,
1443
- volume = _this$props5.volume,
1444
- muted = _this$props5.muted,
1445
- playbackRate = _this$props5.playbackRate,
1446
- pip = _this$props5.pip,
1447
- loop = _this$props5.loop,
1448
- activePlayer = _this$props5.activePlayer,
1449
- disableDeferredLoading = _this$props5.disableDeferredLoading;
1450
-
1451
- if (!(0, _reactFastCompare["default"])(prevProps.url, url)) {
1452
- if (this.isLoading && !activePlayer.forceLoad && !disableDeferredLoading && !(0, _utils.isMediaStream)(url)) {
1453
- console.warn("ReactPlayer: the attempt to load ".concat(url, " is being deferred until the player has loaded"));
1454
- this.loadOnReady = url;
1455
- return;
1456
- }
1457
-
1458
- this.isLoading = true;
1459
- this.startOnPlay = true;
1460
- this.onDurationCalled = false;
1461
- this.player.load(url, this.isReady);
1462
- }
1463
-
1464
- if (!prevProps.playing && playing && !this.isPlaying) {
1465
- this.player.play();
1466
- }
1467
-
1468
- if (prevProps.playing && !playing && this.isPlaying) {
1469
- this.player.pause();
1470
- }
1471
-
1472
- if (!prevProps.pip && pip && this.player.enablePIP) {
1473
- this.player.enablePIP();
1474
- }
1475
-
1476
- if (prevProps.pip && !pip && this.player.disablePIP) {
1477
- this.player.disablePIP();
1478
- }
1479
-
1480
- if (prevProps.volume !== volume && volume !== null) {
1481
- this.player.setVolume(volume);
1482
- }
1483
-
1484
- if (prevProps.muted !== muted) {
1485
- if (muted) {
1486
- this.player.mute();
1487
- } else {
1488
- this.player.unmute();
1489
-
1490
- if (volume !== null) {
1491
- // Set volume next tick to fix a bug with DailyMotion
1492
- setTimeout(function () {
1493
- return _this2.player.setVolume(volume);
1494
- });
1495
- }
1496
- }
1497
- }
1498
-
1499
- if (prevProps.playbackRate !== playbackRate && this.player.setPlaybackRate) {
1500
- this.player.setPlaybackRate(playbackRate);
1501
- }
1502
-
1503
- if (prevProps.loop !== loop && this.player.setLoop) {
1504
- this.player.setLoop(loop);
1505
- }
1506
- }
1507
- }, {
1508
- key: "getDuration",
1509
- value: function getDuration() {
1510
- if (!this.isReady) return null;
1511
- return this.player.getDuration();
1512
- }
1513
- }, {
1514
- key: "getCurrentTime",
1515
- value: function getCurrentTime() {
1516
- if (!this.isReady) return null;
1517
- return this.player.getCurrentTime();
1518
- }
1519
- }, {
1520
- key: "getSecondsLoaded",
1521
- value: function getSecondsLoaded() {
1522
- if (!this.isReady) return null;
1523
- return this.player.getSecondsLoaded();
1524
- }
1525
- }, {
1526
- key: "seekTo",
1527
- value: function seekTo(amount, type) {
1528
- var _this3 = this;
1529
-
1530
- // When seeking before player is ready, store value and seek later
1531
- if (!this.isReady) {
1532
- if (amount !== 0) {
1533
- this.seekOnPlay = amount;
1534
- setTimeout(function () {
1535
- _this3.seekOnPlay = null;
1536
- }, SEEK_ON_PLAY_EXPIRY);
1537
- }
1538
-
1539
- return;
1540
- }
1541
-
1542
- var isFraction = !type ? amount > 0 && amount < 1 : type === 'fraction';
1543
-
1544
- if (isFraction) {
1545
- // Convert fraction to seconds based on duration
1546
- var duration = this.player.getDuration();
1547
-
1548
- if (!duration) {
1549
- console.warn('ReactPlayer: could not seek using fraction – duration not yet available');
1550
- return;
1551
- }
1552
-
1553
- this.player.seekTo(duration * amount);
1554
- return;
1555
- }
1556
-
1557
- this.player.seekTo(amount);
1558
- }
1559
- }, {
1560
- key: "render",
1561
- value: function render() {
1562
- var Player = this.props.activePlayer;
1563
-
1564
- if (!Player) {
1565
- return null;
1566
- }
1567
-
1568
- return /*#__PURE__*/_react["default"].createElement(Player, _extends({}, this.props, {
1569
- onMount: this.handlePlayerMount,
1570
- onReady: this.handleReady,
1571
- onPlay: this.handlePlay,
1572
- onPause: this.handlePause,
1573
- onEnded: this.handleEnded,
1574
- onLoaded: this.handleLoaded,
1575
- onError: this.handleError
1576
- }));
1577
- }
1578
- }]);
1579
-
1580
- return Player;
1581
- }(_react.Component);
1582
-
1583
- exports["default"] = Player;
1584
-
1585
- _defineProperty(Player, "displayName", 'Player');
1586
-
1587
- _defineProperty(Player, "propTypes", _props.propTypes);
1588
-
1589
- _defineProperty(Player, "defaultProps", _props.defaultProps);
1590
- } (Player));
1591
-
1592
- 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); }
1593
-
1594
- Object.defineProperty(ReactPlayer$1, "__esModule", {
1595
- value: true
1596
- });
1597
- ReactPlayer$1.createReactPlayer = void 0;
1598
-
1599
- var _react = _interopRequireWildcard(require$$0);
1600
-
1601
- var _deepmerge = _interopRequireDefault(cjs);
1602
-
1603
- var _memoizeOne = _interopRequireDefault(require$$2);
1604
-
1605
- var _reactFastCompare = _interopRequireDefault(reactFastCompare);
1606
-
1607
- var _props = props;
1608
-
1609
- var _utils = utils;
1610
-
1611
- var _Player3 = _interopRequireDefault(Player);
1612
-
1613
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1614
-
1615
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
1616
-
1617
- 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; }
1618
-
1619
- 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; }
1620
-
1621
- 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; }
1622
-
1623
- 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); }
1624
-
1625
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1626
-
1627
- 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."); }
1628
-
1629
- 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); }
1630
-
1631
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
1632
-
1633
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1634
-
1635
- 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; }
1636
-
1637
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1638
-
1639
- 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); } }
1640
-
1641
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1642
-
1643
- 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); }
1644
-
1645
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1646
-
1647
- 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); }; }
1648
-
1649
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1650
-
1651
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1652
-
1653
- 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; } }
1654
-
1655
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1656
-
1657
- 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; }
1658
-
1659
- var Preview = /*#__PURE__*/(0, _react.lazy)(function () {
1660
- return import(
1661
- /* webpackChunkName: 'reactPlayerPreview' */
1662
- './Preview-7ca1835e.js').then(function (n) { return n.P; });
1663
- });
1664
- var IS_BROWSER = typeof window !== 'undefined' && window.document;
1665
- var IS_GLOBAL = typeof commonjsGlobal !== 'undefined' && commonjsGlobal.window && commonjsGlobal.window.document;
1666
- var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server
1667
- // as Suspense is not supported yet
1668
-
1669
- var UniversalSuspense = IS_BROWSER || IS_GLOBAL ? _react.Suspense : function () {
1670
- return null;
1671
- };
1672
- var customPlayers = [];
1673
-
1674
- var createReactPlayer = function createReactPlayer(players, fallback) {
1675
- var _class, _temp;
1676
-
1677
- return _temp = _class = /*#__PURE__*/function (_Component) {
1678
- _inherits(ReactPlayer, _Component);
1679
-
1680
- var _super = _createSuper(ReactPlayer);
1681
-
1682
- function ReactPlayer() {
1683
- var _this;
1684
-
1685
- _classCallCheck(this, ReactPlayer);
1686
-
1687
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1688
- args[_key] = arguments[_key];
1689
- }
1690
-
1691
- _this = _super.call.apply(_super, [this].concat(args));
1692
-
1693
- _defineProperty(_assertThisInitialized(_this), "state", {
1694
- showPreview: !!_this.props.light
1695
- });
1696
-
1697
- _defineProperty(_assertThisInitialized(_this), "references", {
1698
- wrapper: function wrapper(_wrapper) {
1699
- _this.wrapper = _wrapper;
1700
- },
1701
- player: function player(_player) {
1702
- _this.player = _player;
1703
- }
1704
- });
1705
-
1706
- _defineProperty(_assertThisInitialized(_this), "handleClickPreview", function (e) {
1707
- _this.setState({
1708
- showPreview: false
1709
- });
1710
-
1711
- _this.props.onClickPreview(e);
1712
- });
1713
-
1714
- _defineProperty(_assertThisInitialized(_this), "showPreview", function () {
1715
- _this.setState({
1716
- showPreview: true
1717
- });
1718
- });
1719
-
1720
- _defineProperty(_assertThisInitialized(_this), "getDuration", function () {
1721
- if (!_this.player) return null;
1722
- return _this.player.getDuration();
1723
- });
1724
-
1725
- _defineProperty(_assertThisInitialized(_this), "getCurrentTime", function () {
1726
- if (!_this.player) return null;
1727
- return _this.player.getCurrentTime();
1728
- });
1729
-
1730
- _defineProperty(_assertThisInitialized(_this), "getSecondsLoaded", function () {
1731
- if (!_this.player) return null;
1732
- return _this.player.getSecondsLoaded();
1733
- });
1734
-
1735
- _defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function () {
1736
- var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'player';
1737
- if (!_this.player) return null;
1738
- return _this.player.getInternalPlayer(key);
1739
- });
1740
-
1741
- _defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type) {
1742
- if (!_this.player) return null;
1743
-
1744
- _this.player.seekTo(fraction, type);
1745
- });
1746
-
1747
- _defineProperty(_assertThisInitialized(_this), "handleReady", function () {
1748
- _this.props.onReady(_assertThisInitialized(_this));
1749
- });
1750
-
1751
- _defineProperty(_assertThisInitialized(_this), "getActivePlayer", (0, _memoizeOne["default"])(function (url) {
1752
- for (var _i = 0, _arr = [].concat(customPlayers, _toConsumableArray(players)); _i < _arr.length; _i++) {
1753
- var player = _arr[_i];
1754
-
1755
- if (player.canPlay(url)) {
1756
- return player;
1757
- }
1758
- }
1759
-
1760
- if (fallback) {
1761
- return fallback;
1762
- }
1763
-
1764
- return null;
1765
- }));
1766
-
1767
- _defineProperty(_assertThisInitialized(_this), "getConfig", (0, _memoizeOne["default"])(function (url, key) {
1768
- var config = _this.props.config;
1769
- return _deepmerge["default"].all([_props.defaultProps.config, _props.defaultProps.config[key] || {}, config, config[key] || {}]);
1770
- }));
1771
-
1772
- _defineProperty(_assertThisInitialized(_this), "getAttributes", (0, _memoizeOne["default"])(function (url) {
1773
- return (0, _utils.omit)(_this.props, SUPPORTED_PROPS);
1774
- }));
1775
-
1776
- _defineProperty(_assertThisInitialized(_this), "renderActivePlayer", function (url) {
1777
- if (!url) return null;
1778
-
1779
- var player = _this.getActivePlayer(url);
1780
-
1781
- if (!player) return null;
1782
-
1783
- var config = _this.getConfig(url, player.key);
1784
-
1785
- return /*#__PURE__*/_react["default"].createElement(_Player3["default"], _extends({}, _this.props, {
1786
- key: player.key,
1787
- ref: _this.references.player,
1788
- config: config,
1789
- activePlayer: player.lazyPlayer || player,
1790
- onReady: _this.handleReady
1791
- }));
1792
- });
1793
-
1794
- return _this;
1795
- }
1796
-
1797
- _createClass(ReactPlayer, [{
1798
- key: "shouldComponentUpdate",
1799
- value: function shouldComponentUpdate(nextProps, nextState) {
1800
- return !(0, _reactFastCompare["default"])(this.props, nextProps) || !(0, _reactFastCompare["default"])(this.state, nextState);
1801
- }
1802
- }, {
1803
- key: "componentDidUpdate",
1804
- value: function componentDidUpdate(prevProps) {
1805
- var light = this.props.light;
1806
-
1807
- if (!prevProps.light && light) {
1808
- this.setState({
1809
- showPreview: true
1810
- });
1811
- }
1812
-
1813
- if (prevProps.light && !light) {
1814
- this.setState({
1815
- showPreview: false
1816
- });
1817
- }
1818
- }
1819
- }, {
1820
- key: "renderPreview",
1821
- value: function renderPreview(url) {
1822
- if (!url) return null;
1823
- var _this$props = this.props,
1824
- light = _this$props.light,
1825
- playIcon = _this$props.playIcon,
1826
- previewTabIndex = _this$props.previewTabIndex,
1827
- oEmbedUrl = _this$props.oEmbedUrl;
1828
- return /*#__PURE__*/_react["default"].createElement(Preview, {
1829
- url: url,
1830
- light: light,
1831
- playIcon: playIcon,
1832
- previewTabIndex: previewTabIndex,
1833
- oEmbedUrl: oEmbedUrl,
1834
- onClick: this.handleClickPreview
1835
- });
1836
- }
1837
- }, {
1838
- key: "render",
1839
- value: function render() {
1840
- var _this$props2 = this.props,
1841
- url = _this$props2.url,
1842
- style = _this$props2.style,
1843
- width = _this$props2.width,
1844
- height = _this$props2.height,
1845
- fallback = _this$props2.fallback,
1846
- Wrapper = _this$props2.wrapper;
1847
- var showPreview = this.state.showPreview;
1848
- var attributes = this.getAttributes(url);
1849
- return /*#__PURE__*/_react["default"].createElement(Wrapper, _extends({
1850
- ref: this.references.wrapper,
1851
- style: _objectSpread(_objectSpread({}, style), {}, {
1852
- width: width,
1853
- height: height
1854
- })
1855
- }, attributes), /*#__PURE__*/_react["default"].createElement(UniversalSuspense, {
1856
- fallback: fallback
1857
- }, showPreview ? this.renderPreview(url) : this.renderActivePlayer(url)));
1858
- }
1859
- }]);
1860
-
1861
- return ReactPlayer;
1862
- }(_react.Component), _defineProperty(_class, "displayName", 'ReactPlayer'), _defineProperty(_class, "propTypes", _props.propTypes), _defineProperty(_class, "defaultProps", _props.defaultProps), _defineProperty(_class, "addCustomPlayer", function (player) {
1863
- customPlayers.push(player);
1864
- }), _defineProperty(_class, "removeCustomPlayers", function () {
1865
- customPlayers.length = 0;
1866
- }), _defineProperty(_class, "canPlay", function (url) {
1867
- for (var _i2 = 0, _arr2 = [].concat(customPlayers, _toConsumableArray(players)); _i2 < _arr2.length; _i2++) {
1868
- var _Player = _arr2[_i2];
1869
-
1870
- if (_Player.canPlay(url)) {
1871
- return true;
1872
- }
1873
- }
1874
-
1875
- return false;
1876
- }), _defineProperty(_class, "canEnablePIP", function (url) {
1877
- for (var _i3 = 0, _arr3 = [].concat(customPlayers, _toConsumableArray(players)); _i3 < _arr3.length; _i3++) {
1878
- var _Player2 = _arr3[_i3];
1879
-
1880
- if (_Player2.canEnablePIP && _Player2.canEnablePIP(url)) {
1881
- return true;
1882
- }
1883
- }
1884
-
1885
- return false;
1886
- }), _temp;
1887
- };
1888
-
1889
- ReactPlayer$1.createReactPlayer = createReactPlayer;
1890
-
1891
- (function (exports) {
1892
-
1893
- Object.defineProperty(exports, "__esModule", {
1894
- value: true
1895
- });
1896
- exports["default"] = void 0;
1897
-
1898
- var _players = _interopRequireDefault(players);
1899
-
1900
- var _ReactPlayer = ReactPlayer$1;
1901
-
1902
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1903
-
1904
- // Fall back to FilePlayer if nothing else can play the URL
1905
- var fallback = _players["default"][_players["default"].length - 1];
1906
-
1907
- var _default = (0, _ReactPlayer.createReactPlayer)(_players["default"], fallback);
1908
-
1909
- exports["default"] = _default;
1910
- } (lazy));
1911
-
1912
- var RP = /*@__PURE__*/getDefaultExportFromCjs(lazy);
1913
-
1914
- const ReactPlayer = RP;
1915
- const VideoPlayer = ({ controls, src, poster, youtube, tracks, }) => {
1916
- var _a;
1917
- const { prefix } = useGlobalSettings();
1918
- const baseClass = `${prefix}--legacyvideo`;
1919
- const playerClasses = classNames("", {
1920
- [`${baseClass}--player`]: true,
1921
- [`youtube`]: youtube,
1922
- });
1923
- const controlsClasses = classNames("", {
1924
- [`${baseClass}--controls`]: true,
1925
- });
1926
- /**
1927
- * State hooks for our player controls
1928
- */
1929
- const [duration, setDuration] = useState("0:00");
1930
- const [playedtime, setPlayedtime] = useState("0:00");
1931
- const [buffer, setBuffer] = useState(0);
1932
- const [playing, setPlaying] = useState(false);
1933
- const [playhead, setPlayhead] = useState(0);
1934
- const [volume, setVolume] = useState(0.8);
1935
- const [muted, setMute] = useState(false);
1936
- const [showposter, showPoster] = useState(true);
1937
- const [showvolume, showVolume] = useState(false);
1938
- const [seeking, setSeeking] = useState(false);
1939
- /**
1940
- * Ref for the video element
1941
- */
1942
- const videoElement = createRef();
1943
- /**
1944
- * Ref for the video container
1945
- */
1946
- const videoContainer = createRef();
1947
- const youtubeparams = {
1948
- controls: 0,
1949
- modestbranding: 1,
1950
- };
1951
- const playerconfig = {
1952
- file: {
1953
- tracks: tracks || [],
1954
- },
1955
- youtube: youtube ? { playerVars: youtubeparams } : {},
1956
- };
1957
- /**
1958
- * Fullscreen functionality
1959
- */
1960
- const toggleFullscreen = () => {
1961
- /* This is a known issue with ReactPlayer */
1962
- /* @ts-ignore */
1963
- screenfull.request(findDOMNode(videoContainer.current));
1964
- };
1965
- /**
1966
- * Play/pause functionality
1967
- */
1968
- const togglePlay = () => {
1969
- setPlaying(!playing);
1970
- showPoster(false);
1971
- };
1972
- /**
1973
- * Show volume slider
1974
- */
1975
- const showVolumeSlider = () => {
1976
- showVolume(true);
1977
- };
1978
- /**
1979
- * Hide volume slider
1980
- */
1981
- const hideVolumeSlider = () => {
1982
- setTimeout(() => {
1983
- showVolume(false);
1984
- }, 2000);
1985
- };
1986
- /**
1987
- * Mute/unmute
1988
- */
1989
- const toggleMute = () => {
1990
- setMute(!muted);
1991
- hideVolumeSlider();
1992
- };
1993
- /**
1994
- * Volume change
1995
- */
1996
- const handleVolumeChange = (event) => {
1997
- console.log("handleVolumeChange", event.target.value);
1998
- setVolume(event.target.value * 0.1);
1999
- };
2000
- /**
2001
- * Begin seek
2002
- */
2003
- const handleSeekMouseDown = () => {
2004
- setSeeking(true);
2005
- };
2006
- /**
2007
- * Seek
2008
- */
2009
- const handleSeekChange = (event) => {
2010
- setPlayhead(parseFloat(event.target.value));
2011
- };
2012
- /**
2013
- * End seek
2014
- */
2015
- const handleSeekMouseUp = (event) => {
2016
- setSeeking(false);
2017
- /* This is a known issue with ReactPlayer */
2018
- /* @ts-ignore */
2019
- videoElement.current.seekTo(parseFloat(event.target.value));
2020
- };
2021
- /**
2022
- * handle display of progress
2023
- */
2024
- const handleProgress = (state) => {
2025
- if (!seeking) {
2026
- setPlayhead(state.played);
2027
- setBuffer(state.loaded);
2028
- setPlayedtime(hoursMinutesSeconds(state.playedSeconds));
2029
- }
2030
- };
2031
- /**
2032
- * get the duration to display
2033
- */
2034
- const handleDuration = (duration) => {
2035
- setDuration(hoursMinutesSeconds(duration));
2036
- };
2037
- /**
2038
- * on video end
2039
- */
2040
- const handleEnded = () => {
2041
- setPlaying(false);
2042
- setSeeking(false);
2043
- };
2044
- const handlePlayHover = useCallback((event, state) => {
2045
- const element = event.currentTarget;
2046
- if (!element.classList.contains(`${controlsClasses}--play`)) {
2047
- return;
2048
- }
2049
- const duration = element.previousSibling;
2050
- if (duration instanceof HTMLLabelElement) {
2051
- duration.classList.toggle(`${controlsClasses}--duration--hovered`, state);
2052
- }
2053
- }, [controlsClasses]);
2054
- 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) &&
2055
- poster.url
2056
- .sort((a, b) => parseFloat(a.breakpoint) - parseFloat(b.breakpoint))
2057
- .slice(1)
2058
- .reverse()
2059
- .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, onMouseOver: (e) => handlePlayHover(e, true), onFocus: (e) => handlePlayHover(e, true), onMouseOut: (e) => handlePlayHover(e, false), onBlur: (e) => handlePlayHover(e, false) }, { 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 }) }))] }))] })));
2060
- };
2061
-
2062
- export { VideoPlayer as V, getDefaultExportFromCjs as g, patterns as p, utils as u };