@atlaskit/media-ui 25.0.13 → 25.2.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-ui
2
2
 
3
+ ## 25.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#69454](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69454) [`41f49439d5da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/41f49439d5da) - [ux] ECA11Y-198: Add Shift + F10 shortcut to focus play/pause button when video is selected
8
+
9
+ ## 25.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#69045](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69045) [`b4de23a94d1f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b4de23a94d1f) - Added new intl message for button to open Media viewer in Media Card
14
+
3
15
  ## 25.0.13
4
16
 
5
17
  ### Patch Changes
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getControlsWrapperClassName = void 0;
7
7
  var _classNames = require("../classNames");
8
- var getControlsWrapperClassName = exports.getControlsWrapperClassName = function getControlsWrapperClassName(wasPlayedOnce) {
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
+ var getControlsWrapperClassName = exports.getControlsWrapperClassName = function getControlsWrapperClassName(wasPlayedOnce, areVideoControlsFocused) {
10
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
11
+ return !wasPlayedOnce || areVideoControlsFocused ? '' : _classNames.hideControlsClassName;
12
+ }
9
13
  return !wasPlayedOnce ? '' : _classNames.hideControlsClassName;
10
14
  };
@@ -23,6 +23,7 @@ var _outgoingSound = _interopRequireDefault(require("@atlaskit/icon/glyph/hipcha
23
23
  var _vidHdCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/vid-hd-circle"));
24
24
  var _download = _interopRequireDefault(require("@atlaskit/icon/glyph/download"));
25
25
  var _mediaCommon = require("@atlaskit/media-common");
26
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
27
  var _MediaButton = _interopRequireDefault(require("../MediaButton"));
27
28
  var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
28
29
  var _widthDetector = require("@atlaskit/width-detector");
@@ -51,7 +52,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
51
52
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* 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
52
53
  // support the hybrid theming in media viewer https://product-fabric.atlassian.net/browse/DSP-6067
53
54
  var packageName = "@atlaskit/media-ui";
54
- var packageVersion = "25.0.13";
55
+ var packageVersion = "25.2.0";
55
56
  var MEDIUM_VIDEO_MAX_WIDTH = 400;
56
57
  var SMALL_VIDEO_MAX_WIDTH = 160;
57
58
  var MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
@@ -67,6 +68,8 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
67
68
  }
68
69
  _this = _super.call.apply(_super, [this].concat(args));
69
70
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "videoWrapperRef", /*#__PURE__*/_react.default.createRef());
71
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "controlsWrapperRef", /*#__PURE__*/_react.default.createRef());
72
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "videoPlayPauseButtonRef", /*#__PURE__*/_react.default.createRef());
70
73
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "videoState", {
71
74
  isLoading: true,
72
75
  buffered: 0,
@@ -82,7 +85,8 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
82
85
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
83
86
  isFullScreenEnabled: false,
84
87
  playerSize: 'large',
85
- playbackSpeed: 1
88
+ playbackSpeed: 1,
89
+ areVideoControlsFocused: false
86
90
  });
87
91
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireFirstPlayedTrackEvent", function () {
88
92
  var _this$props = _this.props,
@@ -105,6 +109,14 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
105
109
  playbackSpeed: playbackSpeed
106
110
  }, fileId), createAnalyticsEvent);
107
111
  });
112
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFocusChange", function () {
113
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
114
+ //Check if element or any of it's children is focused
115
+ _this.setState({
116
+ areVideoControlsFocused: !!_this.controlsWrapperRef.current && !!_this.controlsWrapperRef.current.contains(document.activeElement)
117
+ });
118
+ }
119
+ });
108
120
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFullScreenChange", function (e) {
109
121
  if (e.target !== _this.videoWrapperRef.current) {
110
122
  return;
@@ -119,6 +131,15 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
119
131
  });
120
132
  }
121
133
  });
134
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
135
+ if (event.shiftKey && (event.key === 'F10' || event.keyCode === 121) && _this.videoPlayPauseButtonRef.current && _this.props.isVideoSelected) {
136
+ event.preventDefault();
137
+ _this.videoPlayPauseButtonRef.current.focus();
138
+ if (_this.props.showControls) {
139
+ _this.props.showControls();
140
+ }
141
+ }
142
+ });
122
143
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onTimeChanged", function () {
123
144
  _this.createAndFireUIEvent('timeRangeNavigate', 'time');
124
145
  });
@@ -304,6 +325,7 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
304
325
  testId: "custom-media-player-play-toggle-button",
305
326
  "data-test-is-playing": isPlaying,
306
327
  iconBefore: toggleButtonIcon,
328
+ buttonRef: _this.videoPlayPauseButtonRef,
307
329
  onClick: isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
308
330
  }));
309
331
  });
@@ -451,6 +473,11 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
451
473
  if (this.videoWrapperRef.current) {
452
474
  this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
453
475
  }
476
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
477
+ document.addEventListener('keydown', this.handleKeyDown);
478
+ window.addEventListener('focus', this.onFocusChange, true);
479
+ window.addEventListener('blur', this.onFocusChange, true);
480
+ }
454
481
  _simultaneousPlayManager.default.subscribe(this);
455
482
  if (isAutoPlay) {
456
483
  _simultaneousPlayManager.default.pauseOthers(this);
@@ -471,6 +498,11 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
471
498
  var _this$props$onFullscr2, _this$props7;
472
499
  (_this$props$onFullscr2 = (_this$props7 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 || _this$props$onFullscr2.call(_this$props7, false);
473
500
  }
501
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
502
+ document.removeEventListener('keydown', this.handleKeyDown);
503
+ window.removeEventListener('focus', this.onFocusChange, true);
504
+ window.removeEventListener('blur', this.onFocusChange, true);
505
+ }
474
506
  _simultaneousPlayManager.default.unsubscribe(this);
475
507
  }
476
508
  }, {
@@ -593,7 +625,8 @@ var CustomMediaPlayerBase = exports.CustomMediaPlayerBase = /*#__PURE__*/functio
593
625
  onClick: isPlaying ? _this2.pausePlayByBlanketClick : _this2.startPlayByBlanketClick,
594
626
  "data-testid": "play-pause-blanket"
595
627
  }, video), /*#__PURE__*/_react.default.createElement(_styled.ControlsWrapper, {
596
- className: (0, _getControlsWrapperClassName.getControlsWrapperClassName)(_this2.wasPlayedOnce)
628
+ ref: _this2.controlsWrapperRef,
629
+ className: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y_video_controls_keyboard_support_yhcxh') ? (0, _getControlsWrapperClassName.getControlsWrapperClassName)(_this2.wasPlayedOnce, _this2.state.areVideoControlsFocused) : (0, _getControlsWrapperClassName.getControlsWrapperClassName)(_this2.wasPlayedOnce)
597
630
  }, /*#__PURE__*/_react.default.createElement(_styled.TimeWrapper, null, /*#__PURE__*/_react.default.createElement(_timeRange.TimeRange, {
598
631
  currentTime: currentTime,
599
632
  bufferedTime: buffered,
@@ -675,5 +675,10 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
675
675
  id: 'fabric.media.file_is_selected',
676
676
  defaultMessage: 'File {name} is selected',
677
677
  description: '{name} it is the parameter, which saying alt text or file name of uploaded file'
678
+ },
679
+ open_file_in_viewer: {
680
+ id: 'fabric.media.open_file_in_viewer',
681
+ defaultMessage: 'Open {name}',
682
+ description: 'Shown when user focuses on preview to open the full screen viewer of the file with {name}'
678
683
  }
679
684
  });
@@ -1,2 +1,8 @@
1
1
  import { hideControlsClassName } from '../classNames';
2
- export const getControlsWrapperClassName = wasPlayedOnce => !wasPlayedOnce ? '' : hideControlsClassName;
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+ export const getControlsWrapperClassName = (wasPlayedOnce, areVideoControlsFocused) => {
4
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
5
+ return !wasPlayedOnce || areVideoControlsFocused ? '' : hideControlsClassName;
6
+ }
7
+ return !wasPlayedOnce ? '' : hideControlsClassName;
8
+ };
@@ -13,6 +13,7 @@ import SoundIcon from '@atlaskit/icon/glyph/hipchat/outgoing-sound';
13
13
  import HDIcon from '@atlaskit/icon/glyph/vid-hd-circle';
14
14
  import DownloadIcon from '@atlaskit/icon/glyph/download';
15
15
  import { withMediaAnalyticsContext } from '@atlaskit/media-common';
16
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
17
  import MediaButton from '../MediaButton';
17
18
  import Spinner from '@atlaskit/spinner';
18
19
  import { WidthObserver } from '@atlaskit/width-detector';
@@ -34,7 +35,7 @@ import Tooltip from '@atlaskit/tooltip';
34
35
  import { SkipTenBackwardIcon, SkipTenForwardIcon } from './icons';
35
36
  import { getControlsWrapperClassName } from './getControlsWrapperClassName';
36
37
  const packageName = "@atlaskit/media-ui";
37
- const packageVersion = "25.0.13";
38
+ const packageVersion = "25.2.0";
38
39
  const MEDIUM_VIDEO_MAX_WIDTH = 400;
39
40
  const SMALL_VIDEO_MAX_WIDTH = 160;
40
41
  const MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
@@ -43,6 +44,8 @@ export class CustomMediaPlayerBase extends Component {
43
44
  constructor(...args) {
44
45
  super(...args);
45
46
  _defineProperty(this, "videoWrapperRef", /*#__PURE__*/React.createRef());
47
+ _defineProperty(this, "controlsWrapperRef", /*#__PURE__*/React.createRef());
48
+ _defineProperty(this, "videoPlayPauseButtonRef", /*#__PURE__*/React.createRef());
46
49
  _defineProperty(this, "videoState", {
47
50
  isLoading: true,
48
51
  buffered: 0,
@@ -58,7 +61,8 @@ export class CustomMediaPlayerBase extends Component {
58
61
  _defineProperty(this, "state", {
59
62
  isFullScreenEnabled: false,
60
63
  playerSize: 'large',
61
- playbackSpeed: 1
64
+ playbackSpeed: 1,
65
+ areVideoControlsFocused: false
62
66
  });
63
67
  _defineProperty(this, "fireFirstPlayedTrackEvent", () => {
64
68
  const {
@@ -83,6 +87,14 @@ export class CustomMediaPlayerBase extends Component {
83
87
  playbackSpeed
84
88
  }, fileId), createAnalyticsEvent);
85
89
  });
90
+ _defineProperty(this, "onFocusChange", () => {
91
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
92
+ //Check if element or any of it's children is focused
93
+ this.setState({
94
+ areVideoControlsFocused: !!this.controlsWrapperRef.current && !!this.controlsWrapperRef.current.contains(document.activeElement)
95
+ });
96
+ }
97
+ });
86
98
  _defineProperty(this, "onFullScreenChange", e => {
87
99
  if (e.target !== this.videoWrapperRef.current) {
88
100
  return;
@@ -99,6 +111,15 @@ export class CustomMediaPlayerBase extends Component {
99
111
  });
100
112
  }
101
113
  });
114
+ _defineProperty(this, "handleKeyDown", event => {
115
+ if (event.shiftKey && (event.key === 'F10' || event.keyCode === 121) && this.videoPlayPauseButtonRef.current && this.props.isVideoSelected) {
116
+ event.preventDefault();
117
+ this.videoPlayPauseButtonRef.current.focus();
118
+ if (this.props.showControls) {
119
+ this.props.showControls();
120
+ }
121
+ }
122
+ });
102
123
  _defineProperty(this, "onTimeChanged", () => {
103
124
  this.createAndFireUIEvent('timeRangeNavigate', 'time');
104
125
  });
@@ -300,6 +321,7 @@ export class CustomMediaPlayerBase extends Component {
300
321
  testId: "custom-media-player-play-toggle-button",
301
322
  "data-test-is-playing": isPlaying,
302
323
  iconBefore: toggleButtonIcon,
324
+ buttonRef: this.videoPlayPauseButtonRef,
303
325
  onClick: isPlaying ? this.pausePlayByButtonClick : this.startPlayByButtonClick
304
326
  }));
305
327
  });
@@ -457,6 +479,11 @@ export class CustomMediaPlayerBase extends Component {
457
479
  if (this.videoWrapperRef.current) {
458
480
  this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
459
481
  }
482
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
483
+ document.addEventListener('keydown', this.handleKeyDown);
484
+ window.addEventListener('focus', this.onFocusChange, true);
485
+ window.addEventListener('blur', this.onFocusChange, true);
486
+ }
460
487
  simultaneousPlayManager.subscribe(this);
461
488
  if (isAutoPlay) {
462
489
  simultaneousPlayManager.pauseOthers(this);
@@ -475,6 +502,11 @@ export class CustomMediaPlayerBase extends Component {
475
502
  var _this$props$onFullscr2, _this$props2;
476
503
  (_this$props$onFullscr2 = (_this$props2 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 ? void 0 : _this$props$onFullscr2.call(_this$props2, false);
477
504
  }
505
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
506
+ document.removeEventListener('keydown', this.handleKeyDown);
507
+ window.removeEventListener('focus', this.onFocusChange, true);
508
+ window.removeEventListener('blur', this.onFocusChange, true);
509
+ }
478
510
  simultaneousPlayManager.unsubscribe(this);
479
511
  }
480
512
  setActions(actions) {
@@ -598,7 +630,8 @@ export class CustomMediaPlayerBase extends Component {
598
630
  onClick: isPlaying ? this.pausePlayByBlanketClick : this.startPlayByBlanketClick,
599
631
  "data-testid": "play-pause-blanket"
600
632
  }, video), /*#__PURE__*/React.createElement(ControlsWrapper, {
601
- className: getControlsWrapperClassName(this.wasPlayedOnce)
633
+ ref: this.controlsWrapperRef,
634
+ className: getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh') ? getControlsWrapperClassName(this.wasPlayedOnce, this.state.areVideoControlsFocused) : getControlsWrapperClassName(this.wasPlayedOnce)
602
635
  }, /*#__PURE__*/React.createElement(TimeWrapper, null, /*#__PURE__*/React.createElement(TimeRange, {
603
636
  currentTime: currentTime,
604
637
  bufferedTime: buffered,
@@ -669,5 +669,10 @@ export const messages = defineMessages({
669
669
  id: 'fabric.media.file_is_selected',
670
670
  defaultMessage: 'File {name} is selected',
671
671
  description: '{name} it is the parameter, which saying alt text or file name of uploaded file'
672
+ },
673
+ open_file_in_viewer: {
674
+ id: 'fabric.media.open_file_in_viewer',
675
+ defaultMessage: 'Open {name}',
676
+ description: 'Shown when user focuses on preview to open the full screen viewer of the file with {name}'
672
677
  }
673
678
  });
@@ -1,4 +1,8 @@
1
1
  import { hideControlsClassName } from '../classNames';
2
- export var getControlsWrapperClassName = function getControlsWrapperClassName(wasPlayedOnce) {
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+ export var getControlsWrapperClassName = function getControlsWrapperClassName(wasPlayedOnce, areVideoControlsFocused) {
4
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
5
+ return !wasPlayedOnce || areVideoControlsFocused ? '' : hideControlsClassName;
6
+ }
3
7
  return !wasPlayedOnce ? '' : hideControlsClassName;
4
8
  };
@@ -23,6 +23,7 @@ import SoundIcon from '@atlaskit/icon/glyph/hipchat/outgoing-sound';
23
23
  import HDIcon from '@atlaskit/icon/glyph/vid-hd-circle';
24
24
  import DownloadIcon from '@atlaskit/icon/glyph/download';
25
25
  import { withMediaAnalyticsContext } from '@atlaskit/media-common';
26
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
26
27
  import MediaButton from '../MediaButton';
27
28
  import Spinner from '@atlaskit/spinner';
28
29
  import { WidthObserver } from '@atlaskit/width-detector';
@@ -44,7 +45,7 @@ import Tooltip from '@atlaskit/tooltip';
44
45
  import { SkipTenBackwardIcon, SkipTenForwardIcon } from './icons';
45
46
  import { getControlsWrapperClassName } from './getControlsWrapperClassName';
46
47
  var packageName = "@atlaskit/media-ui";
47
- var packageVersion = "25.0.13";
48
+ var packageVersion = "25.2.0";
48
49
  var MEDIUM_VIDEO_MAX_WIDTH = 400;
49
50
  var SMALL_VIDEO_MAX_WIDTH = 160;
50
51
  var MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
@@ -60,6 +61,8 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
60
61
  }
61
62
  _this = _super.call.apply(_super, [this].concat(args));
62
63
  _defineProperty(_assertThisInitialized(_this), "videoWrapperRef", /*#__PURE__*/React.createRef());
64
+ _defineProperty(_assertThisInitialized(_this), "controlsWrapperRef", /*#__PURE__*/React.createRef());
65
+ _defineProperty(_assertThisInitialized(_this), "videoPlayPauseButtonRef", /*#__PURE__*/React.createRef());
63
66
  _defineProperty(_assertThisInitialized(_this), "videoState", {
64
67
  isLoading: true,
65
68
  buffered: 0,
@@ -75,7 +78,8 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
75
78
  _defineProperty(_assertThisInitialized(_this), "state", {
76
79
  isFullScreenEnabled: false,
77
80
  playerSize: 'large',
78
- playbackSpeed: 1
81
+ playbackSpeed: 1,
82
+ areVideoControlsFocused: false
79
83
  });
80
84
  _defineProperty(_assertThisInitialized(_this), "fireFirstPlayedTrackEvent", function () {
81
85
  var _this$props = _this.props,
@@ -98,6 +102,14 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
98
102
  playbackSpeed: playbackSpeed
99
103
  }, fileId), createAnalyticsEvent);
100
104
  });
105
+ _defineProperty(_assertThisInitialized(_this), "onFocusChange", function () {
106
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
107
+ //Check if element or any of it's children is focused
108
+ _this.setState({
109
+ areVideoControlsFocused: !!_this.controlsWrapperRef.current && !!_this.controlsWrapperRef.current.contains(document.activeElement)
110
+ });
111
+ }
112
+ });
101
113
  _defineProperty(_assertThisInitialized(_this), "onFullScreenChange", function (e) {
102
114
  if (e.target !== _this.videoWrapperRef.current) {
103
115
  return;
@@ -112,6 +124,15 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
112
124
  });
113
125
  }
114
126
  });
127
+ _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
128
+ if (event.shiftKey && (event.key === 'F10' || event.keyCode === 121) && _this.videoPlayPauseButtonRef.current && _this.props.isVideoSelected) {
129
+ event.preventDefault();
130
+ _this.videoPlayPauseButtonRef.current.focus();
131
+ if (_this.props.showControls) {
132
+ _this.props.showControls();
133
+ }
134
+ }
135
+ });
115
136
  _defineProperty(_assertThisInitialized(_this), "onTimeChanged", function () {
116
137
  _this.createAndFireUIEvent('timeRangeNavigate', 'time');
117
138
  });
@@ -297,6 +318,7 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
297
318
  testId: "custom-media-player-play-toggle-button",
298
319
  "data-test-is-playing": isPlaying,
299
320
  iconBefore: toggleButtonIcon,
321
+ buttonRef: _this.videoPlayPauseButtonRef,
300
322
  onClick: isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
301
323
  }));
302
324
  });
@@ -444,6 +466,11 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
444
466
  if (this.videoWrapperRef.current) {
445
467
  this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
446
468
  }
469
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
470
+ document.addEventListener('keydown', this.handleKeyDown);
471
+ window.addEventListener('focus', this.onFocusChange, true);
472
+ window.addEventListener('blur', this.onFocusChange, true);
473
+ }
447
474
  simultaneousPlayManager.subscribe(this);
448
475
  if (isAutoPlay) {
449
476
  simultaneousPlayManager.pauseOthers(this);
@@ -464,6 +491,11 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
464
491
  var _this$props$onFullscr2, _this$props7;
465
492
  (_this$props$onFullscr2 = (_this$props7 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 || _this$props$onFullscr2.call(_this$props7, false);
466
493
  }
494
+ if (getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh')) {
495
+ document.removeEventListener('keydown', this.handleKeyDown);
496
+ window.removeEventListener('focus', this.onFocusChange, true);
497
+ window.removeEventListener('blur', this.onFocusChange, true);
498
+ }
467
499
  simultaneousPlayManager.unsubscribe(this);
468
500
  }
469
501
  }, {
@@ -586,7 +618,8 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
586
618
  onClick: isPlaying ? _this2.pausePlayByBlanketClick : _this2.startPlayByBlanketClick,
587
619
  "data-testid": "play-pause-blanket"
588
620
  }, video), /*#__PURE__*/React.createElement(ControlsWrapper, {
589
- className: getControlsWrapperClassName(_this2.wasPlayedOnce)
621
+ ref: _this2.controlsWrapperRef,
622
+ className: getBooleanFF('platform.editor.a11y_video_controls_keyboard_support_yhcxh') ? getControlsWrapperClassName(_this2.wasPlayedOnce, _this2.state.areVideoControlsFocused) : getControlsWrapperClassName(_this2.wasPlayedOnce)
590
623
  }, /*#__PURE__*/React.createElement(TimeWrapper, null, /*#__PURE__*/React.createElement(TimeRange, {
591
624
  currentTime: currentTime,
592
625
  bufferedTime: buffered,
@@ -669,5 +669,10 @@ export var messages = defineMessages({
669
669
  id: 'fabric.media.file_is_selected',
670
670
  defaultMessage: 'File {name} is selected',
671
671
  description: '{name} it is the parameter, which saying alt text or file name of uploaded file'
672
+ },
673
+ open_file_in_viewer: {
674
+ id: 'fabric.media.open_file_in_viewer',
675
+ defaultMessage: 'Open {name}',
676
+ description: 'Shown when user focuses on preview to open the full screen viewer of the file with {name}'
672
677
  }
673
678
  });
@@ -1 +1 @@
1
- export declare const getControlsWrapperClassName: (wasPlayedOnce: boolean) => "mvng-hide-controls" | "";
1
+ export declare const getControlsWrapperClassName: (wasPlayedOnce: boolean, areVideoControlsFocused?: boolean) => "mvng-hide-controls" | "";
@@ -23,12 +23,16 @@ export interface CustomMediaPlayerProps extends WithPlaybackProps, WithShowContr
23
23
  readonly originalDimensions?: NumericalCardDimensions;
24
24
  readonly featureFlags?: MediaFeatureFlags;
25
25
  readonly poster?: string;
26
+ readonly isVideoSelected?: boolean;
26
27
  }
27
28
  export interface CustomMediaPlayerState extends WithMediaPlayerState {
29
+ areVideoControlsFocused: boolean;
28
30
  }
29
31
  export type Action = () => void;
30
32
  export declare class CustomMediaPlayerBase extends Component<CustomMediaPlayerProps & WrappedComponentProps & WithAnalyticsEventsProps, CustomMediaPlayerState> {
31
33
  videoWrapperRef: React.RefObject<HTMLDivElement>;
34
+ controlsWrapperRef: React.RefObject<HTMLDivElement>;
35
+ videoPlayPauseButtonRef: React.RefObject<HTMLButtonElement>;
32
36
  private actions?;
33
37
  private videoState;
34
38
  private wasPlayedOnce;
@@ -39,7 +43,9 @@ export declare class CustomMediaPlayerBase extends Component<CustomMediaPlayerPr
39
43
  componentDidMount(): void;
40
44
  private fireFirstPlayedTrackEvent;
41
45
  componentWillUnmount(): void;
46
+ onFocusChange: () => void;
42
47
  private onFullScreenChange;
48
+ private handleKeyDown;
43
49
  private onTimeChanged;
44
50
  private onVolumeChanged;
45
51
  private onCurrentTimeChange;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'request_access_description' | 'click_to_join_description' | 'request_access_pending_description' | 'click_to_join' | 'request_access' | 'request_access_pending' | 'forbidden_description' | 'request_denied_description';
3
- export type MessageKey = 'retry' | 'failed_to_load' | 'failed_to_upload' | 'recent_uploads' | 'upload_file' | 'drag_and_drop_your_files' | 'drag_and_drop_your_files_and_folders' | 'drop_your_files' | 'upload' | 'cancel' | 'search_all_gifs' | 'cant_retrieve_gifs' | 'cant_retrieve_files' | 'check_your_network' | 'try_again' | 'try_another_account' | 'no_gifs_found' | 'no_gifs_found_suggestion' | 'load_more_gifs' | 'add_account' | 'unlink_account' | 'upload_file_from' | 'connect_to' | 'connect_account_description' | 'connect_link_account' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'invalid_permissions' | 'invalid_permissions_description' | 'select_an_avatar' | 'upload_an_avatar' | 'or_select_default_avatars' | 'select_an_avatar_from_all_defaults' | 'show_more_avatars_btn_label' | 'loading' | 'loading_file' | 'save' | 'or' | 'upload_photo' | 'default_avatars' | 'avatar_picker_back_btn_label' | 'drag_and_drop_images_here' | 'upload_image' | 'image_url_invalid_error' | 'image_format_invalid_error' | 'image_size_too_large_error' | 'something_went_wrong' | 'might_be_a_hiccup' | 'couldnt_generate_preview' | 'couldnt_generate_encrypted_entry_preview' | 'cant_preview_file_type' | 'item_not_found_in_list' | 'not_found_title' | 'not_found_description' | 'no_pdf_artifacts' | 'give_feedback' | 'try_downloading_file' | 'webgl_warning_description' | 'unable_to_annotate_image' | 'learn_more' | 'accounts' | 'actions' | 'error_hint_retry' | 'error_hint_critical' | 'close' | 'could_not_load_editor' | 'could_not_save_image' | 'could_not_load_link' | 'annotate' | 'annotate_tool_arrow' | 'annotate_tool_text' | 'annotate_tool_shape' | 'annotate_tool_brush' | 'annotate_tool_blur' | 'annotate_tool_line_thickness' | 'annotate_tool_color' | 'annotate_confirmation_close_anyway' | 'annotate_confirmation_heading' | 'annotate_confirmation_content' | 'drop_your_files_here' | 'share_files_instantly' | 'insert_files' | 'zoom_out' | 'zoom_in' | 'remove_image' | 'play' | 'pause' | 'disable_fullscreen' | 'enable_fullscreen' | 'error_loading_file' | 'error_generating_preview' | 'download' | 'unknown' | 'document' | 'audio' | 'video' | 'image' | 'archive' | 'email' | 'text' | 'displayThumbnail' | 'search' | 'view' | 'viewIn' | 'viewOriginal' | 'changeView' | 'playbackSpeed' | 'skipBackward' | 'skipForward' | 'playbackDefaultSpeed' | 'preview' | 'preview_unavailable' | 'preview_currently_unavailable' | 'creating_preview' | 'couldnt_load_file' | 'error_429' | 'close_and_reopen' | 'viewer_rateLimited' | 'zip_entry_load_fail' | 'file_image_is_selected' | 'file_video_is_selected' | 'file_audio_is_selected' | 'file_doc_is_selected' | 'file_archive_is_selected' | 'file_unknown_is_selected' | RequestAccessMessageKey;
3
+ export type MessageKey = 'retry' | 'failed_to_load' | 'failed_to_upload' | 'recent_uploads' | 'upload_file' | 'drag_and_drop_your_files' | 'drag_and_drop_your_files_and_folders' | 'drop_your_files' | 'upload' | 'cancel' | 'search_all_gifs' | 'cant_retrieve_gifs' | 'cant_retrieve_files' | 'check_your_network' | 'try_again' | 'try_another_account' | 'no_gifs_found' | 'no_gifs_found_suggestion' | 'load_more_gifs' | 'add_account' | 'unlink_account' | 'upload_file_from' | 'connect_to' | 'connect_account_description' | 'connect_link_account' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'invalid_permissions' | 'invalid_permissions_description' | 'select_an_avatar' | 'upload_an_avatar' | 'or_select_default_avatars' | 'select_an_avatar_from_all_defaults' | 'show_more_avatars_btn_label' | 'loading' | 'loading_file' | 'save' | 'or' | 'upload_photo' | 'default_avatars' | 'avatar_picker_back_btn_label' | 'drag_and_drop_images_here' | 'upload_image' | 'image_url_invalid_error' | 'image_format_invalid_error' | 'image_size_too_large_error' | 'something_went_wrong' | 'might_be_a_hiccup' | 'couldnt_generate_preview' | 'couldnt_generate_encrypted_entry_preview' | 'cant_preview_file_type' | 'item_not_found_in_list' | 'not_found_title' | 'not_found_description' | 'no_pdf_artifacts' | 'give_feedback' | 'try_downloading_file' | 'webgl_warning_description' | 'unable_to_annotate_image' | 'learn_more' | 'accounts' | 'actions' | 'error_hint_retry' | 'error_hint_critical' | 'close' | 'could_not_load_editor' | 'could_not_save_image' | 'could_not_load_link' | 'annotate' | 'annotate_tool_arrow' | 'annotate_tool_text' | 'annotate_tool_shape' | 'annotate_tool_brush' | 'annotate_tool_blur' | 'annotate_tool_line_thickness' | 'annotate_tool_color' | 'annotate_confirmation_close_anyway' | 'annotate_confirmation_heading' | 'annotate_confirmation_content' | 'drop_your_files_here' | 'share_files_instantly' | 'insert_files' | 'zoom_out' | 'zoom_in' | 'remove_image' | 'play' | 'pause' | 'disable_fullscreen' | 'enable_fullscreen' | 'error_loading_file' | 'error_generating_preview' | 'download' | 'unknown' | 'document' | 'audio' | 'video' | 'image' | 'archive' | 'email' | 'text' | 'displayThumbnail' | 'search' | 'view' | 'viewIn' | 'viewOriginal' | 'changeView' | 'playbackSpeed' | 'skipBackward' | 'skipForward' | 'playbackDefaultSpeed' | 'preview' | 'preview_unavailable' | 'preview_currently_unavailable' | 'creating_preview' | 'couldnt_load_file' | 'error_429' | 'close_and_reopen' | 'viewer_rateLimited' | 'zip_entry_load_fail' | 'file_image_is_selected' | 'file_video_is_selected' | 'file_audio_is_selected' | 'file_doc_is_selected' | 'file_archive_is_selected' | 'file_unknown_is_selected' | 'open_file_in_viewer' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -1 +1 @@
1
- export declare const getControlsWrapperClassName: (wasPlayedOnce: boolean) => "mvng-hide-controls" | "";
1
+ export declare const getControlsWrapperClassName: (wasPlayedOnce: boolean, areVideoControlsFocused?: boolean) => "mvng-hide-controls" | "";
@@ -23,12 +23,16 @@ export interface CustomMediaPlayerProps extends WithPlaybackProps, WithShowContr
23
23
  readonly originalDimensions?: NumericalCardDimensions;
24
24
  readonly featureFlags?: MediaFeatureFlags;
25
25
  readonly poster?: string;
26
+ readonly isVideoSelected?: boolean;
26
27
  }
27
28
  export interface CustomMediaPlayerState extends WithMediaPlayerState {
29
+ areVideoControlsFocused: boolean;
28
30
  }
29
31
  export type Action = () => void;
30
32
  export declare class CustomMediaPlayerBase extends Component<CustomMediaPlayerProps & WrappedComponentProps & WithAnalyticsEventsProps, CustomMediaPlayerState> {
31
33
  videoWrapperRef: React.RefObject<HTMLDivElement>;
34
+ controlsWrapperRef: React.RefObject<HTMLDivElement>;
35
+ videoPlayPauseButtonRef: React.RefObject<HTMLButtonElement>;
32
36
  private actions?;
33
37
  private videoState;
34
38
  private wasPlayedOnce;
@@ -39,7 +43,9 @@ export declare class CustomMediaPlayerBase extends Component<CustomMediaPlayerPr
39
43
  componentDidMount(): void;
40
44
  private fireFirstPlayedTrackEvent;
41
45
  componentWillUnmount(): void;
46
+ onFocusChange: () => void;
42
47
  private onFullScreenChange;
48
+ private handleKeyDown;
43
49
  private onTimeChanged;
44
50
  private onVolumeChanged;
45
51
  private onCurrentTimeChange;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'request_access_description' | 'click_to_join_description' | 'request_access_pending_description' | 'click_to_join' | 'request_access' | 'request_access_pending' | 'forbidden_description' | 'request_denied_description';
3
- export type MessageKey = 'retry' | 'failed_to_load' | 'failed_to_upload' | 'recent_uploads' | 'upload_file' | 'drag_and_drop_your_files' | 'drag_and_drop_your_files_and_folders' | 'drop_your_files' | 'upload' | 'cancel' | 'search_all_gifs' | 'cant_retrieve_gifs' | 'cant_retrieve_files' | 'check_your_network' | 'try_again' | 'try_another_account' | 'no_gifs_found' | 'no_gifs_found_suggestion' | 'load_more_gifs' | 'add_account' | 'unlink_account' | 'upload_file_from' | 'connect_to' | 'connect_account_description' | 'connect_link_account' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'invalid_permissions' | 'invalid_permissions_description' | 'select_an_avatar' | 'upload_an_avatar' | 'or_select_default_avatars' | 'select_an_avatar_from_all_defaults' | 'show_more_avatars_btn_label' | 'loading' | 'loading_file' | 'save' | 'or' | 'upload_photo' | 'default_avatars' | 'avatar_picker_back_btn_label' | 'drag_and_drop_images_here' | 'upload_image' | 'image_url_invalid_error' | 'image_format_invalid_error' | 'image_size_too_large_error' | 'something_went_wrong' | 'might_be_a_hiccup' | 'couldnt_generate_preview' | 'couldnt_generate_encrypted_entry_preview' | 'cant_preview_file_type' | 'item_not_found_in_list' | 'not_found_title' | 'not_found_description' | 'no_pdf_artifacts' | 'give_feedback' | 'try_downloading_file' | 'webgl_warning_description' | 'unable_to_annotate_image' | 'learn_more' | 'accounts' | 'actions' | 'error_hint_retry' | 'error_hint_critical' | 'close' | 'could_not_load_editor' | 'could_not_save_image' | 'could_not_load_link' | 'annotate' | 'annotate_tool_arrow' | 'annotate_tool_text' | 'annotate_tool_shape' | 'annotate_tool_brush' | 'annotate_tool_blur' | 'annotate_tool_line_thickness' | 'annotate_tool_color' | 'annotate_confirmation_close_anyway' | 'annotate_confirmation_heading' | 'annotate_confirmation_content' | 'drop_your_files_here' | 'share_files_instantly' | 'insert_files' | 'zoom_out' | 'zoom_in' | 'remove_image' | 'play' | 'pause' | 'disable_fullscreen' | 'enable_fullscreen' | 'error_loading_file' | 'error_generating_preview' | 'download' | 'unknown' | 'document' | 'audio' | 'video' | 'image' | 'archive' | 'email' | 'text' | 'displayThumbnail' | 'search' | 'view' | 'viewIn' | 'viewOriginal' | 'changeView' | 'playbackSpeed' | 'skipBackward' | 'skipForward' | 'playbackDefaultSpeed' | 'preview' | 'preview_unavailable' | 'preview_currently_unavailable' | 'creating_preview' | 'couldnt_load_file' | 'error_429' | 'close_and_reopen' | 'viewer_rateLimited' | 'zip_entry_load_fail' | 'file_image_is_selected' | 'file_video_is_selected' | 'file_audio_is_selected' | 'file_doc_is_selected' | 'file_archive_is_selected' | 'file_unknown_is_selected' | RequestAccessMessageKey;
3
+ export type MessageKey = 'retry' | 'failed_to_load' | 'failed_to_upload' | 'recent_uploads' | 'upload_file' | 'drag_and_drop_your_files' | 'drag_and_drop_your_files_and_folders' | 'drop_your_files' | 'upload' | 'cancel' | 'search_all_gifs' | 'cant_retrieve_gifs' | 'cant_retrieve_files' | 'check_your_network' | 'try_again' | 'try_another_account' | 'no_gifs_found' | 'no_gifs_found_suggestion' | 'load_more_gifs' | 'add_account' | 'unlink_account' | 'upload_file_from' | 'connect_to' | 'connect_account_description' | 'connect_link_account' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'invalid_permissions' | 'invalid_permissions_description' | 'select_an_avatar' | 'upload_an_avatar' | 'or_select_default_avatars' | 'select_an_avatar_from_all_defaults' | 'show_more_avatars_btn_label' | 'loading' | 'loading_file' | 'save' | 'or' | 'upload_photo' | 'default_avatars' | 'avatar_picker_back_btn_label' | 'drag_and_drop_images_here' | 'upload_image' | 'image_url_invalid_error' | 'image_format_invalid_error' | 'image_size_too_large_error' | 'something_went_wrong' | 'might_be_a_hiccup' | 'couldnt_generate_preview' | 'couldnt_generate_encrypted_entry_preview' | 'cant_preview_file_type' | 'item_not_found_in_list' | 'not_found_title' | 'not_found_description' | 'no_pdf_artifacts' | 'give_feedback' | 'try_downloading_file' | 'webgl_warning_description' | 'unable_to_annotate_image' | 'learn_more' | 'accounts' | 'actions' | 'error_hint_retry' | 'error_hint_critical' | 'close' | 'could_not_load_editor' | 'could_not_save_image' | 'could_not_load_link' | 'annotate' | 'annotate_tool_arrow' | 'annotate_tool_text' | 'annotate_tool_shape' | 'annotate_tool_brush' | 'annotate_tool_blur' | 'annotate_tool_line_thickness' | 'annotate_tool_color' | 'annotate_confirmation_close_anyway' | 'annotate_confirmation_heading' | 'annotate_confirmation_content' | 'drop_your_files_here' | 'share_files_instantly' | 'insert_files' | 'zoom_out' | 'zoom_in' | 'remove_image' | 'play' | 'pause' | 'disable_fullscreen' | 'enable_fullscreen' | 'error_loading_file' | 'error_generating_preview' | 'download' | 'unknown' | 'document' | 'audio' | 'video' | 'image' | 'archive' | 'email' | 'text' | 'displayThumbnail' | 'search' | 'view' | 'viewIn' | 'viewOriginal' | 'changeView' | 'playbackSpeed' | 'skipBackward' | 'skipForward' | 'playbackDefaultSpeed' | 'preview' | 'preview_unavailable' | 'preview_currently_unavailable' | 'creating_preview' | 'couldnt_load_file' | 'error_429' | 'close_and_reopen' | 'viewer_rateLimited' | 'zip_entry_load_fail' | 'file_image_is_selected' | 'file_video_is_selected' | 'file_audio_is_selected' | 'file_doc_is_selected' | 'file_archive_is_selected' | 'file_unknown_is_selected' | 'open_file_in_viewer' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/media-ui",
3
- "version": "25.0.13",
3
+ "version": "25.2.0",
4
4
  "description": "Includes common components and utilities used by other media packages",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -23,17 +23,18 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/analytics-next": "^9.1.0",
27
- "@atlaskit/button": "^17.1.0",
26
+ "@atlaskit/analytics-next": "^9.2.0",
27
+ "@atlaskit/button": "^17.5.0",
28
28
  "@atlaskit/code": "^15.1.0",
29
- "@atlaskit/icon": "^22.0.0",
29
+ "@atlaskit/icon": "^22.1.0",
30
30
  "@atlaskit/icon-file-type": "^6.4.0",
31
31
  "@atlaskit/locale": "^2.6.0",
32
32
  "@atlaskit/media-common": "^11.0.0",
33
- "@atlaskit/select": "^17.0.3",
33
+ "@atlaskit/platform-feature-flags": "^0.2.5",
34
+ "@atlaskit/select": "^17.1.0",
34
35
  "@atlaskit/spinner": "^16.0.0",
35
36
  "@atlaskit/theme": "^12.6.0",
36
- "@atlaskit/tokens": "^1.33.0",
37
+ "@atlaskit/tokens": "^1.38.0",
37
38
  "@atlaskit/tooltip": "^18.1.0",
38
39
  "@atlaskit/width-detector": "^4.1.0",
39
40
  "@babel/runtime": "^7.0.0",
@@ -52,7 +53,7 @@
52
53
  },
53
54
  "devDependencies": {
54
55
  "@af/visual-regression": "*",
55
- "@atlaskit/analytics-listeners": "^8.7.0",
56
+ "@atlaskit/analytics-listeners": "^8.9.0",
56
57
  "@atlaskit/ssr": "*",
57
58
  "@atlaskit/visual-regression": "*",
58
59
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -110,5 +111,10 @@
110
111
  "./locales": "./src/locales.ts",
111
112
  ".": "./src/index.ts"
112
113
  },
113
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
114
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
115
+ "platform-feature-flags": {
116
+ "platform.editor.a11y_video_controls_keyboard_support_yhcxh": {
117
+ "type": "boolean"
118
+ }
119
+ }
114
120
  }