@atlaskit/media-ui 28.3.2 → 28.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/customMediaPlayer/index.js +1 -1
- package/dist/cjs/customMediaPlayer/mediaPlayer/captionsSelectControls.js +2 -1
- package/dist/cjs/customMediaPlayer/mediaPlayer/mediaPlayer.js +17 -12
- package/dist/cjs/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +311 -213
- package/dist/cjs/customMediaPlayer/mediaPlayer/testHelpers/_MockedMediaProvider.js +153 -0
- package/dist/cjs/customMediaPlayer/mediaPlayer/testHelpers/_helpers.js +22 -0
- package/dist/cjs/customMediaPlayer/mediaPlayer/useTextTracks.js +11 -7
- package/dist/es2019/customMediaPlayer/index.js +1 -1
- package/dist/es2019/customMediaPlayer/mediaPlayer/captionsSelectControls.js +2 -1
- package/dist/es2019/customMediaPlayer/mediaPlayer/mediaPlayer.js +17 -11
- package/dist/es2019/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +232 -166
- package/dist/es2019/customMediaPlayer/mediaPlayer/testHelpers/_MockedMediaProvider.js +126 -0
- package/dist/es2019/customMediaPlayer/mediaPlayer/testHelpers/_helpers.js +14 -0
- package/dist/es2019/customMediaPlayer/mediaPlayer/useTextTracks.js +23 -18
- package/dist/esm/customMediaPlayer/index.js +1 -1
- package/dist/esm/customMediaPlayer/mediaPlayer/captionsSelectControls.js +2 -1
- package/dist/esm/customMediaPlayer/mediaPlayer/mediaPlayer.js +16 -11
- package/dist/esm/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +310 -212
- package/dist/esm/customMediaPlayer/mediaPlayer/testHelpers/_MockedMediaProvider.js +146 -0
- package/dist/esm/customMediaPlayer/mediaPlayer/testHelpers/_helpers.js +16 -0
- package/dist/esm/customMediaPlayer/mediaPlayer/useTextTracks.js +11 -7
- package/dist/types/customMediaPlayer/analytics/utils/playbackAttributes.d.ts +1 -1
- package/dist/types/customMediaPlayer/mediaPlayer/mediaPlayer.d.ts +2 -1
- package/dist/types/customMediaPlayer/mediaPlayer/mediaPlayerBase.d.ts +15 -6
- package/dist/types/customMediaPlayer/mediaPlayer/testHelpers/_MockedMediaProvider.d.ts +46 -0
- package/dist/types/customMediaPlayer/mediaPlayer/testHelpers/_helpers.d.ts +2 -0
- package/dist/types-ts4.5/customMediaPlayer/analytics/utils/playbackAttributes.d.ts +1 -1
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/mediaPlayer.d.ts +2 -1
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/mediaPlayerBase.d.ts +15 -6
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/testHelpers/_MockedMediaProvider.d.ts +46 -0
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/testHelpers/_helpers.d.ts +2 -0
- package/package.json +6 -5
|
@@ -24,7 +24,6 @@ import SoundIcon from '@atlaskit/icon/core/migration/volume-high--hipchat-outgoi
|
|
|
24
24
|
import VideoHdIcon from '@atlaskit/icon-lab/core/video-hd';
|
|
25
25
|
import VideoHdFilledIcon from '@atlaskit/icon-lab/core/video-hd-filled';
|
|
26
26
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
27
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
28
27
|
import { injectIntl } from 'react-intl-next';
|
|
29
28
|
import { Box, Flex } from '@atlaskit/primitives/compiled';
|
|
30
29
|
import MediaButton from '../../MediaButton';
|
|
@@ -54,10 +53,59 @@ import VideoSkipBackwardTenIcon from '@atlaskit/icon/core/video-skip-backward-te
|
|
|
54
53
|
import { getUserCaptionsLocale, setUserCaptionsLocale, findPreselectedTrackIndex, getUserCaptionsEnabled, setUserCaptionsEnabled } from './captions';
|
|
55
54
|
import { CaptionsUploaderBrowser } from './captions/artifactUploader';
|
|
56
55
|
import CaptionDeleteConfirmationModal from './captions/captionDeleteConfirmationModal';
|
|
57
|
-
var MEDIUM_VIDEO_MAX_WIDTH = 400;
|
|
58
|
-
var SMALL_VIDEO_MAX_WIDTH = 245;
|
|
59
56
|
var MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
|
|
60
57
|
var VIEWED_TRACKING_SECS = 2;
|
|
58
|
+
export var breakpoints = {
|
|
59
|
+
LARGE_VIDEO_MAX_WIDTH: 570,
|
|
60
|
+
MEDIUM_VIDEO_MAX_WIDTH: 430,
|
|
61
|
+
SMALL_VIDEO_MAX_WIDTH: 260
|
|
62
|
+
};
|
|
63
|
+
var breakpointControls = {
|
|
64
|
+
playPauseButton: function playPauseButton() {
|
|
65
|
+
return true;
|
|
66
|
+
},
|
|
67
|
+
volume: function volume() {
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
fullScreenButton: function fullScreenButton() {
|
|
71
|
+
return true;
|
|
72
|
+
},
|
|
73
|
+
currentTime: function currentTime(playerWidth) {
|
|
74
|
+
return playerWidth > breakpoints.SMALL_VIDEO_MAX_WIDTH;
|
|
75
|
+
},
|
|
76
|
+
captionsControls: function captionsControls(playerWidth) {
|
|
77
|
+
return playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH;
|
|
78
|
+
},
|
|
79
|
+
downloadButton: function downloadButton(playerWidth) {
|
|
80
|
+
return playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH;
|
|
81
|
+
},
|
|
82
|
+
volumeSlider: function volumeSlider(playerWidth) {
|
|
83
|
+
return playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH;
|
|
84
|
+
},
|
|
85
|
+
skipButtons: function skipButtons(playerWidth) {
|
|
86
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
87
|
+
},
|
|
88
|
+
speedControls: function speedControls(playerWidth) {
|
|
89
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
90
|
+
},
|
|
91
|
+
hdButton: function hdButton(playerWidth) {
|
|
92
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
93
|
+
},
|
|
94
|
+
captionsAdminControls: function captionsAdminControls(playerWidth) {
|
|
95
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var getPlayerSize = function getPlayerSize(playerWidth) {
|
|
99
|
+
if (playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH) {
|
|
100
|
+
return 'xlarge';
|
|
101
|
+
} else if (playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH) {
|
|
102
|
+
return 'large';
|
|
103
|
+
} else if (playerWidth > breakpoints.SMALL_VIDEO_MAX_WIDTH) {
|
|
104
|
+
return 'medium';
|
|
105
|
+
} else {
|
|
106
|
+
return 'small';
|
|
107
|
+
}
|
|
108
|
+
};
|
|
61
109
|
|
|
62
110
|
/* Styles */
|
|
63
111
|
|
|
@@ -89,14 +137,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
89
137
|
volume: 1,
|
|
90
138
|
status: 'paused',
|
|
91
139
|
duration: 0,
|
|
92
|
-
isMuted: false
|
|
140
|
+
isMuted: false,
|
|
141
|
+
currentActiveCues: function currentActiveCues() {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
93
144
|
});
|
|
94
145
|
_defineProperty(_this, "wasPlayedOnce", false);
|
|
95
146
|
_defineProperty(_this, "lastCurrentTime", 0);
|
|
96
147
|
_defineProperty(_this, "timeSaver", new TimeSaver(_this.props.lastWatchTimeConfig));
|
|
97
148
|
_defineProperty(_this, "state", {
|
|
98
149
|
isFullScreenEnabled: false,
|
|
99
|
-
|
|
150
|
+
playerWidth: 100,
|
|
151
|
+
// initial value for playerSize: 'small', i.e. width < 260px
|
|
100
152
|
playbackSpeed: 1,
|
|
101
153
|
selectedTracksIndex: -1,
|
|
102
154
|
areCaptionsEnabled: false,
|
|
@@ -127,8 +179,9 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
127
179
|
createAnalyticsEvent = _this$props.createAnalyticsEvent;
|
|
128
180
|
var _this$state = _this.state,
|
|
129
181
|
isFullScreenEnabled = _this$state.isFullScreenEnabled,
|
|
130
|
-
playerSize = _this$state.playerSize,
|
|
131
182
|
playbackSpeed = _this$state.playbackSpeed;
|
|
183
|
+
var _this2 = _this,
|
|
184
|
+
playerSize = _this2.playerSize;
|
|
132
185
|
fireAnalyticsEvent(createFirstPlayedTrackEvent(type, {
|
|
133
186
|
isAutoPlay: isAutoPlay,
|
|
134
187
|
isHDAvailable: isHDAvailable,
|
|
@@ -174,22 +227,25 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
174
227
|
_this.timeSaver.defaultTime = 0;
|
|
175
228
|
}
|
|
176
229
|
});
|
|
177
|
-
_defineProperty(_this, "
|
|
178
|
-
|
|
179
|
-
|
|
230
|
+
_defineProperty(_this, "shouldRenderCurrentTime", function () {
|
|
231
|
+
return breakpointControls.currentTime(_this.state.playerWidth);
|
|
232
|
+
});
|
|
233
|
+
_defineProperty(_this, "renderCurrentTime", function () {
|
|
180
234
|
return /*#__PURE__*/React.createElement(CurrentTime, {
|
|
181
|
-
draggable: false
|
|
182
|
-
|
|
235
|
+
draggable: false,
|
|
236
|
+
"data-testid": "current-time"
|
|
237
|
+
}, formatDuration(_this.videoState.currentTime), " / ", formatDuration(_this.videoState.duration));
|
|
183
238
|
});
|
|
184
|
-
_defineProperty(_this, "
|
|
239
|
+
_defineProperty(_this, "shouldRenderHdButton", function () {
|
|
185
240
|
var _this$props4 = _this.props,
|
|
186
241
|
type = _this$props4.type,
|
|
187
|
-
isHDAvailable = _this$props4.isHDAvailable
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
242
|
+
isHDAvailable = _this$props4.isHDAvailable;
|
|
243
|
+
return !fg('platform_media_disable_video_640p_artifact_usage') && breakpointControls.hdButton(_this.state.playerWidth) && type !== 'audio' && !!isHDAvailable;
|
|
244
|
+
});
|
|
245
|
+
_defineProperty(_this, "renderHDButton", function () {
|
|
246
|
+
var _this$props5 = _this.props,
|
|
247
|
+
isHDActive = _this$props5.isHDActive,
|
|
248
|
+
onHDToggleClick = _this$props5.onHDToggleClick;
|
|
193
249
|
return /*#__PURE__*/React.createElement(MediaButton, {
|
|
194
250
|
testId: "custom-media-player-hd-button",
|
|
195
251
|
onClick: !!onHDToggleClick ? _this.getMediaButtonClickHandler(onHDToggleClick, 'HDButton') : undefined,
|
|
@@ -210,6 +266,9 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
210
266
|
});
|
|
211
267
|
_this.createAndFireUIEvent('playbackSpeedChange');
|
|
212
268
|
});
|
|
269
|
+
_defineProperty(_this, "shouldRenderSpeedControls", function () {
|
|
270
|
+
return breakpointControls.speedControls(_this.state.playerWidth);
|
|
271
|
+
});
|
|
213
272
|
_defineProperty(_this, "renderSpeedControls", function () {
|
|
214
273
|
var playbackSpeed = _this.state.playbackSpeed;
|
|
215
274
|
var originalDimensions = _this.props.originalDimensions;
|
|
@@ -222,24 +281,38 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
222
281
|
}
|
|
223
282
|
});
|
|
224
283
|
});
|
|
225
|
-
_defineProperty(_this, "
|
|
284
|
+
_defineProperty(_this, "shouldRenderVolume", function () {
|
|
285
|
+
return breakpointControls.volume(_this.state.playerWidth);
|
|
286
|
+
});
|
|
287
|
+
_defineProperty(_this, "shouldRenderVolumeSLider", function () {
|
|
288
|
+
return breakpointControls.volumeSlider(_this.state.playerWidth);
|
|
289
|
+
});
|
|
290
|
+
_defineProperty(_this, "renderVolume", function () {
|
|
291
|
+
var _this$actions, _this$actions2;
|
|
292
|
+
var showSlider = _this.shouldRenderVolumeSLider();
|
|
226
293
|
return /*#__PURE__*/React.createElement(VolumeWrapper, {
|
|
227
294
|
showSlider: showSlider
|
|
228
295
|
}, /*#__PURE__*/React.createElement(VolumeToggleWrapper, {
|
|
229
|
-
isMuted: videoState.isMuted
|
|
296
|
+
isMuted: _this.videoState.isMuted
|
|
230
297
|
}, /*#__PURE__*/React.createElement(MutedIndicator, {
|
|
231
|
-
isMuted: videoState.isMuted
|
|
298
|
+
isMuted: _this.videoState.isMuted
|
|
232
299
|
}), /*#__PURE__*/React.createElement(MediaButton, {
|
|
233
300
|
testId: "custom-media-player-volume-toggle-button",
|
|
234
|
-
onClick: _this.getMediaButtonClickHandler(actions.toggleMute
|
|
301
|
+
onClick: _this.getMediaButtonClickHandler(((_this$actions = _this.actions) === null || _this$actions === void 0 ? void 0 : _this$actions.toggleMute) || function () {
|
|
302
|
+
return undefined;
|
|
303
|
+
}, 'muteButton'),
|
|
235
304
|
iconBefore: /*#__PURE__*/React.createElement(SoundIcon, {
|
|
236
305
|
color: "currentColor",
|
|
237
306
|
label: _this.props.intl.formatMessage(messages.volumeMuteButtonAria)
|
|
238
307
|
}),
|
|
239
|
-
"aria-pressed": videoState.isMuted
|
|
240
|
-
})), showSlider && /*#__PURE__*/React.createElement(VolumeTimeRangeWrapper,
|
|
241
|
-
|
|
242
|
-
|
|
308
|
+
"aria-pressed": _this.videoState.isMuted
|
|
309
|
+
})), showSlider && /*#__PURE__*/React.createElement(VolumeTimeRangeWrapper, {
|
|
310
|
+
"data-testid": "volume-time-range-wrapper"
|
|
311
|
+
}, /*#__PURE__*/React.createElement(VolumeRange, {
|
|
312
|
+
onChange: ((_this$actions2 = _this.actions) === null || _this$actions2 === void 0 ? void 0 : _this$actions2.setVolume) || function () {
|
|
313
|
+
return undefined;
|
|
314
|
+
},
|
|
315
|
+
currentVolume: _this.videoState.volume,
|
|
243
316
|
isAlwaysActive: true,
|
|
244
317
|
onChanged: _this.onVolumeChanged,
|
|
245
318
|
ariaLabel: _this.props.intl.formatMessage(messages.volumeLevelControlAria)
|
|
@@ -253,24 +326,17 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
253
326
|
_this.createAndFireUIEvent('mediaButtonClick', 'fullScreenButton');
|
|
254
327
|
});
|
|
255
328
|
_defineProperty(_this, "onResize", function (width) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
playerSize: 'medium'
|
|
263
|
-
});
|
|
264
|
-
} else {
|
|
265
|
-
_this.setState({
|
|
266
|
-
playerSize: 'small'
|
|
267
|
-
});
|
|
268
|
-
}
|
|
329
|
+
_this.setState({
|
|
330
|
+
playerWidth: width
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
_defineProperty(_this, "shouldRenderFullScreenButton", function () {
|
|
334
|
+
return breakpointControls.fullScreenButton(_this.state.playerWidth);
|
|
269
335
|
});
|
|
270
336
|
_defineProperty(_this, "renderFullScreenButton", function () {
|
|
271
|
-
var _this$
|
|
272
|
-
formatMessage = _this$
|
|
273
|
-
type = _this$
|
|
337
|
+
var _this$props6 = _this.props,
|
|
338
|
+
formatMessage = _this$props6.intl.formatMessage,
|
|
339
|
+
type = _this$props6.type;
|
|
274
340
|
if (type === 'audio') {
|
|
275
341
|
return;
|
|
276
342
|
}
|
|
@@ -288,25 +354,24 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
288
354
|
iconBefore: icon
|
|
289
355
|
});
|
|
290
356
|
});
|
|
357
|
+
_defineProperty(_this, "shouldRenderDownloadButton", function () {
|
|
358
|
+
return breakpointControls.downloadButton(_this.state.playerWidth);
|
|
359
|
+
});
|
|
291
360
|
_defineProperty(_this, "renderDownloadButton", function () {
|
|
292
|
-
|
|
293
|
-
if (!onDownloadClick) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
return /*#__PURE__*/React.createElement(MediaButton, {
|
|
361
|
+
return _this.props.onDownloadClick && /*#__PURE__*/React.createElement(MediaButton, {
|
|
297
362
|
testId: "custom-media-player-download-button",
|
|
298
|
-
onClick: _this.getMediaButtonClickHandler(onDownloadClick, 'downloadButton'),
|
|
363
|
+
onClick: _this.getMediaButtonClickHandler(_this.props.onDownloadClick, 'downloadButton'),
|
|
299
364
|
iconBefore: /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
300
365
|
color: "currentColor",
|
|
301
366
|
label: "download"
|
|
302
367
|
})
|
|
303
368
|
});
|
|
304
369
|
});
|
|
305
|
-
_defineProperty(_this, "renderShortcuts", function (
|
|
306
|
-
var togglePlayPauseAction =
|
|
307
|
-
toggleMute =
|
|
308
|
-
skipBackward =
|
|
309
|
-
skipForward =
|
|
370
|
+
_defineProperty(_this, "renderShortcuts", function (_ref2) {
|
|
371
|
+
var togglePlayPauseAction = _ref2.togglePlayPauseAction,
|
|
372
|
+
toggleMute = _ref2.toggleMute,
|
|
373
|
+
skipBackward = _ref2.skipBackward,
|
|
374
|
+
skipForward = _ref2.skipForward;
|
|
310
375
|
var isShortcutEnabled = _this.props.isShortcutEnabled;
|
|
311
376
|
var isFullScreenEnabled = _this.state.isFullScreenEnabled;
|
|
312
377
|
var shortcuts = (isShortcutEnabled || isFullScreenEnabled) && [/*#__PURE__*/React.createElement(Shortcut, {
|
|
@@ -333,9 +398,12 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
333
398
|
}
|
|
334
399
|
return shortcuts;
|
|
335
400
|
});
|
|
336
|
-
_defineProperty(_this, "
|
|
401
|
+
_defineProperty(_this, "shouldRenderPlayPauseButton", function () {
|
|
402
|
+
return breakpointControls.playPauseButton(_this.state.playerWidth);
|
|
403
|
+
});
|
|
404
|
+
_defineProperty(_this, "renderPlayPauseButton", function () {
|
|
337
405
|
var formatMessage = _this.props.intl.formatMessage;
|
|
338
|
-
var toggleButtonIcon = isPlaying ? /*#__PURE__*/React.createElement(PauseIcon, {
|
|
406
|
+
var toggleButtonIcon = _this.isPlaying ? /*#__PURE__*/React.createElement(PauseIcon, {
|
|
339
407
|
spacing: "spacious",
|
|
340
408
|
color: "currentColor",
|
|
341
409
|
label: formatMessage(messages.pause)
|
|
@@ -345,16 +413,31 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
345
413
|
label: formatMessage(messages.play)
|
|
346
414
|
});
|
|
347
415
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
348
|
-
content: formatMessage(isPlaying ? messages.pause : messages.play),
|
|
416
|
+
content: formatMessage(_this.isPlaying ? messages.pause : messages.play),
|
|
349
417
|
position: "top"
|
|
350
418
|
}, /*#__PURE__*/React.createElement(MediaButton, {
|
|
351
419
|
testId: "custom-media-player-play-toggle-button",
|
|
352
|
-
"data-test-is-playing": isPlaying,
|
|
420
|
+
"data-test-is-playing": _this.isPlaying,
|
|
353
421
|
iconBefore: toggleButtonIcon,
|
|
354
|
-
onClick: isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
|
|
422
|
+
onClick: _this.isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
|
|
355
423
|
}));
|
|
356
424
|
});
|
|
357
|
-
_defineProperty(_this, "
|
|
425
|
+
_defineProperty(_this, "defaultSkipAmount", 10);
|
|
426
|
+
_defineProperty(_this, "skipBackward", function () {
|
|
427
|
+
var _this$actions3, _this$props$onTimeCha2, _this$props7;
|
|
428
|
+
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.defaultSkipAmount;
|
|
429
|
+
var newTime = _this.videoState.currentTime - skipAmount;
|
|
430
|
+
(_this$actions3 = _this.actions) === null || _this$actions3 === void 0 || _this$actions3.navigate(Math.max(newTime, 0));
|
|
431
|
+
(_this$props$onTimeCha2 = (_this$props7 = _this.props).onTimeChanged) === null || _this$props$onTimeCha2 === void 0 || _this$props$onTimeCha2.call(_this$props7);
|
|
432
|
+
});
|
|
433
|
+
_defineProperty(_this, "skipForward", function () {
|
|
434
|
+
var _this$actions4, _this$props$onTimeCha3, _this$props8;
|
|
435
|
+
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.defaultSkipAmount;
|
|
436
|
+
var newTime = _this.videoState.currentTime + skipAmount;
|
|
437
|
+
(_this$actions4 = _this.actions) === null || _this$actions4 === void 0 || _this$actions4.navigate(Math.min(newTime, _this.videoState.duration));
|
|
438
|
+
(_this$props$onTimeCha3 = (_this$props8 = _this.props).onTimeChanged) === null || _this$props$onTimeCha3 === void 0 || _this$props$onTimeCha3.call(_this$props8);
|
|
439
|
+
});
|
|
440
|
+
_defineProperty(_this, "renderSkipBackwardButton", function () {
|
|
358
441
|
var formatMessage = _this.props.intl.formatMessage;
|
|
359
442
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
360
443
|
content: formatMessage(messages.skipBackward),
|
|
@@ -366,10 +449,10 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
366
449
|
LEGACY_fallbackIcon: SkipTenBackwardIcon,
|
|
367
450
|
label: formatMessage(messages.skipBackward)
|
|
368
451
|
}),
|
|
369
|
-
onClick: _this.getMediaButtonClickHandler(skipBackward, 'skipBackwardButton')
|
|
452
|
+
onClick: _this.getMediaButtonClickHandler(_this.skipBackward, 'skipBackwardButton')
|
|
370
453
|
}));
|
|
371
454
|
});
|
|
372
|
-
_defineProperty(_this, "renderSkipForwardButton", function (
|
|
455
|
+
_defineProperty(_this, "renderSkipForwardButton", function () {
|
|
373
456
|
var formatMessage = _this.props.intl.formatMessage;
|
|
374
457
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
375
458
|
content: formatMessage(messages.skipForward),
|
|
@@ -381,11 +464,20 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
381
464
|
LEGACY_fallbackIcon: SkipTenForwardIcon,
|
|
382
465
|
label: formatMessage(messages.skipForward)
|
|
383
466
|
}),
|
|
384
|
-
onClick: _this.getMediaButtonClickHandler(skipForward, 'skipForwardButton')
|
|
467
|
+
onClick: _this.getMediaButtonClickHandler(_this.skipForward, 'skipForwardButton')
|
|
385
468
|
}));
|
|
386
469
|
});
|
|
470
|
+
_defineProperty(_this, "shouldRenderSkipButtons", function () {
|
|
471
|
+
return breakpointControls.skipButtons(_this.state.playerWidth);
|
|
472
|
+
});
|
|
473
|
+
_defineProperty(_this, "renderSkipButtons", function () {
|
|
474
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
475
|
+
direction: "row"
|
|
476
|
+
}, _this.renderSkipBackwardButton(), _this.renderSkipForwardButton());
|
|
477
|
+
});
|
|
387
478
|
_defineProperty(_this, "renderSpinner", function () {
|
|
388
479
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
480
|
+
testId: "spinner",
|
|
389
481
|
direction: "column",
|
|
390
482
|
alignItems: "center",
|
|
391
483
|
justifyContent: "center",
|
|
@@ -396,11 +488,11 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
396
488
|
}));
|
|
397
489
|
});
|
|
398
490
|
_defineProperty(_this, "pause", function () {
|
|
399
|
-
var _this$props$onPause, _this$
|
|
491
|
+
var _this$props$onPause, _this$props9;
|
|
400
492
|
if (_this.actions) {
|
|
401
493
|
_this.actions.pause();
|
|
402
494
|
}
|
|
403
|
-
(_this$props$onPause = (_this$
|
|
495
|
+
(_this$props$onPause = (_this$props9 = _this.props).onPause) === null || _this$props$onPause === void 0 || _this$props$onPause.call(_this$props9);
|
|
404
496
|
});
|
|
405
497
|
_defineProperty(_this, "play", function () {
|
|
406
498
|
var onFirstPlay = _this.props.onFirstPlay;
|
|
@@ -437,17 +529,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
437
529
|
};
|
|
438
530
|
});
|
|
439
531
|
_defineProperty(_this, "onViewed", function (videoState) {
|
|
440
|
-
var _this$
|
|
441
|
-
createAnalyticsEvent = _this$
|
|
442
|
-
identifier = _this$
|
|
443
|
-
isAutoPlay = _this$
|
|
444
|
-
isHDAvailable = _this$
|
|
445
|
-
isHDActive = _this$
|
|
446
|
-
type = _this$
|
|
532
|
+
var _this$props0 = _this.props,
|
|
533
|
+
createAnalyticsEvent = _this$props0.createAnalyticsEvent,
|
|
534
|
+
identifier = _this$props0.identifier,
|
|
535
|
+
isAutoPlay = _this$props0.isAutoPlay,
|
|
536
|
+
isHDAvailable = _this$props0.isHDAvailable,
|
|
537
|
+
isHDActive = _this$props0.isHDActive,
|
|
538
|
+
type = _this$props0.type;
|
|
447
539
|
var _this$state2 = _this.state,
|
|
448
540
|
isFullScreenEnabled = _this$state2.isFullScreenEnabled,
|
|
449
|
-
playerSize = _this$state2.playerSize,
|
|
450
541
|
playbackSpeed = _this$state2.playbackSpeed;
|
|
542
|
+
var _this3 = _this,
|
|
543
|
+
playerSize = _this3.playerSize;
|
|
451
544
|
var status = videoState.status,
|
|
452
545
|
currentTime = videoState.currentTime;
|
|
453
546
|
if (status === 'playing' && (currentTime < _this.lastCurrentTime || currentTime >= _this.lastCurrentTime + VIEWED_TRACKING_SECS)) {
|
|
@@ -527,6 +620,78 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
527
620
|
}
|
|
528
621
|
return undefined;
|
|
529
622
|
});
|
|
623
|
+
_defineProperty(_this, "shouldRenderCaptionsControls", function () {
|
|
624
|
+
var textTracks = _this.props.textTracks;
|
|
625
|
+
var playerWidth = _this.state.playerWidth;
|
|
626
|
+
return breakpointControls.captionsControls(playerWidth) && !!textTracks;
|
|
627
|
+
});
|
|
628
|
+
_defineProperty(_this, "renderCaptionsControls", function () {
|
|
629
|
+
var textTracks = _this.props.textTracks;
|
|
630
|
+
var areCaptionsEnabled = _this.state.areCaptionsEnabled;
|
|
631
|
+
return textTracks && /*#__PURE__*/React.createElement(CaptionsSelectControls, {
|
|
632
|
+
textTracks: textTracks,
|
|
633
|
+
onSelected: _this.onTextTracksSelected,
|
|
634
|
+
areCaptionsEnabled: !!areCaptionsEnabled,
|
|
635
|
+
onCaptionsEnabledChange: _this.onCaptionsEnabledChange,
|
|
636
|
+
selectedTracksIndex: _this.resolveSelectedTracksIndex()
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
_defineProperty(_this, "shouldRenderCaptionsAdminControls", function () {
|
|
640
|
+
var _this$props$mediaSett;
|
|
641
|
+
var playerWidth = _this.state.playerWidth;
|
|
642
|
+
return (!_this.props.fileState || _this.props.fileState.status !== 'uploading') && breakpointControls.captionsAdminControls(playerWidth) && !!((_this$props$mediaSett = _this.props.mediaSettings) !== null && _this$props$mediaSett !== void 0 && _this$props$mediaSett.canUpdateVideoCaptions);
|
|
643
|
+
});
|
|
644
|
+
_defineProperty(_this, "renderCaptionsAdminControls", function () {
|
|
645
|
+
var _this$state4 = _this.state,
|
|
646
|
+
isArtifactUploaderOpen = _this$state4.isArtifactUploaderOpen,
|
|
647
|
+
artifactToDelete = _this$state4.artifactToDelete;
|
|
648
|
+
var _this$props1 = _this.props,
|
|
649
|
+
textTracks = _this$props1.textTracks,
|
|
650
|
+
identifier = _this$props1.identifier;
|
|
651
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CaptionsAdminControls, {
|
|
652
|
+
textTracks: textTracks,
|
|
653
|
+
onUpload: function onUpload() {
|
|
654
|
+
return _this.setState({
|
|
655
|
+
isArtifactUploaderOpen: true
|
|
656
|
+
});
|
|
657
|
+
},
|
|
658
|
+
onDelete: _this.onCaptionDelete
|
|
659
|
+
}), /*#__PURE__*/React.createElement(CaptionsUploaderBrowser, {
|
|
660
|
+
identifier: identifier,
|
|
661
|
+
isOpen: isArtifactUploaderOpen,
|
|
662
|
+
onClose: function onClose() {
|
|
663
|
+
return _this.setState({
|
|
664
|
+
isArtifactUploaderOpen: false
|
|
665
|
+
});
|
|
666
|
+
},
|
|
667
|
+
onEnd: function onEnd(metadata, context) {
|
|
668
|
+
_this.fireCaptionUploadSucceededEvent(context.traceId);
|
|
669
|
+
},
|
|
670
|
+
onError: function onError(err, context) {
|
|
671
|
+
_this.fireCaptionUploadFailedEvent(context.traceId, err);
|
|
672
|
+
}
|
|
673
|
+
}), /*#__PURE__*/React.createElement(CaptionDeleteConfirmationModal, {
|
|
674
|
+
identifier: identifier,
|
|
675
|
+
artifactName: artifactToDelete,
|
|
676
|
+
onClose: function onClose() {
|
|
677
|
+
return _this.setState({
|
|
678
|
+
artifactToDelete: ''
|
|
679
|
+
});
|
|
680
|
+
},
|
|
681
|
+
onEnd: function onEnd(context) {
|
|
682
|
+
_this.fireCaptionDeleteSucceededEvent(context.traceId, context.artifactName);
|
|
683
|
+
_this.setState({
|
|
684
|
+
artifactToDelete: ''
|
|
685
|
+
});
|
|
686
|
+
},
|
|
687
|
+
onError: function onError(err, context) {
|
|
688
|
+
_this.fireCaptionDeleteFailedEvent(context.traceId, context.artifactName, err);
|
|
689
|
+
_this.setState({
|
|
690
|
+
artifactToDelete: ''
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}));
|
|
694
|
+
});
|
|
530
695
|
_this.state.selectedTracksIndex = _this.findPreselectedTrackIndex(_this.props);
|
|
531
696
|
if (_this.mediaUserPreferences) {
|
|
532
697
|
var userCaptionsEnabled = getUserCaptionsEnabled(_this.mediaUserPreferences);
|
|
@@ -539,9 +704,9 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
539
704
|
key: "componentDidUpdate",
|
|
540
705
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
541
706
|
var _prevTextTracks$capti, _textTracks$captions2;
|
|
542
|
-
var _this$
|
|
543
|
-
intl = _this$
|
|
544
|
-
textTracks = _this$
|
|
707
|
+
var _this$props10 = this.props,
|
|
708
|
+
intl = _this$props10.intl,
|
|
709
|
+
textTracks = _this$props10.textTracks;
|
|
545
710
|
var prevIntl = prevProps.intl,
|
|
546
711
|
prevTextTracks = prevProps.textTracks;
|
|
547
712
|
var didLocaleChange = prevIntl.locale !== intl.locale;
|
|
@@ -558,27 +723,27 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
558
723
|
}, {
|
|
559
724
|
key: "mediaUserPreferences",
|
|
560
725
|
get: function get() {
|
|
561
|
-
var _this$props$
|
|
562
|
-
_this$props$
|
|
563
|
-
_this$props$
|
|
564
|
-
mediaUserPreferences = _this$props$
|
|
726
|
+
var _this$props$mediaSett2 = this.props.mediaSettings,
|
|
727
|
+
_this$props$mediaSett3 = _this$props$mediaSett2 === void 0 ? {} : _this$props$mediaSett2,
|
|
728
|
+
_this$props$mediaSett4 = _this$props$mediaSett3.mediaUserPreferences,
|
|
729
|
+
mediaUserPreferences = _this$props$mediaSett4 === void 0 ? undefined : _this$props$mediaSett4;
|
|
565
730
|
return mediaUserPreferences;
|
|
566
731
|
}
|
|
567
732
|
}, {
|
|
568
733
|
key: "componentDidMount",
|
|
569
734
|
value: function componentDidMount() {
|
|
570
|
-
var _this$
|
|
571
|
-
type = _this$
|
|
572
|
-
identifier = _this$
|
|
573
|
-
isAutoPlay = _this$
|
|
574
|
-
isHDAvailable = _this$
|
|
575
|
-
isHDActive = _this$
|
|
576
|
-
onFirstPlay = _this$
|
|
577
|
-
createAnalyticsEvent = _this$
|
|
578
|
-
var _this$
|
|
579
|
-
isFullScreenEnabled = _this$
|
|
580
|
-
|
|
581
|
-
|
|
735
|
+
var _this$props11 = this.props,
|
|
736
|
+
type = _this$props11.type,
|
|
737
|
+
identifier = _this$props11.identifier,
|
|
738
|
+
isAutoPlay = _this$props11.isAutoPlay,
|
|
739
|
+
isHDAvailable = _this$props11.isHDAvailable,
|
|
740
|
+
isHDActive = _this$props11.isHDActive,
|
|
741
|
+
onFirstPlay = _this$props11.onFirstPlay,
|
|
742
|
+
createAnalyticsEvent = _this$props11.createAnalyticsEvent;
|
|
743
|
+
var _this$state5 = this.state,
|
|
744
|
+
isFullScreenEnabled = _this$state5.isFullScreenEnabled,
|
|
745
|
+
playbackSpeed = _this$state5.playbackSpeed;
|
|
746
|
+
var playerSize = this.playerSize;
|
|
582
747
|
fireAnalyticsEvent(createCustomMediaPlayerScreenEvent(type, {
|
|
583
748
|
isAutoPlay: isAutoPlay,
|
|
584
749
|
isHDAvailable: isHDAvailable,
|
|
@@ -589,17 +754,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
589
754
|
}, identifier.id), createAnalyticsEvent);
|
|
590
755
|
if (this.videoWrapperRef.current) {
|
|
591
756
|
this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
|
|
757
|
+
this.onResize(this.videoWrapperRef.current.getBoundingClientRect().width);
|
|
592
758
|
}
|
|
593
759
|
simultaneousPlayManager.subscribe(this);
|
|
594
760
|
if (isAutoPlay) {
|
|
595
|
-
var _this$props$onPlay, _this$
|
|
761
|
+
var _this$props$onPlay, _this$props12;
|
|
596
762
|
simultaneousPlayManager.pauseOthers(this);
|
|
597
763
|
if (onFirstPlay) {
|
|
598
764
|
this.fireFirstPlayedTrackEvent();
|
|
599
765
|
this.wasPlayedOnce = true;
|
|
600
766
|
onFirstPlay();
|
|
601
767
|
}
|
|
602
|
-
(_this$props$onPlay = (_this$
|
|
768
|
+
(_this$props$onPlay = (_this$props12 = this.props).onPlay) === null || _this$props$onPlay === void 0 || _this$props$onPlay.call(_this$props12);
|
|
603
769
|
}
|
|
604
770
|
}
|
|
605
771
|
}, {
|
|
@@ -609,11 +775,16 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
609
775
|
this.videoWrapperRef.current.removeEventListener('fullscreenchange', this.onFullScreenChange);
|
|
610
776
|
}
|
|
611
777
|
if (this.state.isFullScreenEnabled) {
|
|
612
|
-
var _this$props$onFullscr2, _this$
|
|
613
|
-
(_this$props$onFullscr2 = (_this$
|
|
778
|
+
var _this$props$onFullscr2, _this$props13;
|
|
779
|
+
(_this$props$onFullscr2 = (_this$props13 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 || _this$props$onFullscr2.call(_this$props13, false);
|
|
614
780
|
}
|
|
615
781
|
simultaneousPlayManager.unsubscribe(this);
|
|
616
782
|
}
|
|
783
|
+
}, {
|
|
784
|
+
key: "playerSize",
|
|
785
|
+
get: function get() {
|
|
786
|
+
return getPlayerSize(this.state.playerWidth);
|
|
787
|
+
}
|
|
617
788
|
}, {
|
|
618
789
|
key: "setActions",
|
|
619
790
|
value: function setActions(actions) {
|
|
@@ -626,17 +797,17 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
626
797
|
}, {
|
|
627
798
|
key: "createAndFireUIEvent",
|
|
628
799
|
value: function createAndFireUIEvent(eventType, actionSubjectId) {
|
|
629
|
-
var _this$
|
|
630
|
-
type = _this$
|
|
631
|
-
identifier = _this$
|
|
632
|
-
isHDActive = _this$
|
|
633
|
-
isHDAvailable = _this$
|
|
634
|
-
isAutoPlay = _this$
|
|
635
|
-
createAnalyticsEvent = _this$
|
|
636
|
-
var _this$
|
|
637
|
-
isFullScreenEnabled = _this$
|
|
638
|
-
|
|
639
|
-
|
|
800
|
+
var _this$props14 = this.props,
|
|
801
|
+
type = _this$props14.type,
|
|
802
|
+
identifier = _this$props14.identifier,
|
|
803
|
+
isHDActive = _this$props14.isHDActive,
|
|
804
|
+
isHDAvailable = _this$props14.isHDAvailable,
|
|
805
|
+
isAutoPlay = _this$props14.isAutoPlay,
|
|
806
|
+
createAnalyticsEvent = _this$props14.createAnalyticsEvent;
|
|
807
|
+
var _this$state6 = this.state,
|
|
808
|
+
isFullScreenEnabled = _this$state6.isFullScreenEnabled,
|
|
809
|
+
playbackSpeed = _this$state6.playbackSpeed;
|
|
810
|
+
var playerSize = this.playerSize;
|
|
640
811
|
var playbackState = _objectSpread(_objectSpread({}, this.videoState), {}, {
|
|
641
812
|
isAutoPlay: isAutoPlay,
|
|
642
813
|
isHDAvailable: isHDAvailable,
|
|
@@ -717,29 +888,24 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
717
888
|
artifactName: artifactName
|
|
718
889
|
}), this.props.identifier.id, traceId, error));
|
|
719
890
|
}
|
|
891
|
+
}, {
|
|
892
|
+
key: "isPlaying",
|
|
893
|
+
get: function get() {
|
|
894
|
+
return this.videoState.status === 'playing';
|
|
895
|
+
}
|
|
720
896
|
}, {
|
|
721
897
|
key: "render",
|
|
722
898
|
value: function render() {
|
|
723
|
-
var
|
|
724
|
-
var _this$
|
|
725
|
-
type = _this$
|
|
726
|
-
src = _this$
|
|
727
|
-
isAutoPlay = _this$
|
|
728
|
-
onCanPlay = _this$
|
|
729
|
-
onError = _this$
|
|
730
|
-
poster = _this$
|
|
731
|
-
videoControlsWrapperRef = _this$
|
|
732
|
-
|
|
733
|
-
areControlsVisible = _this$props11.areControlsVisible,
|
|
734
|
-
identifier = _this$props11.identifier,
|
|
735
|
-
_this$props11$mediaSe = _this$props11.mediaSettings,
|
|
736
|
-
_this$props11$mediaSe2 = _this$props11$mediaSe === void 0 ? {} : _this$props11$mediaSe,
|
|
737
|
-
_this$props11$mediaSe3 = _this$props11$mediaSe2.canUpdateVideoCaptions,
|
|
738
|
-
canUpdateVideoCaptions = _this$props11$mediaSe3 === void 0 ? false : _this$props11$mediaSe3;
|
|
739
|
-
var _this$state6 = this.state,
|
|
740
|
-
areCaptionsEnabled = _this$state6.areCaptionsEnabled,
|
|
741
|
-
isArtifactUploaderOpen = _this$state6.isArtifactUploaderOpen,
|
|
742
|
-
artifactToDelete = _this$state6.artifactToDelete;
|
|
899
|
+
var _this4 = this;
|
|
900
|
+
var _this$props15 = this.props,
|
|
901
|
+
type = _this$props15.type,
|
|
902
|
+
src = _this$props15.src,
|
|
903
|
+
isAutoPlay = _this$props15.isAutoPlay,
|
|
904
|
+
onCanPlay = _this$props15.onCanPlay,
|
|
905
|
+
onError = _this$props15.onError,
|
|
906
|
+
poster = _this$props15.poster,
|
|
907
|
+
videoControlsWrapperRef = _this$props15.videoControlsWrapperRef,
|
|
908
|
+
areControlsVisible = _this$props15.areControlsVisible;
|
|
743
909
|
return /*#__PURE__*/React.createElement(Box, {
|
|
744
910
|
xcss: customVideoWrapperStyles.root,
|
|
745
911
|
ref: this.videoWrapperRef,
|
|
@@ -756,52 +922,32 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
756
922
|
textTracks: this.resolveTextTracks(),
|
|
757
923
|
textTracksPosition: areControlsVisible ? -3.7 : undefined
|
|
758
924
|
}, function (video, videoState, actions) {
|
|
759
|
-
|
|
760
|
-
|
|
925
|
+
_this4.onViewed(videoState);
|
|
926
|
+
_this4.setActions(actions);
|
|
761
927
|
//Video State(either prop or variable) is ReadOnly
|
|
762
|
-
|
|
763
|
-
var
|
|
764
|
-
currentTime = videoState.currentTime,
|
|
928
|
+
_this4.videoState = videoState;
|
|
929
|
+
var currentTime = videoState.currentTime,
|
|
765
930
|
buffered = videoState.buffered,
|
|
766
931
|
duration = videoState.duration,
|
|
767
932
|
isLoading = videoState.isLoading;
|
|
768
|
-
var
|
|
769
|
-
|
|
770
|
-
var isLargePlayer = playerSize === 'large';
|
|
771
|
-
var isMediumPlayer = playerSize === 'medium';
|
|
772
|
-
var defaultSkipAmount = 10;
|
|
773
|
-
var skipBackward = function skipBackward() {
|
|
774
|
-
var _this2$props$onTimeCh, _this2$props;
|
|
775
|
-
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
776
|
-
var newTime = videoState.currentTime - skipAmount;
|
|
777
|
-
actions.navigate(Math.max(newTime, 0));
|
|
778
|
-
(_this2$props$onTimeCh = (_this2$props = _this2.props).onTimeChanged) === null || _this2$props$onTimeCh === void 0 || _this2$props$onTimeCh.call(_this2$props);
|
|
779
|
-
};
|
|
780
|
-
var skipForward = function skipForward() {
|
|
781
|
-
var _this2$props$onTimeCh2, _this2$props2;
|
|
782
|
-
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
783
|
-
var newTime = videoState.currentTime + skipAmount;
|
|
784
|
-
actions.navigate(Math.min(newTime, videoState.duration));
|
|
785
|
-
(_this2$props$onTimeCh2 = (_this2$props2 = _this2.props).onTimeChanged) === null || _this2$props$onTimeCh2 === void 0 || _this2$props$onTimeCh2.call(_this2$props2);
|
|
786
|
-
};
|
|
787
|
-
var shortcuts = _this2.renderShortcuts({
|
|
788
|
-
togglePlayPauseAction: isPlaying ? _this2.pause : _this2.play,
|
|
933
|
+
var shortcuts = _this4.renderShortcuts({
|
|
934
|
+
togglePlayPauseAction: _this4.isPlaying ? _this4.pause : _this4.play,
|
|
789
935
|
toggleMute: actions.toggleMute,
|
|
790
|
-
skipBackward: skipBackward,
|
|
791
|
-
skipForward: skipForward
|
|
936
|
+
skipBackward: _this4.skipBackward,
|
|
937
|
+
skipForward: _this4.skipForward
|
|
792
938
|
});
|
|
793
939
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
794
940
|
direction: "column",
|
|
795
941
|
xcss: videoWrapperStyles.root
|
|
796
942
|
}, /*#__PURE__*/React.createElement(WidthObserver, {
|
|
797
|
-
setWidth:
|
|
798
|
-
}), shortcuts, isLoading &&
|
|
799
|
-
onDoubleClick:
|
|
800
|
-
onClick: isPlaying ?
|
|
943
|
+
setWidth: _this4.onResize
|
|
944
|
+
}), shortcuts, isLoading && _this4.renderSpinner(), /*#__PURE__*/React.createElement(PlayPauseBlanket, {
|
|
945
|
+
onDoubleClick: _this4.doubleClickToFullscreen,
|
|
946
|
+
onClick: _this4.isPlaying ? _this4.pausePlayByBlanketClick : _this4.startPlayByBlanketClick,
|
|
801
947
|
"data-testid": "play-pause-blanket"
|
|
802
948
|
}, video), /*#__PURE__*/React.createElement(ControlsWrapper, {
|
|
803
949
|
ref: videoControlsWrapperRef,
|
|
804
|
-
controlsHidden:
|
|
950
|
+
controlsHidden: _this4.wasPlayedOnce
|
|
805
951
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
806
952
|
xcss: timeWrapperStyles.root
|
|
807
953
|
}, /*#__PURE__*/React.createElement(TimeRange, {
|
|
@@ -809,66 +955,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
809
955
|
bufferedTime: buffered,
|
|
810
956
|
duration: duration,
|
|
811
957
|
onChange: actions.navigate,
|
|
812
|
-
onChanged:
|
|
958
|
+
onChanged: _this4.onTimeChanged,
|
|
813
959
|
disableThumbTooltip: true,
|
|
814
|
-
skipBackward: skipBackward,
|
|
815
|
-
skipForward: skipForward,
|
|
960
|
+
skipBackward: _this4.skipBackward,
|
|
961
|
+
skipForward: _this4.skipForward,
|
|
816
962
|
isAlwaysActive: false
|
|
817
963
|
})), /*#__PURE__*/React.createElement(Flex, {
|
|
818
964
|
alignItems: "center",
|
|
819
965
|
justifyContent: "space-between",
|
|
820
966
|
xcss: timebarWrapperStyles.root
|
|
821
|
-
}, /*#__PURE__*/React.createElement(LeftControls, null,
|
|
822
|
-
textTracks: textTracks,
|
|
823
|
-
onSelected: _this2.onTextTracksSelected,
|
|
824
|
-
areCaptionsEnabled: !!areCaptionsEnabled,
|
|
825
|
-
onCaptionsEnabledChange: _this2.onCaptionsEnabledChange,
|
|
826
|
-
selectedTracksIndex: _this2.resolveSelectedTracksIndex()
|
|
827
|
-
}), _this2.renderFullScreenButton(), isLargePlayer && _this2.renderDownloadButton(), isMediumPlayer || isLargePlayer && canUpdateVideoCaptions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CaptionsAdminControls, {
|
|
828
|
-
textTracks: textTracks,
|
|
829
|
-
onUpload: function onUpload() {
|
|
830
|
-
return _this2.setState({
|
|
831
|
-
isArtifactUploaderOpen: true
|
|
832
|
-
});
|
|
833
|
-
},
|
|
834
|
-
onDelete: _this2.onCaptionDelete
|
|
835
|
-
}), /*#__PURE__*/React.createElement(CaptionsUploaderBrowser, {
|
|
836
|
-
identifier: identifier,
|
|
837
|
-
isOpen: isArtifactUploaderOpen,
|
|
838
|
-
onClose: function onClose() {
|
|
839
|
-
return _this2.setState({
|
|
840
|
-
isArtifactUploaderOpen: false
|
|
841
|
-
});
|
|
842
|
-
},
|
|
843
|
-
onEnd: function onEnd(metadata, context) {
|
|
844
|
-
_this2.fireCaptionUploadSucceededEvent(context.traceId);
|
|
845
|
-
},
|
|
846
|
-
onError: function onError(err, context) {
|
|
847
|
-
_this2.fireCaptionUploadFailedEvent(context.traceId, err);
|
|
848
|
-
}
|
|
849
|
-
}), /*#__PURE__*/React.createElement(CaptionDeleteConfirmationModal, {
|
|
850
|
-
identifier: identifier,
|
|
851
|
-
artifactName: artifactToDelete,
|
|
852
|
-
onClose: function onClose() {
|
|
853
|
-
return _this2.setState({
|
|
854
|
-
artifactToDelete: ''
|
|
855
|
-
});
|
|
856
|
-
},
|
|
857
|
-
onEnd: function onEnd(context) {
|
|
858
|
-
_this2.fireCaptionDeleteSucceededEvent(context.traceId, context.artifactName);
|
|
859
|
-
_this2.setState({
|
|
860
|
-
artifactToDelete: ''
|
|
861
|
-
});
|
|
862
|
-
},
|
|
863
|
-
onError: function onError(err, context) {
|
|
864
|
-
_this2.fireCaptionDeleteFailedEvent(context.traceId, context.artifactName, err);
|
|
865
|
-
_this2.setState({
|
|
866
|
-
artifactToDelete: ''
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
}))))));
|
|
967
|
+
}, /*#__PURE__*/React.createElement(LeftControls, null, _this4.shouldRenderPlayPauseButton() && _this4.renderPlayPauseButton(), _this4.shouldRenderSkipButtons() && _this4.renderSkipButtons(), _this4.shouldRenderVolume() && _this4.renderVolume()), /*#__PURE__*/React.createElement(RightControls, null, _this4.shouldRenderCurrentTime() && _this4.renderCurrentTime(), _this4.shouldRenderCaptionsControls() && _this4.renderCaptionsControls(), _this4.shouldRenderSpeedControls() && _this4.renderSpeedControls(), _this4.shouldRenderHdButton() && _this4.renderHDButton(), _this4.shouldRenderDownloadButton() && _this4.renderDownloadButton(), _this4.shouldRenderFullScreenButton() && _this4.renderFullScreenButton(), _this4.shouldRenderCaptionsAdminControls() && _this4.renderCaptionsAdminControls()))));
|
|
870
968
|
}));
|
|
871
969
|
}
|
|
872
970
|
}]);
|
|
873
971
|
}(Component);
|
|
874
|
-
export var MediaPlayerBase =
|
|
972
|
+
export var MediaPlayerBase = injectIntl(_MediaPlayerBase);
|