@atlaskit/media-ui 28.3.3 → 28.4.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.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/customMediaPlayer/index.js +1 -1
- package/dist/cjs/customMediaPlayer/mediaPlayer/captions/apiFeedback.js +29 -23
- 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 +13 -7
- package/dist/es2019/customMediaPlayer/index.js +1 -1
- package/dist/es2019/customMediaPlayer/mediaPlayer/captions/apiFeedback.js +29 -23
- 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 +25 -18
- package/dist/esm/customMediaPlayer/index.js +1 -1
- package/dist/esm/customMediaPlayer/mediaPlayer/captions/apiFeedback.js +29 -23
- 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 +13 -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 +5 -4
|
@@ -6,7 +6,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.MediaPlayerBase = void 0;
|
|
9
|
+
exports.breakpoints = exports.MediaPlayerBase = void 0;
|
|
10
10
|
require("./mediaPlayerBase.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -24,7 +24,6 @@ var _volumeHighHipchatOutgoingSound = _interopRequireDefault(require("@atlaskit/
|
|
|
24
24
|
var _videoHd = _interopRequireDefault(require("@atlaskit/icon-lab/core/video-hd"));
|
|
25
25
|
var _videoHdFilled = _interopRequireDefault(require("@atlaskit/icon-lab/core/video-hd-filled"));
|
|
26
26
|
var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
|
|
27
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
28
27
|
var _reactIntlNext = require("react-intl-next");
|
|
29
28
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
30
29
|
var _MediaButton = _interopRequireDefault(require("../../MediaButton"));
|
|
@@ -60,10 +59,59 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
60
59
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
61
60
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */ // Keep media player components used in media-viewer to use static colors from the new color palette to
|
|
62
61
|
// support the hybrid theming in media viewer https://product-fabric.atlassian.net/browse/DSP-6067
|
|
63
|
-
var MEDIUM_VIDEO_MAX_WIDTH = 400;
|
|
64
|
-
var SMALL_VIDEO_MAX_WIDTH = 245;
|
|
65
62
|
var MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
|
|
66
63
|
var VIEWED_TRACKING_SECS = 2;
|
|
64
|
+
var breakpoints = exports.breakpoints = {
|
|
65
|
+
LARGE_VIDEO_MAX_WIDTH: 570,
|
|
66
|
+
MEDIUM_VIDEO_MAX_WIDTH: 430,
|
|
67
|
+
SMALL_VIDEO_MAX_WIDTH: 260
|
|
68
|
+
};
|
|
69
|
+
var breakpointControls = {
|
|
70
|
+
playPauseButton: function playPauseButton() {
|
|
71
|
+
return true;
|
|
72
|
+
},
|
|
73
|
+
volume: function volume() {
|
|
74
|
+
return true;
|
|
75
|
+
},
|
|
76
|
+
fullScreenButton: function fullScreenButton() {
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
currentTime: function currentTime(playerWidth) {
|
|
80
|
+
return playerWidth > breakpoints.SMALL_VIDEO_MAX_WIDTH;
|
|
81
|
+
},
|
|
82
|
+
captionsControls: function captionsControls(playerWidth) {
|
|
83
|
+
return playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH;
|
|
84
|
+
},
|
|
85
|
+
downloadButton: function downloadButton(playerWidth) {
|
|
86
|
+
return playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH;
|
|
87
|
+
},
|
|
88
|
+
volumeSlider: function volumeSlider(playerWidth) {
|
|
89
|
+
return playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH;
|
|
90
|
+
},
|
|
91
|
+
skipButtons: function skipButtons(playerWidth) {
|
|
92
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
93
|
+
},
|
|
94
|
+
speedControls: function speedControls(playerWidth) {
|
|
95
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
96
|
+
},
|
|
97
|
+
hdButton: function hdButton(playerWidth) {
|
|
98
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
99
|
+
},
|
|
100
|
+
captionsAdminControls: function captionsAdminControls(playerWidth) {
|
|
101
|
+
return playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var getPlayerSize = function getPlayerSize(playerWidth) {
|
|
105
|
+
if (playerWidth > breakpoints.LARGE_VIDEO_MAX_WIDTH) {
|
|
106
|
+
return 'xlarge';
|
|
107
|
+
} else if (playerWidth > breakpoints.MEDIUM_VIDEO_MAX_WIDTH) {
|
|
108
|
+
return 'large';
|
|
109
|
+
} else if (playerWidth > breakpoints.SMALL_VIDEO_MAX_WIDTH) {
|
|
110
|
+
return 'medium';
|
|
111
|
+
} else {
|
|
112
|
+
return 'small';
|
|
113
|
+
}
|
|
114
|
+
};
|
|
67
115
|
|
|
68
116
|
/* Styles */
|
|
69
117
|
|
|
@@ -95,14 +143,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
95
143
|
volume: 1,
|
|
96
144
|
status: 'paused',
|
|
97
145
|
duration: 0,
|
|
98
|
-
isMuted: false
|
|
146
|
+
isMuted: false,
|
|
147
|
+
currentActiveCues: function currentActiveCues() {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
99
150
|
});
|
|
100
151
|
(0, _defineProperty2.default)(_this, "wasPlayedOnce", false);
|
|
101
152
|
(0, _defineProperty2.default)(_this, "lastCurrentTime", 0);
|
|
102
153
|
(0, _defineProperty2.default)(_this, "timeSaver", new _timeSaver.TimeSaver(_this.props.lastWatchTimeConfig));
|
|
103
154
|
(0, _defineProperty2.default)(_this, "state", {
|
|
104
155
|
isFullScreenEnabled: false,
|
|
105
|
-
|
|
156
|
+
playerWidth: 100,
|
|
157
|
+
// initial value for playerSize: 'small', i.e. width < 260px
|
|
106
158
|
playbackSpeed: 1,
|
|
107
159
|
selectedTracksIndex: -1,
|
|
108
160
|
areCaptionsEnabled: false,
|
|
@@ -133,8 +185,9 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
133
185
|
createAnalyticsEvent = _this$props.createAnalyticsEvent;
|
|
134
186
|
var _this$state = _this.state,
|
|
135
187
|
isFullScreenEnabled = _this$state.isFullScreenEnabled,
|
|
136
|
-
playerSize = _this$state.playerSize,
|
|
137
188
|
playbackSpeed = _this$state.playbackSpeed;
|
|
189
|
+
var _this2 = _this,
|
|
190
|
+
playerSize = _this2.playerSize;
|
|
138
191
|
(0, _analytics.fireAnalyticsEvent)((0, _analytics.createFirstPlayedTrackEvent)(type, {
|
|
139
192
|
isAutoPlay: isAutoPlay,
|
|
140
193
|
isHDAvailable: isHDAvailable,
|
|
@@ -180,22 +233,25 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
180
233
|
_this.timeSaver.defaultTime = 0;
|
|
181
234
|
}
|
|
182
235
|
});
|
|
183
|
-
(0, _defineProperty2.default)(_this, "
|
|
184
|
-
|
|
185
|
-
|
|
236
|
+
(0, _defineProperty2.default)(_this, "shouldRenderCurrentTime", function () {
|
|
237
|
+
return breakpointControls.currentTime(_this.state.playerWidth);
|
|
238
|
+
});
|
|
239
|
+
(0, _defineProperty2.default)(_this, "renderCurrentTime", function () {
|
|
186
240
|
return /*#__PURE__*/_react.default.createElement(_styled.CurrentTime, {
|
|
187
|
-
draggable: false
|
|
188
|
-
|
|
241
|
+
draggable: false,
|
|
242
|
+
"data-testid": "current-time"
|
|
243
|
+
}, (0, _formatDuration.formatDuration)(_this.videoState.currentTime), " / ", (0, _formatDuration.formatDuration)(_this.videoState.duration));
|
|
189
244
|
});
|
|
190
|
-
(0, _defineProperty2.default)(_this, "
|
|
245
|
+
(0, _defineProperty2.default)(_this, "shouldRenderHdButton", function () {
|
|
191
246
|
var _this$props4 = _this.props,
|
|
192
247
|
type = _this$props4.type,
|
|
193
|
-
isHDAvailable = _this$props4.isHDAvailable
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
248
|
+
isHDAvailable = _this$props4.isHDAvailable;
|
|
249
|
+
return !(0, _platformFeatureFlags.fg)('platform_media_disable_video_640p_artifact_usage') && breakpointControls.hdButton(_this.state.playerWidth) && type !== 'audio' && !!isHDAvailable;
|
|
250
|
+
});
|
|
251
|
+
(0, _defineProperty2.default)(_this, "renderHDButton", function () {
|
|
252
|
+
var _this$props5 = _this.props,
|
|
253
|
+
isHDActive = _this$props5.isHDActive,
|
|
254
|
+
onHDToggleClick = _this$props5.onHDToggleClick;
|
|
199
255
|
return /*#__PURE__*/_react.default.createElement(_MediaButton.default, {
|
|
200
256
|
testId: "custom-media-player-hd-button",
|
|
201
257
|
onClick: !!onHDToggleClick ? _this.getMediaButtonClickHandler(onHDToggleClick, 'HDButton') : undefined,
|
|
@@ -216,6 +272,9 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
216
272
|
});
|
|
217
273
|
_this.createAndFireUIEvent('playbackSpeedChange');
|
|
218
274
|
});
|
|
275
|
+
(0, _defineProperty2.default)(_this, "shouldRenderSpeedControls", function () {
|
|
276
|
+
return breakpointControls.speedControls(_this.state.playerWidth);
|
|
277
|
+
});
|
|
219
278
|
(0, _defineProperty2.default)(_this, "renderSpeedControls", function () {
|
|
220
279
|
var playbackSpeed = _this.state.playbackSpeed;
|
|
221
280
|
var originalDimensions = _this.props.originalDimensions;
|
|
@@ -228,24 +287,38 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
228
287
|
}
|
|
229
288
|
});
|
|
230
289
|
});
|
|
231
|
-
(0, _defineProperty2.default)(_this, "
|
|
290
|
+
(0, _defineProperty2.default)(_this, "shouldRenderVolume", function () {
|
|
291
|
+
return breakpointControls.volume(_this.state.playerWidth);
|
|
292
|
+
});
|
|
293
|
+
(0, _defineProperty2.default)(_this, "shouldRenderVolumeSLider", function () {
|
|
294
|
+
return breakpointControls.volumeSlider(_this.state.playerWidth);
|
|
295
|
+
});
|
|
296
|
+
(0, _defineProperty2.default)(_this, "renderVolume", function () {
|
|
297
|
+
var _this$actions, _this$actions2;
|
|
298
|
+
var showSlider = _this.shouldRenderVolumeSLider();
|
|
232
299
|
return /*#__PURE__*/_react.default.createElement(_styled.VolumeWrapper, {
|
|
233
300
|
showSlider: showSlider
|
|
234
301
|
}, /*#__PURE__*/_react.default.createElement(_styled.VolumeToggleWrapper, {
|
|
235
|
-
isMuted: videoState.isMuted
|
|
302
|
+
isMuted: _this.videoState.isMuted
|
|
236
303
|
}, /*#__PURE__*/_react.default.createElement(_styled.MutedIndicator, {
|
|
237
|
-
isMuted: videoState.isMuted
|
|
304
|
+
isMuted: _this.videoState.isMuted
|
|
238
305
|
}), /*#__PURE__*/_react.default.createElement(_MediaButton.default, {
|
|
239
306
|
testId: "custom-media-player-volume-toggle-button",
|
|
240
|
-
onClick: _this.getMediaButtonClickHandler(actions.toggleMute
|
|
307
|
+
onClick: _this.getMediaButtonClickHandler(((_this$actions = _this.actions) === null || _this$actions === void 0 ? void 0 : _this$actions.toggleMute) || function () {
|
|
308
|
+
return undefined;
|
|
309
|
+
}, 'muteButton'),
|
|
241
310
|
iconBefore: /*#__PURE__*/_react.default.createElement(_volumeHighHipchatOutgoingSound.default, {
|
|
242
311
|
color: "currentColor",
|
|
243
312
|
label: _this.props.intl.formatMessage(_messages.messages.volumeMuteButtonAria)
|
|
244
313
|
}),
|
|
245
|
-
"aria-pressed": videoState.isMuted
|
|
246
|
-
})), showSlider && /*#__PURE__*/_react.default.createElement(_styled.VolumeTimeRangeWrapper,
|
|
247
|
-
|
|
248
|
-
|
|
314
|
+
"aria-pressed": _this.videoState.isMuted
|
|
315
|
+
})), showSlider && /*#__PURE__*/_react.default.createElement(_styled.VolumeTimeRangeWrapper, {
|
|
316
|
+
"data-testid": "volume-time-range-wrapper"
|
|
317
|
+
}, /*#__PURE__*/_react.default.createElement(_volumeRange.default, {
|
|
318
|
+
onChange: ((_this$actions2 = _this.actions) === null || _this$actions2 === void 0 ? void 0 : _this$actions2.setVolume) || function () {
|
|
319
|
+
return undefined;
|
|
320
|
+
},
|
|
321
|
+
currentVolume: _this.videoState.volume,
|
|
249
322
|
isAlwaysActive: true,
|
|
250
323
|
onChanged: _this.onVolumeChanged,
|
|
251
324
|
ariaLabel: _this.props.intl.formatMessage(_messages.messages.volumeLevelControlAria)
|
|
@@ -259,24 +332,17 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
259
332
|
_this.createAndFireUIEvent('mediaButtonClick', 'fullScreenButton');
|
|
260
333
|
});
|
|
261
334
|
(0, _defineProperty2.default)(_this, "onResize", function (width) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
playerSize: 'medium'
|
|
269
|
-
});
|
|
270
|
-
} else {
|
|
271
|
-
_this.setState({
|
|
272
|
-
playerSize: 'small'
|
|
273
|
-
});
|
|
274
|
-
}
|
|
335
|
+
_this.setState({
|
|
336
|
+
playerWidth: width
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
(0, _defineProperty2.default)(_this, "shouldRenderFullScreenButton", function () {
|
|
340
|
+
return breakpointControls.fullScreenButton(_this.state.playerWidth);
|
|
275
341
|
});
|
|
276
342
|
(0, _defineProperty2.default)(_this, "renderFullScreenButton", function () {
|
|
277
|
-
var _this$
|
|
278
|
-
formatMessage = _this$
|
|
279
|
-
type = _this$
|
|
343
|
+
var _this$props6 = _this.props,
|
|
344
|
+
formatMessage = _this$props6.intl.formatMessage,
|
|
345
|
+
type = _this$props6.type;
|
|
280
346
|
if (type === 'audio') {
|
|
281
347
|
return;
|
|
282
348
|
}
|
|
@@ -294,25 +360,24 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
294
360
|
iconBefore: icon
|
|
295
361
|
});
|
|
296
362
|
});
|
|
363
|
+
(0, _defineProperty2.default)(_this, "shouldRenderDownloadButton", function () {
|
|
364
|
+
return breakpointControls.downloadButton(_this.state.playerWidth);
|
|
365
|
+
});
|
|
297
366
|
(0, _defineProperty2.default)(_this, "renderDownloadButton", function () {
|
|
298
|
-
|
|
299
|
-
if (!onDownloadClick) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
return /*#__PURE__*/_react.default.createElement(_MediaButton.default, {
|
|
367
|
+
return _this.props.onDownloadClick && /*#__PURE__*/_react.default.createElement(_MediaButton.default, {
|
|
303
368
|
testId: "custom-media-player-download-button",
|
|
304
|
-
onClick: _this.getMediaButtonClickHandler(onDownloadClick, 'downloadButton'),
|
|
369
|
+
onClick: _this.getMediaButtonClickHandler(_this.props.onDownloadClick, 'downloadButton'),
|
|
305
370
|
iconBefore: /*#__PURE__*/_react.default.createElement(_download.default, {
|
|
306
371
|
color: "currentColor",
|
|
307
372
|
label: "download"
|
|
308
373
|
})
|
|
309
374
|
});
|
|
310
375
|
});
|
|
311
|
-
(0, _defineProperty2.default)(_this, "renderShortcuts", function (
|
|
312
|
-
var togglePlayPauseAction =
|
|
313
|
-
toggleMute =
|
|
314
|
-
skipBackward =
|
|
315
|
-
skipForward =
|
|
376
|
+
(0, _defineProperty2.default)(_this, "renderShortcuts", function (_ref2) {
|
|
377
|
+
var togglePlayPauseAction = _ref2.togglePlayPauseAction,
|
|
378
|
+
toggleMute = _ref2.toggleMute,
|
|
379
|
+
skipBackward = _ref2.skipBackward,
|
|
380
|
+
skipForward = _ref2.skipForward;
|
|
316
381
|
var isShortcutEnabled = _this.props.isShortcutEnabled;
|
|
317
382
|
var isFullScreenEnabled = _this.state.isFullScreenEnabled;
|
|
318
383
|
var shortcuts = (isShortcutEnabled || isFullScreenEnabled) && [/*#__PURE__*/_react.default.createElement(_shortcut.Shortcut, {
|
|
@@ -339,9 +404,12 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
339
404
|
}
|
|
340
405
|
return shortcuts;
|
|
341
406
|
});
|
|
342
|
-
(0, _defineProperty2.default)(_this, "
|
|
407
|
+
(0, _defineProperty2.default)(_this, "shouldRenderPlayPauseButton", function () {
|
|
408
|
+
return breakpointControls.playPauseButton(_this.state.playerWidth);
|
|
409
|
+
});
|
|
410
|
+
(0, _defineProperty2.default)(_this, "renderPlayPauseButton", function () {
|
|
343
411
|
var formatMessage = _this.props.intl.formatMessage;
|
|
344
|
-
var toggleButtonIcon = isPlaying ? /*#__PURE__*/_react.default.createElement(_videoPauseVidPause.default, {
|
|
412
|
+
var toggleButtonIcon = _this.isPlaying ? /*#__PURE__*/_react.default.createElement(_videoPauseVidPause.default, {
|
|
345
413
|
spacing: "spacious",
|
|
346
414
|
color: "currentColor",
|
|
347
415
|
label: formatMessage(_messages.messages.pause)
|
|
@@ -351,16 +419,31 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
351
419
|
label: formatMessage(_messages.messages.play)
|
|
352
420
|
});
|
|
353
421
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
354
|
-
content: formatMessage(isPlaying ? _messages.messages.pause : _messages.messages.play),
|
|
422
|
+
content: formatMessage(_this.isPlaying ? _messages.messages.pause : _messages.messages.play),
|
|
355
423
|
position: "top"
|
|
356
424
|
}, /*#__PURE__*/_react.default.createElement(_MediaButton.default, {
|
|
357
425
|
testId: "custom-media-player-play-toggle-button",
|
|
358
|
-
"data-test-is-playing": isPlaying,
|
|
426
|
+
"data-test-is-playing": _this.isPlaying,
|
|
359
427
|
iconBefore: toggleButtonIcon,
|
|
360
|
-
onClick: isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
|
|
428
|
+
onClick: _this.isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
|
|
361
429
|
}));
|
|
362
430
|
});
|
|
363
|
-
(0, _defineProperty2.default)(_this, "
|
|
431
|
+
(0, _defineProperty2.default)(_this, "defaultSkipAmount", 10);
|
|
432
|
+
(0, _defineProperty2.default)(_this, "skipBackward", function () {
|
|
433
|
+
var _this$actions3, _this$props$onTimeCha2, _this$props7;
|
|
434
|
+
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.defaultSkipAmount;
|
|
435
|
+
var newTime = _this.videoState.currentTime - skipAmount;
|
|
436
|
+
(_this$actions3 = _this.actions) === null || _this$actions3 === void 0 || _this$actions3.navigate(Math.max(newTime, 0));
|
|
437
|
+
(_this$props$onTimeCha2 = (_this$props7 = _this.props).onTimeChanged) === null || _this$props$onTimeCha2 === void 0 || _this$props$onTimeCha2.call(_this$props7);
|
|
438
|
+
});
|
|
439
|
+
(0, _defineProperty2.default)(_this, "skipForward", function () {
|
|
440
|
+
var _this$actions4, _this$props$onTimeCha3, _this$props8;
|
|
441
|
+
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.defaultSkipAmount;
|
|
442
|
+
var newTime = _this.videoState.currentTime + skipAmount;
|
|
443
|
+
(_this$actions4 = _this.actions) === null || _this$actions4 === void 0 || _this$actions4.navigate(Math.min(newTime, _this.videoState.duration));
|
|
444
|
+
(_this$props$onTimeCha3 = (_this$props8 = _this.props).onTimeChanged) === null || _this$props$onTimeCha3 === void 0 || _this$props$onTimeCha3.call(_this$props8);
|
|
445
|
+
});
|
|
446
|
+
(0, _defineProperty2.default)(_this, "renderSkipBackwardButton", function () {
|
|
364
447
|
var formatMessage = _this.props.intl.formatMessage;
|
|
365
448
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
366
449
|
content: formatMessage(_messages.messages.skipBackward),
|
|
@@ -372,10 +455,10 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
372
455
|
LEGACY_fallbackIcon: _legacyCustomIcons.SkipTenBackwardIcon,
|
|
373
456
|
label: formatMessage(_messages.messages.skipBackward)
|
|
374
457
|
}),
|
|
375
|
-
onClick: _this.getMediaButtonClickHandler(skipBackward, 'skipBackwardButton')
|
|
458
|
+
onClick: _this.getMediaButtonClickHandler(_this.skipBackward, 'skipBackwardButton')
|
|
376
459
|
}));
|
|
377
460
|
});
|
|
378
|
-
(0, _defineProperty2.default)(_this, "renderSkipForwardButton", function (
|
|
461
|
+
(0, _defineProperty2.default)(_this, "renderSkipForwardButton", function () {
|
|
379
462
|
var formatMessage = _this.props.intl.formatMessage;
|
|
380
463
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
381
464
|
content: formatMessage(_messages.messages.skipForward),
|
|
@@ -387,11 +470,20 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
387
470
|
LEGACY_fallbackIcon: _legacyCustomIcons.SkipTenForwardIcon,
|
|
388
471
|
label: formatMessage(_messages.messages.skipForward)
|
|
389
472
|
}),
|
|
390
|
-
onClick: _this.getMediaButtonClickHandler(skipForward, 'skipForwardButton')
|
|
473
|
+
onClick: _this.getMediaButtonClickHandler(_this.skipForward, 'skipForwardButton')
|
|
391
474
|
}));
|
|
392
475
|
});
|
|
476
|
+
(0, _defineProperty2.default)(_this, "shouldRenderSkipButtons", function () {
|
|
477
|
+
return breakpointControls.skipButtons(_this.state.playerWidth);
|
|
478
|
+
});
|
|
479
|
+
(0, _defineProperty2.default)(_this, "renderSkipButtons", function () {
|
|
480
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
481
|
+
direction: "row"
|
|
482
|
+
}, _this.renderSkipBackwardButton(), _this.renderSkipForwardButton());
|
|
483
|
+
});
|
|
393
484
|
(0, _defineProperty2.default)(_this, "renderSpinner", function () {
|
|
394
485
|
return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
486
|
+
testId: "spinner",
|
|
395
487
|
direction: "column",
|
|
396
488
|
alignItems: "center",
|
|
397
489
|
justifyContent: "center",
|
|
@@ -402,11 +494,11 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
402
494
|
}));
|
|
403
495
|
});
|
|
404
496
|
(0, _defineProperty2.default)(_this, "pause", function () {
|
|
405
|
-
var _this$props$onPause, _this$
|
|
497
|
+
var _this$props$onPause, _this$props9;
|
|
406
498
|
if (_this.actions) {
|
|
407
499
|
_this.actions.pause();
|
|
408
500
|
}
|
|
409
|
-
(_this$props$onPause = (_this$
|
|
501
|
+
(_this$props$onPause = (_this$props9 = _this.props).onPause) === null || _this$props$onPause === void 0 || _this$props$onPause.call(_this$props9);
|
|
410
502
|
});
|
|
411
503
|
(0, _defineProperty2.default)(_this, "play", function () {
|
|
412
504
|
var onFirstPlay = _this.props.onFirstPlay;
|
|
@@ -443,17 +535,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
443
535
|
};
|
|
444
536
|
});
|
|
445
537
|
(0, _defineProperty2.default)(_this, "onViewed", function (videoState) {
|
|
446
|
-
var _this$
|
|
447
|
-
createAnalyticsEvent = _this$
|
|
448
|
-
identifier = _this$
|
|
449
|
-
isAutoPlay = _this$
|
|
450
|
-
isHDAvailable = _this$
|
|
451
|
-
isHDActive = _this$
|
|
452
|
-
type = _this$
|
|
538
|
+
var _this$props0 = _this.props,
|
|
539
|
+
createAnalyticsEvent = _this$props0.createAnalyticsEvent,
|
|
540
|
+
identifier = _this$props0.identifier,
|
|
541
|
+
isAutoPlay = _this$props0.isAutoPlay,
|
|
542
|
+
isHDAvailable = _this$props0.isHDAvailable,
|
|
543
|
+
isHDActive = _this$props0.isHDActive,
|
|
544
|
+
type = _this$props0.type;
|
|
453
545
|
var _this$state2 = _this.state,
|
|
454
546
|
isFullScreenEnabled = _this$state2.isFullScreenEnabled,
|
|
455
|
-
playerSize = _this$state2.playerSize,
|
|
456
547
|
playbackSpeed = _this$state2.playbackSpeed;
|
|
548
|
+
var _this3 = _this,
|
|
549
|
+
playerSize = _this3.playerSize;
|
|
457
550
|
var status = videoState.status,
|
|
458
551
|
currentTime = videoState.currentTime;
|
|
459
552
|
if (status === 'playing' && (currentTime < _this.lastCurrentTime || currentTime >= _this.lastCurrentTime + VIEWED_TRACKING_SECS)) {
|
|
@@ -533,6 +626,78 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
533
626
|
}
|
|
534
627
|
return undefined;
|
|
535
628
|
});
|
|
629
|
+
(0, _defineProperty2.default)(_this, "shouldRenderCaptionsControls", function () {
|
|
630
|
+
var textTracks = _this.props.textTracks;
|
|
631
|
+
var playerWidth = _this.state.playerWidth;
|
|
632
|
+
return breakpointControls.captionsControls(playerWidth) && !!textTracks;
|
|
633
|
+
});
|
|
634
|
+
(0, _defineProperty2.default)(_this, "renderCaptionsControls", function () {
|
|
635
|
+
var textTracks = _this.props.textTracks;
|
|
636
|
+
var areCaptionsEnabled = _this.state.areCaptionsEnabled;
|
|
637
|
+
return textTracks && /*#__PURE__*/_react.default.createElement(_captionsSelectControls.CaptionsSelectControls, {
|
|
638
|
+
textTracks: textTracks,
|
|
639
|
+
onSelected: _this.onTextTracksSelected,
|
|
640
|
+
areCaptionsEnabled: !!areCaptionsEnabled,
|
|
641
|
+
onCaptionsEnabledChange: _this.onCaptionsEnabledChange,
|
|
642
|
+
selectedTracksIndex: _this.resolveSelectedTracksIndex()
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
(0, _defineProperty2.default)(_this, "shouldRenderCaptionsAdminControls", function () {
|
|
646
|
+
var _this$props$mediaSett;
|
|
647
|
+
var playerWidth = _this.state.playerWidth;
|
|
648
|
+
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);
|
|
649
|
+
});
|
|
650
|
+
(0, _defineProperty2.default)(_this, "renderCaptionsAdminControls", function () {
|
|
651
|
+
var _this$state4 = _this.state,
|
|
652
|
+
isArtifactUploaderOpen = _this$state4.isArtifactUploaderOpen,
|
|
653
|
+
artifactToDelete = _this$state4.artifactToDelete;
|
|
654
|
+
var _this$props1 = _this.props,
|
|
655
|
+
textTracks = _this$props1.textTracks,
|
|
656
|
+
identifier = _this$props1.identifier;
|
|
657
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_captionsAdminControls.CaptionsAdminControls, {
|
|
658
|
+
textTracks: textTracks,
|
|
659
|
+
onUpload: function onUpload() {
|
|
660
|
+
return _this.setState({
|
|
661
|
+
isArtifactUploaderOpen: true
|
|
662
|
+
});
|
|
663
|
+
},
|
|
664
|
+
onDelete: _this.onCaptionDelete
|
|
665
|
+
}), /*#__PURE__*/_react.default.createElement(_artifactUploader.CaptionsUploaderBrowser, {
|
|
666
|
+
identifier: identifier,
|
|
667
|
+
isOpen: isArtifactUploaderOpen,
|
|
668
|
+
onClose: function onClose() {
|
|
669
|
+
return _this.setState({
|
|
670
|
+
isArtifactUploaderOpen: false
|
|
671
|
+
});
|
|
672
|
+
},
|
|
673
|
+
onEnd: function onEnd(metadata, context) {
|
|
674
|
+
_this.fireCaptionUploadSucceededEvent(context.traceId);
|
|
675
|
+
},
|
|
676
|
+
onError: function onError(err, context) {
|
|
677
|
+
_this.fireCaptionUploadFailedEvent(context.traceId, err);
|
|
678
|
+
}
|
|
679
|
+
}), /*#__PURE__*/_react.default.createElement(_captionDeleteConfirmationModal.default, {
|
|
680
|
+
identifier: identifier,
|
|
681
|
+
artifactName: artifactToDelete,
|
|
682
|
+
onClose: function onClose() {
|
|
683
|
+
return _this.setState({
|
|
684
|
+
artifactToDelete: ''
|
|
685
|
+
});
|
|
686
|
+
},
|
|
687
|
+
onEnd: function onEnd(context) {
|
|
688
|
+
_this.fireCaptionDeleteSucceededEvent(context.traceId, context.artifactName);
|
|
689
|
+
_this.setState({
|
|
690
|
+
artifactToDelete: ''
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
onError: function onError(err, context) {
|
|
694
|
+
_this.fireCaptionDeleteFailedEvent(context.traceId, context.artifactName, err);
|
|
695
|
+
_this.setState({
|
|
696
|
+
artifactToDelete: ''
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
}));
|
|
700
|
+
});
|
|
536
701
|
_this.state.selectedTracksIndex = _this.findPreselectedTrackIndex(_this.props);
|
|
537
702
|
if (_this.mediaUserPreferences) {
|
|
538
703
|
var userCaptionsEnabled = (0, _captions.getUserCaptionsEnabled)(_this.mediaUserPreferences);
|
|
@@ -545,9 +710,9 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
545
710
|
key: "componentDidUpdate",
|
|
546
711
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
547
712
|
var _prevTextTracks$capti, _textTracks$captions2;
|
|
548
|
-
var _this$
|
|
549
|
-
intl = _this$
|
|
550
|
-
textTracks = _this$
|
|
713
|
+
var _this$props10 = this.props,
|
|
714
|
+
intl = _this$props10.intl,
|
|
715
|
+
textTracks = _this$props10.textTracks;
|
|
551
716
|
var prevIntl = prevProps.intl,
|
|
552
717
|
prevTextTracks = prevProps.textTracks;
|
|
553
718
|
var didLocaleChange = prevIntl.locale !== intl.locale;
|
|
@@ -564,27 +729,27 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
564
729
|
}, {
|
|
565
730
|
key: "mediaUserPreferences",
|
|
566
731
|
get: function get() {
|
|
567
|
-
var _this$props$
|
|
568
|
-
_this$props$
|
|
569
|
-
_this$props$
|
|
570
|
-
mediaUserPreferences = _this$props$
|
|
732
|
+
var _this$props$mediaSett2 = this.props.mediaSettings,
|
|
733
|
+
_this$props$mediaSett3 = _this$props$mediaSett2 === void 0 ? {} : _this$props$mediaSett2,
|
|
734
|
+
_this$props$mediaSett4 = _this$props$mediaSett3.mediaUserPreferences,
|
|
735
|
+
mediaUserPreferences = _this$props$mediaSett4 === void 0 ? undefined : _this$props$mediaSett4;
|
|
571
736
|
return mediaUserPreferences;
|
|
572
737
|
}
|
|
573
738
|
}, {
|
|
574
739
|
key: "componentDidMount",
|
|
575
740
|
value: function componentDidMount() {
|
|
576
|
-
var _this$
|
|
577
|
-
type = _this$
|
|
578
|
-
identifier = _this$
|
|
579
|
-
isAutoPlay = _this$
|
|
580
|
-
isHDAvailable = _this$
|
|
581
|
-
isHDActive = _this$
|
|
582
|
-
onFirstPlay = _this$
|
|
583
|
-
createAnalyticsEvent = _this$
|
|
584
|
-
var _this$
|
|
585
|
-
isFullScreenEnabled = _this$
|
|
586
|
-
|
|
587
|
-
|
|
741
|
+
var _this$props11 = this.props,
|
|
742
|
+
type = _this$props11.type,
|
|
743
|
+
identifier = _this$props11.identifier,
|
|
744
|
+
isAutoPlay = _this$props11.isAutoPlay,
|
|
745
|
+
isHDAvailable = _this$props11.isHDAvailable,
|
|
746
|
+
isHDActive = _this$props11.isHDActive,
|
|
747
|
+
onFirstPlay = _this$props11.onFirstPlay,
|
|
748
|
+
createAnalyticsEvent = _this$props11.createAnalyticsEvent;
|
|
749
|
+
var _this$state5 = this.state,
|
|
750
|
+
isFullScreenEnabled = _this$state5.isFullScreenEnabled,
|
|
751
|
+
playbackSpeed = _this$state5.playbackSpeed;
|
|
752
|
+
var playerSize = this.playerSize;
|
|
588
753
|
(0, _analytics.fireAnalyticsEvent)((0, _analytics.createCustomMediaPlayerScreenEvent)(type, {
|
|
589
754
|
isAutoPlay: isAutoPlay,
|
|
590
755
|
isHDAvailable: isHDAvailable,
|
|
@@ -595,17 +760,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
595
760
|
}, identifier.id), createAnalyticsEvent);
|
|
596
761
|
if (this.videoWrapperRef.current) {
|
|
597
762
|
this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
|
|
763
|
+
this.onResize(this.videoWrapperRef.current.getBoundingClientRect().width);
|
|
598
764
|
}
|
|
599
765
|
_simultaneousPlayManager.default.subscribe(this);
|
|
600
766
|
if (isAutoPlay) {
|
|
601
|
-
var _this$props$onPlay, _this$
|
|
767
|
+
var _this$props$onPlay, _this$props12;
|
|
602
768
|
_simultaneousPlayManager.default.pauseOthers(this);
|
|
603
769
|
if (onFirstPlay) {
|
|
604
770
|
this.fireFirstPlayedTrackEvent();
|
|
605
771
|
this.wasPlayedOnce = true;
|
|
606
772
|
onFirstPlay();
|
|
607
773
|
}
|
|
608
|
-
(_this$props$onPlay = (_this$
|
|
774
|
+
(_this$props$onPlay = (_this$props12 = this.props).onPlay) === null || _this$props$onPlay === void 0 || _this$props$onPlay.call(_this$props12);
|
|
609
775
|
}
|
|
610
776
|
}
|
|
611
777
|
}, {
|
|
@@ -615,11 +781,16 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
615
781
|
this.videoWrapperRef.current.removeEventListener('fullscreenchange', this.onFullScreenChange);
|
|
616
782
|
}
|
|
617
783
|
if (this.state.isFullScreenEnabled) {
|
|
618
|
-
var _this$props$onFullscr2, _this$
|
|
619
|
-
(_this$props$onFullscr2 = (_this$
|
|
784
|
+
var _this$props$onFullscr2, _this$props13;
|
|
785
|
+
(_this$props$onFullscr2 = (_this$props13 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 || _this$props$onFullscr2.call(_this$props13, false);
|
|
620
786
|
}
|
|
621
787
|
_simultaneousPlayManager.default.unsubscribe(this);
|
|
622
788
|
}
|
|
789
|
+
}, {
|
|
790
|
+
key: "playerSize",
|
|
791
|
+
get: function get() {
|
|
792
|
+
return getPlayerSize(this.state.playerWidth);
|
|
793
|
+
}
|
|
623
794
|
}, {
|
|
624
795
|
key: "setActions",
|
|
625
796
|
value: function setActions(actions) {
|
|
@@ -632,17 +803,17 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
632
803
|
}, {
|
|
633
804
|
key: "createAndFireUIEvent",
|
|
634
805
|
value: function createAndFireUIEvent(eventType, actionSubjectId) {
|
|
635
|
-
var _this$
|
|
636
|
-
type = _this$
|
|
637
|
-
identifier = _this$
|
|
638
|
-
isHDActive = _this$
|
|
639
|
-
isHDAvailable = _this$
|
|
640
|
-
isAutoPlay = _this$
|
|
641
|
-
createAnalyticsEvent = _this$
|
|
642
|
-
var _this$
|
|
643
|
-
isFullScreenEnabled = _this$
|
|
644
|
-
|
|
645
|
-
|
|
806
|
+
var _this$props14 = this.props,
|
|
807
|
+
type = _this$props14.type,
|
|
808
|
+
identifier = _this$props14.identifier,
|
|
809
|
+
isHDActive = _this$props14.isHDActive,
|
|
810
|
+
isHDAvailable = _this$props14.isHDAvailable,
|
|
811
|
+
isAutoPlay = _this$props14.isAutoPlay,
|
|
812
|
+
createAnalyticsEvent = _this$props14.createAnalyticsEvent;
|
|
813
|
+
var _this$state6 = this.state,
|
|
814
|
+
isFullScreenEnabled = _this$state6.isFullScreenEnabled,
|
|
815
|
+
playbackSpeed = _this$state6.playbackSpeed;
|
|
816
|
+
var playerSize = this.playerSize;
|
|
646
817
|
var playbackState = _objectSpread(_objectSpread({}, this.videoState), {}, {
|
|
647
818
|
isAutoPlay: isAutoPlay,
|
|
648
819
|
isHDAvailable: isHDAvailable,
|
|
@@ -723,29 +894,24 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
723
894
|
artifactName: artifactName
|
|
724
895
|
}), this.props.identifier.id, traceId, error));
|
|
725
896
|
}
|
|
897
|
+
}, {
|
|
898
|
+
key: "isPlaying",
|
|
899
|
+
get: function get() {
|
|
900
|
+
return this.videoState.status === 'playing';
|
|
901
|
+
}
|
|
726
902
|
}, {
|
|
727
903
|
key: "render",
|
|
728
904
|
value: function render() {
|
|
729
|
-
var
|
|
730
|
-
var _this$
|
|
731
|
-
type = _this$
|
|
732
|
-
src = _this$
|
|
733
|
-
isAutoPlay = _this$
|
|
734
|
-
onCanPlay = _this$
|
|
735
|
-
onError = _this$
|
|
736
|
-
poster = _this$
|
|
737
|
-
videoControlsWrapperRef = _this$
|
|
738
|
-
|
|
739
|
-
areControlsVisible = _this$props11.areControlsVisible,
|
|
740
|
-
identifier = _this$props11.identifier,
|
|
741
|
-
_this$props11$mediaSe = _this$props11.mediaSettings,
|
|
742
|
-
_this$props11$mediaSe2 = _this$props11$mediaSe === void 0 ? {} : _this$props11$mediaSe,
|
|
743
|
-
_this$props11$mediaSe3 = _this$props11$mediaSe2.canUpdateVideoCaptions,
|
|
744
|
-
canUpdateVideoCaptions = _this$props11$mediaSe3 === void 0 ? false : _this$props11$mediaSe3;
|
|
745
|
-
var _this$state6 = this.state,
|
|
746
|
-
areCaptionsEnabled = _this$state6.areCaptionsEnabled,
|
|
747
|
-
isArtifactUploaderOpen = _this$state6.isArtifactUploaderOpen,
|
|
748
|
-
artifactToDelete = _this$state6.artifactToDelete;
|
|
905
|
+
var _this4 = this;
|
|
906
|
+
var _this$props15 = this.props,
|
|
907
|
+
type = _this$props15.type,
|
|
908
|
+
src = _this$props15.src,
|
|
909
|
+
isAutoPlay = _this$props15.isAutoPlay,
|
|
910
|
+
onCanPlay = _this$props15.onCanPlay,
|
|
911
|
+
onError = _this$props15.onError,
|
|
912
|
+
poster = _this$props15.poster,
|
|
913
|
+
videoControlsWrapperRef = _this$props15.videoControlsWrapperRef,
|
|
914
|
+
areControlsVisible = _this$props15.areControlsVisible;
|
|
749
915
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
750
916
|
xcss: customVideoWrapperStyles.root,
|
|
751
917
|
ref: this.videoWrapperRef,
|
|
@@ -762,52 +928,32 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
762
928
|
textTracks: this.resolveTextTracks(),
|
|
763
929
|
textTracksPosition: areControlsVisible ? -3.7 : undefined
|
|
764
930
|
}, function (video, videoState, actions) {
|
|
765
|
-
|
|
766
|
-
|
|
931
|
+
_this4.onViewed(videoState);
|
|
932
|
+
_this4.setActions(actions);
|
|
767
933
|
//Video State(either prop or variable) is ReadOnly
|
|
768
|
-
|
|
769
|
-
var
|
|
770
|
-
currentTime = videoState.currentTime,
|
|
934
|
+
_this4.videoState = videoState;
|
|
935
|
+
var currentTime = videoState.currentTime,
|
|
771
936
|
buffered = videoState.buffered,
|
|
772
937
|
duration = videoState.duration,
|
|
773
938
|
isLoading = videoState.isLoading;
|
|
774
|
-
var
|
|
775
|
-
|
|
776
|
-
var isLargePlayer = playerSize === 'large';
|
|
777
|
-
var isMediumPlayer = playerSize === 'medium';
|
|
778
|
-
var defaultSkipAmount = 10;
|
|
779
|
-
var skipBackward = function skipBackward() {
|
|
780
|
-
var _this2$props$onTimeCh, _this2$props;
|
|
781
|
-
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
782
|
-
var newTime = videoState.currentTime - skipAmount;
|
|
783
|
-
actions.navigate(Math.max(newTime, 0));
|
|
784
|
-
(_this2$props$onTimeCh = (_this2$props = _this2.props).onTimeChanged) === null || _this2$props$onTimeCh === void 0 || _this2$props$onTimeCh.call(_this2$props);
|
|
785
|
-
};
|
|
786
|
-
var skipForward = function skipForward() {
|
|
787
|
-
var _this2$props$onTimeCh2, _this2$props2;
|
|
788
|
-
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
789
|
-
var newTime = videoState.currentTime + skipAmount;
|
|
790
|
-
actions.navigate(Math.min(newTime, videoState.duration));
|
|
791
|
-
(_this2$props$onTimeCh2 = (_this2$props2 = _this2.props).onTimeChanged) === null || _this2$props$onTimeCh2 === void 0 || _this2$props$onTimeCh2.call(_this2$props2);
|
|
792
|
-
};
|
|
793
|
-
var shortcuts = _this2.renderShortcuts({
|
|
794
|
-
togglePlayPauseAction: isPlaying ? _this2.pause : _this2.play,
|
|
939
|
+
var shortcuts = _this4.renderShortcuts({
|
|
940
|
+
togglePlayPauseAction: _this4.isPlaying ? _this4.pause : _this4.play,
|
|
795
941
|
toggleMute: actions.toggleMute,
|
|
796
|
-
skipBackward: skipBackward,
|
|
797
|
-
skipForward: skipForward
|
|
942
|
+
skipBackward: _this4.skipBackward,
|
|
943
|
+
skipForward: _this4.skipForward
|
|
798
944
|
});
|
|
799
945
|
return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
800
946
|
direction: "column",
|
|
801
947
|
xcss: videoWrapperStyles.root
|
|
802
948
|
}, /*#__PURE__*/_react.default.createElement(_widthDetector.WidthObserver, {
|
|
803
|
-
setWidth:
|
|
804
|
-
}), shortcuts, isLoading &&
|
|
805
|
-
onDoubleClick:
|
|
806
|
-
onClick: isPlaying ?
|
|
949
|
+
setWidth: _this4.onResize
|
|
950
|
+
}), shortcuts, isLoading && _this4.renderSpinner(), /*#__PURE__*/_react.default.createElement(_playPauseBlanket.PlayPauseBlanket, {
|
|
951
|
+
onDoubleClick: _this4.doubleClickToFullscreen,
|
|
952
|
+
onClick: _this4.isPlaying ? _this4.pausePlayByBlanketClick : _this4.startPlayByBlanketClick,
|
|
807
953
|
"data-testid": "play-pause-blanket"
|
|
808
954
|
}, video), /*#__PURE__*/_react.default.createElement(_styledCompiled.ControlsWrapper, {
|
|
809
955
|
ref: videoControlsWrapperRef,
|
|
810
|
-
controlsHidden:
|
|
956
|
+
controlsHidden: _this4.wasPlayedOnce
|
|
811
957
|
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
812
958
|
xcss: timeWrapperStyles.root
|
|
813
959
|
}, /*#__PURE__*/_react.default.createElement(_timeRange.TimeRange, {
|
|
@@ -815,66 +961,18 @@ var _MediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
815
961
|
bufferedTime: buffered,
|
|
816
962
|
duration: duration,
|
|
817
963
|
onChange: actions.navigate,
|
|
818
|
-
onChanged:
|
|
964
|
+
onChanged: _this4.onTimeChanged,
|
|
819
965
|
disableThumbTooltip: true,
|
|
820
|
-
skipBackward: skipBackward,
|
|
821
|
-
skipForward: skipForward,
|
|
966
|
+
skipBackward: _this4.skipBackward,
|
|
967
|
+
skipForward: _this4.skipForward,
|
|
822
968
|
isAlwaysActive: false
|
|
823
969
|
})), /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
|
|
824
970
|
alignItems: "center",
|
|
825
971
|
justifyContent: "space-between",
|
|
826
972
|
xcss: timebarWrapperStyles.root
|
|
827
|
-
}, /*#__PURE__*/_react.default.createElement(_styled.LeftControls, null,
|
|
828
|
-
textTracks: textTracks,
|
|
829
|
-
onSelected: _this2.onTextTracksSelected,
|
|
830
|
-
areCaptionsEnabled: !!areCaptionsEnabled,
|
|
831
|
-
onCaptionsEnabledChange: _this2.onCaptionsEnabledChange,
|
|
832
|
-
selectedTracksIndex: _this2.resolveSelectedTracksIndex()
|
|
833
|
-
}), _this2.renderFullScreenButton(), isLargePlayer && _this2.renderDownloadButton(), isMediumPlayer || isLargePlayer && canUpdateVideoCaptions && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_captionsAdminControls.CaptionsAdminControls, {
|
|
834
|
-
textTracks: textTracks,
|
|
835
|
-
onUpload: function onUpload() {
|
|
836
|
-
return _this2.setState({
|
|
837
|
-
isArtifactUploaderOpen: true
|
|
838
|
-
});
|
|
839
|
-
},
|
|
840
|
-
onDelete: _this2.onCaptionDelete
|
|
841
|
-
}), /*#__PURE__*/_react.default.createElement(_artifactUploader.CaptionsUploaderBrowser, {
|
|
842
|
-
identifier: identifier,
|
|
843
|
-
isOpen: isArtifactUploaderOpen,
|
|
844
|
-
onClose: function onClose() {
|
|
845
|
-
return _this2.setState({
|
|
846
|
-
isArtifactUploaderOpen: false
|
|
847
|
-
});
|
|
848
|
-
},
|
|
849
|
-
onEnd: function onEnd(metadata, context) {
|
|
850
|
-
_this2.fireCaptionUploadSucceededEvent(context.traceId);
|
|
851
|
-
},
|
|
852
|
-
onError: function onError(err, context) {
|
|
853
|
-
_this2.fireCaptionUploadFailedEvent(context.traceId, err);
|
|
854
|
-
}
|
|
855
|
-
}), /*#__PURE__*/_react.default.createElement(_captionDeleteConfirmationModal.default, {
|
|
856
|
-
identifier: identifier,
|
|
857
|
-
artifactName: artifactToDelete,
|
|
858
|
-
onClose: function onClose() {
|
|
859
|
-
return _this2.setState({
|
|
860
|
-
artifactToDelete: ''
|
|
861
|
-
});
|
|
862
|
-
},
|
|
863
|
-
onEnd: function onEnd(context) {
|
|
864
|
-
_this2.fireCaptionDeleteSucceededEvent(context.traceId, context.artifactName);
|
|
865
|
-
_this2.setState({
|
|
866
|
-
artifactToDelete: ''
|
|
867
|
-
});
|
|
868
|
-
},
|
|
869
|
-
onError: function onError(err, context) {
|
|
870
|
-
_this2.fireCaptionDeleteFailedEvent(context.traceId, context.artifactName, err);
|
|
871
|
-
_this2.setState({
|
|
872
|
-
artifactToDelete: ''
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
}))))));
|
|
973
|
+
}, /*#__PURE__*/_react.default.createElement(_styled.LeftControls, null, _this4.shouldRenderPlayPauseButton() && _this4.renderPlayPauseButton(), _this4.shouldRenderSkipButtons() && _this4.renderSkipButtons(), _this4.shouldRenderVolume() && _this4.renderVolume()), /*#__PURE__*/_react.default.createElement(_styled.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()))));
|
|
876
974
|
}));
|
|
877
975
|
}
|
|
878
976
|
}]);
|
|
879
977
|
}(_react.Component);
|
|
880
|
-
var MediaPlayerBase = exports.MediaPlayerBase = (0,
|
|
978
|
+
var MediaPlayerBase = exports.MediaPlayerBase = (0, _reactIntlNext.injectIntl)(_MediaPlayerBase);
|