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