video-react-player 0.1.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 (105) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +23 -0
  3. package/README.md +584 -0
  4. package/dist/Manager.d.ts +36 -0
  5. package/dist/actions/player.d.ts +124 -0
  6. package/dist/actions/video.d.ts +161 -0
  7. package/dist/components/Bezel.d.ts +22 -0
  8. package/dist/components/BigPlayButton.d.ts +20 -0
  9. package/dist/components/ClickableComponent.d.ts +24 -0
  10. package/dist/components/LoadingSpinner.d.ts +11 -0
  11. package/dist/components/Player.d.ts +82 -0
  12. package/dist/components/PosterImage.d.ts +12 -0
  13. package/dist/components/Shortcut.d.ts +48 -0
  14. package/dist/components/Slider.d.ts +49 -0
  15. package/dist/components/Source.d.ts +25 -0
  16. package/dist/components/Video.d.ts +48 -0
  17. package/dist/components/control-bar/ClosedCaptionButton.d.ts +19 -0
  18. package/dist/components/control-bar/ControlBar.d.ts +17 -0
  19. package/dist/components/control-bar/DownloadButton.d.ts +17 -0
  20. package/dist/components/control-bar/ForwardControl.d.ts +13 -0
  21. package/dist/components/control-bar/ForwardReplayControl.d.ts +17 -0
  22. package/dist/components/control-bar/FullscreenToggle.d.ts +5 -0
  23. package/dist/components/control-bar/LoadProgressBar.d.ts +18 -0
  24. package/dist/components/control-bar/LoopToggle.d.ts +5 -0
  25. package/dist/components/control-bar/MouseTimeDisplay.d.ts +22 -0
  26. package/dist/components/control-bar/PictureInPictureToggle.d.ts +15 -0
  27. package/dist/components/control-bar/PlayProgressBar.d.ts +12 -0
  28. package/dist/components/control-bar/PlayToggle.d.ts +13 -0
  29. package/dist/components/control-bar/PlaybackRate.d.ts +14 -0
  30. package/dist/components/control-bar/PlaybackRateMenuButton.d.ts +17 -0
  31. package/dist/components/control-bar/ProgressControl.d.ts +16 -0
  32. package/dist/components/control-bar/QualityMenuButton.d.ts +17 -0
  33. package/dist/components/control-bar/ReplayControl.d.ts +13 -0
  34. package/dist/components/control-bar/ScreenshotButton.d.ts +14 -0
  35. package/dist/components/control-bar/SeekBar.d.ts +18 -0
  36. package/dist/components/control-bar/TheaterModeToggle.d.ts +14 -0
  37. package/dist/components/control-bar/VolumeMenuButton.d.ts +17 -0
  38. package/dist/components/menu/Menu.d.ts +15 -0
  39. package/dist/components/menu/MenuButton.d.ts +46 -0
  40. package/dist/components/menu/MenuItem.d.ts +22 -0
  41. package/dist/components/popup/Popup.d.ts +15 -0
  42. package/dist/components/popup/PopupButton.d.ts +19 -0
  43. package/dist/components/time-controls/CurrentTimeDisplay.d.ts +18 -0
  44. package/dist/components/time-controls/DurationDisplay.d.ts +12 -0
  45. package/dist/components/time-controls/RemainingTimeDisplay.d.ts +13 -0
  46. package/dist/components/time-controls/TimeDivider.d.ts +10 -0
  47. package/dist/components/volume-control/VolumeBar.d.ts +33 -0
  48. package/dist/components/volume-control/VolumeControl.d.ts +16 -0
  49. package/dist/components/volume-control/VolumeLevel.d.ts +9 -0
  50. package/dist/index.d.ts +46 -0
  51. package/dist/reducers/index.d.ts +11 -0
  52. package/dist/reducers/operation.d.ts +10 -0
  53. package/dist/reducers/player.d.ts +33 -0
  54. package/dist/types/component.d.ts +13 -0
  55. package/dist/types/player.d.ts +31 -0
  56. package/dist/utils/browser.d.ts +5 -0
  57. package/dist/utils/dom.d.ts +31 -0
  58. package/dist/utils/fullscreen.d.ts +16 -0
  59. package/dist/utils/index.d.ts +24 -0
  60. package/dist/video-react-new.cjs.js +3904 -0
  61. package/dist/video-react-new.css +1155 -0
  62. package/dist/video-react-new.d.ts +11 -0
  63. package/dist/video-react-new.es.js +3861 -0
  64. package/dist/video-react-new.full.js +4578 -0
  65. package/dist/video-react-new.full.min.js +2 -0
  66. package/dist/video-react-new.js +4283 -0
  67. package/dist/video-react-new.min.js +2 -0
  68. package/dist/video-react-player.cjs.js +3904 -0
  69. package/dist/video-react-player.css +1155 -0
  70. package/dist/video-react-player.d.ts +11 -0
  71. package/dist/video-react-player.es.js +3861 -0
  72. package/dist/video-react-player.full.js +4578 -0
  73. package/dist/video-react-player.full.min.js +2 -0
  74. package/dist/video-react-player.js +4283 -0
  75. package/dist/video-react-player.min.js +2 -0
  76. package/package.json +145 -0
  77. package/styles/fonts/video-react.eot +0 -0
  78. package/styles/fonts/video-react.svg +43 -0
  79. package/styles/fonts/video-react.ttf +0 -0
  80. package/styles/fonts/video-react.woff +0 -0
  81. package/styles/icons.json +584 -0
  82. package/styles/scss/components/bezel.scss +119 -0
  83. package/styles/scss/components/big-play-button.scss +45 -0
  84. package/styles/scss/components/button.scss +18 -0
  85. package/styles/scss/components/closed-caption.scss +13 -0
  86. package/styles/scss/components/control-bar.scss +51 -0
  87. package/styles/scss/components/control.scss +42 -0
  88. package/styles/scss/components/fullscreen.scss +13 -0
  89. package/styles/scss/components/loading-spinner.scss +105 -0
  90. package/styles/scss/components/menu/menu-inline.scss +67 -0
  91. package/styles/scss/components/menu/menu-popup.scss +27 -0
  92. package/styles/scss/components/menu/menu.scss +59 -0
  93. package/styles/scss/components/new-controls.scss +42 -0
  94. package/styles/scss/components/play-pause.scss +11 -0
  95. package/styles/scss/components/playback-rate.scss +13 -0
  96. package/styles/scss/components/poster.scss +27 -0
  97. package/styles/scss/components/progress.scss +157 -0
  98. package/styles/scss/components/slider.scss +13 -0
  99. package/styles/scss/components/time.scss +18 -0
  100. package/styles/scss/components/volume.scss +147 -0
  101. package/styles/scss/icons.scss +278 -0
  102. package/styles/scss/layout.scss +115 -0
  103. package/styles/scss/mixins.scss +117 -0
  104. package/styles/scss/variables.scss +16 -0
  105. package/styles/scss/video-react-player.scss +34 -0
@@ -0,0 +1,4283 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('redux')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'redux'], factory) :
4
+ (global = global || self, factory(global['video-react-player'] = {}, global.React, global.Redux));
5
+ }(this, function (exports, React, redux) { 'use strict';
6
+
7
+ var React__default = 'default' in React ? React['default'] : React;
8
+
9
+ function _assertThisInitialized(e) {
10
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11
+ return e;
12
+ }
13
+ function _defineProperties(e, r) {
14
+ for (var t = 0; t < r.length; t++) {
15
+ var o = r[t];
16
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
17
+ }
18
+ }
19
+ function _createClass(e, r, t) {
20
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
21
+ writable: !1
22
+ }), e;
23
+ }
24
+ function _extends() {
25
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
26
+ for (var e = 1; e < arguments.length; e++) {
27
+ var t = arguments[e];
28
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
29
+ }
30
+ return n;
31
+ }, _extends.apply(null, arguments);
32
+ }
33
+ function _inheritsLoose(t, o) {
34
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
35
+ }
36
+ function _objectWithoutPropertiesLoose(r, e) {
37
+ if (null == r) return {};
38
+ var t = {};
39
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
40
+ if (-1 !== e.indexOf(n)) continue;
41
+ t[n] = r[n];
42
+ }
43
+ return t;
44
+ }
45
+ function _setPrototypeOf(t, e) {
46
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
47
+ return t.__proto__ = e, t;
48
+ }, _setPrototypeOf(t, e);
49
+ }
50
+ function _toPrimitive(t, r) {
51
+ if ("object" != typeof t || !t) return t;
52
+ var e = t[Symbol.toPrimitive];
53
+ if (void 0 !== e) {
54
+ var i = e.call(t, r || "default");
55
+ if ("object" != typeof i) return i;
56
+ throw new TypeError("@@toPrimitive must return a primitive value.");
57
+ }
58
+ return ("string" === r ? String : Number)(t);
59
+ }
60
+ function _toPropertyKey(t) {
61
+ var i = _toPrimitive(t, "string");
62
+ return "symbol" == typeof i ? i : i + "";
63
+ }
64
+
65
+ function unwrapExports (x) {
66
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
67
+ }
68
+
69
+ function createCommonjsModule(fn, module) {
70
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
71
+ }
72
+
73
+ var classnames = createCommonjsModule(function (module) {
74
+ /*!
75
+ Copyright (c) 2017 Jed Watson.
76
+ Licensed under the MIT License (MIT), see
77
+ http://jedwatson.github.io/classnames
78
+ */
79
+ /* global define */
80
+
81
+ (function () {
82
+
83
+ var hasOwn = {}.hasOwnProperty;
84
+ function classNames() {
85
+ var classes = [];
86
+ for (var i = 0; i < arguments.length; i++) {
87
+ var arg = arguments[i];
88
+ if (!arg) continue;
89
+ var argType = typeof arg;
90
+ if (argType === 'string' || argType === 'number') {
91
+ classes.push(arg);
92
+ } else if (Array.isArray(arg) && arg.length) {
93
+ var inner = classNames.apply(null, arg);
94
+ if (inner) {
95
+ classes.push(inner);
96
+ }
97
+ } else if (argType === 'object') {
98
+ for (var key in arg) {
99
+ if (hasOwn.call(arg, key) && arg[key]) {
100
+ classes.push(key);
101
+ }
102
+ }
103
+ }
104
+ }
105
+ return classes.join(' ');
106
+ }
107
+ if (module.exports) {
108
+ classNames.default = classNames;
109
+ module.exports = classNames;
110
+ } else {
111
+ window.classNames = classNames;
112
+ }
113
+ })();
114
+ });
115
+
116
+ /**
117
+
118
+ * Copyright (c) 2016 Video-React contributors
119
+ * Copyright (c) 2025 ZingMe.Vn
120
+ *
121
+ * This source code is licensed under the MIT license found in the
122
+ * LICENSE file in the root directory of this source tree.
123
+ */
124
+ var LOAD_START = 'video-react-player/LOAD_START';
125
+ var CAN_PLAY = 'video-react-player/CAN_PLAY';
126
+ var WAITING = 'video-react-player/WAITING';
127
+ var CAN_PLAY_THROUGH = 'video-react-player/CAN_PLAY_THROUGH';
128
+ var PLAYING = 'video-react-player/PLAYING';
129
+ var PLAY = 'video-react-player/PLAY';
130
+ var PAUSE = 'video-react-player/PAUSE';
131
+ var END = 'video-react-player/END';
132
+ var SEEKING = 'video-react-player/SEEKING';
133
+ var SEEKED = 'video-react-player/SEEKED';
134
+ var SEEKING_TIME = 'video-react-player/SEEKING_TIME';
135
+ var END_SEEKING = 'video-react-player/END_SEEKING';
136
+ var DURATION_CHANGE = 'video-react-player/DURATION_CHANGE';
137
+ var TIME_UPDATE = 'video-react-player/TIME_UPDATE';
138
+ var VOLUME_CHANGE = 'video-react-player/VOLUME_CHANGE';
139
+ var PROGRESS_CHANGE = 'video-react-player/PROGRESS_CHANGE';
140
+ var RATE_CHANGE = 'video-react-player/RATE_CHANGE';
141
+ var SUSPEND = 'video-react-player/SUSPEND';
142
+ var ABORT = 'video-react-player/ABORT';
143
+ var EMPTIED = 'video-react-player/EMPTIED';
144
+ var STALLED = 'video-react-player/STALLED';
145
+ var LOADED_META_DATA = 'video-react-player/LOADED_META_DATA';
146
+ var LOADED_DATA = 'video-react-player/LOADED_DATA';
147
+ var RESIZE = 'video-react-player/RESIZE';
148
+ var ERROR = 'video-react-player/ERROR';
149
+ var ACTIVATE_TEXT_TRACK = 'video-react-player/ACTIVATE_TEXT_TRACK';
150
+ var PICTURE_IN_PICTURE_CHANGE = 'video-react-player/PICTURE_IN_PICTURE_CHANGE';
151
+ var LOOP_CHANGE = 'video-react-player/LOOP_CHANGE';
152
+ var THEATER_MODE_CHANGE = 'video-react-player/THEATER_MODE_CHANGE';
153
+ var QUALITY_CHANGE = 'video-react-player/QUALITY_CHANGE';
154
+ function handleLoadStart(videoProps) {
155
+ return {
156
+ type: LOAD_START,
157
+ videoProps: videoProps
158
+ };
159
+ }
160
+ function handleCanPlay(videoProps) {
161
+ return {
162
+ type: CAN_PLAY,
163
+ videoProps: videoProps
164
+ };
165
+ }
166
+ function handleWaiting(videoProps) {
167
+ return {
168
+ type: WAITING,
169
+ videoProps: videoProps
170
+ };
171
+ }
172
+ function handleCanPlayThrough(videoProps) {
173
+ return {
174
+ type: CAN_PLAY_THROUGH,
175
+ videoProps: videoProps
176
+ };
177
+ }
178
+ function handlePlaying(videoProps) {
179
+ return {
180
+ type: PLAYING,
181
+ videoProps: videoProps
182
+ };
183
+ }
184
+ function handlePlay(videoProps) {
185
+ return {
186
+ type: PLAY,
187
+ videoProps: videoProps
188
+ };
189
+ }
190
+ function handlePause(videoProps) {
191
+ return {
192
+ type: PAUSE,
193
+ videoProps: videoProps
194
+ };
195
+ }
196
+ function handleEnd(videoProps) {
197
+ return {
198
+ type: END,
199
+ videoProps: videoProps
200
+ };
201
+ }
202
+ function handleSeeking(videoProps) {
203
+ return {
204
+ type: SEEKING,
205
+ videoProps: videoProps
206
+ };
207
+ }
208
+ function handleSeeked(videoProps) {
209
+ return {
210
+ type: SEEKED,
211
+ videoProps: videoProps
212
+ };
213
+ }
214
+ function handleDurationChange(videoProps) {
215
+ return {
216
+ type: DURATION_CHANGE,
217
+ videoProps: videoProps
218
+ };
219
+ }
220
+ function handleTimeUpdate(videoProps) {
221
+ return {
222
+ type: TIME_UPDATE,
223
+ videoProps: videoProps
224
+ };
225
+ }
226
+ function handleVolumeChange(videoProps) {
227
+ return {
228
+ type: VOLUME_CHANGE,
229
+ videoProps: videoProps
230
+ };
231
+ }
232
+ function handleProgressChange(videoProps) {
233
+ return {
234
+ type: PROGRESS_CHANGE,
235
+ videoProps: videoProps
236
+ };
237
+ }
238
+ function handleRateChange(videoProps) {
239
+ return {
240
+ type: RATE_CHANGE,
241
+ videoProps: videoProps
242
+ };
243
+ }
244
+ function handleSuspend(videoProps) {
245
+ return {
246
+ type: SUSPEND,
247
+ videoProps: videoProps
248
+ };
249
+ }
250
+ function handleAbort(videoProps) {
251
+ return {
252
+ type: ABORT,
253
+ videoProps: videoProps
254
+ };
255
+ }
256
+ function handleEmptied(videoProps) {
257
+ return {
258
+ type: EMPTIED,
259
+ videoProps: videoProps
260
+ };
261
+ }
262
+ function handleStalled(videoProps) {
263
+ return {
264
+ type: STALLED,
265
+ videoProps: videoProps
266
+ };
267
+ }
268
+ function handleLoadedMetaData(videoProps) {
269
+ return {
270
+ type: LOADED_META_DATA,
271
+ videoProps: videoProps
272
+ };
273
+ }
274
+ function handleLoadedData(videoProps) {
275
+ return {
276
+ type: LOADED_DATA,
277
+ videoProps: videoProps
278
+ };
279
+ }
280
+ function handleResize(videoProps) {
281
+ return {
282
+ type: RESIZE,
283
+ videoProps: videoProps
284
+ };
285
+ }
286
+ function handleError(videoProps) {
287
+ return {
288
+ type: ERROR,
289
+ videoProps: videoProps
290
+ };
291
+ }
292
+ function handleSeekingTime(time) {
293
+ return {
294
+ type: SEEKING_TIME,
295
+ time: time
296
+ };
297
+ }
298
+ function handleEndSeeking(time) {
299
+ return {
300
+ type: END_SEEKING,
301
+ time: time
302
+ };
303
+ }
304
+ function activateTextTrack(textTrack) {
305
+ return {
306
+ type: ACTIVATE_TEXT_TRACK,
307
+ textTrack: textTrack
308
+ };
309
+ }
310
+ function handlePictureInPictureChange(isPictureInPicture) {
311
+ return {
312
+ type: PICTURE_IN_PICTURE_CHANGE,
313
+ isPictureInPicture: isPictureInPicture
314
+ };
315
+ }
316
+ function handleLoopChange(loop) {
317
+ return {
318
+ type: LOOP_CHANGE,
319
+ loop: loop
320
+ };
321
+ }
322
+ function handleTheaterModeChange(isTheater) {
323
+ return {
324
+ type: THEATER_MODE_CHANGE,
325
+ isTheater: isTheater
326
+ };
327
+ }
328
+ function handleQualityChange(quality) {
329
+ return {
330
+ type: QUALITY_CHANGE,
331
+ quality: quality
332
+ };
333
+ }
334
+
335
+ var videoActions = /*#__PURE__*/Object.freeze({
336
+ LOAD_START: LOAD_START,
337
+ CAN_PLAY: CAN_PLAY,
338
+ WAITING: WAITING,
339
+ CAN_PLAY_THROUGH: CAN_PLAY_THROUGH,
340
+ PLAYING: PLAYING,
341
+ PLAY: PLAY,
342
+ PAUSE: PAUSE,
343
+ END: END,
344
+ SEEKING: SEEKING,
345
+ SEEKED: SEEKED,
346
+ SEEKING_TIME: SEEKING_TIME,
347
+ END_SEEKING: END_SEEKING,
348
+ DURATION_CHANGE: DURATION_CHANGE,
349
+ TIME_UPDATE: TIME_UPDATE,
350
+ VOLUME_CHANGE: VOLUME_CHANGE,
351
+ PROGRESS_CHANGE: PROGRESS_CHANGE,
352
+ RATE_CHANGE: RATE_CHANGE,
353
+ SUSPEND: SUSPEND,
354
+ ABORT: ABORT,
355
+ EMPTIED: EMPTIED,
356
+ STALLED: STALLED,
357
+ LOADED_META_DATA: LOADED_META_DATA,
358
+ LOADED_DATA: LOADED_DATA,
359
+ RESIZE: RESIZE,
360
+ ERROR: ERROR,
361
+ ACTIVATE_TEXT_TRACK: ACTIVATE_TEXT_TRACK,
362
+ PICTURE_IN_PICTURE_CHANGE: PICTURE_IN_PICTURE_CHANGE,
363
+ LOOP_CHANGE: LOOP_CHANGE,
364
+ THEATER_MODE_CHANGE: THEATER_MODE_CHANGE,
365
+ QUALITY_CHANGE: QUALITY_CHANGE,
366
+ handleLoadStart: handleLoadStart,
367
+ handleCanPlay: handleCanPlay,
368
+ handleWaiting: handleWaiting,
369
+ handleCanPlayThrough: handleCanPlayThrough,
370
+ handlePlaying: handlePlaying,
371
+ handlePlay: handlePlay,
372
+ handlePause: handlePause,
373
+ handleEnd: handleEnd,
374
+ handleSeeking: handleSeeking,
375
+ handleSeeked: handleSeeked,
376
+ handleDurationChange: handleDurationChange,
377
+ handleTimeUpdate: handleTimeUpdate,
378
+ handleVolumeChange: handleVolumeChange,
379
+ handleProgressChange: handleProgressChange,
380
+ handleRateChange: handleRateChange,
381
+ handleSuspend: handleSuspend,
382
+ handleAbort: handleAbort,
383
+ handleEmptied: handleEmptied,
384
+ handleStalled: handleStalled,
385
+ handleLoadedMetaData: handleLoadedMetaData,
386
+ handleLoadedData: handleLoadedData,
387
+ handleResize: handleResize,
388
+ handleError: handleError,
389
+ handleSeekingTime: handleSeekingTime,
390
+ handleEndSeeking: handleEndSeeking,
391
+ activateTextTrack: activateTextTrack,
392
+ handlePictureInPictureChange: handlePictureInPictureChange,
393
+ handleLoopChange: handleLoopChange,
394
+ handleTheaterModeChange: handleTheaterModeChange,
395
+ handleQualityChange: handleQualityChange
396
+ });
397
+
398
+ // Lazily grab the document to avoid SSR "document is not defined" errors.
399
+ var doc = typeof document !== 'undefined' ? document : null;
400
+ var Fullscreen = /*#__PURE__*/function () {
401
+ function Fullscreen() {}
402
+ var _proto = Fullscreen.prototype;
403
+ _proto.request = function request(elm) {
404
+ if (elm.requestFullscreen) {
405
+ elm.requestFullscreen();
406
+ } else if (elm.webkitRequestFullscreen) {
407
+ elm.webkitRequestFullscreen();
408
+ } else if (elm.mozRequestFullScreen) {
409
+ elm.mozRequestFullScreen();
410
+ } else if (elm.msRequestFullscreen) {
411
+ elm.msRequestFullscreen();
412
+ }
413
+ };
414
+ _proto.exit = function exit() {
415
+ if (!doc) {
416
+ return;
417
+ }
418
+ if (doc.exitFullscreen) {
419
+ doc.exitFullscreen();
420
+ } else if (doc.webkitExitFullscreen) {
421
+ doc.webkitExitFullscreen();
422
+ } else if (doc.mozCancelFullScreen) {
423
+ doc.mozCancelFullScreen();
424
+ } else if (doc.msExitFullscreen) {
425
+ doc.msExitFullscreen();
426
+ }
427
+ };
428
+ _proto.addEventListener = function addEventListener(handler) {
429
+ if (!doc) {
430
+ return;
431
+ }
432
+ doc.addEventListener('fullscreenchange', handler);
433
+ doc.addEventListener('webkitfullscreenchange', handler);
434
+ doc.addEventListener('mozfullscreenchange', handler);
435
+ doc.addEventListener('MSFullscreenChange', handler);
436
+ };
437
+ _proto.removeEventListener = function removeEventListener(handler) {
438
+ if (!doc) {
439
+ return;
440
+ }
441
+ doc.removeEventListener('fullscreenchange', handler);
442
+ doc.removeEventListener('webkitfullscreenchange', handler);
443
+ doc.removeEventListener('mozfullscreenchange', handler);
444
+ doc.removeEventListener('MSFullscreenChange', handler);
445
+ };
446
+ _createClass(Fullscreen, [{
447
+ key: "isFullscreen",
448
+ get: function get() {
449
+ if (!doc) {
450
+ return null;
451
+ }
452
+ return doc.fullscreenElement || doc.webkitFullscreenElement || doc.mozFullScreenElement || doc.msFullscreenElement;
453
+ }
454
+ }, {
455
+ key: "enabled",
456
+ get: function get() {
457
+ if (!doc) {
458
+ return false;
459
+ }
460
+ return doc.fullscreenEnabled || doc.webkitFullscreenEnabled || doc.mozFullScreenEnabled || doc.msFullscreenEnabled;
461
+ }
462
+ }]);
463
+ return Fullscreen;
464
+ }();
465
+ var fullscreen = new Fullscreen();
466
+
467
+ /**
468
+
469
+ * Copyright (c) 2016 Video-React contributors
470
+ * Copyright (c) 2025 ZingMe.Vn
471
+ *
472
+ * This source code is licensed under the MIT license found in the
473
+ * LICENSE file in the root directory of this source tree.
474
+ */
475
+ var OPERATE = 'video-react-player/OPERATE';
476
+ var FULLSCREEN_CHANGE = 'video-react-player/FULLSCREEN_CHANGE';
477
+ var PLAYER_ACTIVATE = 'video-react-player/PLAYER_ACTIVATE';
478
+ var USER_ACTIVATE = 'video-react-player/USER_ACTIVATE';
479
+ function handleFullscreenChange(isFullscreen) {
480
+ return {
481
+ type: FULLSCREEN_CHANGE,
482
+ isFullscreen: isFullscreen
483
+ };
484
+ }
485
+ function activate(activity) {
486
+ return {
487
+ type: PLAYER_ACTIVATE,
488
+ activity: activity
489
+ };
490
+ }
491
+ function userActivate(activity) {
492
+ return {
493
+ type: USER_ACTIVATE,
494
+ activity: activity
495
+ };
496
+ }
497
+ function play(operation) {
498
+ var _this$video;
499
+ if (operation === void 0) {
500
+ operation = {
501
+ action: 'play',
502
+ source: ''
503
+ };
504
+ }
505
+ (_this$video = this.video) === null || _this$video === void 0 ? void 0 : _this$video.play();
506
+ return {
507
+ type: OPERATE,
508
+ operation: operation
509
+ };
510
+ }
511
+ function pause(operation) {
512
+ var _this$video2;
513
+ if (operation === void 0) {
514
+ operation = {
515
+ action: 'pause',
516
+ source: ''
517
+ };
518
+ }
519
+ (_this$video2 = this.video) === null || _this$video2 === void 0 ? void 0 : _this$video2.pause();
520
+ return {
521
+ type: OPERATE,
522
+ operation: operation
523
+ };
524
+ }
525
+ function togglePlay(operation) {
526
+ var _this$video3;
527
+ if (operation === void 0) {
528
+ operation = {
529
+ action: 'toggle-play',
530
+ source: ''
531
+ };
532
+ }
533
+ (_this$video3 = this.video) === null || _this$video3 === void 0 ? void 0 : _this$video3.togglePlay();
534
+ return {
535
+ type: OPERATE,
536
+ operation: operation
537
+ };
538
+ }
539
+
540
+ // seek video by time
541
+ function seek(time, operation) {
542
+ var _this$video4;
543
+ if (operation === void 0) {
544
+ operation = {
545
+ action: 'seek',
546
+ source: ''
547
+ };
548
+ }
549
+ (_this$video4 = this.video) === null || _this$video4 === void 0 ? void 0 : _this$video4.seek(time);
550
+ return {
551
+ type: OPERATE,
552
+ operation: operation
553
+ };
554
+ }
555
+
556
+ // jump forward x seconds
557
+ function forward(seconds, operation) {
558
+ var _this$video5;
559
+ if (operation === void 0) {
560
+ operation = {
561
+ action: "forward-" + seconds,
562
+ source: ''
563
+ };
564
+ }
565
+ (_this$video5 = this.video) === null || _this$video5 === void 0 ? void 0 : _this$video5.forward(seconds);
566
+ return {
567
+ type: OPERATE,
568
+ operation: operation
569
+ };
570
+ }
571
+
572
+ // jump back x seconds
573
+ function replay(seconds, operation) {
574
+ var _this$video6;
575
+ if (operation === void 0) {
576
+ operation = {
577
+ action: "replay-" + seconds,
578
+ source: ''
579
+ };
580
+ }
581
+ (_this$video6 = this.video) === null || _this$video6 === void 0 ? void 0 : _this$video6.replay(seconds);
582
+ return {
583
+ type: OPERATE,
584
+ operation: operation
585
+ };
586
+ }
587
+ function changeRate(rate, operation) {
588
+ if (operation === void 0) {
589
+ operation = {
590
+ action: 'change-rate',
591
+ source: ''
592
+ };
593
+ }
594
+ if (this.video) {
595
+ this.video.playbackRate = rate;
596
+ }
597
+ return {
598
+ type: OPERATE,
599
+ operation: operation
600
+ };
601
+ }
602
+ function changeVolume(volume, operation) {
603
+ if (operation === void 0) {
604
+ operation = {
605
+ action: 'change-volume',
606
+ source: ''
607
+ };
608
+ }
609
+ var v = volume;
610
+ if (volume < 0) {
611
+ v = 0;
612
+ }
613
+ if (volume > 1) {
614
+ v = 1;
615
+ }
616
+ if (this.video) {
617
+ this.video.volume = v;
618
+ }
619
+ return {
620
+ type: OPERATE,
621
+ operation: operation
622
+ };
623
+ }
624
+ function mute(muted, operation) {
625
+ if (operation === void 0) {
626
+ operation = {
627
+ action: muted ? 'muted' : 'unmuted',
628
+ source: ''
629
+ };
630
+ }
631
+ if (this.video) {
632
+ this.video.muted = muted;
633
+ }
634
+ return {
635
+ type: OPERATE,
636
+ operation: operation
637
+ };
638
+ }
639
+ function toggleFullscreen(player) {
640
+ if (fullscreen.enabled) {
641
+ if (fullscreen.isFullscreen) {
642
+ fullscreen.exit();
643
+ } else if (this.rootElement) {
644
+ fullscreen.request(this.rootElement);
645
+ }
646
+ return {
647
+ type: OPERATE,
648
+ operation: {
649
+ action: 'toggle-fullscreen',
650
+ source: ''
651
+ }
652
+ };
653
+ }
654
+ return {
655
+ type: FULLSCREEN_CHANGE,
656
+ isFullscreen: !player.isFullscreen
657
+ };
658
+ }
659
+ function togglePictureInPicture() {
660
+ var next = !this.store.getState().player.isPictureInPicture;
661
+ return handlePictureInPictureChange(next);
662
+ }
663
+ function changeQuality(quality) {
664
+ return handleQualityChange(quality);
665
+ }
666
+ function takeScreenshot() {
667
+ return {
668
+ type: OPERATE,
669
+ operation: {
670
+ action: 'screenshot',
671
+ source: 'control'
672
+ }
673
+ };
674
+ }
675
+ function toggleTheaterMode(isTheater) {
676
+ return handleTheaterModeChange(isTheater);
677
+ }
678
+
679
+ var playerActions = /*#__PURE__*/Object.freeze({
680
+ OPERATE: OPERATE,
681
+ FULLSCREEN_CHANGE: FULLSCREEN_CHANGE,
682
+ PLAYER_ACTIVATE: PLAYER_ACTIVATE,
683
+ USER_ACTIVATE: USER_ACTIVATE,
684
+ handleFullscreenChange: handleFullscreenChange,
685
+ activate: activate,
686
+ userActivate: userActivate,
687
+ play: play,
688
+ pause: pause,
689
+ togglePlay: togglePlay,
690
+ seek: seek,
691
+ forward: forward,
692
+ replay: replay,
693
+ changeRate: changeRate,
694
+ changeVolume: changeVolume,
695
+ mute: mute,
696
+ toggleFullscreen: toggleFullscreen,
697
+ togglePictureInPicture: togglePictureInPicture,
698
+ changeQuality: changeQuality,
699
+ takeScreenshot: takeScreenshot,
700
+ toggleTheaterMode: toggleTheaterMode
701
+ });
702
+
703
+ var initialState = {
704
+ currentSrc: null,
705
+ duration: 0,
706
+ currentTime: 0,
707
+ seekingTime: 0,
708
+ buffered: null,
709
+ textTracks: null,
710
+ waiting: false,
711
+ seeking: false,
712
+ paused: true,
713
+ autoPaused: false,
714
+ ended: false,
715
+ playbackRate: 1,
716
+ muted: false,
717
+ volume: 1,
718
+ readyState: 0,
719
+ networkState: 0,
720
+ videoWidth: 0,
721
+ videoHeight: 0,
722
+ hasStarted: false,
723
+ userActivity: true,
724
+ isActive: false,
725
+ isFullscreen: false,
726
+ isPictureInPicture: false,
727
+ loop: false,
728
+ isTheater: false,
729
+ quality: 'auto',
730
+ activeTextTrack: null
731
+ };
732
+ function player(state, action) {
733
+ if (state === void 0) {
734
+ state = initialState;
735
+ }
736
+ switch (action.type) {
737
+ case USER_ACTIVATE:
738
+ return _extends({}, state, {
739
+ userActivity: action.activity
740
+ });
741
+ case PLAYER_ACTIVATE:
742
+ return _extends({}, state, {
743
+ isActive: action.activity
744
+ });
745
+ case FULLSCREEN_CHANGE:
746
+ return _extends({}, state, {
747
+ isFullscreen: !!action.isFullscreen
748
+ });
749
+ case SEEKING_TIME:
750
+ return _extends({}, state, {
751
+ seekingTime: action.time
752
+ });
753
+ case END_SEEKING:
754
+ return _extends({}, state, {
755
+ seekingTime: 0
756
+ });
757
+ case LOAD_START:
758
+ return _extends({}, state, action.videoProps, {
759
+ hasStarted: false,
760
+ ended: false
761
+ });
762
+ case CAN_PLAY:
763
+ return _extends({}, state, action.videoProps, {
764
+ waiting: false
765
+ });
766
+ case WAITING:
767
+ return _extends({}, state, action.videoProps, {
768
+ waiting: true
769
+ });
770
+ case CAN_PLAY_THROUGH:
771
+ case PLAYING:
772
+ return _extends({}, state, action.videoProps, {
773
+ waiting: false
774
+ });
775
+ case PLAY:
776
+ return _extends({}, state, action.videoProps, {
777
+ ended: false,
778
+ paused: false,
779
+ autoPaused: false,
780
+ waiting: false,
781
+ hasStarted: true
782
+ });
783
+ case PAUSE:
784
+ return _extends({}, state, action.videoProps, {
785
+ paused: true
786
+ });
787
+ case END:
788
+ return _extends({}, state, action.videoProps, {
789
+ ended: true
790
+ });
791
+ case SEEKING:
792
+ return _extends({}, state, action.videoProps, {
793
+ seeking: true
794
+ });
795
+ case SEEKED:
796
+ return _extends({}, state, action.videoProps, {
797
+ seeking: false
798
+ });
799
+ case ERROR:
800
+ return _extends({}, state, action.videoProps, {
801
+ error: 'UNKNOWN ERROR',
802
+ ended: true
803
+ });
804
+ case DURATION_CHANGE:
805
+ case TIME_UPDATE:
806
+ case VOLUME_CHANGE:
807
+ case PROGRESS_CHANGE:
808
+ case RATE_CHANGE:
809
+ case SUSPEND:
810
+ case ABORT:
811
+ case EMPTIED:
812
+ case STALLED:
813
+ case LOADED_META_DATA:
814
+ case LOADED_DATA:
815
+ case RESIZE:
816
+ return _extends({}, state, action.videoProps);
817
+ case ACTIVATE_TEXT_TRACK:
818
+ return _extends({}, state, {
819
+ activeTextTrack: action.textTrack
820
+ });
821
+ case PICTURE_IN_PICTURE_CHANGE:
822
+ return _extends({}, state, {
823
+ isPictureInPicture: !!action.isPictureInPicture
824
+ });
825
+ case LOOP_CHANGE:
826
+ return _extends({}, state, {
827
+ loop: !!action.loop
828
+ });
829
+ case THEATER_MODE_CHANGE:
830
+ return _extends({}, state, {
831
+ isTheater: !!action.isTheater
832
+ });
833
+ case QUALITY_CHANGE:
834
+ return _extends({}, state, {
835
+ quality: action.quality || 'auto'
836
+ });
837
+ default:
838
+ return state;
839
+ }
840
+ }
841
+
842
+ var initialState$1 = {
843
+ count: 0,
844
+ operation: {
845
+ action: '',
846
+ source: ''
847
+ }
848
+ };
849
+ function operation(state, action) {
850
+ if (state === void 0) {
851
+ state = initialState$1;
852
+ }
853
+ switch (action.type) {
854
+ case OPERATE:
855
+ return _extends({}, state, {
856
+ count: state.count + 1,
857
+ operation: _extends({}, state.operation, action.operation)
858
+ });
859
+ default:
860
+ return state;
861
+ }
862
+ }
863
+
864
+ function reducer(state, action) {
865
+ return {
866
+ player: player(state === null || state === void 0 ? void 0 : state.player, action),
867
+ operation: operation(state === null || state === void 0 ? void 0 : state.operation, action)
868
+ };
869
+ }
870
+ var playerReducer = player;
871
+ var operationReducer = operation;
872
+
873
+ var Manager = /*#__PURE__*/function () {
874
+ function Manager(store) {
875
+ this.store = void 0;
876
+ this.video = void 0;
877
+ this.rootElement = void 0;
878
+ this.boundActions = void 0;
879
+ this.store = store || redux.createStore(reducer);
880
+ this.video = null;
881
+ this.rootElement = null;
882
+ this.boundActions = undefined;
883
+ }
884
+ var _proto = Manager.prototype;
885
+ _proto.getActions = function getActions() {
886
+ var _this = this;
887
+ if (this.boundActions) {
888
+ return this.boundActions;
889
+ }
890
+ var actions = _extends({}, playerActions, videoActions);
891
+ var bound = {};
892
+ Object.keys(actions).forEach(function (key) {
893
+ var creator = actions[key];
894
+ if (typeof creator !== 'function') {
895
+ return;
896
+ }
897
+ bound[key] = function () {
898
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
899
+ args[_key] = arguments[_key];
900
+ }
901
+ var action = creator.apply(_this, args);
902
+ if (typeof action !== 'undefined') {
903
+ _this.store.dispatch(action);
904
+ }
905
+ };
906
+ });
907
+ this.boundActions = bound;
908
+ return this.boundActions;
909
+ };
910
+ _proto.getState = function getState() {
911
+ return this.store.getState();
912
+ };
913
+ _proto.subscribeToStateChange = function subscribeToStateChange(listener, getState) {
914
+ if (getState === void 0) {
915
+ getState = this.getState.bind(this);
916
+ }
917
+ var prevState = getState();
918
+ var handleChange = function handleChange() {
919
+ var state = getState();
920
+ if (state === prevState) {
921
+ return;
922
+ }
923
+ var prevStateCopy = prevState;
924
+ prevState = state;
925
+ listener(state, prevStateCopy);
926
+ };
927
+ return this.store.subscribe(handleChange);
928
+ };
929
+ _proto.subscribeToOperationStateChange = function subscribeToOperationStateChange(listener) {
930
+ var _this2 = this;
931
+ return this.subscribeToStateChange(listener, function () {
932
+ return _this2.getState().operation;
933
+ });
934
+ };
935
+ _proto.subscribeToPlayerStateChange = function subscribeToPlayerStateChange(listener) {
936
+ var _this3 = this;
937
+ return this.subscribeToStateChange(listener, function () {
938
+ return _this3.getState().player;
939
+ });
940
+ };
941
+ return Manager;
942
+ }();
943
+
944
+ // eslint-disable-next-line import/no-unresolved
945
+ var BigPlayButton = /*#__PURE__*/function (_Component) {
946
+ _inheritsLoose(BigPlayButton, _Component);
947
+ function BigPlayButton(props, context) {
948
+ var _this;
949
+ _this = _Component.call(this, props, context) || this;
950
+ _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
951
+ return _this;
952
+ }
953
+ var _proto = BigPlayButton.prototype;
954
+ _proto.componentDidMount = function componentDidMount() {};
955
+ _proto.handleClick = function handleClick(event) {
956
+ var _this$props$actions;
957
+ event.preventDefault();
958
+ (_this$props$actions = this.props.actions) === null || _this$props$actions === void 0 ? void 0 : _this$props$actions.play();
959
+ };
960
+ _proto.render = function render() {
961
+ var _player$hasStarted;
962
+ var _this$props = this.props,
963
+ player = _this$props.player,
964
+ position = _this$props.position;
965
+ var positionClass = position === 'center' ? 'center' : 'left';
966
+ var hasStarted = (_player$hasStarted = player === null || player === void 0 ? void 0 : player.hasStarted) !== null && _player$hasStarted !== void 0 ? _player$hasStarted : false;
967
+ var hasSource = (player === null || player === void 0 ? void 0 : player.currentSrc) !== undefined && (player === null || player === void 0 ? void 0 : player.currentSrc) !== '';
968
+ return React__default.createElement("button", {
969
+ className: classnames('video-react-player-button', 'video-react-player-big-play-button', "video-react-player-big-play-button-" + positionClass, this.props.className, {
970
+ // keep visible by default if player info is not provided
971
+ 'big-play-button-hide': hasStarted || !hasSource
972
+ }),
973
+ type: "button",
974
+ "aria-live": "polite",
975
+ tabIndex: 0,
976
+ onClick: this.handleClick
977
+ }, React__default.createElement("span", {
978
+ className: "video-react-player-control-text"
979
+ }, "Play Video"));
980
+ };
981
+ return BigPlayButton;
982
+ }(React.Component);
983
+ BigPlayButton.defaultProps = {
984
+ position: 'left'
985
+ };
986
+ BigPlayButton.displayName = 'BigPlayButton';
987
+
988
+ function LoadingSpinner(_ref) {
989
+ var player = _ref.player,
990
+ className = _ref.className;
991
+ if (player.error) {
992
+ return null;
993
+ }
994
+ return React__default.createElement("div", {
995
+ className: classnames('video-react-player-loading-spinner', className)
996
+ });
997
+ }
998
+ LoadingSpinner.displayName = 'LoadingSpinner';
999
+
1000
+ function PosterImage(_ref) {
1001
+ var poster = _ref.poster,
1002
+ player = _ref.player,
1003
+ actions = _ref.actions,
1004
+ className = _ref.className;
1005
+ if (!poster || player.hasStarted) {
1006
+ return null;
1007
+ }
1008
+ return React__default.createElement("div", {
1009
+ className: classnames('video-react-player-poster', className),
1010
+ style: {
1011
+ backgroundImage: "url(\"" + poster + "\")"
1012
+ },
1013
+ onClick: function onClick() {
1014
+ if (player.paused) {
1015
+ actions.play();
1016
+ }
1017
+ }
1018
+ });
1019
+ }
1020
+ PosterImage.displayName = 'PosterImage';
1021
+
1022
+ // NaN is the only value in javascript which is not equal to itself.
1023
+ // eslint-disable-next-line no-self-compare
1024
+ var isNaN = Number.isNaN || function (value) {
1025
+ return value !== value;
1026
+ };
1027
+
1028
+ /**
1029
+ * @file format-time.js
1030
+ *
1031
+ * Format seconds as a time string, H:MM:SS or M:SS
1032
+ * Supplying a guide (in seconds) will force a number of leading zeros
1033
+ * to cover the length of the guide
1034
+ *
1035
+ * @param {Number} seconds Number of seconds to be turned into a string
1036
+ * @param {Number} guide Number (in seconds) to model the string after
1037
+ * @return {String} Time formatted as H:MM:SS or M:SS
1038
+ * @private
1039
+ * @function formatTime
1040
+ */
1041
+ function formatTime(seconds, guide) {
1042
+ if (seconds === void 0) {
1043
+ seconds = 0;
1044
+ }
1045
+ if (guide === void 0) {
1046
+ guide = seconds;
1047
+ }
1048
+ var s = Math.floor(seconds % 60);
1049
+ var m = Math.floor(seconds / 60 % 60);
1050
+ var h = Math.floor(seconds / 3600);
1051
+ var gm = Math.floor(guide / 60 % 60);
1052
+ var gh = Math.floor(guide / 3600);
1053
+
1054
+ // handle invalid times
1055
+ if (isNaN(seconds) || seconds === Infinity) {
1056
+ // '-' is false for all relational operators (e.g. <, >=) so this setting
1057
+ // will add the minimum number of fields specified by the guide
1058
+ h = 0;
1059
+ m = 0;
1060
+ s = 0;
1061
+ }
1062
+ var hasHours = h > 0 || gh > 0;
1063
+ var hours = hasHours ? h + ":" : '';
1064
+ var minutes = ((hasHours || gm >= 10) && m < 10 ? "0" + m : m) + ":";
1065
+ var secondsString = s < 10 ? "0" + s : "" + s;
1066
+ return "" + hours + minutes + secondsString;
1067
+ }
1068
+
1069
+ // Check if the element belongs to a video element
1070
+ // only accept <source />, <track />,
1071
+ // <MyComponent isVideoChild />
1072
+ // elements
1073
+ function isVideoChild(c) {
1074
+ if (!React__default.isValidElement(c)) {
1075
+ return false;
1076
+ }
1077
+ if (c.props && c.props.isVideoChild) {
1078
+ return true;
1079
+ }
1080
+ return c.type === 'source' || c.type === 'track';
1081
+ }
1082
+ var find = function find(elements, func) {
1083
+ return elements.find(func);
1084
+ };
1085
+
1086
+ // check if two components are the same type
1087
+ var isTypeEqual = function isTypeEqual(component1, component2) {
1088
+ var type1 = component1.type;
1089
+ var type2 = component2.type;
1090
+ if (typeof type1 === 'string' || typeof type2 === 'string') {
1091
+ return type1 === type2;
1092
+ }
1093
+ if (typeof type1 === 'function' && typeof type2 === 'function') {
1094
+ return type1.displayName === type2.displayName;
1095
+ }
1096
+ return false;
1097
+ };
1098
+
1099
+ // merge default children
1100
+ // sort them by `order` property
1101
+ // filter them by `disabled` property
1102
+ function mergeAndSortChildren(defaultChildren, _children, _parentProps, defaultOrder) {
1103
+ if (defaultOrder === void 0) {
1104
+ defaultOrder = 1;
1105
+ }
1106
+ var children = React__default.Children.toArray(_children).filter(React__default.isValidElement);
1107
+ var _order = _parentProps.order,
1108
+ parentProps = _objectWithoutPropertiesLoose(_parentProps, ["order"]); // ignore order from parent
1109
+ return children.filter(function (e) {
1110
+ return !e.props.disabled;
1111
+ }) // filter the disabled components
1112
+ .concat(defaultChildren.filter(function (c) {
1113
+ return !find(children, function (component) {
1114
+ return isTypeEqual(component, c);
1115
+ });
1116
+ })).map(function (element) {
1117
+ var defaultComponent = find(defaultChildren, function (c) {
1118
+ return isTypeEqual(c, element);
1119
+ });
1120
+ var defaultProps = defaultComponent ? defaultComponent.props : {};
1121
+ var props = _extends({}, parentProps, defaultProps, element.props);
1122
+ return React__default.cloneElement(element, props, element.props.children);
1123
+ }).sort(function (a, b) {
1124
+ return (a.props.order || defaultOrder) - (b.props.order || defaultOrder);
1125
+ });
1126
+ }
1127
+
1128
+ /**
1129
+ * Temporary utility for generating the warnings
1130
+ */
1131
+ function deprecatedWarning(oldMethodCall, newMethodCall) {
1132
+ // eslint-disable-next-line no-console
1133
+ console.warn("WARNING: " + oldMethodCall + " will be deprecated soon! Please use " + newMethodCall + " instead.");
1134
+ }
1135
+ function throttle(callback, limit) {
1136
+ var wait = false;
1137
+ return function () {
1138
+ if (!wait) {
1139
+ callback.apply(void 0, arguments);
1140
+ wait = true;
1141
+ setTimeout(function () {
1142
+ wait = false;
1143
+ }, limit);
1144
+ }
1145
+ };
1146
+ }
1147
+ var mediaProperties = ['error', 'src', 'srcObject', 'currentSrc', 'crossOrigin', 'networkState', 'preload', 'buffered', 'readyState', 'seeking', 'currentTime', 'duration', 'paused', 'defaultPlaybackRate', 'playbackRate', 'played', 'seekable', 'ended', 'autoplay', 'loop', 'mediaGroup', 'controller', 'controls', 'volume', 'muted', 'defaultMuted', 'audioTracks', 'videoTracks', 'textTracks', 'width', 'height', 'videoWidth', 'videoHeight', 'poster'];
1148
+
1149
+ var Video = React.forwardRef(function (props, ref) {
1150
+ var actions = props.actions,
1151
+ player = props.player,
1152
+ children = props.children,
1153
+ startTime = props.startTime,
1154
+ loop = props.loop,
1155
+ poster = props.poster,
1156
+ preload = props.preload,
1157
+ src = props.src,
1158
+ autoPlay = props.autoPlay,
1159
+ playsInline = props.playsInline,
1160
+ muted = props.muted,
1161
+ crossOrigin = props.crossOrigin,
1162
+ videoId = props.videoId,
1163
+ className = props.className,
1164
+ onLoadStart = props.onLoadStart,
1165
+ onWaiting = props.onWaiting,
1166
+ onCanPlay = props.onCanPlay,
1167
+ onCanPlayThrough = props.onCanPlayThrough,
1168
+ onPlaying = props.onPlaying,
1169
+ onEnded = props.onEnded,
1170
+ onSeeking = props.onSeeking,
1171
+ onSeeked = props.onSeeked,
1172
+ onPlay = props.onPlay,
1173
+ onPause = props.onPause,
1174
+ onProgress = props.onProgress,
1175
+ onDurationChange = props.onDurationChange,
1176
+ onError = props.onError,
1177
+ onSuspend = props.onSuspend,
1178
+ onAbort = props.onAbort,
1179
+ onEmptied = props.onEmptied,
1180
+ onStalled = props.onStalled,
1181
+ onLoadedMetadata = props.onLoadedMetadata,
1182
+ onLoadedData = props.onLoadedData,
1183
+ onTimeUpdate = props.onTimeUpdate,
1184
+ onRateChange = props.onRateChange,
1185
+ onVolumeChange = props.onVolumeChange,
1186
+ onResize = props.onResize;
1187
+ var videoRef = React.useRef(null);
1188
+ var propsRef = React.useRef(props);
1189
+ propsRef.current = props;
1190
+ var _useReducer = React.useReducer(function (count) {
1191
+ return count + 1;
1192
+ }, 0),
1193
+ forceRender = _useReducer[1];
1194
+ React.useEffect(function () {
1195
+ forceRender();
1196
+ }, []);
1197
+ var getVideoProperties = React.useCallback(function () {
1198
+ var video = videoRef.current;
1199
+ if (!video) {
1200
+ return {};
1201
+ }
1202
+ return mediaProperties.reduce(function (acc, key) {
1203
+ var videoKey = key;
1204
+ acc[key] = video === null || video === void 0 ? void 0 : video[videoKey];
1205
+ return acc;
1206
+ }, {});
1207
+ }, []);
1208
+ var createVideoEventHandler = React.useCallback(function (dispatcher, callback) {
1209
+ return function () {
1210
+ dispatcher(getVideoProperties());
1211
+ if (callback) {
1212
+ callback.apply(void 0, arguments);
1213
+ }
1214
+ };
1215
+ }, [getVideoProperties]);
1216
+ var handleLoadStart = React.useMemo(function () {
1217
+ return createVideoEventHandler(actions.handleLoadStart, onLoadStart);
1218
+ }, [actions.handleLoadStart, onLoadStart, createVideoEventHandler]);
1219
+ var handleWaiting = React.useMemo(function () {
1220
+ return createVideoEventHandler(actions.handleWaiting, onWaiting);
1221
+ }, [actions.handleWaiting, onWaiting, createVideoEventHandler]);
1222
+ var handleCanPlay = React.useMemo(function () {
1223
+ return createVideoEventHandler(actions.handleCanPlay, onCanPlay);
1224
+ }, [actions.handleCanPlay, onCanPlay, createVideoEventHandler]);
1225
+ var handleCanPlayThrough = React.useMemo(function () {
1226
+ return createVideoEventHandler(actions.handleCanPlayThrough, onCanPlayThrough);
1227
+ }, [actions.handleCanPlayThrough, onCanPlayThrough, createVideoEventHandler]);
1228
+ var handlePlaying = React.useMemo(function () {
1229
+ return createVideoEventHandler(actions.handlePlaying, onPlaying);
1230
+ }, [actions.handlePlaying, onPlaying, createVideoEventHandler]);
1231
+ var handlePlay = React.useMemo(function () {
1232
+ return createVideoEventHandler(actions.handlePlay, onPlay);
1233
+ }, [actions.handlePlay, onPlay, createVideoEventHandler]);
1234
+ var handlePause = React.useMemo(function () {
1235
+ return createVideoEventHandler(actions.handlePause, onPause);
1236
+ }, [actions.handlePause, onPause, createVideoEventHandler]);
1237
+ var handleDurationChange = React.useMemo(function () {
1238
+ return createVideoEventHandler(actions.handleDurationChange, onDurationChange);
1239
+ }, [actions.handleDurationChange, onDurationChange, createVideoEventHandler]);
1240
+ var handleTimeUpdate = React.useMemo(function () {
1241
+ return createVideoEventHandler(actions.handleTimeUpdate, onTimeUpdate);
1242
+ }, [actions.handleTimeUpdate, onTimeUpdate, createVideoEventHandler]);
1243
+ var handleRateChange = React.useMemo(function () {
1244
+ return createVideoEventHandler(actions.handleRateChange, onRateChange);
1245
+ }, [actions.handleRateChange, onRateChange, createVideoEventHandler]);
1246
+ var handleVolumeChange = React.useMemo(function () {
1247
+ return createVideoEventHandler(actions.handleVolumeChange, onVolumeChange);
1248
+ }, [actions.handleVolumeChange, onVolumeChange, createVideoEventHandler]);
1249
+ var handleSuspend = React.useMemo(function () {
1250
+ return createVideoEventHandler(actions.handleSuspend, onSuspend);
1251
+ }, [actions.handleSuspend, onSuspend, createVideoEventHandler]);
1252
+ var handleAbort = React.useMemo(function () {
1253
+ return createVideoEventHandler(actions.handleAbort, onAbort);
1254
+ }, [actions.handleAbort, onAbort, createVideoEventHandler]);
1255
+ var handleEmptied = React.useMemo(function () {
1256
+ return createVideoEventHandler(actions.handleEmptied, onEmptied);
1257
+ }, [actions.handleEmptied, onEmptied, createVideoEventHandler]);
1258
+ var handleStalled = React.useMemo(function () {
1259
+ return createVideoEventHandler(actions.handleStalled, onStalled);
1260
+ }, [actions.handleStalled, onStalled, createVideoEventHandler]);
1261
+ var handleResize = React.useMemo(function () {
1262
+ return createVideoEventHandler(actions.handleResize, onResize);
1263
+ }, [actions.handleResize, onResize, createVideoEventHandler]);
1264
+ var throttledProgress = React.useMemo(function () {
1265
+ return throttle(function () {
1266
+ actions.handleProgressChange(getVideoProperties());
1267
+ }, 250);
1268
+ }, [actions, getVideoProperties]);
1269
+ var handleProgress = React.useCallback(function (event) {
1270
+ throttledProgress();
1271
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(event);
1272
+ }, [onProgress, throttledProgress]);
1273
+ var handleError = React.useCallback(function (event) {
1274
+ actions.handleError(getVideoProperties());
1275
+ onError === null || onError === void 0 ? void 0 : onError(event);
1276
+ }, [actions, getVideoProperties, onError]);
1277
+ var handleSeeking = React.useCallback(function (event) {
1278
+ actions.handleSeeking(getVideoProperties());
1279
+ onSeeking === null || onSeeking === void 0 ? void 0 : onSeeking(event);
1280
+ }, [actions, getVideoProperties, onSeeking]);
1281
+ var handleSeeked = React.useCallback(function (event) {
1282
+ actions.handleSeeked(getVideoProperties());
1283
+ onSeeked === null || onSeeked === void 0 ? void 0 : onSeeked(event);
1284
+ }, [actions, getVideoProperties, onSeeked]);
1285
+ var handleEnd = React.useCallback(function (event) {
1286
+ var video = videoRef.current;
1287
+ if (loop && video) {
1288
+ video.currentTime = 0;
1289
+ var promise = video.play();
1290
+ promise === null || promise === void 0 ? void 0 : promise.catch(function () {});
1291
+ } else if (video && !player.paused) {
1292
+ video.pause();
1293
+ }
1294
+ actions.handleEnd(getVideoProperties());
1295
+ onEnded === null || onEnded === void 0 ? void 0 : onEnded(event);
1296
+ }, [actions, getVideoProperties, loop, onEnded, player.paused]);
1297
+ var handleLoadedMetadata = React.useCallback(function (event) {
1298
+ var video = videoRef.current;
1299
+ if (typeof startTime === 'number' && startTime > 0 && video) {
1300
+ video.currentTime = startTime;
1301
+ }
1302
+ actions.handleLoadedMetaData(getVideoProperties());
1303
+ onLoadedMetadata === null || onLoadedMetadata === void 0 ? void 0 : onLoadedMetadata(event);
1304
+ }, [actions, getVideoProperties, onLoadedMetadata, startTime]);
1305
+ var handleLoadedData = React.useCallback(function (event) {
1306
+ actions.handleLoadedData(getVideoProperties());
1307
+ onLoadedData === null || onLoadedData === void 0 ? void 0 : onLoadedData(event);
1308
+ }, [actions, getVideoProperties, onLoadedData]);
1309
+ var handleTextTrackChange = React.useCallback(function () {
1310
+ var video = videoRef.current;
1311
+ if (video && video.textTracks) {
1312
+ var activeTextTrack = Array.from(video.textTracks).find(function (textTrack) {
1313
+ return textTrack.mode === 'showing';
1314
+ });
1315
+ if (activeTextTrack !== player.activeTextTrack) {
1316
+ actions.activateTextTrack(activeTextTrack !== null && activeTextTrack !== void 0 ? activeTextTrack : null);
1317
+ }
1318
+ }
1319
+ }, [actions, player.activeTextTrack]);
1320
+ React.useEffect(function () {
1321
+ var video = videoRef.current;
1322
+ if (!video) {
1323
+ return undefined;
1324
+ }
1325
+ if (video.textTracks) {
1326
+ video.textTracks.onaddtrack = handleTextTrackChange;
1327
+ video.textTracks.onremovetrack = handleTextTrackChange;
1328
+ }
1329
+ var handleEnterPiP = function handleEnterPiP() {
1330
+ return actions.handlePictureInPictureChange(true);
1331
+ };
1332
+ var handleLeavePiP = function handleLeavePiP() {
1333
+ return actions.handlePictureInPictureChange(false);
1334
+ };
1335
+ video.addEventListener('enterpictureinpicture', handleEnterPiP);
1336
+ video.addEventListener('leavepictureinpicture', handleLeavePiP);
1337
+ return function () {
1338
+ video.removeEventListener('enterpictureinpicture', handleEnterPiP);
1339
+ video.removeEventListener('leavepictureinpicture', handleLeavePiP);
1340
+ };
1341
+ }, [actions, handleTextTrackChange]);
1342
+ var apiRef = React.useRef();
1343
+ if (!apiRef.current) {
1344
+ var getVideo = function getVideo() {
1345
+ return videoRef.current;
1346
+ };
1347
+ apiRef.current = {
1348
+ play: function play() {
1349
+ var _getVideo;
1350
+ var promise = (_getVideo = getVideo()) === null || _getVideo === void 0 ? void 0 : _getVideo.play();
1351
+ if (promise && typeof promise.catch === 'function') {
1352
+ promise.catch(function () {});
1353
+ }
1354
+ },
1355
+ pause: function pause() {
1356
+ var video = getVideo();
1357
+ var promiseLike = video === null || video === void 0 ? void 0 : video.pause();
1358
+ if (typeof promiseLike === 'object' && promiseLike !== null && 'catch' in promiseLike && typeof promiseLike.catch === 'function') {
1359
+ promiseLike.catch(function () {});
1360
+ }
1361
+ },
1362
+ load: function load() {
1363
+ var _getVideo2;
1364
+ (_getVideo2 = getVideo()) === null || _getVideo2 === void 0 ? void 0 : _getVideo2.load();
1365
+ },
1366
+ addTextTrack: function addTextTrack(kind, label, language) {
1367
+ var video = getVideo();
1368
+ return video ? video.addTextTrack(kind, label, language) : {};
1369
+ },
1370
+ canPlayType: function canPlayType() {
1371
+ var _getVideo$canPlayType, _getVideo3;
1372
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1373
+ args[_key] = arguments[_key];
1374
+ }
1375
+ return (_getVideo$canPlayType = (_getVideo3 = getVideo()) === null || _getVideo3 === void 0 ? void 0 : _getVideo3.canPlayType.apply(_getVideo3, args)) !== null && _getVideo$canPlayType !== void 0 ? _getVideo$canPlayType : '';
1376
+ },
1377
+ togglePlay: function togglePlay() {
1378
+ var video = getVideo();
1379
+ if (!video) {
1380
+ return;
1381
+ }
1382
+ if (video.paused) {
1383
+ var promise = video.play();
1384
+ if (promise && typeof promise.catch === 'function') {
1385
+ promise.catch(function () {});
1386
+ }
1387
+ } else {
1388
+ var promiseLike = video.pause();
1389
+ if (typeof promiseLike === 'object' && promiseLike !== null && 'catch' in promiseLike && typeof promiseLike.catch === 'function') {
1390
+ promiseLike.catch(function () {});
1391
+ }
1392
+ }
1393
+ },
1394
+ seek: function seek(time) {
1395
+ var video = getVideo();
1396
+ if (!video) {
1397
+ return;
1398
+ }
1399
+ try {
1400
+ video.currentTime = time;
1401
+ } catch (err) {
1402
+ // ignore
1403
+ }
1404
+ },
1405
+ forward: function forward(seconds) {
1406
+ var video = getVideo();
1407
+ if (video) {
1408
+ var _apiRef$current;
1409
+ (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.seek(video.currentTime + seconds);
1410
+ }
1411
+ },
1412
+ replay: function replay(seconds) {
1413
+ var _apiRef$current2;
1414
+ (_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.forward(-seconds);
1415
+ },
1416
+ toggleFullscreen: function toggleFullscreen() {
1417
+ propsRef.current.actions.toggleFullscreen(propsRef.current.player);
1418
+ },
1419
+ get playbackRate() {
1420
+ var _getVideo$playbackRat, _getVideo4;
1421
+ return (_getVideo$playbackRat = (_getVideo4 = getVideo()) === null || _getVideo4 === void 0 ? void 0 : _getVideo4.playbackRate) !== null && _getVideo$playbackRat !== void 0 ? _getVideo$playbackRat : 1;
1422
+ },
1423
+ set playbackRate(rate) {
1424
+ var video = getVideo();
1425
+ if (video) {
1426
+ video.playbackRate = rate;
1427
+ }
1428
+ },
1429
+ get muted() {
1430
+ var _getVideo$muted, _getVideo5;
1431
+ return (_getVideo$muted = (_getVideo5 = getVideo()) === null || _getVideo5 === void 0 ? void 0 : _getVideo5.muted) !== null && _getVideo$muted !== void 0 ? _getVideo$muted : false;
1432
+ },
1433
+ set muted(value) {
1434
+ var video = getVideo();
1435
+ if (video) {
1436
+ video.muted = value;
1437
+ }
1438
+ },
1439
+ get volume() {
1440
+ var _getVideo$volume, _getVideo6;
1441
+ return (_getVideo$volume = (_getVideo6 = getVideo()) === null || _getVideo6 === void 0 ? void 0 : _getVideo6.volume) !== null && _getVideo$volume !== void 0 ? _getVideo$volume : 1;
1442
+ },
1443
+ set volume(value) {
1444
+ var video = getVideo();
1445
+ if (video) {
1446
+ video.volume = Math.max(0, Math.min(1, value));
1447
+ }
1448
+ },
1449
+ get videoWidth() {
1450
+ var _getVideo$videoWidth, _getVideo7;
1451
+ return (_getVideo$videoWidth = (_getVideo7 = getVideo()) === null || _getVideo7 === void 0 ? void 0 : _getVideo7.videoWidth) !== null && _getVideo$videoWidth !== void 0 ? _getVideo$videoWidth : 0;
1452
+ },
1453
+ get videoHeight() {
1454
+ var _getVideo$videoHeight, _getVideo8;
1455
+ return (_getVideo$videoHeight = (_getVideo8 = getVideo()) === null || _getVideo8 === void 0 ? void 0 : _getVideo8.videoHeight) !== null && _getVideo$videoHeight !== void 0 ? _getVideo$videoHeight : 0;
1456
+ },
1457
+ get video() {
1458
+ return getVideo();
1459
+ }
1460
+ };
1461
+ }
1462
+ React.useImperativeHandle(ref, function () {
1463
+ return apiRef.current;
1464
+ }, []);
1465
+ var renderedChildren = React.useMemo(function () {
1466
+ if (!apiRef.current) {
1467
+ return null;
1468
+ }
1469
+ var sharedProps = _extends({}, props, {
1470
+ video: apiRef.current
1471
+ });
1472
+ return React__default.Children.toArray(children).filter(isVideoChild).map(function (child) {
1473
+ var element = child;
1474
+ if (typeof element.type === 'string') {
1475
+ if (element.type === 'source') {
1476
+ var childProps = _extends({}, element.props);
1477
+ var originalOnError = childProps.onError;
1478
+ childProps.onError = function () {
1479
+ if (originalOnError) {
1480
+ originalOnError.apply(void 0, arguments);
1481
+ }
1482
+ actions.handleError(getVideoProperties());
1483
+ };
1484
+ return React__default.cloneElement(element, childProps);
1485
+ }
1486
+ return element;
1487
+ }
1488
+ return React__default.cloneElement(element, sharedProps);
1489
+ });
1490
+ }, [actions, children, getVideoProperties, props]);
1491
+ return React__default.createElement("video", {
1492
+ className: classnames('video-react-player-video', className),
1493
+ id: videoId,
1494
+ crossOrigin: crossOrigin,
1495
+ ref: videoRef,
1496
+ muted: muted,
1497
+ preload: preload,
1498
+ loop: loop,
1499
+ playsInline: playsInline,
1500
+ autoPlay: autoPlay,
1501
+ poster: poster,
1502
+ src: src,
1503
+ onLoadStart: handleLoadStart,
1504
+ onWaiting: handleWaiting,
1505
+ onCanPlay: handleCanPlay,
1506
+ onCanPlayThrough: handleCanPlayThrough,
1507
+ onPlaying: handlePlaying,
1508
+ onEnded: handleEnd,
1509
+ onSeeking: handleSeeking,
1510
+ onSeeked: handleSeeked,
1511
+ onPlay: handlePlay,
1512
+ onPause: handlePause,
1513
+ onProgress: handleProgress,
1514
+ onDurationChange: handleDurationChange,
1515
+ onError: handleError,
1516
+ onSuspend: handleSuspend,
1517
+ onAbort: handleAbort,
1518
+ onEmptied: handleEmptied,
1519
+ onStalled: handleStalled,
1520
+ onLoadedMetadata: handleLoadedMetadata,
1521
+ onLoadedData: handleLoadedData,
1522
+ onTimeUpdate: handleTimeUpdate,
1523
+ onRateChange: handleRateChange,
1524
+ onVolumeChange: handleVolumeChange,
1525
+ onResize: handleResize,
1526
+ tabIndex: -1
1527
+ }, renderedChildren);
1528
+ });
1529
+ Video.displayName = 'Video';
1530
+
1531
+ var Bezel = /*#__PURE__*/function (_Component) {
1532
+ _inheritsLoose(Bezel, _Component);
1533
+ function Bezel(props, context) {
1534
+ var _this;
1535
+ _this = _Component.call(this, props, context) || this;
1536
+ _this.timer = null;
1537
+ props.manager.subscribeToOperationStateChange(_this.handleStateChange.bind(_assertThisInitialized(_this)));
1538
+ _this.state = {
1539
+ hidden: true,
1540
+ operation: {
1541
+ action: '',
1542
+ source: ''
1543
+ },
1544
+ count: 0
1545
+ };
1546
+ return _this;
1547
+ }
1548
+ var _proto = Bezel.prototype;
1549
+ _proto.handleStateChange = function handleStateChange(state, prevState) {
1550
+ var _this2 = this;
1551
+ if (state.count !== prevState.count && state.operation.source === 'shortcut') {
1552
+ if (this.timer) {
1553
+ // previous animation is not finished
1554
+ clearTimeout(this.timer); // cancel it
1555
+ this.timer = null;
1556
+ }
1557
+
1558
+ // show it
1559
+ // update operation
1560
+ this.setState({
1561
+ hidden: false,
1562
+ count: state.count,
1563
+ operation: state.operation
1564
+ });
1565
+
1566
+ // hide it after 0.5s
1567
+ this.timer = window.setTimeout(function () {
1568
+ _this2.setState({
1569
+ hidden: true
1570
+ });
1571
+ _this2.timer = null;
1572
+ }, 500);
1573
+ }
1574
+ };
1575
+ _proto.render = function render() {
1576
+ // only displays for shortcut so far
1577
+ if (this.state.operation.source !== 'shortcut') {
1578
+ return null;
1579
+ }
1580
+ var style = this.state.hidden ? {
1581
+ display: 'none'
1582
+ } : null;
1583
+ return React__default.createElement("div", {
1584
+ className: classnames({
1585
+ 'video-react-player-bezel': true,
1586
+ 'video-react-player-bezel-animation': this.state.count % 2 === 0,
1587
+ 'video-react-player-bezel-animation-alt': this.state.count % 2 === 1
1588
+ }, this.props.className),
1589
+ style: style,
1590
+ role: "status",
1591
+ "aria-label": this.state.operation.action
1592
+ }, React__default.createElement("div", {
1593
+ className: classnames('video-react-player-bezel-icon', "video-react-player-bezel-icon-" + this.state.operation.action)
1594
+ }));
1595
+ };
1596
+ return Bezel;
1597
+ }(React.Component);
1598
+ Bezel.displayName = 'Bezel';
1599
+
1600
+ /**
1601
+ * Offset Left
1602
+ * getBoundingClientRect technique from
1603
+ * John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
1604
+ *
1605
+ * @function findElPosition
1606
+ * @param {ReactNodeRef} el React Node ref from which to get offset
1607
+ * @return {Object}
1608
+ */
1609
+ function findElPosition(el) {
1610
+ var box;
1611
+ if (el.getBoundingClientRect && el.parentNode) {
1612
+ box = el.getBoundingClientRect();
1613
+ }
1614
+ if (!box) {
1615
+ return {
1616
+ left: 0,
1617
+ top: 0
1618
+ };
1619
+ }
1620
+ var _document = document,
1621
+ body = _document.body,
1622
+ docEl = _document.documentElement;
1623
+ var clientLeft = docEl.clientLeft || body.clientLeft || 0;
1624
+ var scrollLeft = window.pageXOffset || body.scrollLeft;
1625
+ var left = box.left + scrollLeft - clientLeft;
1626
+ var clientTop = docEl.clientTop || body.clientTop || 0;
1627
+ var scrollTop = window.pageYOffset || body.scrollTop;
1628
+ var top = box.top + scrollTop - clientTop;
1629
+
1630
+ // Android sometimes returns slightly off decimal values, so need to round
1631
+ return {
1632
+ left: Math.round(left),
1633
+ top: Math.round(top)
1634
+ };
1635
+ }
1636
+
1637
+ /**
1638
+ * Get pointer position in a React Node ref
1639
+ * Returns an object with x and y coordinates.
1640
+ * The base on the coordinates are the bottom left of the element.
1641
+ *
1642
+ * @function getPointerPosition
1643
+ * @param {ReactNodeRef} el React Node ref on which to get the pointer position on
1644
+ * @param {Event} event Event object
1645
+ * @return {Object} This object will have x and y coordinates corresponding to the mouse position
1646
+ */
1647
+ function getPointerPosition(el, event) {
1648
+ var position = {};
1649
+ var box = findElPosition(el);
1650
+ var boxW = el.offsetWidth;
1651
+ var boxH = el.offsetHeight;
1652
+ var boxY = box.top;
1653
+ var boxX = box.left;
1654
+ var evtPageY = event.pageY;
1655
+ var evtPageX = event.pageX;
1656
+ if ('changedTouches' in event && event.changedTouches.length) {
1657
+ evtPageX = event.changedTouches[0].pageX;
1658
+ evtPageY = event.changedTouches[0].pageY;
1659
+ }
1660
+ position.y = Math.max(0, Math.min(1, (boxY - evtPageY + boxH) / boxH));
1661
+ position.x = Math.max(0, Math.min(1, (evtPageX - boxX) / boxW));
1662
+ return position;
1663
+ }
1664
+
1665
+ // focus an element
1666
+ function focusNode(reactNode) {
1667
+ if (reactNode && reactNode.focus) {
1668
+ reactNode.focus();
1669
+ }
1670
+ }
1671
+
1672
+ // check if an element has a class name
1673
+ function hasClass(elm, cls) {
1674
+ var classes = elm.className.split(' ');
1675
+ for (var i = 0; i < classes.length; i += 1) {
1676
+ if (classes[i].toLowerCase() === cls.toLowerCase()) {
1677
+ return true;
1678
+ }
1679
+ }
1680
+ return false;
1681
+ }
1682
+
1683
+ var Shortcut = /*#__PURE__*/function (_Component) {
1684
+ _inheritsLoose(Shortcut, _Component);
1685
+ function Shortcut(props, context) {
1686
+ var _this;
1687
+ _this = _Component.call(this, props, context) || this;
1688
+ _this.defaultShortcuts = void 0;
1689
+ _this.shortcuts = [];
1690
+ _this.defaultShortcuts = [{
1691
+ keyCode: 32,
1692
+ // spacebar
1693
+ handle: _this.togglePlay
1694
+ }, {
1695
+ keyCode: 75,
1696
+ // k
1697
+ handle: _this.togglePlay
1698
+ }, {
1699
+ keyCode: 70,
1700
+ // f
1701
+ handle: _this.toggleFullscreen
1702
+ }, {
1703
+ keyCode: 37,
1704
+ // Left arrow
1705
+ handle: function handle(player, actions) {
1706
+ if (!player.hasStarted) {
1707
+ return;
1708
+ }
1709
+ actions.replay(5, {
1710
+ action: 'replay-5',
1711
+ source: 'shortcut'
1712
+ }); // Go back 5 seconds
1713
+ }
1714
+ }, {
1715
+ keyCode: 74,
1716
+ // j
1717
+ handle: function handle(player, actions) {
1718
+ if (!player.hasStarted) {
1719
+ return;
1720
+ }
1721
+ actions.replay(10, {
1722
+ action: 'replay-10',
1723
+ source: 'shortcut'
1724
+ }); // Go back 10 seconds
1725
+ }
1726
+ }, {
1727
+ keyCode: 39,
1728
+ // Right arrow
1729
+ handle: function handle(player, actions) {
1730
+ if (!player.hasStarted) {
1731
+ return;
1732
+ }
1733
+ actions.forward(5, {
1734
+ action: 'forward-5',
1735
+ source: 'shortcut'
1736
+ }); // Go forward 5 seconds
1737
+ }
1738
+ }, {
1739
+ keyCode: 76,
1740
+ // l
1741
+ handle: function handle(player, actions) {
1742
+ if (!player.hasStarted) {
1743
+ return;
1744
+ }
1745
+ actions.forward(10, {
1746
+ action: 'forward-10',
1747
+ source: 'shortcut'
1748
+ }); // Go forward 10 seconds
1749
+ }
1750
+ }, {
1751
+ keyCode: 36,
1752
+ // Home
1753
+ handle: function handle(player, actions) {
1754
+ if (!player.hasStarted) {
1755
+ return;
1756
+ }
1757
+ actions.seek(0); // Go to beginning of video
1758
+ }
1759
+ }, {
1760
+ keyCode: 35,
1761
+ // End
1762
+ handle: function handle(player, actions) {
1763
+ if (!player.hasStarted) {
1764
+ return;
1765
+ }
1766
+ // Go to end of video
1767
+ actions.seek(player.duration);
1768
+ }
1769
+ }, {
1770
+ keyCode: 38,
1771
+ // Up arrow
1772
+ handle: function handle(player, actions) {
1773
+ // Increase volume 5%
1774
+ var v = player.volume + 0.05;
1775
+ if (v > 1) {
1776
+ v = 1;
1777
+ }
1778
+ actions.changeVolume(v, {
1779
+ action: 'volume-up',
1780
+ source: 'shortcut'
1781
+ });
1782
+ }
1783
+ }, {
1784
+ keyCode: 40,
1785
+ // Down arrow
1786
+ handle: function handle(player, actions) {
1787
+ // Decrease volume 5%
1788
+ var v = player.volume - 0.05;
1789
+ if (v < 0) {
1790
+ v = 0;
1791
+ }
1792
+ var action = v > 0 ? 'volume-down' : 'volume-off';
1793
+ actions.changeVolume(v, {
1794
+ action: action,
1795
+ source: 'shortcut'
1796
+ });
1797
+ }
1798
+ }, {
1799
+ keyCode: 190,
1800
+ // Shift + >
1801
+ shift: true,
1802
+ handle: function handle(player, actions) {
1803
+ // Increase speed
1804
+ var playbackRate = player.playbackRate;
1805
+ if (playbackRate >= 1.5) {
1806
+ playbackRate = 2;
1807
+ } else if (playbackRate >= 1.25) {
1808
+ playbackRate = 1.5;
1809
+ } else if (playbackRate >= 1.0) {
1810
+ playbackRate = 1.25;
1811
+ } else if (playbackRate >= 0.5) {
1812
+ playbackRate = 1.0;
1813
+ } else if (playbackRate >= 0.25) {
1814
+ playbackRate = 0.5;
1815
+ } else if (playbackRate >= 0) {
1816
+ playbackRate = 0.25;
1817
+ }
1818
+ actions.changeRate(playbackRate, {
1819
+ action: 'fast-forward',
1820
+ source: 'shortcut'
1821
+ });
1822
+ }
1823
+ }, {
1824
+ keyCode: 188,
1825
+ // Shift + <
1826
+ shift: true,
1827
+ handle: function handle(player, actions) {
1828
+ // Decrease speed
1829
+ var playbackRate = player.playbackRate;
1830
+ if (playbackRate <= 0.5) {
1831
+ playbackRate = 0.25;
1832
+ } else if (playbackRate <= 1.0) {
1833
+ playbackRate = 0.5;
1834
+ } else if (playbackRate <= 1.25) {
1835
+ playbackRate = 1.0;
1836
+ } else if (playbackRate <= 1.5) {
1837
+ playbackRate = 1.25;
1838
+ } else if (playbackRate <= 2) {
1839
+ playbackRate = 1.5;
1840
+ }
1841
+ actions.changeRate(playbackRate, {
1842
+ action: 'fast-rewind',
1843
+ source: 'shortcut'
1844
+ });
1845
+ }
1846
+ }];
1847
+ _this.shortcuts = [].concat(_this.defaultShortcuts);
1848
+ _this.mergeShortcuts = _this.mergeShortcuts.bind(_assertThisInitialized(_this));
1849
+ _this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_this));
1850
+ _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
1851
+ _this.handleDoubleClick = _this.handleDoubleClick.bind(_assertThisInitialized(_this));
1852
+ return _this;
1853
+ }
1854
+ var _proto = Shortcut.prototype;
1855
+ _proto.componentDidMount = function componentDidMount() {
1856
+ this.mergeShortcuts();
1857
+ document.addEventListener('keydown', this.handleKeyPress);
1858
+ document.addEventListener('click', this.handleClick);
1859
+ document.addEventListener('dblclick', this.handleDoubleClick);
1860
+ };
1861
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
1862
+ if (prevProps.shortcuts !== this.props.shortcuts) {
1863
+ this.mergeShortcuts();
1864
+ }
1865
+ };
1866
+ _proto.componentWillUnmount = function componentWillUnmount() {
1867
+ document.removeEventListener('keydown', this.handleKeyPress);
1868
+ document.removeEventListener('click', this.handleClick);
1869
+ document.removeEventListener('dblclick', this.handleDoubleClick);
1870
+ }
1871
+
1872
+ // merge the shortcuts from props
1873
+ ;
1874
+ _proto.mergeShortcuts = function mergeShortcuts() {
1875
+ var getShortcutKey = function getShortcutKey(_ref) {
1876
+ var _ref$keyCode = _ref.keyCode,
1877
+ keyCode = _ref$keyCode === void 0 ? 0 : _ref$keyCode,
1878
+ _ref$ctrl = _ref.ctrl,
1879
+ ctrl = _ref$ctrl === void 0 ? false : _ref$ctrl,
1880
+ _ref$shift = _ref.shift,
1881
+ shift = _ref$shift === void 0 ? false : _ref$shift,
1882
+ _ref$alt = _ref.alt,
1883
+ alt = _ref$alt === void 0 ? false : _ref$alt;
1884
+ return keyCode + ":" + ctrl + ":" + shift + ":" + alt;
1885
+ };
1886
+ var defaultShortcuts = this.defaultShortcuts.reduce(function (shortcuts, shortcut) {
1887
+ var _extends2;
1888
+ return _extends({}, shortcuts, (_extends2 = {}, _extends2[getShortcutKey(shortcut)] = shortcut, _extends2));
1889
+ }, {});
1890
+ var mergedShortcuts = (this.props.shortcuts || []).reduce(function (shortcuts, shortcut) {
1891
+ var keyCode = shortcut.keyCode,
1892
+ handle = shortcut.handle;
1893
+ if (keyCode && typeof handle === 'function') {
1894
+ var _extends3;
1895
+ return _extends({}, shortcuts, (_extends3 = {}, _extends3[getShortcutKey(shortcut)] = shortcut, _extends3));
1896
+ }
1897
+ return shortcuts;
1898
+ }, defaultShortcuts);
1899
+ var gradeShortcut = function gradeShortcut(shortcut) {
1900
+ var score = 0;
1901
+ ['ctrl', 'shift', 'alt'].forEach(function (key) {
1902
+ if (shortcut[key]) {
1903
+ score += 1;
1904
+ }
1905
+ });
1906
+ return score;
1907
+ };
1908
+ this.shortcuts = Object.values(mergedShortcuts).sort(function (a, b) {
1909
+ return gradeShortcut(b) - gradeShortcut(a);
1910
+ });
1911
+ };
1912
+ _proto.togglePlay = function togglePlay(player, actions) {
1913
+ if (player.paused) {
1914
+ actions.play({
1915
+ action: 'play',
1916
+ source: 'shortcut'
1917
+ });
1918
+ } else {
1919
+ actions.pause({
1920
+ action: 'pause',
1921
+ source: 'shortcut'
1922
+ });
1923
+ }
1924
+ };
1925
+ _proto.toggleFullscreen = function toggleFullscreen(player, actions) {
1926
+ actions.toggleFullscreen(player);
1927
+ };
1928
+ _proto.handleKeyPress = function handleKeyPress(e) {
1929
+ var _this$props = this.props,
1930
+ player = _this$props.player,
1931
+ actions = _this$props.actions;
1932
+ if (!player.isActive) {
1933
+ return;
1934
+ }
1935
+ var activeElement = document.activeElement;
1936
+ if (activeElement && activeElement instanceof HTMLElement && (hasClass(activeElement, 'video-react-player-control') || hasClass(activeElement, 'video-react-player-menu-button-active') || hasClass(activeElement, 'video-react-player-big-play-button'))) {
1937
+ return;
1938
+ }
1939
+ var keyCode = e.keyCode || e.which;
1940
+ var ctrl = e.ctrlKey || e.metaKey;
1941
+ var shift = e.shiftKey;
1942
+ var alt = e.altKey;
1943
+ var shortcut = this.shortcuts.find(function (s) {
1944
+ if (!s.keyCode || s.keyCode - keyCode !== 0) {
1945
+ return false;
1946
+ }
1947
+ if (s.ctrl !== undefined && s.ctrl !== ctrl || s.shift !== undefined && s.shift !== shift || s.alt !== undefined && s.alt !== alt) {
1948
+ return false;
1949
+ }
1950
+ return true;
1951
+ });
1952
+ if (shortcut) {
1953
+ shortcut.handle(player, actions);
1954
+ e.preventDefault();
1955
+ }
1956
+ }
1957
+
1958
+ // only if player is active and player is ready
1959
+ ;
1960
+ _proto.canBeClicked = function canBeClicked(player, e) {
1961
+ if (!player.isActive || player.readyState !== 4 || !(e.target instanceof HTMLVideoElement)) {
1962
+ return false;
1963
+ }
1964
+ return true;
1965
+ };
1966
+ _proto.handleClick = function handleClick(e) {
1967
+ var _this$props2 = this.props,
1968
+ player = _this$props2.player,
1969
+ actions = _this$props2.actions,
1970
+ clickable = _this$props2.clickable;
1971
+ if (!this.canBeClicked(player, e) || !clickable) {
1972
+ return;
1973
+ }
1974
+ this.togglePlay(player, actions);
1975
+ // e.preventDefault();
1976
+ };
1977
+ _proto.handleDoubleClick = function handleDoubleClick(e) {
1978
+ var _this$props3 = this.props,
1979
+ player = _this$props3.player,
1980
+ actions = _this$props3.actions,
1981
+ dblclickable = _this$props3.dblclickable;
1982
+ if (!this.canBeClicked(player, e) || !dblclickable) {
1983
+ return;
1984
+ }
1985
+ this.toggleFullscreen(player, actions);
1986
+ // e.preventDefault();
1987
+ }
1988
+
1989
+ // this component dose not render anything
1990
+ // it's just for the key down event
1991
+ ;
1992
+ _proto.render = function render() {
1993
+ return null;
1994
+ };
1995
+ return Shortcut;
1996
+ }(React.Component);
1997
+ Shortcut.defaultProps = {
1998
+ clickable: true,
1999
+ dblclickable: true
2000
+ };
2001
+ Shortcut.displayName = 'Shortcut';
2002
+
2003
+ var reactIs_production_min = createCommonjsModule(function (module, exports) {
2004
+
2005
+ Object.defineProperty(exports, "__esModule", {
2006
+ value: !0
2007
+ });
2008
+ var b = "function" === typeof Symbol && Symbol.for,
2009
+ c = b ? Symbol.for("react.element") : 60103,
2010
+ d = b ? Symbol.for("react.portal") : 60106,
2011
+ e = b ? Symbol.for("react.fragment") : 60107,
2012
+ f = b ? Symbol.for("react.strict_mode") : 60108,
2013
+ g = b ? Symbol.for("react.profiler") : 60114,
2014
+ h = b ? Symbol.for("react.provider") : 60109,
2015
+ k = b ? Symbol.for("react.context") : 60110,
2016
+ l = b ? Symbol.for("react.async_mode") : 60111,
2017
+ m = b ? Symbol.for("react.concurrent_mode") : 60111,
2018
+ n = b ? Symbol.for("react.forward_ref") : 60112,
2019
+ p = b ? Symbol.for("react.suspense") : 60113,
2020
+ q = b ? Symbol.for("react.memo") : 60115,
2021
+ r = b ? Symbol.for("react.lazy") : 60116;
2022
+ function t(a) {
2023
+ if ("object" === typeof a && null !== a) {
2024
+ var u = a.$$typeof;
2025
+ switch (u) {
2026
+ case c:
2027
+ switch (a = a.type, a) {
2028
+ case l:
2029
+ case m:
2030
+ case e:
2031
+ case g:
2032
+ case f:
2033
+ case p:
2034
+ return a;
2035
+ default:
2036
+ switch (a = a && a.$$typeof, a) {
2037
+ case k:
2038
+ case n:
2039
+ case h:
2040
+ return a;
2041
+ default:
2042
+ return u;
2043
+ }
2044
+ }
2045
+ case r:
2046
+ case q:
2047
+ case d:
2048
+ return u;
2049
+ }
2050
+ }
2051
+ }
2052
+ function v(a) {
2053
+ return t(a) === m;
2054
+ }
2055
+ exports.typeOf = t;
2056
+ exports.AsyncMode = l;
2057
+ exports.ConcurrentMode = m;
2058
+ exports.ContextConsumer = k;
2059
+ exports.ContextProvider = h;
2060
+ exports.Element = c;
2061
+ exports.ForwardRef = n;
2062
+ exports.Fragment = e;
2063
+ exports.Lazy = r;
2064
+ exports.Memo = q;
2065
+ exports.Portal = d;
2066
+ exports.Profiler = g;
2067
+ exports.StrictMode = f;
2068
+ exports.Suspense = p;
2069
+ exports.isValidElementType = function (a) {
2070
+ return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || "object" === typeof a && null !== a && (a.$$typeof === r || a.$$typeof === q || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n);
2071
+ };
2072
+ exports.isAsyncMode = function (a) {
2073
+ return v(a) || t(a) === l;
2074
+ };
2075
+ exports.isConcurrentMode = v;
2076
+ exports.isContextConsumer = function (a) {
2077
+ return t(a) === k;
2078
+ };
2079
+ exports.isContextProvider = function (a) {
2080
+ return t(a) === h;
2081
+ };
2082
+ exports.isElement = function (a) {
2083
+ return "object" === typeof a && null !== a && a.$$typeof === c;
2084
+ };
2085
+ exports.isForwardRef = function (a) {
2086
+ return t(a) === n;
2087
+ };
2088
+ exports.isFragment = function (a) {
2089
+ return t(a) === e;
2090
+ };
2091
+ exports.isLazy = function (a) {
2092
+ return t(a) === r;
2093
+ };
2094
+ exports.isMemo = function (a) {
2095
+ return t(a) === q;
2096
+ };
2097
+ exports.isPortal = function (a) {
2098
+ return t(a) === d;
2099
+ };
2100
+ exports.isProfiler = function (a) {
2101
+ return t(a) === g;
2102
+ };
2103
+ exports.isStrictMode = function (a) {
2104
+ return t(a) === f;
2105
+ };
2106
+ exports.isSuspense = function (a) {
2107
+ return t(a) === p;
2108
+ };
2109
+ });
2110
+ unwrapExports(reactIs_production_min);
2111
+ var reactIs_production_min_1 = reactIs_production_min.typeOf;
2112
+ var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
2113
+ var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
2114
+ var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
2115
+ var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
2116
+ var reactIs_production_min_6 = reactIs_production_min.Element;
2117
+ var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
2118
+ var reactIs_production_min_8 = reactIs_production_min.Fragment;
2119
+ var reactIs_production_min_9 = reactIs_production_min.Lazy;
2120
+ var reactIs_production_min_10 = reactIs_production_min.Memo;
2121
+ var reactIs_production_min_11 = reactIs_production_min.Portal;
2122
+ var reactIs_production_min_12 = reactIs_production_min.Profiler;
2123
+ var reactIs_production_min_13 = reactIs_production_min.StrictMode;
2124
+ var reactIs_production_min_14 = reactIs_production_min.Suspense;
2125
+ var reactIs_production_min_15 = reactIs_production_min.isValidElementType;
2126
+ var reactIs_production_min_16 = reactIs_production_min.isAsyncMode;
2127
+ var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode;
2128
+ var reactIs_production_min_18 = reactIs_production_min.isContextConsumer;
2129
+ var reactIs_production_min_19 = reactIs_production_min.isContextProvider;
2130
+ var reactIs_production_min_20 = reactIs_production_min.isElement;
2131
+ var reactIs_production_min_21 = reactIs_production_min.isForwardRef;
2132
+ var reactIs_production_min_22 = reactIs_production_min.isFragment;
2133
+ var reactIs_production_min_23 = reactIs_production_min.isLazy;
2134
+ var reactIs_production_min_24 = reactIs_production_min.isMemo;
2135
+ var reactIs_production_min_25 = reactIs_production_min.isPortal;
2136
+ var reactIs_production_min_26 = reactIs_production_min.isProfiler;
2137
+ var reactIs_production_min_27 = reactIs_production_min.isStrictMode;
2138
+ var reactIs_production_min_28 = reactIs_production_min.isSuspense;
2139
+
2140
+ var reactIs_development = createCommonjsModule(function (module, exports) {
2141
+ });
2142
+ unwrapExports(reactIs_development);
2143
+ var reactIs_development_1 = reactIs_development.typeOf;
2144
+ var reactIs_development_2 = reactIs_development.AsyncMode;
2145
+ var reactIs_development_3 = reactIs_development.ConcurrentMode;
2146
+ var reactIs_development_4 = reactIs_development.ContextConsumer;
2147
+ var reactIs_development_5 = reactIs_development.ContextProvider;
2148
+ var reactIs_development_6 = reactIs_development.Element;
2149
+ var reactIs_development_7 = reactIs_development.ForwardRef;
2150
+ var reactIs_development_8 = reactIs_development.Fragment;
2151
+ var reactIs_development_9 = reactIs_development.Lazy;
2152
+ var reactIs_development_10 = reactIs_development.Memo;
2153
+ var reactIs_development_11 = reactIs_development.Portal;
2154
+ var reactIs_development_12 = reactIs_development.Profiler;
2155
+ var reactIs_development_13 = reactIs_development.StrictMode;
2156
+ var reactIs_development_14 = reactIs_development.Suspense;
2157
+ var reactIs_development_15 = reactIs_development.isValidElementType;
2158
+ var reactIs_development_16 = reactIs_development.isAsyncMode;
2159
+ var reactIs_development_17 = reactIs_development.isConcurrentMode;
2160
+ var reactIs_development_18 = reactIs_development.isContextConsumer;
2161
+ var reactIs_development_19 = reactIs_development.isContextProvider;
2162
+ var reactIs_development_20 = reactIs_development.isElement;
2163
+ var reactIs_development_21 = reactIs_development.isForwardRef;
2164
+ var reactIs_development_22 = reactIs_development.isFragment;
2165
+ var reactIs_development_23 = reactIs_development.isLazy;
2166
+ var reactIs_development_24 = reactIs_development.isMemo;
2167
+ var reactIs_development_25 = reactIs_development.isPortal;
2168
+ var reactIs_development_26 = reactIs_development.isProfiler;
2169
+ var reactIs_development_27 = reactIs_development.isStrictMode;
2170
+ var reactIs_development_28 = reactIs_development.isSuspense;
2171
+
2172
+ var reactIs = createCommonjsModule(function (module) {
2173
+
2174
+ {
2175
+ module.exports = reactIs_production_min;
2176
+ }
2177
+ });
2178
+
2179
+ /*
2180
+ object-assign
2181
+ (c) Sindre Sorhus
2182
+ @license MIT
2183
+ */
2184
+
2185
+ /* eslint-disable no-unused-vars */
2186
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
2187
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2188
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
2189
+ function toObject(val) {
2190
+ if (val === null || val === undefined) {
2191
+ throw new TypeError('Object.assign cannot be called with null or undefined');
2192
+ }
2193
+ return Object(val);
2194
+ }
2195
+ function shouldUseNative() {
2196
+ try {
2197
+ if (!Object.assign) {
2198
+ return false;
2199
+ }
2200
+
2201
+ // Detect buggy property enumeration order in older V8 versions.
2202
+
2203
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
2204
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
2205
+ test1[5] = 'de';
2206
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
2207
+ return false;
2208
+ }
2209
+
2210
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
2211
+ var test2 = {};
2212
+ for (var i = 0; i < 10; i++) {
2213
+ test2['_' + String.fromCharCode(i)] = i;
2214
+ }
2215
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
2216
+ return test2[n];
2217
+ });
2218
+ if (order2.join('') !== '0123456789') {
2219
+ return false;
2220
+ }
2221
+
2222
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
2223
+ var test3 = {};
2224
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
2225
+ test3[letter] = letter;
2226
+ });
2227
+ if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
2228
+ return false;
2229
+ }
2230
+ return true;
2231
+ } catch (err) {
2232
+ // We don't expect any of the above to throw, but better to be safe.
2233
+ return false;
2234
+ }
2235
+ }
2236
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
2237
+ var from;
2238
+ var to = toObject(target);
2239
+ var symbols;
2240
+ for (var s = 1; s < arguments.length; s++) {
2241
+ from = Object(arguments[s]);
2242
+ for (var key in from) {
2243
+ if (hasOwnProperty.call(from, key)) {
2244
+ to[key] = from[key];
2245
+ }
2246
+ }
2247
+ if (getOwnPropertySymbols) {
2248
+ symbols = getOwnPropertySymbols(from);
2249
+ for (var i = 0; i < symbols.length; i++) {
2250
+ if (propIsEnumerable.call(from, symbols[i])) {
2251
+ to[symbols[i]] = from[symbols[i]];
2252
+ }
2253
+ }
2254
+ }
2255
+ }
2256
+ return to;
2257
+ };
2258
+
2259
+ /**
2260
+ * Copyright (c) 2013-present, Facebook, Inc.
2261
+ *
2262
+ * This source code is licensed under the MIT license found in the
2263
+ * LICENSE file in the root directory of this source tree.
2264
+ */
2265
+
2266
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2267
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret;
2268
+
2269
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
2270
+
2271
+ function emptyFunction() {}
2272
+ function emptyFunctionWithReset() {}
2273
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
2274
+ var factoryWithThrowingShims = function factoryWithThrowingShims() {
2275
+ function shim(props, propName, componentName, location, propFullName, secret) {
2276
+ if (secret === ReactPropTypesSecret_1) {
2277
+ // It is still safe when called from React.
2278
+ return;
2279
+ }
2280
+ var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
2281
+ err.name = 'Invariant Violation';
2282
+ throw err;
2283
+ }
2284
+ shim.isRequired = shim;
2285
+ function getShim() {
2286
+ return shim;
2287
+ }
2288
+ // Important!
2289
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
2290
+ var ReactPropTypes = {
2291
+ array: shim,
2292
+ bool: shim,
2293
+ func: shim,
2294
+ number: shim,
2295
+ object: shim,
2296
+ string: shim,
2297
+ symbol: shim,
2298
+ any: shim,
2299
+ arrayOf: getShim,
2300
+ element: shim,
2301
+ elementType: shim,
2302
+ instanceOf: getShim,
2303
+ node: shim,
2304
+ objectOf: getShim,
2305
+ oneOf: getShim,
2306
+ oneOfType: getShim,
2307
+ shape: getShim,
2308
+ exact: getShim,
2309
+ checkPropTypes: emptyFunctionWithReset,
2310
+ resetWarningCache: emptyFunction
2311
+ };
2312
+ ReactPropTypes.PropTypes = ReactPropTypes;
2313
+ return ReactPropTypes;
2314
+ };
2315
+
2316
+ var propTypes = createCommonjsModule(function (module) {
2317
+ /**
2318
+ * Copyright (c) 2013-present, Facebook, Inc.
2319
+ *
2320
+ * This source code is licensed under the MIT license found in the
2321
+ * LICENSE file in the root directory of this source tree.
2322
+ */
2323
+
2324
+ {
2325
+ // By explicitly using `prop-types` you are opting into new production behavior.
2326
+ // http://fb.me/prop-types-in-prod
2327
+ module.exports = factoryWithThrowingShims();
2328
+ }
2329
+ });
2330
+
2331
+ /**
2332
+
2333
+ * Copyright (c) 2016 Video-React contributors
2334
+ * Copyright (c) 2025 ZingMe.Vn
2335
+ *
2336
+ * This source code is licensed under the MIT license found in the
2337
+ * LICENSE file in the root directory of this source tree.
2338
+ */
2339
+ var propTypes$1 = {
2340
+ player: propTypes.object,
2341
+ className: propTypes.string
2342
+ };
2343
+ function CurrentTimeDisplay(_ref) {
2344
+ var player = _ref.player,
2345
+ className = _ref.className;
2346
+ var formattedTime = formatTime(player.currentTime, player.duration);
2347
+ return React__default.createElement("div", {
2348
+ className: classnames('video-react-player-current-time video-react-player-time-control video-react-player-control', className)
2349
+ }, React__default.createElement("div", {
2350
+ className: "video-react-player-current-time-display",
2351
+ "aria-live": "off"
2352
+ }, React__default.createElement("span", {
2353
+ className: "video-react-player-control-text"
2354
+ }, "Current Time "), formattedTime));
2355
+ }
2356
+ CurrentTimeDisplay.propTypes = propTypes$1;
2357
+ CurrentTimeDisplay.displayName = 'CurrentTimeDisplay';
2358
+
2359
+ /**
2360
+
2361
+ * Copyright (c) 2016 Video-React contributors
2362
+ * Copyright (c) 2025 ZingMe.Vn
2363
+ *
2364
+ * This source code is licensed under the MIT license found in the
2365
+ * LICENSE file in the root directory of this source tree.
2366
+ */
2367
+ function DurationDisplay(_ref) {
2368
+ var player = _ref.player,
2369
+ className = _ref.className;
2370
+ var formattedTime = formatTime(player.duration);
2371
+ return React__default.createElement("div", {
2372
+ className: classnames(className, 'video-react-player-duration video-react-player-time-control video-react-player-control')
2373
+ }, React__default.createElement("div", {
2374
+ className: "video-react-player-duration-display",
2375
+ "aria-live": "off"
2376
+ }, React__default.createElement("span", {
2377
+ className: "video-react-player-control-text"
2378
+ }, "Duration Time "), formattedTime));
2379
+ }
2380
+ DurationDisplay.displayName = 'DurationDisplay';
2381
+
2382
+ /**
2383
+
2384
+ * Copyright (c) 2016 Video-React contributors
2385
+ * Copyright (c) 2025 ZingMe.Vn
2386
+ *
2387
+ * This source code is licensed under the MIT license found in the
2388
+ * LICENSE file in the root directory of this source tree.
2389
+ */
2390
+ function TimeDivider(_ref) {
2391
+ var separator = _ref.separator,
2392
+ className = _ref.className;
2393
+ var separatorText = separator || '/';
2394
+ return React__default.createElement("div", {
2395
+ className: classnames('video-react-player-time-control video-react-player-time-divider', className),
2396
+ dir: "ltr"
2397
+ }, React__default.createElement("div", null, React__default.createElement("span", null, separatorText)));
2398
+ }
2399
+ TimeDivider.displayName = 'TimeDivider';
2400
+
2401
+ /**
2402
+
2403
+ * Copyright (c) 2016 Video-React contributors
2404
+ * Copyright (c) 2025 ZingMe.Vn
2405
+ *
2406
+ * This source code is licensed under the MIT license found in the
2407
+ * LICENSE file in the root directory of this source tree.
2408
+ */
2409
+ var FullscreenToggle = React.forwardRef(function (_ref, ref) {
2410
+ var actions = _ref.actions,
2411
+ player = _ref.player,
2412
+ className = _ref.className;
2413
+ var handleClick = React.useCallback(function () {
2414
+ actions.toggleFullscreen(player);
2415
+ }, [actions, player]);
2416
+ return React__default.createElement("button", {
2417
+ className: classnames(className, {
2418
+ 'video-react-player-icon-fullscreen-exit': player.isFullscreen,
2419
+ 'video-react-player-icon-fullscreen': !player.isFullscreen
2420
+ }, 'video-react-player-fullscreen-control video-react-player-control video-react-player-button video-react-player-icon'),
2421
+ ref: ref,
2422
+ type: "button",
2423
+ tabIndex: 0,
2424
+ onClick: handleClick
2425
+ }, React__default.createElement("span", {
2426
+ className: "video-react-player-control-text"
2427
+ }, "Non-Fullscreen"));
2428
+ });
2429
+ FullscreenToggle.displayName = 'FullscreenToggle';
2430
+
2431
+ var PlayToggle = React.forwardRef(function (_ref, ref) {
2432
+ var _player$paused;
2433
+ var actions = _ref.actions,
2434
+ player = _ref.player,
2435
+ className = _ref.className;
2436
+ var paused = (_player$paused = player === null || player === void 0 ? void 0 : player.paused) !== null && _player$paused !== void 0 ? _player$paused : true;
2437
+ var handleClick = React.useCallback(function () {
2438
+ if (!actions) return;
2439
+ if (paused) {
2440
+ actions.play();
2441
+ } else {
2442
+ actions.pause();
2443
+ }
2444
+ }, [actions, paused]);
2445
+ var controlText = paused ? 'Play' : 'Pause';
2446
+ return React__default.createElement("button", {
2447
+ ref: ref,
2448
+ className: classnames(className, {
2449
+ 'video-react-player-play-control': true,
2450
+ 'video-react-player-control': true,
2451
+ 'video-react-player-button': true,
2452
+ 'video-react-player-paused': paused,
2453
+ 'video-react-player-playing': !paused
2454
+ }),
2455
+ type: "button",
2456
+ tabIndex: 0,
2457
+ onClick: handleClick
2458
+ }, React__default.createElement("span", {
2459
+ className: "video-react-player-control-text"
2460
+ }, controlText));
2461
+ });
2462
+ PlayToggle.displayName = 'PlayToggle';
2463
+
2464
+ var Slider = /*#__PURE__*/function (_Component) {
2465
+ _inheritsLoose(Slider, _Component);
2466
+ function Slider() {
2467
+ var _this;
2468
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2469
+ args[_key] = arguments[_key];
2470
+ }
2471
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
2472
+ _this.slider = null;
2473
+ _this.state = {
2474
+ active: false
2475
+ };
2476
+ _this.getProgress = function () {
2477
+ var getPercent = _this.props.getPercent;
2478
+ if (!getPercent) {
2479
+ return 0;
2480
+ }
2481
+ var progress = getPercent();
2482
+ if (typeof progress !== 'number' || progress < 0 || progress === Infinity) {
2483
+ progress = 0;
2484
+ }
2485
+ return progress;
2486
+ };
2487
+ _this.handleMouseDown = function (event) {
2488
+ var _this$props$sliderAct, _this$props;
2489
+ var onMouseDown = _this.props.onMouseDown;
2490
+ document.addEventListener('mousemove', _this.handleMouseMove, true);
2491
+ document.addEventListener('mouseup', _this.handleMouseUp, true);
2492
+ document.addEventListener('touchmove', _this.handleMouseMove, true);
2493
+ document.addEventListener('touchend', _this.handleMouseUp, true);
2494
+ _this.setState({
2495
+ active: true
2496
+ });
2497
+ (_this$props$sliderAct = (_this$props = _this.props).sliderActive) === null || _this$props$sliderAct === void 0 ? void 0 : _this$props$sliderAct.call(_this$props, event);
2498
+ _this.handleMouseMove(event);
2499
+ if (onMouseDown) {
2500
+ onMouseDown(event);
2501
+ }
2502
+ };
2503
+ _this.handleMouseMove = function (event) {
2504
+ var onMouseMove = _this.props.onMouseMove;
2505
+ if (onMouseMove) {
2506
+ onMouseMove(event);
2507
+ }
2508
+ };
2509
+ _this.handleMouseUp = function (event) {
2510
+ var _this$props$sliderIna, _this$props2;
2511
+ event.preventDefault();
2512
+ var onMouseUp = _this.props.onMouseUp;
2513
+ document.removeEventListener('mousemove', _this.handleMouseMove, true);
2514
+ document.removeEventListener('mouseup', _this.handleMouseUp, true);
2515
+ document.removeEventListener('touchmove', _this.handleMouseMove, true);
2516
+ document.removeEventListener('touchend', _this.handleMouseUp, true);
2517
+ _this.setState({
2518
+ active: false
2519
+ });
2520
+ (_this$props$sliderIna = (_this$props2 = _this.props).sliderInactive) === null || _this$props$sliderIna === void 0 ? void 0 : _this$props$sliderIna.call(_this$props2, event);
2521
+ if (onMouseUp) {
2522
+ onMouseUp(event);
2523
+ }
2524
+ };
2525
+ _this.handleFocus = function (event) {
2526
+ var _this$props$onFocus, _this$props3;
2527
+ document.addEventListener('keydown', _this.handleKeyPress, true);
2528
+ (_this$props$onFocus = (_this$props3 = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props3, event);
2529
+ };
2530
+ _this.handleBlur = function (event) {
2531
+ document.removeEventListener('keydown', _this.handleKeyPress, true);
2532
+ if (event) {
2533
+ var _this$props$onBlur, _this$props4;
2534
+ (_this$props$onBlur = (_this$props4 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props4, event);
2535
+ }
2536
+ };
2537
+ _this.handleClick = function (event) {
2538
+ var _this$props$onClick, _this$props5;
2539
+ event.preventDefault();
2540
+ (_this$props$onClick = (_this$props5 = _this.props).onClick) === null || _this$props$onClick === void 0 ? void 0 : _this$props$onClick.call(_this$props5, event);
2541
+ };
2542
+ _this.handleKeyPress = function (event) {
2543
+ if (event.which === 37 || event.which === 40) {
2544
+ event.preventDefault();
2545
+ event.stopPropagation();
2546
+ _this.stepBack();
2547
+ } else if (event.which === 38 || event.which === 39) {
2548
+ event.preventDefault();
2549
+ event.stopPropagation();
2550
+ _this.stepForward();
2551
+ }
2552
+ };
2553
+ _this.stepForward = function () {
2554
+ var _this$props$stepForwa, _this$props6;
2555
+ (_this$props$stepForwa = (_this$props6 = _this.props).stepForward) === null || _this$props$stepForwa === void 0 ? void 0 : _this$props$stepForwa.call(_this$props6);
2556
+ };
2557
+ _this.stepBack = function () {
2558
+ var _this$props$stepBack, _this$props7;
2559
+ (_this$props$stepBack = (_this$props7 = _this.props).stepBack) === null || _this$props$stepBack === void 0 ? void 0 : _this$props$stepBack.call(_this$props7);
2560
+ };
2561
+ _this.renderChildren = function () {
2562
+ var _this$props$onPercent, _this$props8;
2563
+ var progress = _this.getProgress();
2564
+ var percentage = (progress * 100).toFixed(2) + "%";
2565
+ (_this$props$onPercent = (_this$props8 = _this.props).onPercentageChange) === null || _this$props$onPercent === void 0 ? void 0 : _this$props$onPercent.call(_this$props8, percentage);
2566
+ return React__default.Children.map(_this.props.children, function (child) {
2567
+ return React__default.isValidElement(child) ? React__default.cloneElement(child, {
2568
+ progress: progress,
2569
+ percentage: percentage
2570
+ }) : child;
2571
+ });
2572
+ };
2573
+ return _this;
2574
+ }
2575
+ var _proto = Slider.prototype;
2576
+ _proto.componentWillUnmount = function componentWillUnmount() {
2577
+ document.removeEventListener('mousemove', this.handleMouseMove, true);
2578
+ document.removeEventListener('mouseup', this.handleMouseUp, true);
2579
+ document.removeEventListener('touchmove', this.handleMouseMove, true);
2580
+ document.removeEventListener('touchend', this.handleMouseUp, true);
2581
+ document.removeEventListener('keydown', this.handleKeyPress, true);
2582
+ };
2583
+ _proto.calculateDistance = function calculateDistance(event) {
2584
+ var _position$x;
2585
+ if (!this.slider) {
2586
+ return 0;
2587
+ }
2588
+ var position = getPointerPosition(this.slider, event);
2589
+ if (this.props.vertical) {
2590
+ var _position$y;
2591
+ return (_position$y = position.y) !== null && _position$y !== void 0 ? _position$y : 0;
2592
+ }
2593
+ return (_position$x = position.x) !== null && _position$x !== void 0 ? _position$x : 0;
2594
+ };
2595
+ _proto.render = function render() {
2596
+ var _this2 = this;
2597
+ var _this$props9 = this.props,
2598
+ vertical = _this$props9.vertical,
2599
+ label = _this$props9.label,
2600
+ valuenow = _this$props9.valuenow,
2601
+ valuetext = _this$props9.valuetext;
2602
+ var ariaValueNow = typeof valuenow === 'number' ? valuenow : Number(valuenow !== null && valuenow !== void 0 ? valuenow : 0);
2603
+ return React__default.createElement("div", {
2604
+ className: classnames(this.props.className, {
2605
+ 'video-react-player-slider-vertical': vertical,
2606
+ 'video-react-player-slider-horizontal': !vertical,
2607
+ 'video-react-player-sliding': this.state.active
2608
+ }, 'video-react-player-slider'),
2609
+ ref: function ref(node) {
2610
+ _this2.slider = node;
2611
+ },
2612
+ tabIndex: 0,
2613
+ role: "slider",
2614
+ onMouseDown: this.handleMouseDown,
2615
+ onTouchStart: this.handleMouseDown,
2616
+ onFocus: this.handleFocus,
2617
+ onBlur: this.handleBlur,
2618
+ onClick: this.handleClick,
2619
+ "aria-label": label || '',
2620
+ "aria-valuenow": ariaValueNow,
2621
+ "aria-valuetext": valuetext || '',
2622
+ "aria-valuemin": 0,
2623
+ "aria-valuemax": 100
2624
+ }, this.renderChildren());
2625
+ };
2626
+ return Slider;
2627
+ }(React.Component);
2628
+ Slider.displayName = 'Slider';
2629
+
2630
+ /**
2631
+
2632
+ * Copyright (c) 2016 Video-React contributors
2633
+ * Copyright (c) 2025 ZingMe.Vn
2634
+ *
2635
+ * This source code is licensed under the MIT license found in the
2636
+ * LICENSE file in the root directory of this source tree.
2637
+ */
2638
+ // Shows play progress
2639
+ function PlayProgressBar(_ref) {
2640
+ var currentTime = _ref.currentTime,
2641
+ duration = _ref.duration,
2642
+ percentage = _ref.percentage,
2643
+ className = _ref.className;
2644
+ return React__default.createElement("div", {
2645
+ "data-current-time": formatTime(currentTime, duration),
2646
+ className: classnames('video-react-player-play-progress video-react-player-slider-bar', className),
2647
+ style: {
2648
+ width: percentage
2649
+ }
2650
+ }, React__default.createElement("span", {
2651
+ className: "video-react-player-control-text"
2652
+ }, "Progress: " + percentage));
2653
+ }
2654
+ PlayProgressBar.displayName = 'PlayProgressBar';
2655
+
2656
+ /**
2657
+
2658
+ * Copyright (c) 2016 Video-React contributors
2659
+ * Copyright (c) 2025 ZingMe.Vn
2660
+ *
2661
+ * This source code is licensed under the MIT license found in the
2662
+ * LICENSE file in the root directory of this source tree.
2663
+ */
2664
+ var percentify = function percentify(time, end) {
2665
+ var percent = time / end || 0;
2666
+ return (percent >= 1 ? 1 : percent) * 100 + "%";
2667
+ };
2668
+ var LoadProgressBar = function LoadProgressBar(_ref) {
2669
+ var buffered = _ref.buffered,
2670
+ duration = _ref.duration,
2671
+ className = _ref.className;
2672
+ if (!buffered || buffered.length === 0) {
2673
+ return null;
2674
+ }
2675
+ var bufferedEnd = buffered.end(buffered.length - 1);
2676
+ if (bufferedEnd > duration) {
2677
+ bufferedEnd = duration;
2678
+ }
2679
+ var style = {
2680
+ width: percentify(bufferedEnd, duration)
2681
+ };
2682
+ var parts = [];
2683
+ for (var i = 0; i < buffered.length; i += 1) {
2684
+ var start = buffered.start(i);
2685
+ var end = buffered.end(i);
2686
+ parts.push(React__default.createElement("div", {
2687
+ style: {
2688
+ left: percentify(start, bufferedEnd),
2689
+ width: percentify(end - start, bufferedEnd)
2690
+ },
2691
+ key: "part-" + i
2692
+ }));
2693
+ }
2694
+ return React__default.createElement("div", {
2695
+ style: style,
2696
+ className: classnames('video-react-player-load-progress', className)
2697
+ }, React__default.createElement("span", {
2698
+ className: "video-react-player-control-text"
2699
+ }, "Loaded: 0%"), parts);
2700
+ };
2701
+ LoadProgressBar.displayName = 'LoadProgressBar';
2702
+
2703
+ /**
2704
+
2705
+ * Copyright (c) 2016 Video-React contributors
2706
+ * Copyright (c) 2025 ZingMe.Vn
2707
+ *
2708
+ * This source code is licensed under the MIT license found in the
2709
+ * LICENSE file in the root directory of this source tree.
2710
+ */
2711
+ var MouseTimeDisplay = function MouseTimeDisplay(_ref) {
2712
+ var duration = _ref.duration,
2713
+ mouseTime = _ref.mouseTime,
2714
+ className = _ref.className,
2715
+ text = _ref.text;
2716
+ if (!mouseTime.time) {
2717
+ return null;
2718
+ }
2719
+ var time = text || formatTime(mouseTime.time, duration);
2720
+ return React__default.createElement("div", {
2721
+ className: classnames('video-react-player-mouse-display', className),
2722
+ style: {
2723
+ left: mouseTime.position + "px"
2724
+ },
2725
+ "data-current-time": time
2726
+ });
2727
+ };
2728
+ MouseTimeDisplay.displayName = 'MouseTimeDisplay';
2729
+
2730
+ /**
2731
+
2732
+ * Copyright (c) 2016 Video-React contributors
2733
+ * Copyright (c) 2025 ZingMe.Vn
2734
+ *
2735
+ * This source code is licensed under the MIT license found in the
2736
+ * LICENSE file in the root directory of this source tree.
2737
+ */
2738
+ var SeekBar = function SeekBar(_ref) {
2739
+ var player = _ref.player,
2740
+ actions = _ref.actions,
2741
+ mouseTime = _ref.mouseTime,
2742
+ className = _ref.className;
2743
+ var sliderRef = React.useRef(null);
2744
+ var getPercent = React.useCallback(function () {
2745
+ var currentTime = player.currentTime,
2746
+ seekingTime = player.seekingTime,
2747
+ duration = player.duration;
2748
+ var time = seekingTime || currentTime;
2749
+ if (!duration) {
2750
+ return 0;
2751
+ }
2752
+ var percent = time / duration;
2753
+ return percent >= 1 ? 1 : percent;
2754
+ }, [player]);
2755
+ var getNewTime = React.useCallback(function (event) {
2756
+ var duration = player.duration || 0;
2757
+ var distance = sliderRef.current ? sliderRef.current.calculateDistance(event) : 0;
2758
+ var newTime = distance * duration;
2759
+ return newTime === duration ? newTime - 0.1 : newTime;
2760
+ }, [player.duration]);
2761
+ var handleMouseMove = React.useCallback(function (event) {
2762
+ var newTime = getNewTime(event);
2763
+ actions.handleSeekingTime(newTime);
2764
+ }, [actions, getNewTime]);
2765
+ var handleMouseUp = React.useCallback(function (event) {
2766
+ var newTime = getNewTime(event);
2767
+ actions.seek(newTime);
2768
+ actions.handleEndSeeking(newTime);
2769
+ }, [actions, getNewTime]);
2770
+ var stepForward = React.useCallback(function () {
2771
+ actions.forward(5);
2772
+ }, [actions]);
2773
+ var stepBack = React.useCallback(function () {
2774
+ actions.replay(5);
2775
+ }, [actions]);
2776
+ var time = player.seekingTime || player.currentTime;
2777
+ var percent = getPercent();
2778
+ var valueText = React.useMemo(function () {
2779
+ return formatTime(time, player.duration);
2780
+ }, [player.duration, time]);
2781
+ return React__default.createElement(Slider, {
2782
+ ref: function ref(instance) {
2783
+ sliderRef.current = instance;
2784
+ },
2785
+ label: "video progress bar",
2786
+ className: classnames('video-react-player-progress-holder', className),
2787
+ valuenow: Number((percent * 100).toFixed(2)),
2788
+ valuetext: valueText,
2789
+ onMouseMove: handleMouseMove,
2790
+ onMouseUp: handleMouseUp,
2791
+ getPercent: getPercent,
2792
+ stepForward: stepForward,
2793
+ stepBack: stepBack
2794
+ }, React__default.createElement(LoadProgressBar, {
2795
+ buffered: player.buffered,
2796
+ currentTime: time,
2797
+ duration: player.duration
2798
+ }), React__default.createElement(MouseTimeDisplay, {
2799
+ duration: player.duration,
2800
+ mouseTime: mouseTime
2801
+ }), React__default.createElement(PlayProgressBar, {
2802
+ percentage: (percent * 100).toFixed(2) + "%",
2803
+ currentTime: time,
2804
+ duration: player.duration
2805
+ }));
2806
+ };
2807
+ SeekBar.displayName = 'SeekBar';
2808
+
2809
+ var ProgressControl = function ProgressControl(_ref) {
2810
+ var className = _ref.className,
2811
+ playerProps = _objectWithoutPropertiesLoose(_ref, ["className"]);
2812
+ var _useState = React.useState({
2813
+ time: null,
2814
+ position: 0
2815
+ }),
2816
+ mouseTime = _useState[0],
2817
+ setMouseTime = _useState[1];
2818
+ var handleMouseMove = React.useCallback(function (event) {
2819
+ if (!event.pageX) {
2820
+ return;
2821
+ }
2822
+ var target = event.currentTarget;
2823
+ if (!target) {
2824
+ return;
2825
+ }
2826
+ var _Dom$getPointerPositi = getPointerPosition(target, event.nativeEvent),
2827
+ _Dom$getPointerPositi2 = _Dom$getPointerPositi.x,
2828
+ x = _Dom$getPointerPositi2 === void 0 ? 0 : _Dom$getPointerPositi2;
2829
+ var newTime = x * playerProps.player.duration;
2830
+ var position = event.pageX - findElPosition(target).left;
2831
+ setMouseTime({
2832
+ time: newTime,
2833
+ position: position
2834
+ });
2835
+ }, [playerProps.player.duration]);
2836
+ return React__default.createElement("div", {
2837
+ onMouseMove: handleMouseMove,
2838
+ className: classnames('video-react-player-progress-control video-react-player-control', className)
2839
+ }, React__default.createElement(SeekBar, _extends({
2840
+ mouseTime: mouseTime
2841
+ }, playerProps)));
2842
+ };
2843
+ ProgressControl.displayName = 'ProgressControl';
2844
+
2845
+ var ClickableComponent = /*#__PURE__*/function (_Component) {
2846
+ _inheritsLoose(ClickableComponent, _Component);
2847
+ function ClickableComponent() {
2848
+ var _this;
2849
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2850
+ args[_key] = arguments[_key];
2851
+ }
2852
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
2853
+ _this.handleKeypress = function (event) {
2854
+ if (event.which === 32 || event.which === 13) {
2855
+ event.preventDefault();
2856
+ _this.handleClick(event);
2857
+ }
2858
+ };
2859
+ _this.handleClick = function (event) {
2860
+ _this.props.onClick(event);
2861
+ };
2862
+ _this.handleFocus = function (event) {
2863
+ var _this$props$onFocus, _this$props;
2864
+ document.addEventListener('keydown', _this.handleKeypress);
2865
+ (_this$props$onFocus = (_this$props = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, event);
2866
+ };
2867
+ _this.handleBlur = function (event) {
2868
+ document.removeEventListener('keydown', _this.handleKeypress);
2869
+ if (event) {
2870
+ var _this$props$onBlur, _this$props2;
2871
+ (_this$props$onBlur = (_this$props2 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props2, event);
2872
+ }
2873
+ };
2874
+ return _this;
2875
+ }
2876
+ var _proto = ClickableComponent.prototype;
2877
+ _proto.componentWillUnmount = function componentWillUnmount() {
2878
+ this.handleBlur();
2879
+ };
2880
+ _proto.render = function render() {
2881
+ var _this$props3 = this.props,
2882
+ _this$props3$tagName = _this$props3.tagName,
2883
+ tagName = _this$props3$tagName === void 0 ? 'div' : _this$props3$tagName,
2884
+ className = _this$props3.className,
2885
+ children = _this$props3.children,
2886
+ onClick = _this$props3.onClick,
2887
+ onFocus = _this$props3.onFocus,
2888
+ onBlur = _this$props3.onBlur,
2889
+ rest = _objectWithoutPropertiesLoose(_this$props3, ["tagName", "className", "children", "onClick", "onFocus", "onBlur"]);
2890
+ var Tag = tagName;
2891
+ return React__default.createElement(Tag, _extends({}, rest, {
2892
+ className: classnames(className),
2893
+ role: "button",
2894
+ tabIndex: 0,
2895
+ onClick: this.handleClick,
2896
+ onFocus: this.handleFocus,
2897
+ onBlur: this.handleBlur
2898
+ }), children);
2899
+ };
2900
+ return ClickableComponent;
2901
+ }(React.Component);
2902
+ ClickableComponent.defaultProps = {
2903
+ tagName: 'div'
2904
+ };
2905
+ ClickableComponent.displayName = 'ClickableComponent';
2906
+
2907
+ /**
2908
+
2909
+ * Copyright (c) 2016 Video-React contributors
2910
+ * Copyright (c) 2025 ZingMe.Vn
2911
+ *
2912
+ * This source code is licensed under the MIT license found in the
2913
+ * LICENSE file in the root directory of this source tree.
2914
+ */
2915
+ var Popup = function Popup(_ref) {
2916
+ var children = _ref.children;
2917
+ var handleClick = function handleClick(event) {
2918
+ event.preventDefault();
2919
+ };
2920
+ return React__default.createElement("div", {
2921
+ className: "video-react-player-menu",
2922
+ onClick: handleClick
2923
+ }, React__default.createElement("div", {
2924
+ className: "video-react-player-menu-content"
2925
+ }, children));
2926
+ };
2927
+ Popup.displayName = 'Popup';
2928
+
2929
+ var PopupButton = function PopupButton(_ref) {
2930
+ var _ref$inline = _ref.inline,
2931
+ inline = _ref$inline === void 0 ? true : _ref$inline,
2932
+ className = _ref.className,
2933
+ children = _ref.children,
2934
+ rest = _objectWithoutPropertiesLoose(_ref, ["inline", "className", "children"]);
2935
+ return React__default.createElement(ClickableComponent, _extends({}, rest, {
2936
+ className: classnames(className, {
2937
+ 'video-react-player-menu-button-inline': !!inline,
2938
+ 'video-react-player-menu-button-popup': !inline
2939
+ }, 'video-react-player-control video-react-player-button video-react-player-menu-button')
2940
+ }), React__default.createElement(Popup, null, children));
2941
+ };
2942
+ PopupButton.displayName = 'PopupButton';
2943
+
2944
+ var VolumeLevel = function VolumeLevel(_ref) {
2945
+ var _ref$percentage = _ref.percentage,
2946
+ percentage = _ref$percentage === void 0 ? '100%' : _ref$percentage,
2947
+ _ref$vertical = _ref.vertical,
2948
+ vertical = _ref$vertical === void 0 ? false : _ref$vertical,
2949
+ className = _ref.className;
2950
+ var style = {};
2951
+ if (vertical) {
2952
+ style.height = percentage;
2953
+ } else {
2954
+ style.width = percentage;
2955
+ }
2956
+ return React__default.createElement("div", {
2957
+ className: classnames(className, 'video-react-player-volume-level'),
2958
+ style: style
2959
+ }, React__default.createElement("span", {
2960
+ className: "video-react-player-control-text"
2961
+ }));
2962
+ };
2963
+ VolumeLevel.displayName = 'VolumeLevel';
2964
+
2965
+ var VolumeBar = /*#__PURE__*/function (_Component) {
2966
+ _inheritsLoose(VolumeBar, _Component);
2967
+ function VolumeBar() {
2968
+ var _this;
2969
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2970
+ args[_key] = arguments[_key];
2971
+ }
2972
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
2973
+ _this.slider = null;
2974
+ _this.state = {
2975
+ percentage: '0%'
2976
+ };
2977
+ _this.getPercent = function () {
2978
+ var player = _this.props.player;
2979
+ return player.muted ? 0 : player.volume;
2980
+ };
2981
+ _this.checkMuted = function () {
2982
+ var _this$props = _this.props,
2983
+ player = _this$props.player,
2984
+ actions = _this$props.actions;
2985
+ if (player.muted) {
2986
+ actions.mute(false);
2987
+ }
2988
+ };
2989
+ _this.handleMouseMove = function (event) {
2990
+ var actions = _this.props.actions;
2991
+ _this.checkMuted();
2992
+ var distance = _this.slider ? _this.slider.calculateDistance(event) : 0;
2993
+ actions.changeVolume(distance);
2994
+ };
2995
+ _this.stepForward = function () {
2996
+ var _this$props2 = _this.props,
2997
+ player = _this$props2.player,
2998
+ actions = _this$props2.actions;
2999
+ _this.checkMuted();
3000
+ actions.changeVolume(player.volume + 0.1);
3001
+ };
3002
+ _this.stepBack = function () {
3003
+ var _this$props3 = _this.props,
3004
+ player = _this$props3.player,
3005
+ actions = _this$props3.actions;
3006
+ _this.checkMuted();
3007
+ actions.changeVolume(player.volume - 0.1);
3008
+ };
3009
+ _this.handleFocus = function (event) {
3010
+ var _this$props$onFocus, _this$props4;
3011
+ (_this$props$onFocus = (_this$props4 = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props4, event);
3012
+ };
3013
+ _this.handleBlur = function (event) {
3014
+ var _this$props$onBlur, _this$props5;
3015
+ (_this$props$onBlur = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props5, event);
3016
+ };
3017
+ _this.handleSliderActivate = function (event) {
3018
+ if (event.type === 'focus') {
3019
+ _this.handleFocus(event);
3020
+ }
3021
+ };
3022
+ _this.handleSliderDeactivate = function (event) {
3023
+ if (event.type === 'blur') {
3024
+ _this.handleBlur(event);
3025
+ }
3026
+ };
3027
+ _this.handlePercentageChange = function (percentage) {
3028
+ if (percentage !== _this.state.percentage) {
3029
+ _this.setState({
3030
+ percentage: percentage
3031
+ });
3032
+ }
3033
+ };
3034
+ _this.handleClick = function (event) {
3035
+ event.stopPropagation();
3036
+ };
3037
+ return _this;
3038
+ }
3039
+ var _proto = VolumeBar.prototype;
3040
+ _proto.render = function render() {
3041
+ var _this2 = this;
3042
+ var _this$props6 = this.props,
3043
+ player = _this$props6.player,
3044
+ className = _this$props6.className,
3045
+ vertical = _this$props6.vertical;
3046
+ var volume = Number((player.volume * 100).toFixed(2));
3047
+ return React__default.createElement(Slider, {
3048
+ order: 1,
3049
+ ref: function ref(instance) {
3050
+ _this2.slider = instance;
3051
+ },
3052
+ label: "volume level",
3053
+ valuenow: volume,
3054
+ valuetext: volume + "%",
3055
+ onMouseMove: this.handleMouseMove,
3056
+ onFocus: this.handleFocus,
3057
+ onBlur: this.handleBlur,
3058
+ onClick: this.handleClick,
3059
+ sliderActive: this.handleSliderActivate,
3060
+ sliderInactive: this.handleSliderDeactivate,
3061
+ getPercent: this.getPercent,
3062
+ onPercentageChange: this.handlePercentageChange,
3063
+ stepForward: this.stepForward,
3064
+ stepBack: this.stepBack,
3065
+ vertical: vertical,
3066
+ className: classnames(className, 'video-react-player-volume-bar', 'video-react-player-slider-bar')
3067
+ }, React__default.createElement(VolumeLevel, {
3068
+ className: "video-react-player-volume-level"
3069
+ }));
3070
+ };
3071
+ return VolumeBar;
3072
+ }(React.Component);
3073
+ VolumeBar.displayName = 'VolumeBar';
3074
+
3075
+ var VolumeMenuButton = function VolumeMenuButton(_ref) {
3076
+ var player = _ref.player,
3077
+ actions = _ref.actions,
3078
+ _ref$vertical = _ref.vertical,
3079
+ vertical = _ref$vertical === void 0 ? false : _ref$vertical,
3080
+ className = _ref.className,
3081
+ alwaysShowVolume = _ref.alwaysShowVolume,
3082
+ buttonProps = _objectWithoutPropertiesLoose(_ref, ["player", "actions", "vertical", "className", "alwaysShowVolume"]);
3083
+ var _useState = React.useState(false),
3084
+ active = _useState[0],
3085
+ setActive = _useState[1];
3086
+ var volumeLevel = React.useMemo(function () {
3087
+ if (player.muted || player.volume === 0) {
3088
+ return 0;
3089
+ }
3090
+ if (player.volume < 0.33) {
3091
+ return 1;
3092
+ }
3093
+ if (player.volume < 0.67) {
3094
+ return 2;
3095
+ }
3096
+ return 3;
3097
+ }, [player.muted, player.volume]);
3098
+ var handleClick = React.useCallback(function () {
3099
+ actions.mute(!player.muted);
3100
+ }, [actions, player.muted]);
3101
+ var handleFocus = React.useCallback(function () {
3102
+ setActive(true);
3103
+ }, []);
3104
+ var handleBlur = React.useCallback(function () {
3105
+ setActive(false);
3106
+ }, []);
3107
+ var inline = !vertical;
3108
+ return React__default.createElement(PopupButton, _extends({}, buttonProps, {
3109
+ className: classnames(className, {
3110
+ 'video-react-player-volume-menu-button-vertical': vertical,
3111
+ 'video-react-player-volume-menu-button-horizontal': !vertical,
3112
+ 'video-react-player-vol-muted': player.muted,
3113
+ 'video-react-player-vol-0': volumeLevel === 0 && !player.muted,
3114
+ 'video-react-player-vol-1': volumeLevel === 1,
3115
+ 'video-react-player-vol-2': volumeLevel === 2,
3116
+ 'video-react-player-vol-3': volumeLevel === 3,
3117
+ 'video-react-player-slider-active': alwaysShowVolume || active,
3118
+ 'video-react-player-lock-showing': alwaysShowVolume || active
3119
+ }, 'video-react-player-volume-menu-button'),
3120
+ onClick: handleClick,
3121
+ inline: inline
3122
+ }), React__default.createElement(VolumeBar, {
3123
+ onFocus: handleFocus,
3124
+ onBlur: handleBlur,
3125
+ player: player,
3126
+ actions: actions,
3127
+ vertical: vertical
3128
+ }));
3129
+ };
3130
+ VolumeMenuButton.displayName = 'VolumeMenuButton';
3131
+
3132
+ var asDefaultChild = function asDefaultChild(element) {
3133
+ return element;
3134
+ };
3135
+ var getDefaultChildren = function getDefaultChildren() {
3136
+ return [asDefaultChild(React__default.createElement(PlayToggle, {
3137
+ key: 'play-toggle',
3138
+ order: 1
3139
+ })), asDefaultChild(React__default.createElement(VolumeMenuButton, {
3140
+ key: 'volume-menu-button',
3141
+ order: 4
3142
+ })), asDefaultChild(React__default.createElement(CurrentTimeDisplay, {
3143
+ key: 'current-time-display',
3144
+ order: 5.1
3145
+ })), asDefaultChild(React__default.createElement(TimeDivider, {
3146
+ key: 'time-divider',
3147
+ order: 5.2
3148
+ })), asDefaultChild(React__default.createElement(DurationDisplay, {
3149
+ key: 'duration-display',
3150
+ order: 5.3
3151
+ })), asDefaultChild(React__default.createElement(ProgressControl, {
3152
+ key: 'progress-control',
3153
+ order: 6
3154
+ })), asDefaultChild(React__default.createElement(FullscreenToggle, {
3155
+ key: 'fullscreen-toggle',
3156
+ order: 8
3157
+ }))];
3158
+ };
3159
+ var ControlBar = function ControlBar(_ref) {
3160
+ var _ref$autoHide = _ref.autoHide,
3161
+ autoHide = _ref$autoHide === void 0 ? true : _ref$autoHide,
3162
+ className = _ref.className,
3163
+ _ref$disableCompletel = _ref.disableCompletely,
3164
+ disableCompletely = _ref$disableCompletel === void 0 ? false : _ref$disableCompletel,
3165
+ disableDefaultControls = _ref.disableDefaultControls,
3166
+ children = _ref.children,
3167
+ parentProps = _objectWithoutPropertiesLoose(_ref, ["autoHide", "className", "disableCompletely", "disableDefaultControls", "children"]);
3168
+ if (disableCompletely || !parentProps.actions || !parentProps.player) {
3169
+ return null;
3170
+ }
3171
+ var hasCoreProps = Boolean(parentProps.actions && parentProps.player);
3172
+ var defaultChildren = disableDefaultControls || !hasCoreProps ? [] : getDefaultChildren();
3173
+ var mergedChildren = mergeAndSortChildren(defaultChildren, children, parentProps);
3174
+ return React__default.createElement("div", {
3175
+ className: classnames('video-react-player-control-bar', {
3176
+ 'video-react-player-control-bar-auto-hide': autoHide
3177
+ }, className)
3178
+ }, mergedChildren);
3179
+ };
3180
+ ControlBar.displayName = 'ControlBar';
3181
+
3182
+ var USER_AGENT = typeof window !== 'undefined' && window.navigator ? window.navigator.userAgent : '';
3183
+ // const webkitVersionMap = (/AppleWebKit\/([\d.]+)/i).exec(USER_AGENT);
3184
+ // const appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;
3185
+
3186
+ /*
3187
+ * Device is an iPhone
3188
+ *
3189
+ * @type {Boolean}
3190
+ * @constant
3191
+ * @private
3192
+ */
3193
+ var IS_IPAD = /iPad/i.test(USER_AGENT);
3194
+
3195
+ // The Facebook app's UIWebView identifies as both an iPhone and iPad, so
3196
+ // to identify iPhones, we need to exclude iPads.
3197
+ // http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/
3198
+ var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;
3199
+ var IS_IPOD = /iPod/i.test(USER_AGENT);
3200
+ var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;
3201
+
3202
+ var defaultProps = {
3203
+ fluid: true,
3204
+ muted: false,
3205
+ playsInline: false,
3206
+ preload: 'auto',
3207
+ aspectRatio: 'auto'
3208
+ };
3209
+ var Player = React.forwardRef(function (incomingProps, ref) {
3210
+ var props = _extends({}, defaultProps, incomingProps);
3211
+ var children = props.children,
3212
+ width = props.width,
3213
+ height = props.height,
3214
+ fluid = props.fluid,
3215
+ bigPlayButtonPosition = props.bigPlayButtonPosition,
3216
+ hideDefaultBigPlayButton = props.hideDefaultBigPlayButton,
3217
+ aspectRatio = props.aspectRatio,
3218
+ className = props.className,
3219
+ store = props.store,
3220
+ passThroughProps = _objectWithoutPropertiesLoose(props, ["children", "width", "height", "fluid", "bigPlayButtonPosition", "hideDefaultBigPlayButton", "aspectRatio", "className", "store"]);
3221
+ var managerRef = React.useRef();
3222
+ if (!managerRef.current) {
3223
+ managerRef.current = new Manager(store);
3224
+ }
3225
+ var manager = managerRef.current;
3226
+ var actionsRef = React.useRef(manager.getActions());
3227
+ var actions = actionsRef.current;
3228
+ var videoComponentRef = React.useRef(null);
3229
+ var controlsHideTimerRef = React.useRef(null);
3230
+ var _useState = React.useState(manager.getState().player),
3231
+ playerState = _useState[0],
3232
+ setPlayerState = _useState[1];
3233
+ var handleResize = React.useCallback(function () {}, []);
3234
+ React.useEffect(function () {
3235
+ var unsubscribe = manager.subscribeToPlayerStateChange(function (state, prevState) {
3236
+ if (state.isFullscreen !== prevState.isFullscreen) {
3237
+ handleResize();
3238
+ focusNode(manager.rootElement);
3239
+ }
3240
+ setPlayerState(state);
3241
+ });
3242
+ return unsubscribe;
3243
+ }, [handleResize, manager]);
3244
+ React.useEffect(function () {
3245
+ handleResize();
3246
+ window.addEventListener('resize', handleResize);
3247
+ return function () {
3248
+ window.removeEventListener('resize', handleResize);
3249
+ };
3250
+ }, [handleResize]);
3251
+ var handleFullScreenChange = React.useCallback(function (event) {
3252
+ if (event.target === manager.rootElement) {
3253
+ actions.handleFullscreenChange(Boolean(fullscreen.isFullscreen));
3254
+ }
3255
+ }, [actions, manager]);
3256
+ React.useEffect(function () {
3257
+ fullscreen.addEventListener(handleFullScreenChange);
3258
+ return function () {
3259
+ return fullscreen.removeEventListener(handleFullScreenChange);
3260
+ };
3261
+ }, [handleFullScreenChange]);
3262
+ React.useEffect(function () {
3263
+ return function () {
3264
+ if (controlsHideTimerRef.current) {
3265
+ clearTimeout(controlsHideTimerRef.current);
3266
+ }
3267
+ };
3268
+ }, []);
3269
+ var handleVideoRef = React.useCallback(function (instance) {
3270
+ videoComponentRef.current = instance;
3271
+ manager.video = instance;
3272
+ }, [manager]);
3273
+ var getDefaultChildren = React.useCallback(function (originalChildren, includeBigPlayButton, bigPlayPos) {
3274
+ if (includeBigPlayButton === void 0) {
3275
+ includeBigPlayButton = true;
3276
+ }
3277
+ return [React__default.createElement(Video, {
3278
+ ref: handleVideoRef,
3279
+ key: "video",
3280
+ order: 0,
3281
+ actions: actions,
3282
+ player: playerState
3283
+ }, originalChildren), React__default.createElement(PosterImage, {
3284
+ key: "poster-image",
3285
+ order: 1,
3286
+ actions: actions,
3287
+ player: playerState
3288
+ }), React__default.createElement(LoadingSpinner, {
3289
+ key: "loading-spinner",
3290
+ order: 2,
3291
+ actions: actions,
3292
+ player: playerState
3293
+ }), React__default.createElement(Bezel, {
3294
+ key: "bezel",
3295
+ order: 3,
3296
+ manager: manager
3297
+ }), includeBigPlayButton && React__default.createElement(BigPlayButton, {
3298
+ key: "big-play-button",
3299
+ order: 4,
3300
+ actions: actions,
3301
+ player: playerState,
3302
+ position: bigPlayPos
3303
+ }), React__default.createElement(ControlBar, {
3304
+ key: "control-bar",
3305
+ order: 5,
3306
+ actions: actions,
3307
+ player: playerState
3308
+ }), React__default.createElement(Shortcut, {
3309
+ key: "shortcut",
3310
+ order: 99,
3311
+ actions: actions,
3312
+ player: playerState,
3313
+ manager: manager
3314
+ })];
3315
+ }, [actions, handleVideoRef, manager, playerState]);
3316
+ var containsBigPlayButton = React.useCallback(function (nodes) {
3317
+ var found = false;
3318
+ React__default.Children.forEach(nodes, function (child) {
3319
+ if (found) {
3320
+ return;
3321
+ }
3322
+ if (!React__default.isValidElement(child)) {
3323
+ return;
3324
+ }
3325
+ var t = child.type;
3326
+ var name = t.displayName || t.name;
3327
+ if (child.type === BigPlayButton || name === 'BigPlayButton' || child.props['data-big-play-button'] === true) {
3328
+ found = true;
3329
+ return;
3330
+ }
3331
+ if (child.props && child.props.children) {
3332
+ if (containsBigPlayButton(child.props.children)) {
3333
+ found = true;
3334
+ }
3335
+ }
3336
+ });
3337
+ return found;
3338
+ }, []);
3339
+ var getChildren = React.useCallback(function (propsForChildren) {
3340
+ // Do not forward layout-only props like `fluid` to children to avoid DOM attribute warnings.
3341
+ var _ignored = propsForChildren.className,
3342
+ originalChildren = propsForChildren.children,
3343
+ _fluid = propsForChildren.fluid,
3344
+ _bp = propsForChildren.bigPlayButtonPosition,
3345
+ _hide = propsForChildren.hideDefaultBigPlayButton,
3346
+ rest = _objectWithoutPropertiesLoose(propsForChildren, ["className", "children", "fluid", "bigPlayButtonPosition", "hideDefaultBigPlayButton"]);
3347
+ var userChildren = React__default.Children.toArray(children).filter(function (child) {
3348
+ return !isVideoChild(child);
3349
+ });
3350
+ var hasUserBigPlayButton = containsBigPlayButton(children);
3351
+ var includeDefaultBigPlay = !hideDefaultBigPlayButton && !hasUserBigPlayButton;
3352
+ var defaultChildren = getDefaultChildren(originalChildren, includeDefaultBigPlay, bigPlayButtonPosition);
3353
+ var parentProps = _extends({}, rest, {
3354
+ actions: actions,
3355
+ player: playerState,
3356
+ manager: manager
3357
+ });
3358
+ return mergeAndSortChildren(defaultChildren, userChildren, parentProps);
3359
+ }, [actions, bigPlayButtonPosition, children, containsBigPlayButton, getDefaultChildren, hideDefaultBigPlayButton, manager, playerState]);
3360
+ var setWidthOrHeight = React.useCallback(function (style, name, value) {
3361
+ var styleVal;
3362
+ if (typeof value === 'string') {
3363
+ if (value === 'auto') {
3364
+ styleVal = 'auto';
3365
+ } else if (/\d+%/.test(value)) {
3366
+ styleVal = value;
3367
+ }
3368
+ } else if (typeof value === 'number') {
3369
+ styleVal = value + "px";
3370
+ }
3371
+ if (styleVal) {
3372
+ style[name] = styleVal;
3373
+ }
3374
+ }, []);
3375
+ var playerStyle = React.useMemo(function () {
3376
+ var style = {};
3377
+ var resolvedAspectRatio = aspectRatio;
3378
+ if (resolvedAspectRatio === undefined || resolvedAspectRatio === 'auto') {
3379
+ if (playerState.videoWidth) {
3380
+ resolvedAspectRatio = playerState.videoWidth + ":" + playerState.videoHeight;
3381
+ } else {
3382
+ resolvedAspectRatio = '16:9';
3383
+ }
3384
+ }
3385
+ var _resolvedAspectRatio$ = resolvedAspectRatio.split(':').map(Number),
3386
+ ratioWidth = _resolvedAspectRatio$[0],
3387
+ ratioHeight = _resolvedAspectRatio$[1];
3388
+ var ratioMultiplier = ratioHeight / ratioWidth;
3389
+ var resolvedWidth = width;
3390
+ if (resolvedWidth === undefined) {
3391
+ if (typeof height === 'number') {
3392
+ resolvedWidth = height / ratioMultiplier;
3393
+ } else if (typeof height === 'string' && height !== 'auto') {
3394
+ resolvedWidth = parseFloat(height) / ratioMultiplier;
3395
+ } else {
3396
+ resolvedWidth = playerState.videoWidth || 400;
3397
+ }
3398
+ }
3399
+ var resolvedHeight = height;
3400
+ if (resolvedHeight === undefined) {
3401
+ if (typeof resolvedWidth === 'number') {
3402
+ resolvedHeight = resolvedWidth * ratioMultiplier;
3403
+ } else if (typeof resolvedWidth === 'string' && resolvedWidth !== 'auto') {
3404
+ resolvedHeight = parseFloat(resolvedWidth) * ratioMultiplier;
3405
+ }
3406
+ }
3407
+ if (fluid) {
3408
+ style.paddingTop = ratioMultiplier * 100 + "%";
3409
+ } else {
3410
+ if (resolvedWidth !== undefined) {
3411
+ setWidthOrHeight(style, 'width', resolvedWidth);
3412
+ }
3413
+ if (resolvedHeight !== undefined) {
3414
+ setWidthOrHeight(style, 'height', resolvedHeight);
3415
+ }
3416
+ }
3417
+ return style;
3418
+ }, [aspectRatio, fluid, height, playerState.videoHeight, playerState.videoWidth, setWidthOrHeight, width]);
3419
+ var startControlsTimer = React.useCallback(function () {
3420
+ var controlBarActiveTime = 3000;
3421
+ React__default.Children.forEach(children, function (element) {
3422
+ if (!React__default.isValidElement(element) || element.type !== ControlBar) {
3423
+ return;
3424
+ }
3425
+ var _ref = element.props,
3426
+ autoHideTime = _ref.autoHideTime;
3427
+ if (typeof autoHideTime === 'number') {
3428
+ controlBarActiveTime = autoHideTime;
3429
+ }
3430
+ });
3431
+ actions.userActivate(true);
3432
+ if (controlsHideTimerRef.current) {
3433
+ clearTimeout(controlsHideTimerRef.current);
3434
+ }
3435
+ controlsHideTimerRef.current = window.setTimeout(function () {
3436
+ actions.userActivate(false);
3437
+ }, controlBarActiveTime);
3438
+ }, [actions, children]);
3439
+ var throttledMouseMove = React.useMemo(function () {
3440
+ return throttle(function () {
3441
+ startControlsTimer();
3442
+ }, 250);
3443
+ }, [startControlsTimer]);
3444
+ var handleMouseDown = React.useCallback(function () {
3445
+ startControlsTimer();
3446
+ }, [startControlsTimer]);
3447
+ var handleMouseMove = React.useCallback(function () {
3448
+ throttledMouseMove();
3449
+ }, [throttledMouseMove]);
3450
+ var handleKeyDown = React.useCallback(function () {
3451
+ startControlsTimer();
3452
+ }, [startControlsTimer]);
3453
+ var handleFocus = React.useCallback(function () {
3454
+ actions.activate(true);
3455
+ }, [actions]);
3456
+ var handleBlur = React.useCallback(function () {
3457
+ actions.activate(false);
3458
+ }, [actions]);
3459
+ var rootRef = React.useCallback(function (node) {
3460
+ manager.rootElement = node;
3461
+ }, [manager]);
3462
+ var childProps = React.useMemo(function () {
3463
+ var _videoComponentRef$cu, _videoComponentRef$cu2;
3464
+ return _extends({}, passThroughProps, {
3465
+ fluid: fluid,
3466
+ bigPlayButtonPosition: bigPlayButtonPosition,
3467
+ hideDefaultBigPlayButton: hideDefaultBigPlayButton,
3468
+ player: playerState,
3469
+ actions: actions,
3470
+ manager: manager,
3471
+ store: manager.store,
3472
+ video: (_videoComponentRef$cu = (_videoComponentRef$cu2 = videoComponentRef.current) === null || _videoComponentRef$cu2 === void 0 ? void 0 : _videoComponentRef$cu2.video) !== null && _videoComponentRef$cu !== void 0 ? _videoComponentRef$cu : null
3473
+ });
3474
+ }, [actions, bigPlayButtonPosition, fluid, hideDefaultBigPlayButton, manager, passThroughProps, playerState]);
3475
+ var childElements = React.useMemo(function () {
3476
+ return getChildren(childProps);
3477
+ }, [childProps, getChildren]);
3478
+ React.useImperativeHandle(ref, function () {
3479
+ return {
3480
+ manager: manager,
3481
+ actions: actions,
3482
+ video: videoComponentRef.current,
3483
+ getState: function getState() {
3484
+ return manager.getState();
3485
+ },
3486
+ get playbackRate() {
3487
+ var _videoComponentRef$cu3, _videoComponentRef$cu4;
3488
+ return (_videoComponentRef$cu3 = (_videoComponentRef$cu4 = videoComponentRef.current) === null || _videoComponentRef$cu4 === void 0 ? void 0 : _videoComponentRef$cu4.playbackRate) !== null && _videoComponentRef$cu3 !== void 0 ? _videoComponentRef$cu3 : 1;
3489
+ },
3490
+ set playbackRate(rate) {
3491
+ if (videoComponentRef.current) {
3492
+ videoComponentRef.current.playbackRate = rate;
3493
+ }
3494
+ },
3495
+ get muted() {
3496
+ var _videoComponentRef$cu5, _videoComponentRef$cu6;
3497
+ return (_videoComponentRef$cu5 = (_videoComponentRef$cu6 = videoComponentRef.current) === null || _videoComponentRef$cu6 === void 0 ? void 0 : _videoComponentRef$cu6.muted) !== null && _videoComponentRef$cu5 !== void 0 ? _videoComponentRef$cu5 : false;
3498
+ },
3499
+ set muted(value) {
3500
+ if (videoComponentRef.current) {
3501
+ videoComponentRef.current.muted = value;
3502
+ }
3503
+ },
3504
+ get volume() {
3505
+ var _videoComponentRef$cu7, _videoComponentRef$cu8;
3506
+ return (_videoComponentRef$cu7 = (_videoComponentRef$cu8 = videoComponentRef.current) === null || _videoComponentRef$cu8 === void 0 ? void 0 : _videoComponentRef$cu8.volume) !== null && _videoComponentRef$cu7 !== void 0 ? _videoComponentRef$cu7 : 1;
3507
+ },
3508
+ set volume(value) {
3509
+ if (videoComponentRef.current) {
3510
+ videoComponentRef.current.volume = value;
3511
+ }
3512
+ },
3513
+ get videoWidth() {
3514
+ var _videoComponentRef$cu9, _videoComponentRef$cu0;
3515
+ return (_videoComponentRef$cu9 = (_videoComponentRef$cu0 = videoComponentRef.current) === null || _videoComponentRef$cu0 === void 0 ? void 0 : _videoComponentRef$cu0.videoWidth) !== null && _videoComponentRef$cu9 !== void 0 ? _videoComponentRef$cu9 : 0;
3516
+ },
3517
+ get videoHeight() {
3518
+ var _videoComponentRef$cu1, _videoComponentRef$cu10;
3519
+ return (_videoComponentRef$cu1 = (_videoComponentRef$cu10 = videoComponentRef.current) === null || _videoComponentRef$cu10 === void 0 ? void 0 : _videoComponentRef$cu10.videoHeight) !== null && _videoComponentRef$cu1 !== void 0 ? _videoComponentRef$cu1 : 0;
3520
+ },
3521
+ play: function play() {
3522
+ var _videoComponentRef$cu11;
3523
+ (_videoComponentRef$cu11 = videoComponentRef.current) === null || _videoComponentRef$cu11 === void 0 ? void 0 : _videoComponentRef$cu11.play();
3524
+ },
3525
+ pause: function pause() {
3526
+ var _videoComponentRef$cu12;
3527
+ (_videoComponentRef$cu12 = videoComponentRef.current) === null || _videoComponentRef$cu12 === void 0 ? void 0 : _videoComponentRef$cu12.pause();
3528
+ },
3529
+ load: function load() {
3530
+ var _videoComponentRef$cu13;
3531
+ (_videoComponentRef$cu13 = videoComponentRef.current) === null || _videoComponentRef$cu13 === void 0 ? void 0 : _videoComponentRef$cu13.load();
3532
+ },
3533
+ addTextTrack: function addTextTrack() {
3534
+ var _videoComponentRef$cu14, _videoComponentRef$cu15;
3535
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3536
+ args[_key] = arguments[_key];
3537
+ }
3538
+ return (_videoComponentRef$cu14 = (_videoComponentRef$cu15 = videoComponentRef.current) === null || _videoComponentRef$cu15 === void 0 ? void 0 : _videoComponentRef$cu15.addTextTrack.apply(_videoComponentRef$cu15, args)) !== null && _videoComponentRef$cu14 !== void 0 ? _videoComponentRef$cu14 : {};
3539
+ },
3540
+ canPlayType: function canPlayType() {
3541
+ var _videoComponentRef$cu16, _videoComponentRef$cu17;
3542
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3543
+ args[_key2] = arguments[_key2];
3544
+ }
3545
+ return (_videoComponentRef$cu16 = (_videoComponentRef$cu17 = videoComponentRef.current) === null || _videoComponentRef$cu17 === void 0 ? void 0 : _videoComponentRef$cu17.canPlayType.apply(_videoComponentRef$cu17, args)) !== null && _videoComponentRef$cu16 !== void 0 ? _videoComponentRef$cu16 : '';
3546
+ },
3547
+ seek: function seek(time) {
3548
+ var _videoComponentRef$cu18;
3549
+ (_videoComponentRef$cu18 = videoComponentRef.current) === null || _videoComponentRef$cu18 === void 0 ? void 0 : _videoComponentRef$cu18.seek(time);
3550
+ },
3551
+ forward: function forward(seconds) {
3552
+ var _videoComponentRef$cu19;
3553
+ (_videoComponentRef$cu19 = videoComponentRef.current) === null || _videoComponentRef$cu19 === void 0 ? void 0 : _videoComponentRef$cu19.forward(seconds);
3554
+ },
3555
+ replay: function replay(seconds) {
3556
+ var _videoComponentRef$cu20;
3557
+ (_videoComponentRef$cu20 = videoComponentRef.current) === null || _videoComponentRef$cu20 === void 0 ? void 0 : _videoComponentRef$cu20.replay(seconds);
3558
+ },
3559
+ toggleFullscreen: function toggleFullscreen() {
3560
+ var _videoComponentRef$cu21;
3561
+ (_videoComponentRef$cu21 = videoComponentRef.current) === null || _videoComponentRef$cu21 === void 0 ? void 0 : _videoComponentRef$cu21.toggleFullscreen();
3562
+ },
3563
+ subscribeToStateChange: function subscribeToStateChange(listener) {
3564
+ return manager.subscribeToPlayerStateChange(listener);
3565
+ }
3566
+ };
3567
+ }, [actions, manager]);
3568
+ var paused = playerState.paused,
3569
+ hasStarted = playerState.hasStarted,
3570
+ waiting = playerState.waiting,
3571
+ seeking = playerState.seeking,
3572
+ isFullscreen = playerState.isFullscreen,
3573
+ userActivity = playerState.userActivity;
3574
+ return React__default.createElement("div", {
3575
+ className: classnames({
3576
+ 'video-react-player-controls-enabled': true,
3577
+ 'video-react-player-has-started': hasStarted,
3578
+ 'video-react-player-paused': paused,
3579
+ 'video-react-player-playing': !paused,
3580
+ 'video-react-player-waiting': waiting,
3581
+ 'video-react-player-seeking': seeking,
3582
+ 'video-react-player-fluid': fluid,
3583
+ 'video-react-player-fullscreen': isFullscreen,
3584
+ 'video-react-player-user-inactive': !userActivity,
3585
+ 'video-react-player-user-active': userActivity,
3586
+ 'video-react-player-workinghover': !IS_IOS
3587
+ }, 'video-react-player', className),
3588
+ style: playerStyle,
3589
+ ref: rootRef,
3590
+ role: "region",
3591
+ onTouchStart: handleMouseDown,
3592
+ onMouseDown: handleMouseDown,
3593
+ onTouchMove: handleMouseMove,
3594
+ onMouseMove: handleMouseMove,
3595
+ onKeyDown: handleKeyDown,
3596
+ onFocus: handleFocus,
3597
+ onBlur: handleBlur,
3598
+ tabIndex: -1
3599
+ }, childElements);
3600
+ });
3601
+ Player.displayName = 'Player';
3602
+
3603
+ /**
3604
+
3605
+ * Copyright (c) 2016 Video-React contributors
3606
+ * Copyright (c) 2025 ZingMe.Vn
3607
+ *
3608
+ * This source code is licensed under the MIT license found in the
3609
+ * LICENSE file in the root directory of this source tree.
3610
+ */
3611
+ var createForwardReplayControl = function createForwardReplayControl(mode) {
3612
+ var ForwardReplayControl = React.forwardRef(function (_ref, ref) {
3613
+ var actions = _ref.actions,
3614
+ _ref$seconds = _ref.seconds,
3615
+ seconds = _ref$seconds === void 0 ? 10 : _ref$seconds,
3616
+ className = _ref.className;
3617
+ var handleClick = React.useCallback(function () {
3618
+ if (mode === 'forward') {
3619
+ actions.forward(seconds);
3620
+ } else {
3621
+ actions.replay(seconds);
3622
+ }
3623
+ }, [actions, seconds]);
3624
+ var classNames = ['video-react-player-control', 'video-react-player-button', 'video-react-player-icon', "video-react-player-icon-" + mode + "-" + seconds, "video-react-player-" + mode + "-control"];
3625
+ if (className) {
3626
+ classNames.push(className);
3627
+ }
3628
+ return React__default.createElement("button", {
3629
+ ref: ref,
3630
+ className: classNames.join(' '),
3631
+ type: "button",
3632
+ onClick: handleClick
3633
+ }, React__default.createElement("span", {
3634
+ className: "video-react-player-control-text"
3635
+ }, mode + " " + seconds + " seconds"));
3636
+ });
3637
+ ForwardReplayControl.displayName = "ForwardReplayControl(" + mode + ")";
3638
+ return ForwardReplayControl;
3639
+ };
3640
+
3641
+ /**
3642
+
3643
+ * Copyright (c) 2016 Video-React contributors
3644
+ * Copyright (c) 2025 ZingMe.Vn
3645
+ *
3646
+ * This source code is licensed under the MIT license found in the
3647
+ * LICENSE file in the root directory of this source tree.
3648
+ */
3649
+
3650
+ // Pass mode into parent function
3651
+ var ForwardControl = createForwardReplayControl('forward');
3652
+ ForwardControl.displayName = 'ForwardControl';
3653
+
3654
+ /**
3655
+
3656
+ * Copyright (c) 2016 Video-React contributors
3657
+ * Copyright (c) 2025 ZingMe.Vn
3658
+ *
3659
+ * This source code is licensed under the MIT license found in the
3660
+ * LICENSE file in the root directory of this source tree.
3661
+ */
3662
+
3663
+ // Pass mode into parent function
3664
+ var ReplayControl = createForwardReplayControl('replay');
3665
+ ReplayControl.displayName = 'ReplayControl';
3666
+
3667
+ /**
3668
+
3669
+ * Copyright (c) 2016 Video-React contributors
3670
+ * Copyright (c) 2025 ZingMe.Vn
3671
+ *
3672
+ * This source code is licensed under the MIT license found in the
3673
+ * LICENSE file in the root directory of this source tree.
3674
+ */
3675
+ var Menu = function Menu(_ref) {
3676
+ var children = _ref.children;
3677
+ var handleClick = function handleClick(event) {
3678
+ event.preventDefault();
3679
+ };
3680
+ return React__default.createElement("div", {
3681
+ className: "video-react-player-menu video-react-player-lock-showing",
3682
+ role: "presentation",
3683
+ onClick: handleClick
3684
+ }, React__default.createElement("ul", {
3685
+ className: "video-react-player-menu-content"
3686
+ }, children));
3687
+ };
3688
+ Menu.displayName = 'Menu';
3689
+
3690
+ /**
3691
+
3692
+ * Copyright (c) 2016 Video-React contributors
3693
+ * Copyright (c) 2025 ZingMe.Vn
3694
+ *
3695
+ * This source code is licensed under the MIT license found in the
3696
+ * LICENSE file in the root directory of this source tree.
3697
+ */
3698
+ var MenuItem = function MenuItem(_ref) {
3699
+ var item = _ref.item,
3700
+ index = _ref.index,
3701
+ activateIndex = _ref.activateIndex,
3702
+ onSelectItem = _ref.onSelectItem;
3703
+ var handleClick = function handleClick() {
3704
+ onSelectItem(index);
3705
+ };
3706
+ return React__default.createElement("li", {
3707
+ className: classnames({
3708
+ 'video-react-player-menu-item': true,
3709
+ 'video-react-player-selected': index === activateIndex
3710
+ }),
3711
+ role: "menuitem",
3712
+ onClick: handleClick
3713
+ }, item.label, React__default.createElement("span", {
3714
+ className: "video-react-player-control-text"
3715
+ }));
3716
+ };
3717
+ MenuItem.displayName = 'MenuItem';
3718
+
3719
+ var MenuButton = /*#__PURE__*/function (_Component) {
3720
+ _inheritsLoose(MenuButton, _Component);
3721
+ function MenuButton() {
3722
+ var _this$props$selectedI;
3723
+ var _this;
3724
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3725
+ args[_key] = arguments[_key];
3726
+ }
3727
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
3728
+ _this.state = {
3729
+ active: false,
3730
+ activateIndex: (_this$props$selectedI = _this.props.selectedIndex) !== null && _this$props$selectedI !== void 0 ? _this$props$selectedI : 0
3731
+ };
3732
+ _this.commitSelection = function (index) {
3733
+ _this.setState({
3734
+ activateIndex: index
3735
+ });
3736
+ _this.handleIndexChange(index);
3737
+ };
3738
+ _this.activateMenuItem = function (index) {
3739
+ if (index === void 0) {
3740
+ index = 0;
3741
+ }
3742
+ _this.setState({
3743
+ activateIndex: index
3744
+ });
3745
+ _this.handleIndexChange(index);
3746
+ };
3747
+ _this.handleIndexChange = function (index) {
3748
+ _this.props.onSelectItem(index);
3749
+ };
3750
+ _this.handleClick = function () {
3751
+ _this.setState(function (prevState) {
3752
+ return {
3753
+ active: !prevState.active
3754
+ };
3755
+ });
3756
+ };
3757
+ _this.handleFocus = function () {
3758
+ document.addEventListener('keydown', _this.handleKeyPress);
3759
+ };
3760
+ _this.handleBlur = function () {
3761
+ _this.setState({
3762
+ active: false
3763
+ });
3764
+ document.removeEventListener('keydown', _this.handleKeyPress);
3765
+ };
3766
+ _this.handleUpArrow = function (event) {
3767
+ var _this$props$items;
3768
+ var items = (_this$props$items = _this.props.items) !== null && _this$props$items !== void 0 ? _this$props$items : [];
3769
+ if (_this.state.active && items.length) {
3770
+ event.preventDefault();
3771
+ var newIndex = (_this.state.activateIndex - 1 + items.length) % items.length;
3772
+ _this.activateMenuItem(newIndex);
3773
+ }
3774
+ };
3775
+ _this.handleDownArrow = function (event) {
3776
+ var _this$props$items2;
3777
+ var items = (_this$props$items2 = _this.props.items) !== null && _this$props$items2 !== void 0 ? _this$props$items2 : [];
3778
+ if (_this.state.active && items.length) {
3779
+ event.preventDefault();
3780
+ var newIndex = (_this.state.activateIndex + 1) % items.length;
3781
+ _this.activateMenuItem(newIndex);
3782
+ }
3783
+ };
3784
+ _this.handleTab = function (event) {
3785
+ if (_this.state.active) {
3786
+ event.preventDefault();
3787
+ _this.commitSelection(_this.state.activateIndex);
3788
+ }
3789
+ };
3790
+ _this.handleReturn = function (event) {
3791
+ event.preventDefault();
3792
+ if (_this.state.active) {
3793
+ _this.commitSelection(_this.state.activateIndex);
3794
+ } else {
3795
+ _this.setState({
3796
+ active: true
3797
+ });
3798
+ }
3799
+ };
3800
+ _this.handleEscape = function () {
3801
+ _this.setState({
3802
+ active: false,
3803
+ activateIndex: 0
3804
+ });
3805
+ };
3806
+ _this.handleKeyPress = function (event) {
3807
+ if (event.which === 27) {
3808
+ _this.handleEscape();
3809
+ } else if (event.which === 9) {
3810
+ _this.handleTab(event);
3811
+ } else if (event.which === 13) {
3812
+ _this.handleReturn(event);
3813
+ } else if (event.which === 38) {
3814
+ _this.handleUpArrow(event);
3815
+ } else if (event.which === 40) {
3816
+ _this.handleDownArrow(event);
3817
+ }
3818
+ };
3819
+ _this.handleSelectItem = function (index) {
3820
+ _this.commitSelection(index);
3821
+ };
3822
+ return _this;
3823
+ }
3824
+ var _proto = MenuButton.prototype;
3825
+ _proto.componentWillUnmount = function componentWillUnmount() {
3826
+ document.removeEventListener('keydown', this.handleKeyPress);
3827
+ };
3828
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
3829
+ if (prevProps.selectedIndex !== this.props.selectedIndex && typeof this.props.selectedIndex === 'number') {
3830
+ this.activateMenuItem(this.props.selectedIndex);
3831
+ }
3832
+ };
3833
+ _proto.renderMenu = function renderMenu() {
3834
+ var _this$props$items3,
3835
+ _this2 = this;
3836
+ if (!this.state.active) {
3837
+ return null;
3838
+ }
3839
+ var items = (_this$props$items3 = this.props.items) !== null && _this$props$items3 !== void 0 ? _this$props$items3 : [];
3840
+ return React__default.createElement(Menu, null, items.map(function (item, index) {
3841
+ return React__default.createElement(MenuItem, {
3842
+ item: item,
3843
+ index: index,
3844
+ onSelectItem: _this2.handleSelectItem,
3845
+ activateIndex: _this2.state.activateIndex,
3846
+ key: "item-" + index
3847
+ });
3848
+ }));
3849
+ };
3850
+ _proto.render = function render() {
3851
+ var _this$props = this.props,
3852
+ inline = _this$props.inline,
3853
+ className = _this$props.className,
3854
+ children = _this$props.children;
3855
+ return React__default.createElement(ClickableComponent, {
3856
+ className: classnames(className, {
3857
+ 'video-react-player-menu-button-inline': !!inline,
3858
+ 'video-react-player-menu-button-popup': !inline,
3859
+ 'video-react-player-menu-button-active': this.state.active
3860
+ }, 'video-react-player-control video-react-player-button video-react-player-menu-button'),
3861
+ onClick: this.handleClick,
3862
+ onFocus: this.handleFocus,
3863
+ onBlur: this.handleBlur
3864
+ }, children, this.renderMenu());
3865
+ };
3866
+ return MenuButton;
3867
+ }(React.Component);
3868
+ MenuButton.displayName = 'MenuButton';
3869
+ MenuButton.defaultProps = {
3870
+ items: [],
3871
+ selectedIndex: 0
3872
+ };
3873
+
3874
+ /**
3875
+
3876
+ * Copyright (c) 2016 Video-React contributors
3877
+ * Copyright (c) 2025 ZingMe.Vn
3878
+ *
3879
+ * This source code is licensed under the MIT license found in the
3880
+ * LICENSE file in the root directory of this source tree.
3881
+ */
3882
+ var DEFAULT_RATES = [2, 1.5, 1.25, 1, 0.5, 0.25];
3883
+ var PlaybackRateMenuButton = function PlaybackRateMenuButton(_ref) {
3884
+ var actions = _ref.actions,
3885
+ player = _ref.player,
3886
+ _ref$rates = _ref.rates,
3887
+ rates = _ref$rates === void 0 ? DEFAULT_RATES : _ref$rates,
3888
+ className = _ref.className;
3889
+ var items = React.useMemo(function () {
3890
+ return rates.map(function (rate) {
3891
+ return {
3892
+ label: rate + "x",
3893
+ value: rate
3894
+ };
3895
+ });
3896
+ }, [rates]);
3897
+ var selectedIndex = React.useMemo(function () {
3898
+ var index = rates.indexOf(player.playbackRate);
3899
+ if (index >= 0) {
3900
+ return index;
3901
+ }
3902
+ var fallback = rates.indexOf(1);
3903
+ return fallback >= 0 ? fallback : 0;
3904
+ }, [player.playbackRate, rates]);
3905
+ var handleSelectItem = React.useCallback(function (index) {
3906
+ if (index >= 0 && index < rates.length) {
3907
+ actions.changeRate(rates[index]);
3908
+ }
3909
+ }, [actions, rates]);
3910
+ return React__default.createElement(MenuButton, {
3911
+ className: classnames('video-react-player-playback-rate', className),
3912
+ onSelectItem: handleSelectItem,
3913
+ items: items,
3914
+ selectedIndex: selectedIndex
3915
+ }, React__default.createElement("span", {
3916
+ className: "video-react-player-control-text"
3917
+ }, "Playback Rate"), React__default.createElement("div", {
3918
+ className: "video-react-player-playback-rate-value"
3919
+ }, player.playbackRate.toFixed(2) + "x"));
3920
+ };
3921
+ PlaybackRateMenuButton.displayName = 'PlaybackRateMenuButton';
3922
+
3923
+ /**
3924
+
3925
+ * Copyright (c) 2016 Video-React contributors
3926
+ * Copyright (c) 2025 ZingMe.Vn
3927
+ *
3928
+ * This source code is licensed under the MIT license found in the
3929
+ * LICENSE file in the root directory of this source tree.
3930
+ */
3931
+ var PlaybackRate = function PlaybackRate(props) {
3932
+ React.useEffect(function () {
3933
+ deprecatedWarning('PlaybackRate', 'PlaybackRateMenuButton');
3934
+ }, []);
3935
+ return React__default.createElement(PlaybackRateMenuButton, props);
3936
+ };
3937
+ PlaybackRate.displayName = 'PlaybackRate';
3938
+
3939
+ /**
3940
+
3941
+ * Copyright (c) 2016 Video-React contributors
3942
+ * Copyright (c) 2025 ZingMe.Vn
3943
+ *
3944
+ * This source code is licensed under the MIT license found in the
3945
+ * LICENSE file in the root directory of this source tree.
3946
+ */
3947
+ var DEFAULT_KINDS = ['captions', 'subtitles'];
3948
+ var ClosedCaptionButton = function ClosedCaptionButton(_ref) {
3949
+ var player = _ref.player,
3950
+ actions = _ref.actions,
3951
+ className = _ref.className,
3952
+ _ref$offMenuText = _ref.offMenuText,
3953
+ offMenuText = _ref$offMenuText === void 0 ? 'Off' : _ref$offMenuText,
3954
+ _ref$showOffMenu = _ref.showOffMenu,
3955
+ showOffMenu = _ref$showOffMenu === void 0 ? true : _ref$showOffMenu,
3956
+ _ref$kinds = _ref.kinds,
3957
+ kinds = _ref$kinds === void 0 ? DEFAULT_KINDS : _ref$kinds;
3958
+ var textTrackItems = React.useMemo(function () {
3959
+ var items = [];
3960
+ var tracks = Array.from(player.textTracks || []);
3961
+ if (showOffMenu) {
3962
+ items.push({
3963
+ label: offMenuText,
3964
+ value: null
3965
+ });
3966
+ }
3967
+ tracks.forEach(function (textTrack) {
3968
+ if (kinds.length && !kinds.includes(textTrack.kind)) {
3969
+ return;
3970
+ }
3971
+ items.push({
3972
+ label: textTrack.label || textTrack.language || 'Unknown',
3973
+ value: textTrack.language || null
3974
+ });
3975
+ });
3976
+ var selectedIndex = items.findIndex(function (item) {
3977
+ return player.activeTextTrack && item.value !== null && player.activeTextTrack.language === item.value;
3978
+ });
3979
+ return {
3980
+ items: items,
3981
+ selectedIndex: selectedIndex >= 0 ? selectedIndex : 0
3982
+ };
3983
+ }, [kinds, offMenuText, player.activeTextTrack, player.textTracks, showOffMenu]);
3984
+ var handleSelectItem = React.useCallback(function (index) {
3985
+ Array.from(player.textTracks || []).forEach(function (textTrack, trackIndex) {
3986
+ var normalizedIndex = showOffMenu ? trackIndex + 1 : trackIndex;
3987
+ if (index === normalizedIndex) {
3988
+ textTrack.mode = 'showing';
3989
+ actions.activateTextTrack(textTrack);
3990
+ } else {
3991
+ textTrack.mode = 'hidden';
3992
+ }
3993
+ });
3994
+ if (showOffMenu && index === 0) {
3995
+ actions.activateTextTrack(null);
3996
+ }
3997
+ }, [actions, player.textTracks, showOffMenu]);
3998
+ return React__default.createElement(MenuButton, {
3999
+ className: classnames('video-react-player-closed-caption', className),
4000
+ onSelectItem: handleSelectItem,
4001
+ items: textTrackItems.items,
4002
+ selectedIndex: textTrackItems.selectedIndex
4003
+ }, React__default.createElement("span", {
4004
+ className: "video-react-player-control-text"
4005
+ }, "Closed Caption"));
4006
+ };
4007
+ ClosedCaptionButton.displayName = 'ClosedCaptionButton';
4008
+
4009
+ /**
4010
+
4011
+ * Copyright (c) 2016 Video-React contributors
4012
+ * Copyright (c) 2025 ZingMe.Vn
4013
+ *
4014
+ * This source code is licensed under the MIT license found in the
4015
+ * LICENSE file in the root directory of this source tree.
4016
+ */
4017
+ var PictureInPictureToggle = function PictureInPictureToggle(_ref) {
4018
+ var _player$isPictureInPi;
4019
+ var actions = _ref.actions,
4020
+ player = _ref.player,
4021
+ className = _ref.className;
4022
+ var handleClick = React.useCallback(function () {
4023
+ actions.togglePictureInPicture();
4024
+ }, [actions]);
4025
+ var isPip = (_player$isPictureInPi = player.isPictureInPicture) !== null && _player$isPictureInPi !== void 0 ? _player$isPictureInPi : false;
4026
+ return React__default.createElement("button", {
4027
+ className: classnames(className, {
4028
+ 'video-react-player-icon-picture-in-picture-exit': isPip,
4029
+ 'video-react-player-icon-picture-in-picture': !isPip
4030
+ }, 'video-react-player-picture-in-picture-control video-react-player-control video-react-player-button video-react-player-icon'),
4031
+ type: "button",
4032
+ tabIndex: 0,
4033
+ onClick: handleClick
4034
+ }, React__default.createElement("span", {
4035
+ className: "video-react-player-control-text"
4036
+ }, "Picture-in-Picture"));
4037
+ };
4038
+ PictureInPictureToggle.displayName = 'PictureInPictureToggle';
4039
+
4040
+ /**
4041
+
4042
+ * Copyright (c) 2016 Video-React contributors
4043
+ * Copyright (c) 2025 ZingMe.Vn
4044
+ *
4045
+ * This source code is licensed under the MIT license found in the
4046
+ * LICENSE file in the root directory of this source tree.
4047
+ */
4048
+ var LoopToggle = React.forwardRef(function (_ref, ref) {
4049
+ var actions = _ref.actions,
4050
+ player = _ref.player,
4051
+ className = _ref.className;
4052
+ var isLoop = !!player.loop;
4053
+ var handleClick = React.useCallback(function () {
4054
+ actions.handleLoopChange(!isLoop);
4055
+ }, [actions, isLoop]);
4056
+ return React__default.createElement("button", {
4057
+ className: classnames(className, {
4058
+ 'video-react-player-icon-loop-active': isLoop,
4059
+ 'video-react-player-icon-loop': !isLoop
4060
+ }, 'video-react-player-loop-control video-react-player-control video-react-player-button video-react-player-icon'),
4061
+ ref: ref,
4062
+ type: "button",
4063
+ tabIndex: 0,
4064
+ onClick: handleClick
4065
+ }, React__default.createElement("span", {
4066
+ className: "video-react-player-control-text"
4067
+ }, isLoop ? 'Loop On' : 'Loop Off'));
4068
+ });
4069
+ LoopToggle.displayName = 'LoopToggle';
4070
+
4071
+ /**
4072
+
4073
+ * Copyright (c) 2016 Video-React contributors
4074
+ * Copyright (c) 2025 ZingMe.Vn
4075
+ *
4076
+ * This source code is licensed under the MIT license found in the
4077
+ * LICENSE file in the root directory of this source tree.
4078
+ */
4079
+ var TheaterModeToggle = function TheaterModeToggle(_ref) {
4080
+ var _player$isTheater;
4081
+ var actions = _ref.actions,
4082
+ player = _ref.player,
4083
+ className = _ref.className;
4084
+ var handleClick = React.useCallback(function () {
4085
+ actions.toggleTheaterMode(!player.isTheater);
4086
+ }, [actions, player.isTheater]);
4087
+ var isTheater = (_player$isTheater = player.isTheater) !== null && _player$isTheater !== void 0 ? _player$isTheater : false;
4088
+ return React__default.createElement("button", {
4089
+ className: classnames(className, {
4090
+ 'video-react-player-icon-theater-exit': isTheater,
4091
+ 'video-react-player-icon-theater': !isTheater
4092
+ }, 'video-react-player-theater-control video-react-player-control video-react-player-button video-react-player-icon'),
4093
+ type: "button",
4094
+ tabIndex: 0,
4095
+ onClick: handleClick
4096
+ }, React__default.createElement("span", {
4097
+ className: "video-react-player-control-text"
4098
+ }, isTheater ? 'Exit Theater Mode' : 'Theater Mode'));
4099
+ };
4100
+ TheaterModeToggle.displayName = 'TheaterModeToggle';
4101
+
4102
+ /**
4103
+
4104
+ * Copyright (c) 2016 Video-React contributors
4105
+ * Copyright (c) 2025 ZingMe.Vn
4106
+ *
4107
+ * This source code is licensed under the MIT license found in the
4108
+ * LICENSE file in the root directory of this source tree.
4109
+ */
4110
+ var DownloadButton = function DownloadButton(_ref) {
4111
+ var player = _ref.player,
4112
+ className = _ref.className,
4113
+ _ref$filename = _ref.filename,
4114
+ filename = _ref$filename === void 0 ? 'video' : _ref$filename;
4115
+ var handleClick = React.useCallback(function () {
4116
+ if (!player.currentSrc) {
4117
+ return;
4118
+ }
4119
+ var link = document.createElement('a');
4120
+ link.href = player.currentSrc;
4121
+ link.download = filename;
4122
+ link.click();
4123
+ }, [filename, player.currentSrc]);
4124
+ return React__default.createElement("button", {
4125
+ className: classnames(className, 'video-react-player-icon-download', 'video-react-player-download-control video-react-player-control video-react-player-button video-react-player-icon'),
4126
+ type: "button",
4127
+ tabIndex: 0,
4128
+ onClick: handleClick
4129
+ }, React__default.createElement("span", {
4130
+ className: "video-react-player-control-text"
4131
+ }, "Download"));
4132
+ };
4133
+ DownloadButton.displayName = 'DownloadButton';
4134
+
4135
+ /**
4136
+
4137
+ * Copyright (c) 2016 Video-React contributors
4138
+ * Copyright (c) 2025 ZingMe.Vn
4139
+ *
4140
+ * This source code is licensed under the MIT license found in the
4141
+ * LICENSE file in the root directory of this source tree.
4142
+ */
4143
+ var ScreenshotButton = function ScreenshotButton(_ref) {
4144
+ var actions = _ref.actions,
4145
+ className = _ref.className;
4146
+ var handleClick = React.useCallback(function () {
4147
+ actions.takeScreenshot();
4148
+ }, [actions]);
4149
+ return React__default.createElement("button", {
4150
+ className: classnames(className, 'video-react-player-icon-camera', 'video-react-player-screenshot-control video-react-player-control video-react-player-button video-react-player-icon'),
4151
+ type: "button",
4152
+ tabIndex: 0,
4153
+ onClick: handleClick
4154
+ }, React__default.createElement("span", {
4155
+ className: "video-react-player-control-text"
4156
+ }, "Screenshot"));
4157
+ };
4158
+ ScreenshotButton.displayName = 'ScreenshotButton';
4159
+
4160
+ /**
4161
+
4162
+ * Copyright (c) 2016 Video-React contributors
4163
+ * Copyright (c) 2025 ZingMe.Vn
4164
+ *
4165
+ * This source code is licensed under the MIT license found in the
4166
+ * LICENSE file in the root directory of this source tree.
4167
+ */
4168
+ var DEFAULT_QUALITIES = ['auto', '1080p', '720p', '480p', '360p', '240p'];
4169
+ var QualityMenuButton = function QualityMenuButton(_ref) {
4170
+ var _ref$qualities = _ref.qualities,
4171
+ qualities = _ref$qualities === void 0 ? DEFAULT_QUALITIES : _ref$qualities,
4172
+ actions = _ref.actions,
4173
+ player = _ref.player,
4174
+ className = _ref.className;
4175
+ var items = React.useMemo(function () {
4176
+ return qualities.map(function (quality) {
4177
+ return {
4178
+ label: quality,
4179
+ value: quality
4180
+ };
4181
+ });
4182
+ }, [qualities]);
4183
+ var currentQuality = player.quality || 'auto';
4184
+ var selectedIndex = React.useMemo(function () {
4185
+ var index = qualities.indexOf(currentQuality);
4186
+ return index >= 0 ? index : 0;
4187
+ }, [currentQuality, qualities]);
4188
+ var handleSelectItem = React.useCallback(function (index) {
4189
+ if (index >= 0 && index < qualities.length) {
4190
+ actions.changeQuality(qualities[index]);
4191
+ }
4192
+ }, [actions, qualities]);
4193
+ return React__default.createElement(MenuButton, {
4194
+ className: classnames('video-react-player-quality-menu', className),
4195
+ onSelectItem: handleSelectItem,
4196
+ items: items,
4197
+ selectedIndex: selectedIndex
4198
+ }, React__default.createElement("span", {
4199
+ className: "video-react-player-control-text"
4200
+ }, "Quality"), React__default.createElement("div", {
4201
+ className: "video-react-player-quality-value"
4202
+ }, currentQuality));
4203
+ };
4204
+ QualityMenuButton.displayName = 'QualityMenuButton';
4205
+
4206
+ function RemainingTimeDisplay(_ref) {
4207
+ var _ref$player = _ref.player,
4208
+ currentTime = _ref$player.currentTime,
4209
+ duration = _ref$player.duration,
4210
+ className = _ref.className;
4211
+ var remainingTime = duration - currentTime;
4212
+ var formattedTime = formatTime(remainingTime);
4213
+ return React__default.createElement("div", {
4214
+ className: classnames('video-react-player-remaining-time video-react-player-time-control video-react-player-control', className)
4215
+ }, React__default.createElement("div", {
4216
+ className: "video-react-player-remaining-time-display",
4217
+ "aria-live": "off"
4218
+ }, React__default.createElement("span", {
4219
+ className: "video-react-player-control-text"
4220
+ }, "Remaining Time "), "-" + formattedTime));
4221
+ }
4222
+ RemainingTimeDisplay.displayName = 'RemainingTimeDisplay';
4223
+
4224
+ /**
4225
+
4226
+ * Copyright (c) 2016 Video-React contributors
4227
+ * Copyright (c) 2025 ZingMe.Vn
4228
+ *
4229
+ * This source code is licensed under the MIT license found in the
4230
+ * LICENSE file in the root directory of this source tree.
4231
+ */
4232
+
4233
+ /**
4234
+
4235
+ * Copyright (c) 2016 Video-React contributors
4236
+ * Copyright (c) 2025 ZingMe.Vn
4237
+ *
4238
+ * This source code is licensed under the MIT license found in the
4239
+ * LICENSE file in the root directory of this source tree.
4240
+ */
4241
+
4242
+ exports.Bezel = Bezel;
4243
+ exports.BigPlayButton = BigPlayButton;
4244
+ exports.ClosedCaptionButton = ClosedCaptionButton;
4245
+ exports.ControlBar = ControlBar;
4246
+ exports.CurrentTimeDisplay = CurrentTimeDisplay;
4247
+ exports.DownloadButton = DownloadButton;
4248
+ exports.DurationDisplay = DurationDisplay;
4249
+ exports.ForwardControl = ForwardControl;
4250
+ exports.FullscreenToggle = FullscreenToggle;
4251
+ exports.LoadProgressBar = LoadProgressBar;
4252
+ exports.LoadingSpinner = LoadingSpinner;
4253
+ exports.LoopToggle = LoopToggle;
4254
+ exports.MenuButton = MenuButton;
4255
+ exports.MouseTimeDisplay = MouseTimeDisplay;
4256
+ exports.PictureInPictureToggle = PictureInPictureToggle;
4257
+ exports.PlayProgressBar = PlayProgressBar;
4258
+ exports.PlayToggle = PlayToggle;
4259
+ exports.PlaybackRate = PlaybackRate;
4260
+ exports.PlaybackRateMenuButton = PlaybackRateMenuButton;
4261
+ exports.Player = Player;
4262
+ exports.PosterImage = PosterImage;
4263
+ exports.ProgressControl = ProgressControl;
4264
+ exports.QualityMenuButton = QualityMenuButton;
4265
+ exports.RemainingTimeDisplay = RemainingTimeDisplay;
4266
+ exports.ReplayControl = ReplayControl;
4267
+ exports.ScreenshotButton = ScreenshotButton;
4268
+ exports.SeekBar = SeekBar;
4269
+ exports.Shortcut = Shortcut;
4270
+ exports.Slider = Slider;
4271
+ exports.TheaterModeToggle = TheaterModeToggle;
4272
+ exports.TimeDivider = TimeDivider;
4273
+ exports.Video = Video;
4274
+ exports.VolumeMenuButton = VolumeMenuButton;
4275
+ exports.operationReducer = operationReducer;
4276
+ exports.playerActions = playerActions;
4277
+ exports.playerReducer = playerReducer;
4278
+ exports.videoActions = videoActions;
4279
+
4280
+ Object.defineProperty(exports, '__esModule', { value: true });
4281
+
4282
+ }));
4283
+ //# sourceMappingURL=video-react-player.js.map