@atlaskit/media-ui 28.2.1 → 28.2.3
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 +26 -0
- package/dist/cjs/MediaInlineCard/Frame/styled-compiled.js +1 -2
- package/dist/cjs/MediaInlineCard/Icon-compiled.js +1 -2
- package/dist/cjs/MediaInlineCard/IconAndTitleLayout/styled-compiled.js +1 -2
- package/dist/cjs/MediaInlineCard/LoadingView/styled-compiled.js +1 -2
- package/dist/cjs/MediaInlineCard/styled-compiled.js +1 -2
- package/dist/cjs/abuseModal/abuseModal.js +1 -2
- package/dist/cjs/customMediaPlayer/index-compiled.js +75 -47
- package/dist/cjs/customMediaPlayer/index-emotion.js +73 -48
- package/dist/cjs/customMediaPlayer/index.js +1 -1
- package/dist/cjs/customMediaPlayer/mediaPlayer/captions/artifactUploader/captions/uploadForm.js +1 -2
- package/dist/cjs/customMediaPlayer/mediaPlayer/captions/artifactUploader/captionsUploaderBrowser.js +1 -2
- package/dist/cjs/customMediaPlayer/mediaPlayer/captions/artifactUploader/filePickers/browser.js +1 -2
- package/dist/cjs/customMediaPlayer/mediaPlayer/captionsAdminControls.js +1 -2
- package/dist/cjs/customMediaPlayer/mediaPlayer/captionsSelectControls.js +1 -2
- package/dist/cjs/customMediaPlayer/mediaPlayer/mediaPlayer.js +1 -1
- package/dist/cjs/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +70 -54
- package/dist/cjs/customMediaPlayer/playbackSpeedControls.js +1 -2
- package/dist/cjs/customMediaPlayer/react-video-renderer/track.js +1 -2
- package/dist/cjs/customMediaPlayer/react-video-renderer/video.js +5 -4
- package/dist/cjs/customMediaPlayer/styled-compiled.js +30 -31
- package/dist/cjs/customMediaPlayer/styled.js +1 -2
- package/dist/cjs/customMediaPlayer/timeRange.js +1 -2
- package/dist/cjs/customMediaPlayer/volumeRange.js +5 -4
- package/dist/cjs/ellipsify-compiled.js +1 -2
- package/dist/cjs/ellipsify-emotion.js +1 -2
- package/dist/cjs/humanReadableSize.js +1 -2
- package/dist/cjs/imageMetaData/parseJPEG.js +1 -2
- package/dist/cjs/imageMetaData/parsePNG.js +1 -2
- package/dist/cjs/inactivityDetector/inactivityDetector.js +1 -2
- package/dist/cjs/inactivityDetector/styled-compiled.js +1 -2
- package/dist/cjs/inactivityDetector/styled.js +1 -2
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/locales.js +1 -2
- package/dist/cjs/media-type-icon-compiled.js +16 -16
- package/dist/cjs/media-type-icon-emotion.js +6 -6
- package/dist/cjs/mediaImage/index.js +8 -4
- package/dist/cjs/mime-type-icon.js +1 -2
- package/dist/cjs/modalSpinner-compiled.js +1 -2
- package/dist/cjs/modalSpinner.js +1 -2
- package/dist/cjs/truncateText-compiled.js +1 -2
- package/dist/cjs/util.js +12 -12
- package/dist/es2019/customMediaPlayer/index-compiled.js +35 -7
- package/dist/es2019/customMediaPlayer/index-emotion.js +34 -8
- package/dist/es2019/customMediaPlayer/index.js +1 -1
- package/dist/es2019/customMediaPlayer/mediaPlayer/mediaPlayer.js +1 -1
- package/dist/es2019/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +21 -4
- package/dist/es2019/customMediaPlayer/react-video-renderer/video.js +2 -2
- package/dist/es2019/customMediaPlayer/volumeRange.js +4 -2
- package/dist/es2019/mediaImage/index.js +7 -2
- package/dist/esm/customMediaPlayer/index-compiled.js +74 -45
- package/dist/esm/customMediaPlayer/index-emotion.js +73 -46
- package/dist/esm/customMediaPlayer/index.js +1 -1
- package/dist/esm/customMediaPlayer/mediaPlayer/mediaPlayer.js +1 -1
- package/dist/esm/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +69 -52
- package/dist/esm/customMediaPlayer/react-video-renderer/video.js +4 -2
- package/dist/esm/customMediaPlayer/styled-compiled.js +29 -29
- package/dist/esm/customMediaPlayer/volumeRange.js +4 -2
- package/dist/esm/mediaImage/index.js +7 -2
- package/dist/types/customMediaPlayer/index-compiled.d.ts +4 -0
- package/dist/types/customMediaPlayer/index-emotion.d.ts +1 -0
- package/dist/types/customMediaPlayer/mediaPlayer/mediaPlayerBase.d.ts +3 -0
- package/dist/types/customMediaPlayer/react-video-renderer/video.d.ts +7 -2
- package/dist/types-ts4.5/customMediaPlayer/index-compiled.d.ts +4 -0
- package/dist/types-ts4.5/customMediaPlayer/index-emotion.d.ts +1 -0
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/mediaPlayerBase.d.ts +3 -0
- package/dist/types-ts4.5/customMediaPlayer/react-video-renderer/video.d.ts +7 -2
- package/package.json +10 -4
|
@@ -131,13 +131,22 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
_defineProperty(_this, "onTimeChanged", function () {
|
|
134
|
+
var _this$props3, _this$props3$onTimeCh;
|
|
134
135
|
_this.createAndFireUIEvent('timeRangeNavigate', 'time');
|
|
136
|
+
(_this$props3 = _this.props) === null || _this$props3 === void 0 || (_this$props3$onTimeCh = _this$props3.onTimeChanged) === null || _this$props3$onTimeCh === void 0 || _this$props3$onTimeCh.call(_this$props3);
|
|
135
137
|
});
|
|
136
138
|
_defineProperty(_this, "onVolumeChanged", function () {
|
|
137
139
|
_this.createAndFireUIEvent('volumeRangeNavigate', 'volume');
|
|
138
140
|
});
|
|
141
|
+
_defineProperty(_this, "getDefaultTime", function () {
|
|
142
|
+
return _this.timeSaver.defaultTime;
|
|
143
|
+
});
|
|
139
144
|
_defineProperty(_this, "onCurrentTimeChange", function (currentTime, duration) {
|
|
140
|
-
|
|
145
|
+
// We rely on the saved time when switching to the new source URL
|
|
146
|
+
// so we need to save it irrespective of elapsed time or video length
|
|
147
|
+
if (fg('platform_media_resume_video_on_token_expiry')) {
|
|
148
|
+
_this.timeSaver.defaultTime = currentTime;
|
|
149
|
+
} else if (duration - currentTime > MINIMUM_DURATION_BEFORE_SAVING_TIME) {
|
|
141
150
|
_this.timeSaver.defaultTime = currentTime;
|
|
142
151
|
} else {
|
|
143
152
|
_this.timeSaver.defaultTime = 0;
|
|
@@ -147,15 +156,16 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
147
156
|
var currentTime = _ref.currentTime,
|
|
148
157
|
duration = _ref.duration;
|
|
149
158
|
return /*#__PURE__*/React.createElement(CurrentTime, {
|
|
150
|
-
draggable: false
|
|
159
|
+
draggable: false,
|
|
160
|
+
"data-testid": "current-time"
|
|
151
161
|
}, formatDuration(currentTime), " / ", formatDuration(duration));
|
|
152
162
|
});
|
|
153
163
|
_defineProperty(_this, "renderHDButton", function () {
|
|
154
|
-
var _this$
|
|
155
|
-
type = _this$
|
|
156
|
-
isHDAvailable = _this$
|
|
157
|
-
isHDActive = _this$
|
|
158
|
-
onHDToggleClick = _this$
|
|
164
|
+
var _this$props4 = _this.props,
|
|
165
|
+
type = _this$props4.type,
|
|
166
|
+
isHDAvailable = _this$props4.isHDAvailable,
|
|
167
|
+
isHDActive = _this$props4.isHDActive,
|
|
168
|
+
onHDToggleClick = _this$props4.onHDToggleClick;
|
|
159
169
|
if (type === 'audio' || !isHDAvailable) {
|
|
160
170
|
return;
|
|
161
171
|
}
|
|
@@ -206,7 +216,9 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
206
216
|
label: _this.props.intl.formatMessage(messages.volumeMuteButtonAria)
|
|
207
217
|
}),
|
|
208
218
|
"aria-pressed": videoState.isMuted
|
|
209
|
-
})), showSlider && /*#__PURE__*/React.createElement(VolumeTimeRangeWrapper,
|
|
219
|
+
})), showSlider && /*#__PURE__*/React.createElement(VolumeTimeRangeWrapper, {
|
|
220
|
+
"data-testid": "volume-time-range-wrapper"
|
|
221
|
+
}, /*#__PURE__*/React.createElement(VolumeRange, {
|
|
210
222
|
onChange: actions.setVolume,
|
|
211
223
|
currentVolume: videoState.volume,
|
|
212
224
|
isAlwaysActive: true,
|
|
@@ -237,9 +249,9 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
237
249
|
}
|
|
238
250
|
});
|
|
239
251
|
_defineProperty(_this, "renderFullScreenButton", function () {
|
|
240
|
-
var _this$
|
|
241
|
-
formatMessage = _this$
|
|
242
|
-
type = _this$
|
|
252
|
+
var _this$props5 = _this.props,
|
|
253
|
+
formatMessage = _this$props5.intl.formatMessage,
|
|
254
|
+
type = _this$props5.type;
|
|
243
255
|
if (type === 'audio') {
|
|
244
256
|
return;
|
|
245
257
|
}
|
|
@@ -355,6 +367,7 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
355
367
|
});
|
|
356
368
|
_defineProperty(_this, "renderSpinner", function () {
|
|
357
369
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
370
|
+
testId: "spinner",
|
|
358
371
|
direction: "column",
|
|
359
372
|
alignItems: "center",
|
|
360
373
|
justifyContent: "center",
|
|
@@ -365,12 +378,16 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
365
378
|
}));
|
|
366
379
|
});
|
|
367
380
|
_defineProperty(_this, "pause", function () {
|
|
381
|
+
var _this$props6, _this$props6$onPause;
|
|
368
382
|
if (_this.actions) {
|
|
369
383
|
_this.actions.pause();
|
|
370
384
|
}
|
|
385
|
+
(_this$props6 = _this.props) === null || _this$props6 === void 0 || (_this$props6$onPause = _this$props6.onPause) === null || _this$props6$onPause === void 0 || _this$props6$onPause.call(_this$props6);
|
|
371
386
|
});
|
|
372
387
|
_defineProperty(_this, "play", function () {
|
|
373
|
-
var
|
|
388
|
+
var _this$props7 = _this.props,
|
|
389
|
+
onFirstPlay = _this$props7.onFirstPlay,
|
|
390
|
+
onPlay = _this$props7.onPlay;
|
|
374
391
|
if (_this.actions) {
|
|
375
392
|
_this.actions.play();
|
|
376
393
|
}
|
|
@@ -380,6 +397,7 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
380
397
|
_this.wasPlayedOnce = true;
|
|
381
398
|
onFirstPlay();
|
|
382
399
|
}
|
|
400
|
+
onPlay === null || onPlay === void 0 || onPlay();
|
|
383
401
|
});
|
|
384
402
|
_defineProperty(_this, "getMediaButtonClickHandler", function (action, buttonType) {
|
|
385
403
|
return function () {
|
|
@@ -398,13 +416,13 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
398
416
|
};
|
|
399
417
|
});
|
|
400
418
|
_defineProperty(_this, "onViewed", function (videoState) {
|
|
401
|
-
var _this$
|
|
402
|
-
createAnalyticsEvent = _this$
|
|
403
|
-
fileId = _this$
|
|
404
|
-
isAutoPlay = _this$
|
|
405
|
-
isHDAvailable = _this$
|
|
406
|
-
isHDActive = _this$
|
|
407
|
-
type = _this$
|
|
419
|
+
var _this$props8 = _this.props,
|
|
420
|
+
createAnalyticsEvent = _this$props8.createAnalyticsEvent,
|
|
421
|
+
fileId = _this$props8.fileId,
|
|
422
|
+
isAutoPlay = _this$props8.isAutoPlay,
|
|
423
|
+
isHDAvailable = _this$props8.isHDAvailable,
|
|
424
|
+
isHDActive = _this$props8.isHDActive,
|
|
425
|
+
type = _this$props8.type;
|
|
408
426
|
var _this$state2 = _this.state,
|
|
409
427
|
isFullScreenEnabled = _this$state2.isFullScreenEnabled,
|
|
410
428
|
playerSize = _this$state2.playerSize,
|
|
@@ -454,14 +472,14 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
454
472
|
return _createClass(CustomMediaPlayerBase, [{
|
|
455
473
|
key: "componentDidMount",
|
|
456
474
|
value: function componentDidMount() {
|
|
457
|
-
var _this$
|
|
458
|
-
type = _this$
|
|
459
|
-
fileId = _this$
|
|
460
|
-
isAutoPlay = _this$
|
|
461
|
-
isHDAvailable = _this$
|
|
462
|
-
isHDActive = _this$
|
|
463
|
-
onFirstPlay = _this$
|
|
464
|
-
createAnalyticsEvent = _this$
|
|
475
|
+
var _this$props9 = this.props,
|
|
476
|
+
type = _this$props9.type,
|
|
477
|
+
fileId = _this$props9.fileId,
|
|
478
|
+
isAutoPlay = _this$props9.isAutoPlay,
|
|
479
|
+
isHDAvailable = _this$props9.isHDAvailable,
|
|
480
|
+
isHDActive = _this$props9.isHDActive,
|
|
481
|
+
onFirstPlay = _this$props9.onFirstPlay,
|
|
482
|
+
createAnalyticsEvent = _this$props9.createAnalyticsEvent;
|
|
465
483
|
var _this$state3 = this.state,
|
|
466
484
|
isFullScreenEnabled = _this$state3.isFullScreenEnabled,
|
|
467
485
|
playerSize = _this$state3.playerSize,
|
|
@@ -479,12 +497,14 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
479
497
|
}
|
|
480
498
|
simultaneousPlayManager.subscribe(this);
|
|
481
499
|
if (isAutoPlay) {
|
|
500
|
+
var _this$props0, _this$props0$onPlay;
|
|
482
501
|
simultaneousPlayManager.pauseOthers(this);
|
|
483
502
|
if (onFirstPlay) {
|
|
484
503
|
this.fireFirstPlayedTrackEvent();
|
|
485
504
|
this.wasPlayedOnce = true;
|
|
486
505
|
onFirstPlay();
|
|
487
506
|
}
|
|
507
|
+
(_this$props0 = this.props) === null || _this$props0 === void 0 || (_this$props0$onPlay = _this$props0.onPlay) === null || _this$props0$onPlay === void 0 || _this$props0$onPlay.call(_this$props0);
|
|
488
508
|
}
|
|
489
509
|
}
|
|
490
510
|
}, {
|
|
@@ -494,8 +514,8 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
494
514
|
this.videoWrapperRef.current.removeEventListener('fullscreenchange', this.onFullScreenChange);
|
|
495
515
|
}
|
|
496
516
|
if (this.state.isFullScreenEnabled) {
|
|
497
|
-
var _this$props$onFullscr2, _this$
|
|
498
|
-
(_this$props$onFullscr2 = (_this$
|
|
517
|
+
var _this$props$onFullscr2, _this$props1;
|
|
518
|
+
(_this$props$onFullscr2 = (_this$props1 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 || _this$props$onFullscr2.call(_this$props1, false);
|
|
499
519
|
}
|
|
500
520
|
simultaneousPlayManager.unsubscribe(this);
|
|
501
521
|
}
|
|
@@ -511,13 +531,13 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
511
531
|
}, {
|
|
512
532
|
key: "createAndFireUIEvent",
|
|
513
533
|
value: function createAndFireUIEvent(eventType, actionSubjectId) {
|
|
514
|
-
var _this$
|
|
515
|
-
type = _this$
|
|
516
|
-
fileId = _this$
|
|
517
|
-
isHDActive = _this$
|
|
518
|
-
isHDAvailable = _this$
|
|
519
|
-
isAutoPlay = _this$
|
|
520
|
-
createAnalyticsEvent = _this$
|
|
534
|
+
var _this$props10 = this.props,
|
|
535
|
+
type = _this$props10.type,
|
|
536
|
+
fileId = _this$props10.fileId,
|
|
537
|
+
isHDActive = _this$props10.isHDActive,
|
|
538
|
+
isHDAvailable = _this$props10.isHDAvailable,
|
|
539
|
+
isAutoPlay = _this$props10.isAutoPlay,
|
|
540
|
+
createAnalyticsEvent = _this$props10.createAnalyticsEvent;
|
|
521
541
|
var _this$state4 = this.state,
|
|
522
542
|
isFullScreenEnabled = _this$state4.isFullScreenEnabled,
|
|
523
543
|
playerSize = _this$state4.playerSize,
|
|
@@ -564,24 +584,25 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
564
584
|
key: "render",
|
|
565
585
|
value: function render() {
|
|
566
586
|
var _this2 = this;
|
|
567
|
-
var _this$
|
|
568
|
-
type = _this$
|
|
569
|
-
src = _this$
|
|
570
|
-
isAutoPlay = _this$
|
|
571
|
-
onCanPlay = _this$
|
|
572
|
-
onError = _this$
|
|
573
|
-
poster = _this$
|
|
574
|
-
videoControlsWrapperRef = _this$
|
|
587
|
+
var _this$props11 = this.props,
|
|
588
|
+
type = _this$props11.type,
|
|
589
|
+
src = _this$props11.src,
|
|
590
|
+
isAutoPlay = _this$props11.isAutoPlay,
|
|
591
|
+
onCanPlay = _this$props11.onCanPlay,
|
|
592
|
+
onError = _this$props11.onError,
|
|
593
|
+
poster = _this$props11.poster,
|
|
594
|
+
videoControlsWrapperRef = _this$props11.videoControlsWrapperRef;
|
|
575
595
|
return /*#__PURE__*/React.createElement(Box, {
|
|
576
596
|
xcss: customVideoWrapperStyles.root,
|
|
577
597
|
ref: this.videoWrapperRef,
|
|
578
598
|
testId: "custom-media-player"
|
|
579
599
|
}, /*#__PURE__*/React.createElement(MediaPlayer, {
|
|
600
|
+
"data-testid": "media-player",
|
|
580
601
|
sourceType: type,
|
|
581
602
|
src: src,
|
|
582
603
|
autoPlay: isAutoPlay,
|
|
583
604
|
onCanPlay: onCanPlay,
|
|
584
|
-
defaultTime: this.
|
|
605
|
+
defaultTime: this.getDefaultTime,
|
|
585
606
|
onTimeChange: this.onCurrentTimeChange,
|
|
586
607
|
onError: onError,
|
|
587
608
|
poster: poster
|
|
@@ -604,11 +625,19 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
604
625
|
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
605
626
|
var newTime = videoState.currentTime - skipAmount;
|
|
606
627
|
actions.navigate(Math.max(newTime, 0));
|
|
628
|
+
if (fg('platform_media_resume_video_on_token_expiry')) {
|
|
629
|
+
var _this2$props, _this2$props$onTimeCh;
|
|
630
|
+
(_this2$props = _this2.props) === null || _this2$props === void 0 || (_this2$props$onTimeCh = _this2$props.onTimeChanged) === null || _this2$props$onTimeCh === void 0 || _this2$props$onTimeCh.call(_this2$props);
|
|
631
|
+
}
|
|
607
632
|
};
|
|
608
633
|
var skipForward = function skipForward() {
|
|
609
634
|
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
610
635
|
var newTime = videoState.currentTime + skipAmount;
|
|
611
636
|
actions.navigate(Math.min(newTime, videoState.duration));
|
|
637
|
+
if (fg('platform_media_resume_video_on_token_expiry')) {
|
|
638
|
+
var _this2$props2, _this2$props2$onTimeC;
|
|
639
|
+
(_this2$props2 = _this2.props) === null || _this2$props2 === void 0 || (_this2$props2$onTimeC = _this2$props2.onTimeChanged) === null || _this2$props2$onTimeC === void 0 || _this2$props2$onTimeC.call(_this2$props2);
|
|
640
|
+
}
|
|
612
641
|
};
|
|
613
642
|
var shortcuts = _this2.renderShortcuts({
|
|
614
643
|
togglePlayPauseAction: isPlaying ? _this2.pause : _this2.play,
|
|
@@ -21,6 +21,8 @@ import SoundIcon from '@atlaskit/icon/core/migration/volume-high--hipchat-outgoi
|
|
|
21
21
|
import VideoHdIcon from '@atlaskit/icon-lab/core/video-hd';
|
|
22
22
|
import VideoHdFilledIcon from '@atlaskit/icon-lab/core/video-hd-filled';
|
|
23
23
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives
|
|
24
26
|
import { xcss, Box, Flex } from '@atlaskit/primitives';
|
|
25
27
|
import MediaButton from '../MediaButton';
|
|
26
28
|
import Spinner from '@atlaskit/spinner';
|
|
@@ -140,31 +142,41 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
140
142
|
}
|
|
141
143
|
});
|
|
142
144
|
_defineProperty(_this, "onTimeChanged", function () {
|
|
145
|
+
var _this$props3, _this$props3$onTimeCh;
|
|
143
146
|
_this.createAndFireUIEvent('timeRangeNavigate', 'time');
|
|
147
|
+
(_this$props3 = _this.props) === null || _this$props3 === void 0 || (_this$props3$onTimeCh = _this$props3.onTimeChanged) === null || _this$props3$onTimeCh === void 0 || _this$props3$onTimeCh.call(_this$props3);
|
|
144
148
|
});
|
|
145
149
|
_defineProperty(_this, "onVolumeChanged", function () {
|
|
146
150
|
_this.createAndFireUIEvent('volumeRangeNavigate', 'volume');
|
|
147
151
|
});
|
|
148
152
|
_defineProperty(_this, "onCurrentTimeChange", function (currentTime, duration) {
|
|
149
|
-
|
|
153
|
+
// We rely on the saved time when switching to the new source URL
|
|
154
|
+
// so we need to save it irrespective of elapsed time or video length
|
|
155
|
+
if (fg('platform_media_resume_video_on_token_expiry')) {
|
|
156
|
+
_this.timeSaver.defaultTime = currentTime;
|
|
157
|
+
} else if (duration - currentTime > MINIMUM_DURATION_BEFORE_SAVING_TIME) {
|
|
150
158
|
_this.timeSaver.defaultTime = currentTime;
|
|
151
159
|
} else {
|
|
152
160
|
_this.timeSaver.defaultTime = 0;
|
|
153
161
|
}
|
|
154
162
|
});
|
|
163
|
+
_defineProperty(_this, "getDefaultTime", function () {
|
|
164
|
+
return _this.timeSaver.defaultTime;
|
|
165
|
+
});
|
|
155
166
|
_defineProperty(_this, "renderCurrentTime", function (_ref) {
|
|
156
167
|
var currentTime = _ref.currentTime,
|
|
157
168
|
duration = _ref.duration;
|
|
158
169
|
return /*#__PURE__*/React.createElement(CurrentTime, {
|
|
159
|
-
draggable: false
|
|
170
|
+
draggable: false,
|
|
171
|
+
"data-testid": "current-time"
|
|
160
172
|
}, formatDuration(currentTime), " / ", formatDuration(duration));
|
|
161
173
|
});
|
|
162
174
|
_defineProperty(_this, "renderHDButton", function () {
|
|
163
|
-
var _this$
|
|
164
|
-
type = _this$
|
|
165
|
-
isHDAvailable = _this$
|
|
166
|
-
isHDActive = _this$
|
|
167
|
-
onHDToggleClick = _this$
|
|
175
|
+
var _this$props4 = _this.props,
|
|
176
|
+
type = _this$props4.type,
|
|
177
|
+
isHDAvailable = _this$props4.isHDAvailable,
|
|
178
|
+
isHDActive = _this$props4.isHDActive,
|
|
179
|
+
onHDToggleClick = _this$props4.onHDToggleClick;
|
|
168
180
|
if (type === 'audio' || !isHDAvailable) {
|
|
169
181
|
return;
|
|
170
182
|
}
|
|
@@ -215,7 +227,9 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
215
227
|
label: _this.props.intl.formatMessage(messages.volumeMuteButtonAria)
|
|
216
228
|
}),
|
|
217
229
|
"aria-pressed": videoState.isMuted
|
|
218
|
-
})), showSlider && /*#__PURE__*/React.createElement(VolumeTimeRangeWrapper,
|
|
230
|
+
})), showSlider && /*#__PURE__*/React.createElement(VolumeTimeRangeWrapper, {
|
|
231
|
+
"data-testid": "volume-time-range-wrapper"
|
|
232
|
+
}, /*#__PURE__*/React.createElement(VolumeRange, {
|
|
219
233
|
onChange: actions.setVolume,
|
|
220
234
|
currentVolume: videoState.volume,
|
|
221
235
|
isAlwaysActive: true,
|
|
@@ -246,9 +260,9 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
246
260
|
}
|
|
247
261
|
});
|
|
248
262
|
_defineProperty(_this, "renderFullScreenButton", function () {
|
|
249
|
-
var _this$
|
|
250
|
-
formatMessage = _this$
|
|
251
|
-
type = _this$
|
|
263
|
+
var _this$props5 = _this.props,
|
|
264
|
+
formatMessage = _this$props5.intl.formatMessage,
|
|
265
|
+
type = _this$props5.type;
|
|
252
266
|
if (type === 'audio') {
|
|
253
267
|
return;
|
|
254
268
|
}
|
|
@@ -364,6 +378,7 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
364
378
|
});
|
|
365
379
|
_defineProperty(_this, "renderSpinner", function () {
|
|
366
380
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
381
|
+
testId: "spinner",
|
|
367
382
|
direction: "column",
|
|
368
383
|
alignItems: "center",
|
|
369
384
|
justifyContent: "center",
|
|
@@ -374,12 +389,16 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
374
389
|
}));
|
|
375
390
|
});
|
|
376
391
|
_defineProperty(_this, "pause", function () {
|
|
392
|
+
var _this$props6, _this$props6$onPause;
|
|
377
393
|
if (_this.actions) {
|
|
378
394
|
_this.actions.pause();
|
|
379
395
|
}
|
|
396
|
+
(_this$props6 = _this.props) === null || _this$props6 === void 0 || (_this$props6$onPause = _this$props6.onPause) === null || _this$props6$onPause === void 0 || _this$props6$onPause.call(_this$props6);
|
|
380
397
|
});
|
|
381
398
|
_defineProperty(_this, "play", function () {
|
|
382
|
-
var
|
|
399
|
+
var _this$props7 = _this.props,
|
|
400
|
+
onFirstPlay = _this$props7.onFirstPlay,
|
|
401
|
+
onPlay = _this$props7.onPlay;
|
|
383
402
|
if (_this.actions) {
|
|
384
403
|
_this.actions.play();
|
|
385
404
|
}
|
|
@@ -389,6 +408,7 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
389
408
|
_this.wasPlayedOnce = true;
|
|
390
409
|
onFirstPlay();
|
|
391
410
|
}
|
|
411
|
+
onPlay === null || onPlay === void 0 || onPlay();
|
|
392
412
|
});
|
|
393
413
|
_defineProperty(_this, "getMediaButtonClickHandler", function (action, buttonType) {
|
|
394
414
|
return function () {
|
|
@@ -407,13 +427,13 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
407
427
|
};
|
|
408
428
|
});
|
|
409
429
|
_defineProperty(_this, "onViewed", function (videoState) {
|
|
410
|
-
var _this$
|
|
411
|
-
createAnalyticsEvent = _this$
|
|
412
|
-
fileId = _this$
|
|
413
|
-
isAutoPlay = _this$
|
|
414
|
-
isHDAvailable = _this$
|
|
415
|
-
isHDActive = _this$
|
|
416
|
-
type = _this$
|
|
430
|
+
var _this$props8 = _this.props,
|
|
431
|
+
createAnalyticsEvent = _this$props8.createAnalyticsEvent,
|
|
432
|
+
fileId = _this$props8.fileId,
|
|
433
|
+
isAutoPlay = _this$props8.isAutoPlay,
|
|
434
|
+
isHDAvailable = _this$props8.isHDAvailable,
|
|
435
|
+
isHDActive = _this$props8.isHDActive,
|
|
436
|
+
type = _this$props8.type;
|
|
417
437
|
var _this$state2 = _this.state,
|
|
418
438
|
isFullScreenEnabled = _this$state2.isFullScreenEnabled,
|
|
419
439
|
playerSize = _this$state2.playerSize,
|
|
@@ -463,14 +483,14 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
463
483
|
return _createClass(CustomMediaPlayerBase, [{
|
|
464
484
|
key: "componentDidMount",
|
|
465
485
|
value: function componentDidMount() {
|
|
466
|
-
var _this$
|
|
467
|
-
type = _this$
|
|
468
|
-
fileId = _this$
|
|
469
|
-
isAutoPlay = _this$
|
|
470
|
-
isHDAvailable = _this$
|
|
471
|
-
isHDActive = _this$
|
|
472
|
-
onFirstPlay = _this$
|
|
473
|
-
createAnalyticsEvent = _this$
|
|
486
|
+
var _this$props9 = this.props,
|
|
487
|
+
type = _this$props9.type,
|
|
488
|
+
fileId = _this$props9.fileId,
|
|
489
|
+
isAutoPlay = _this$props9.isAutoPlay,
|
|
490
|
+
isHDAvailable = _this$props9.isHDAvailable,
|
|
491
|
+
isHDActive = _this$props9.isHDActive,
|
|
492
|
+
onFirstPlay = _this$props9.onFirstPlay,
|
|
493
|
+
createAnalyticsEvent = _this$props9.createAnalyticsEvent;
|
|
474
494
|
var _this$state3 = this.state,
|
|
475
495
|
isFullScreenEnabled = _this$state3.isFullScreenEnabled,
|
|
476
496
|
playerSize = _this$state3.playerSize,
|
|
@@ -488,12 +508,14 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
488
508
|
}
|
|
489
509
|
simultaneousPlayManager.subscribe(this);
|
|
490
510
|
if (isAutoPlay) {
|
|
511
|
+
var _this$props0, _this$props0$onPlay;
|
|
491
512
|
simultaneousPlayManager.pauseOthers(this);
|
|
492
513
|
if (onFirstPlay) {
|
|
493
514
|
this.fireFirstPlayedTrackEvent();
|
|
494
515
|
this.wasPlayedOnce = true;
|
|
495
516
|
onFirstPlay();
|
|
496
517
|
}
|
|
518
|
+
(_this$props0 = this.props) === null || _this$props0 === void 0 || (_this$props0$onPlay = _this$props0.onPlay) === null || _this$props0$onPlay === void 0 || _this$props0$onPlay.call(_this$props0);
|
|
497
519
|
}
|
|
498
520
|
}
|
|
499
521
|
}, {
|
|
@@ -503,8 +525,8 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
503
525
|
this.videoWrapperRef.current.removeEventListener('fullscreenchange', this.onFullScreenChange);
|
|
504
526
|
}
|
|
505
527
|
if (this.state.isFullScreenEnabled) {
|
|
506
|
-
var _this$props$onFullscr2, _this$
|
|
507
|
-
(_this$props$onFullscr2 = (_this$
|
|
528
|
+
var _this$props$onFullscr2, _this$props1;
|
|
529
|
+
(_this$props$onFullscr2 = (_this$props1 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 || _this$props$onFullscr2.call(_this$props1, false);
|
|
508
530
|
}
|
|
509
531
|
simultaneousPlayManager.unsubscribe(this);
|
|
510
532
|
}
|
|
@@ -520,13 +542,13 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
520
542
|
}, {
|
|
521
543
|
key: "createAndFireUIEvent",
|
|
522
544
|
value: function createAndFireUIEvent(eventType, actionSubjectId) {
|
|
523
|
-
var _this$
|
|
524
|
-
type = _this$
|
|
525
|
-
fileId = _this$
|
|
526
|
-
isHDActive = _this$
|
|
527
|
-
isHDAvailable = _this$
|
|
528
|
-
isAutoPlay = _this$
|
|
529
|
-
createAnalyticsEvent = _this$
|
|
545
|
+
var _this$props10 = this.props,
|
|
546
|
+
type = _this$props10.type,
|
|
547
|
+
fileId = _this$props10.fileId,
|
|
548
|
+
isHDActive = _this$props10.isHDActive,
|
|
549
|
+
isHDAvailable = _this$props10.isHDAvailable,
|
|
550
|
+
isAutoPlay = _this$props10.isAutoPlay,
|
|
551
|
+
createAnalyticsEvent = _this$props10.createAnalyticsEvent;
|
|
530
552
|
var _this$state4 = this.state,
|
|
531
553
|
isFullScreenEnabled = _this$state4.isFullScreenEnabled,
|
|
532
554
|
playerSize = _this$state4.playerSize,
|
|
@@ -573,14 +595,14 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
573
595
|
key: "render",
|
|
574
596
|
value: function render() {
|
|
575
597
|
var _this2 = this;
|
|
576
|
-
var _this$
|
|
577
|
-
type = _this$
|
|
578
|
-
src = _this$
|
|
579
|
-
isAutoPlay = _this$
|
|
580
|
-
onCanPlay = _this$
|
|
581
|
-
onError = _this$
|
|
582
|
-
poster = _this$
|
|
583
|
-
videoControlsWrapperRef = _this$
|
|
598
|
+
var _this$props11 = this.props,
|
|
599
|
+
type = _this$props11.type,
|
|
600
|
+
src = _this$props11.src,
|
|
601
|
+
isAutoPlay = _this$props11.isAutoPlay,
|
|
602
|
+
onCanPlay = _this$props11.onCanPlay,
|
|
603
|
+
onError = _this$props11.onError,
|
|
604
|
+
poster = _this$props11.poster,
|
|
605
|
+
videoControlsWrapperRef = _this$props11.videoControlsWrapperRef;
|
|
584
606
|
return /*#__PURE__*/React.createElement(Box, {
|
|
585
607
|
xcss: customVideoWrapperStyles,
|
|
586
608
|
ref: this.videoWrapperRef,
|
|
@@ -590,10 +612,11 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
590
612
|
src: src,
|
|
591
613
|
autoPlay: isAutoPlay,
|
|
592
614
|
onCanPlay: onCanPlay,
|
|
593
|
-
defaultTime: this.
|
|
615
|
+
defaultTime: this.getDefaultTime,
|
|
594
616
|
onTimeChange: this.onCurrentTimeChange,
|
|
595
617
|
onError: onError,
|
|
596
|
-
poster: poster
|
|
618
|
+
poster: poster,
|
|
619
|
+
"data-testid": "media-player"
|
|
597
620
|
}, function (video, videoState, actions) {
|
|
598
621
|
_this2.onViewed(videoState);
|
|
599
622
|
_this2.setActions(actions);
|
|
@@ -610,14 +633,18 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
|
|
|
610
633
|
var isMediumPlayer = playerSize === 'medium';
|
|
611
634
|
var defaultSkipAmount = 10;
|
|
612
635
|
var skipBackward = function skipBackward() {
|
|
636
|
+
var _this2$props, _this2$props$onTimeCh;
|
|
613
637
|
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
614
638
|
var newTime = videoState.currentTime - skipAmount;
|
|
615
639
|
actions.navigate(Math.max(newTime, 0));
|
|
640
|
+
(_this2$props = _this2.props) === null || _this2$props === void 0 || (_this2$props$onTimeCh = _this2$props.onTimeChanged) === null || _this2$props$onTimeCh === void 0 || _this2$props$onTimeCh.call(_this2$props);
|
|
616
641
|
};
|
|
617
642
|
var skipForward = function skipForward() {
|
|
643
|
+
var _this2$props2, _this2$props2$onTimeC;
|
|
618
644
|
var skipAmount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSkipAmount;
|
|
619
645
|
var newTime = videoState.currentTime + skipAmount;
|
|
620
646
|
actions.navigate(Math.min(newTime, videoState.duration));
|
|
647
|
+
(_this2$props2 = _this2.props) === null || _this2$props2 === void 0 || (_this2$props2$onTimeC = _this2$props2.onTimeChanged) === null || _this2$props2$onTimeC === void 0 || _this2$props2$onTimeC.call(_this2$props2);
|
|
621
648
|
};
|
|
622
649
|
var shortcuts = _this2.renderShortcuts({
|
|
623
650
|
togglePlayPauseAction: isPlaying ? _this2.pause : _this2.play,
|
|
@@ -9,7 +9,7 @@ export var CustomMediaPlayerBase = function CustomMediaPlayerBase(props) {
|
|
|
9
9
|
return fg('platform_media_compiled') ? /*#__PURE__*/React.createElement(CompiledCustomMediaPlayerBase, props) : /*#__PURE__*/React.createElement(EmotionCustomMediaPlayerBase, props);
|
|
10
10
|
};
|
|
11
11
|
var packageName = "@atlaskit/media-ui";
|
|
12
|
-
var packageVersion = "28.2.
|
|
12
|
+
var packageVersion = "28.2.3";
|
|
13
13
|
|
|
14
14
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
15
15
|
export var CustomMediaPlayer = withMediaAnalyticsContext({
|
|
@@ -5,7 +5,7 @@ import { useFileState, useMediaClient, useMediaSettings } from '@atlaskit/media-
|
|
|
5
5
|
import { MediaPlayerBase } from './mediaPlayerBase';
|
|
6
6
|
import { useTextTracks } from './useTextTracks';
|
|
7
7
|
var packageName = "@atlaskit/media-ui";
|
|
8
|
-
var packageVersion = "28.2.
|
|
8
|
+
var packageVersion = "28.2.3";
|
|
9
9
|
var MediaPlayerBaseWithContext = withMediaAnalyticsContext({
|
|
10
10
|
packageVersion: packageVersion,
|
|
11
11
|
packageName: packageName,
|