@atlaskit/media-ui 22.3.0 → 22.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/MediaButton.js +12 -29
  3. package/dist/cjs/MediaInlineCard/ErroredView/index.js +5 -32
  4. package/dist/cjs/MediaInlineCard/Frame/index.js +4 -27
  5. package/dist/cjs/MediaInlineCard/Frame/styled.js +1 -12
  6. package/dist/cjs/MediaInlineCard/Icon.js +3 -10
  7. package/dist/cjs/MediaInlineCard/IconAndTitleLayout/index.js +7 -35
  8. package/dist/cjs/MediaInlineCard/IconAndTitleLayout/styled.js +15 -33
  9. package/dist/cjs/MediaInlineCard/LoadedView/index.js +8 -24
  10. package/dist/cjs/MediaInlineCard/LoadingView/index.js +6 -26
  11. package/dist/cjs/MediaInlineCard/LoadingView/styled.js +0 -6
  12. package/dist/cjs/MediaInlineCard/index.js +0 -3
  13. package/dist/cjs/MediaInlineCard/styled.js +0 -7
  14. package/dist/cjs/browser.js +1 -5
  15. package/dist/cjs/camera.js +14 -36
  16. package/dist/cjs/codeViewer.js +1 -46
  17. package/dist/cjs/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +0 -7
  18. package/dist/cjs/customMediaPlayer/analytics/events/track/playCount.js +0 -7
  19. package/dist/cjs/customMediaPlayer/analytics/events/track/played.js +0 -7
  20. package/dist/cjs/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +0 -6
  21. package/dist/cjs/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +0 -6
  22. package/dist/cjs/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +0 -6
  23. package/dist/cjs/customMediaPlayer/analytics/events/ui/shortcutPressed.js +0 -6
  24. package/dist/cjs/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +0 -6
  25. package/dist/cjs/customMediaPlayer/analytics/index.js +0 -9
  26. package/dist/cjs/customMediaPlayer/analytics/utils/analytics.js +4 -8
  27. package/dist/cjs/customMediaPlayer/analytics/utils/playbackAttributes.js +10 -12
  28. package/dist/cjs/customMediaPlayer/fullscreen.js +4 -20
  29. package/dist/cjs/customMediaPlayer/getControlsWrapperClassName.js +0 -3
  30. package/dist/cjs/customMediaPlayer/icons.js +0 -8
  31. package/dist/cjs/customMediaPlayer/index.js +54 -157
  32. package/dist/cjs/customMediaPlayer/playPauseBlanket.js +0 -6
  33. package/dist/cjs/customMediaPlayer/playbackSpeedControls.js +7 -45
  34. package/dist/cjs/customMediaPlayer/simultaneousPlayManager.js +0 -4
  35. package/dist/cjs/customMediaPlayer/styled.js +0 -43
  36. package/dist/cjs/customMediaPlayer/timeRange.js +24 -55
  37. package/dist/cjs/customMediaPlayer/timeSaver.js +5 -12
  38. package/dist/cjs/ellipsify.js +4 -25
  39. package/dist/cjs/errorIcon.js +1 -5
  40. package/dist/cjs/formatDate.js +6 -12
  41. package/dist/cjs/formatDuration.js +0 -5
  42. package/dist/cjs/humanReadableSize.js +1 -6
  43. package/dist/cjs/i18n/cs.js +0 -1
  44. package/dist/cjs/i18n/da.js +0 -1
  45. package/dist/cjs/i18n/de.js +0 -1
  46. package/dist/cjs/i18n/en.js +0 -1
  47. package/dist/cjs/i18n/en_GB.js +0 -1
  48. package/dist/cjs/i18n/en_ZZ.js +0 -1
  49. package/dist/cjs/i18n/es.js +0 -1
  50. package/dist/cjs/i18n/et.js +0 -1
  51. package/dist/cjs/i18n/fi.js +0 -1
  52. package/dist/cjs/i18n/fr.js +0 -1
  53. package/dist/cjs/i18n/hu.js +0 -1
  54. package/dist/cjs/i18n/index.js +0 -30
  55. package/dist/cjs/i18n/it.js +0 -1
  56. package/dist/cjs/i18n/ja.js +0 -1
  57. package/dist/cjs/i18n/ko.js +0 -1
  58. package/dist/cjs/i18n/nb.js +0 -1
  59. package/dist/cjs/i18n/nl.js +0 -1
  60. package/dist/cjs/i18n/pl.js +0 -1
  61. package/dist/cjs/i18n/pt_BR.js +0 -1
  62. package/dist/cjs/i18n/pt_PT.js +0 -1
  63. package/dist/cjs/i18n/ru.js +0 -1
  64. package/dist/cjs/i18n/sk.js +0 -1
  65. package/dist/cjs/i18n/sv.js +0 -1
  66. package/dist/cjs/i18n/th.js +0 -1
  67. package/dist/cjs/i18n/tr.js +0 -1
  68. package/dist/cjs/i18n/uk.js +0 -1
  69. package/dist/cjs/i18n/vi.js +0 -1
  70. package/dist/cjs/i18n/zh.js +0 -1
  71. package/dist/cjs/i18n/zh_TW.js +0 -1
  72. package/dist/cjs/imageMetaData/imageOrientationUtil.js +1 -5
  73. package/dist/cjs/imageMetaData/index.js +8 -50
  74. package/dist/cjs/imageMetaData/metatags.js +0 -23
  75. package/dist/cjs/imageMetaData/parseJPEG.js +1 -18
  76. package/dist/cjs/imageMetaData/parsePNG.js +0 -30
  77. package/dist/cjs/imageMetaData/parsePNGXMP.js +0 -4
  78. package/dist/cjs/imageMetaData/types.js +0 -5
  79. package/dist/cjs/inactivityDetector/inactivityDetector.js +5 -34
  80. package/dist/cjs/inactivityDetector/styled.js +0 -8
  81. package/dist/cjs/index.js +0 -29
  82. package/dist/cjs/intersectionObserver.js +0 -2
  83. package/dist/cjs/locales.js +0 -5
  84. package/dist/cjs/media-type-icon.js +3 -35
  85. package/dist/cjs/mediaImage/index.js +28 -62
  86. package/dist/cjs/mediaImage/styled.js +2 -13
  87. package/dist/cjs/messages.js +0 -2
  88. package/dist/cjs/mime-type-icon.js +13 -18
  89. package/dist/cjs/mixins.js +0 -11
  90. package/dist/cjs/modalSpinner.js +1 -15
  91. package/dist/cjs/shortcut.js +3 -25
  92. package/dist/cjs/truncateText.js +12 -33
  93. package/dist/cjs/util.js +16 -72
  94. package/dist/cjs/version.json +1 -1
  95. package/dist/es2019/MediaButton.js +8 -11
  96. package/dist/es2019/MediaInlineCard/ErroredView/index.js +0 -3
  97. package/dist/es2019/MediaInlineCard/Frame/index.js +0 -8
  98. package/dist/es2019/MediaInlineCard/Frame/styled.js +1 -3
  99. package/dist/es2019/MediaInlineCard/Icon.js +6 -4
  100. package/dist/es2019/MediaInlineCard/IconAndTitleLayout/index.js +0 -14
  101. package/dist/es2019/MediaInlineCard/IconAndTitleLayout/styled.js +19 -13
  102. package/dist/es2019/MediaInlineCard/LoadedView/index.js +0 -1
  103. package/dist/es2019/MediaInlineCard/LoadingView/index.js +0 -2
  104. package/dist/es2019/browser.js +1 -5
  105. package/dist/es2019/camera.js +9 -52
  106. package/dist/es2019/codeViewer.js +1 -42
  107. package/dist/es2019/customMediaPlayer/analytics/utils/analytics.js +4 -2
  108. package/dist/es2019/customMediaPlayer/fullscreen.js +4 -9
  109. package/dist/es2019/customMediaPlayer/icons.js +0 -4
  110. package/dist/es2019/customMediaPlayer/index.js +9 -85
  111. package/dist/es2019/customMediaPlayer/playbackSpeedControls.js +14 -20
  112. package/dist/es2019/customMediaPlayer/simultaneousPlayManager.js +0 -4
  113. package/dist/es2019/customMediaPlayer/timeRange.js +12 -29
  114. package/dist/es2019/customMediaPlayer/timeSaver.js +5 -9
  115. package/dist/es2019/ellipsify.js +0 -8
  116. package/dist/es2019/formatDuration.js +0 -3
  117. package/dist/es2019/humanReadableSize.js +3 -2
  118. package/dist/es2019/imageMetaData/imageOrientationUtil.js +1 -2
  119. package/dist/es2019/imageMetaData/index.js +10 -24
  120. package/dist/es2019/imageMetaData/metatags.js +4 -4
  121. package/dist/es2019/imageMetaData/parseJPEG.js +0 -3
  122. package/dist/es2019/imageMetaData/parsePNG.js +5 -10
  123. package/dist/es2019/imageMetaData/parsePNGXMP.js +0 -3
  124. package/dist/es2019/imageMetaData/types.js +0 -5
  125. package/dist/es2019/inactivityDetector/inactivityDetector.js +5 -15
  126. package/dist/es2019/inactivityDetector/styled.js +0 -2
  127. package/dist/es2019/media-type-icon.js +0 -2
  128. package/dist/es2019/mediaImage/index.js +10 -24
  129. package/dist/es2019/mediaImage/styled.js +2 -1
  130. package/dist/es2019/mime-type-icon.js +5 -5
  131. package/dist/es2019/shortcut.js +0 -9
  132. package/dist/es2019/truncateText.js +1 -9
  133. package/dist/es2019/util.js +14 -26
  134. package/dist/es2019/version.json +1 -1
  135. package/dist/esm/MediaButton.js +12 -22
  136. package/dist/esm/MediaInlineCard/ErroredView/index.js +5 -17
  137. package/dist/esm/MediaInlineCard/Frame/index.js +4 -21
  138. package/dist/esm/MediaInlineCard/Frame/styled.js +1 -6
  139. package/dist/esm/MediaInlineCard/Icon.js +4 -4
  140. package/dist/esm/MediaInlineCard/IconAndTitleLayout/index.js +7 -24
  141. package/dist/esm/MediaInlineCard/IconAndTitleLayout/styled.js +17 -13
  142. package/dist/esm/MediaInlineCard/LoadedView/index.js +8 -16
  143. package/dist/esm/MediaInlineCard/LoadingView/index.js +6 -15
  144. package/dist/esm/MediaInlineCard/LoadingView/styled.js +0 -2
  145. package/dist/esm/MediaInlineCard/styled.js +0 -2
  146. package/dist/esm/browser.js +1 -5
  147. package/dist/esm/camera.js +14 -31
  148. package/dist/esm/codeViewer.js +1 -42
  149. package/dist/esm/customMediaPlayer/analytics/events/screen/customMediaPlayer.js +0 -3
  150. package/dist/esm/customMediaPlayer/analytics/events/track/playCount.js +0 -3
  151. package/dist/esm/customMediaPlayer/analytics/events/track/played.js +0 -3
  152. package/dist/esm/customMediaPlayer/analytics/events/ui/mediaButtonClicked.js +0 -3
  153. package/dist/esm/customMediaPlayer/analytics/events/ui/playPauseBlanketClicked.js +0 -3
  154. package/dist/esm/customMediaPlayer/analytics/events/ui/playbackSpeedChanged.js +0 -3
  155. package/dist/esm/customMediaPlayer/analytics/events/ui/shortcutPressed.js +0 -3
  156. package/dist/esm/customMediaPlayer/analytics/events/ui/timeRangeNavigated.js +0 -3
  157. package/dist/esm/customMediaPlayer/analytics/utils/analytics.js +4 -2
  158. package/dist/esm/customMediaPlayer/analytics/utils/playbackAttributes.js +10 -10
  159. package/dist/esm/customMediaPlayer/fullscreen.js +4 -9
  160. package/dist/esm/customMediaPlayer/icons.js +0 -4
  161. package/dist/esm/customMediaPlayer/index.js +54 -153
  162. package/dist/esm/customMediaPlayer/playPauseBlanket.js +0 -2
  163. package/dist/esm/customMediaPlayer/playbackSpeedControls.js +7 -30
  164. package/dist/esm/customMediaPlayer/simultaneousPlayManager.js +0 -4
  165. package/dist/esm/customMediaPlayer/styled.js +0 -2
  166. package/dist/esm/customMediaPlayer/timeRange.js +24 -51
  167. package/dist/esm/customMediaPlayer/timeSaver.js +5 -10
  168. package/dist/esm/ellipsify.js +4 -14
  169. package/dist/esm/formatDate.js +6 -6
  170. package/dist/esm/formatDuration.js +0 -3
  171. package/dist/esm/humanReadableSize.js +3 -2
  172. package/dist/esm/imageMetaData/imageOrientationUtil.js +1 -2
  173. package/dist/esm/imageMetaData/index.js +8 -40
  174. package/dist/esm/imageMetaData/metatags.js +0 -15
  175. package/dist/esm/imageMetaData/parseJPEG.js +1 -8
  176. package/dist/esm/imageMetaData/parsePNG.js +0 -21
  177. package/dist/esm/imageMetaData/parsePNGXMP.js +0 -3
  178. package/dist/esm/imageMetaData/types.js +0 -5
  179. package/dist/esm/inactivityDetector/inactivityDetector.js +5 -25
  180. package/dist/esm/inactivityDetector/styled.js +0 -4
  181. package/dist/esm/media-type-icon.js +3 -13
  182. package/dist/esm/mediaImage/index.js +28 -51
  183. package/dist/esm/mediaImage/styled.js +2 -6
  184. package/dist/esm/mime-type-icon.js +13 -13
  185. package/dist/esm/mixins.js +0 -2
  186. package/dist/esm/modalSpinner.js +1 -3
  187. package/dist/esm/shortcut.js +3 -19
  188. package/dist/esm/truncateText.js +12 -22
  189. package/dist/esm/util.js +16 -46
  190. package/dist/esm/version.json +1 -1
  191. package/package.json +6 -4
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
11
  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; } }
16
-
17
12
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
18
13
  // Keep media player components used in media-viewer to use static colors from the new color palette to
19
14
  // support the hybrid theming in media viewer https://product-fabric.atlassian.net/browse/DSP-6067
@@ -49,29 +44,22 @@ import Tooltip from '@atlaskit/tooltip';
49
44
  import { SkipTenBackwardIcon, SkipTenForwardIcon } from './icons';
50
45
  import { getControlsWrapperClassName } from './getControlsWrapperClassName';
51
46
  var packageName = "@atlaskit/media-ui";
52
- var packageVersion = "22.3.0";
47
+ var packageVersion = "22.3.2";
53
48
  var MEDIUM_VIDEO_MAX_WIDTH = 400;
54
49
  var SMALL_VIDEO_MAX_WIDTH = 160;
55
50
  var MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
56
51
  var VIEWED_TRACKING_SECS = 2;
57
52
  export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
58
53
  _inherits(CustomMediaPlayerBase, _Component);
59
-
60
54
  var _super = _createSuper(CustomMediaPlayerBase);
61
-
62
55
  function CustomMediaPlayerBase() {
63
56
  var _this;
64
-
65
57
  _classCallCheck(this, CustomMediaPlayerBase);
66
-
67
58
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
68
59
  args[_key] = arguments[_key];
69
60
  }
70
-
71
61
  _this = _super.call.apply(_super, [this].concat(args));
72
-
73
62
  _defineProperty(_assertThisInitialized(_this), "videoWrapperRef", /*#__PURE__*/React.createRef());
74
-
75
63
  _defineProperty(_assertThisInitialized(_this), "videoState", {
76
64
  isLoading: true,
77
65
  buffered: 0,
@@ -81,46 +69,34 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
81
69
  duration: 0,
82
70
  isMuted: false
83
71
  });
84
-
85
72
  _defineProperty(_assertThisInitialized(_this), "wasPlayedOnce", false);
86
-
87
73
  _defineProperty(_assertThisInitialized(_this), "lastCurrentTime", 0);
88
-
89
74
  _defineProperty(_assertThisInitialized(_this), "timeSaver", new TimeSaver(_this.props.lastWatchTimeConfig));
90
-
91
75
  _defineProperty(_assertThisInitialized(_this), "state", {
92
76
  isFullScreenEnabled: false,
93
77
  playerSize: 'large',
94
78
  playbackSpeed: 1
95
79
  });
96
-
97
80
  _defineProperty(_assertThisInitialized(_this), "onFullScreenChange", function (e) {
98
81
  if (e.target !== _this.videoWrapperRef.current) {
99
82
  return;
100
83
  }
101
-
102
84
  var currentFullScreenMode = _this.state.isFullScreenEnabled;
103
85
  var isFullScreenEnabled = !!getFullscreenElement();
104
-
105
86
  if (currentFullScreenMode !== isFullScreenEnabled) {
106
87
  var _this$props$onFullscr, _this$props;
107
-
108
88
  (_this$props$onFullscr = (_this$props = _this.props).onFullscreenChange) === null || _this$props$onFullscr === void 0 ? void 0 : _this$props$onFullscr.call(_this$props, isFullScreenEnabled);
109
-
110
89
  _this.setState({
111
90
  isFullScreenEnabled: isFullScreenEnabled
112
91
  });
113
92
  }
114
93
  });
115
-
116
94
  _defineProperty(_assertThisInitialized(_this), "onTimeChanged", function () {
117
95
  _this.createAndFireUIEvent('timeRangeNavigate', 'time');
118
96
  });
119
-
120
97
  _defineProperty(_assertThisInitialized(_this), "onVolumeChanged", function () {
121
98
  _this.createAndFireUIEvent('volumeRangeNavigate', 'volume');
122
99
  });
123
-
124
100
  _defineProperty(_assertThisInitialized(_this), "onCurrentTimeChange", function (currentTime, duration) {
125
101
  if (duration - currentTime > MINIMUM_DURATION_BEFORE_SAVING_TIME) {
126
102
  _this.timeSaver.defaultTime = currentTime;
@@ -128,26 +104,22 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
128
104
  _this.timeSaver.defaultTime = 0;
129
105
  }
130
106
  });
131
-
132
107
  _defineProperty(_assertThisInitialized(_this), "renderCurrentTime", function (_ref) {
133
108
  var currentTime = _ref.currentTime,
134
- duration = _ref.duration;
109
+ duration = _ref.duration;
135
110
  return /*#__PURE__*/React.createElement(CurrentTime, {
136
111
  draggable: false
137
112
  }, formatDuration(currentTime), " / ", formatDuration(duration));
138
113
  });
139
-
140
114
  _defineProperty(_assertThisInitialized(_this), "renderHDButton", function () {
141
115
  var _this$props2 = _this.props,
142
- type = _this$props2.type,
143
- isHDAvailable = _this$props2.isHDAvailable,
144
- isHDActive = _this$props2.isHDActive,
145
- onHDToggleClick = _this$props2.onHDToggleClick;
146
-
116
+ type = _this$props2.type,
117
+ isHDAvailable = _this$props2.isHDAvailable,
118
+ isHDActive = _this$props2.isHDActive,
119
+ onHDToggleClick = _this$props2.onHDToggleClick;
147
120
  if (type === 'audio' || !isHDAvailable) {
148
121
  return;
149
122
  }
150
-
151
123
  var primaryColor = isHDActive ? '#579DFF' : '#c7d1db';
152
124
  var secondaryColor = isHDActive ? N0 : DN60;
153
125
  return /*#__PURE__*/React.createElement(MediaButton, {
@@ -160,21 +132,16 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
160
132
  })
161
133
  });
162
134
  });
163
-
164
135
  _defineProperty(_assertThisInitialized(_this), "onPlaybackSpeedChange", function (playbackSpeed) {
165
136
  if (!_this.actions) {
166
137
  return;
167
138
  }
168
-
169
139
  _this.actions.setPlaybackSpeed(playbackSpeed);
170
-
171
140
  _this.setState({
172
141
  playbackSpeed: playbackSpeed
173
142
  });
174
-
175
143
  _this.createAndFireUIEvent('playbackSpeedChange');
176
144
  });
177
-
178
145
  _defineProperty(_assertThisInitialized(_this), "renderSpeedControls", function () {
179
146
  var playbackSpeed = _this.state.playbackSpeed;
180
147
  var originalDimensions = _this.props.originalDimensions;
@@ -187,7 +154,6 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
187
154
  }
188
155
  });
189
156
  });
190
-
191
157
  _defineProperty(_assertThisInitialized(_this), "renderVolume", function (videoState, actions, showSlider) {
192
158
  return /*#__PURE__*/React.createElement(VolumeWrapper, {
193
159
  showSlider: showSlider
@@ -211,17 +177,13 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
211
177
  onChanged: _this.onVolumeChanged
212
178
  })));
213
179
  });
214
-
215
180
  _defineProperty(_assertThisInitialized(_this), "toggleFullscreen", function () {
216
181
  return _this.videoWrapperRef.current && toggleFullscreen(_this.videoWrapperRef.current);
217
182
  });
218
-
219
183
  _defineProperty(_assertThisInitialized(_this), "onFullScreenButtonClick", function () {
220
184
  _this.toggleFullscreen();
221
-
222
185
  _this.createAndFireUIEvent('mediaButtonClick', 'fullScreenButton');
223
186
  });
224
-
225
187
  _defineProperty(_assertThisInitialized(_this), "onResize", function (width) {
226
188
  if (width > MEDIUM_VIDEO_MAX_WIDTH) {
227
189
  _this.setState({
@@ -237,16 +199,13 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
237
199
  });
238
200
  }
239
201
  });
240
-
241
202
  _defineProperty(_assertThisInitialized(_this), "renderFullScreenButton", function () {
242
203
  var _this$props3 = _this.props,
243
- formatMessage = _this$props3.intl.formatMessage,
244
- type = _this$props3.type;
245
-
204
+ formatMessage = _this$props3.intl.formatMessage,
205
+ type = _this$props3.type;
246
206
  if (type === 'audio') {
247
207
  return;
248
208
  }
249
-
250
209
  var isFullScreenEnabled = _this.state.isFullScreenEnabled;
251
210
  var icon = isFullScreenEnabled ? /*#__PURE__*/React.createElement(FullScreenIconOff, {
252
211
  label: formatMessage(messages.disable_fullscreen)
@@ -259,14 +218,11 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
259
218
  iconBefore: icon
260
219
  });
261
220
  });
262
-
263
221
  _defineProperty(_assertThisInitialized(_this), "renderDownloadButton", function () {
264
222
  var onDownloadClick = _this.props.onDownloadClick;
265
-
266
223
  if (!onDownloadClick) {
267
224
  return;
268
225
  }
269
-
270
226
  return /*#__PURE__*/React.createElement(MediaButton, {
271
227
  testId: "custom-media-player-download-button",
272
228
  onClick: _this.getMediaButtonClickHandler(onDownloadClick, 'downloadButton'),
@@ -275,12 +231,11 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
275
231
  })
276
232
  });
277
233
  });
278
-
279
234
  _defineProperty(_assertThisInitialized(_this), "renderShortcuts", function (_ref2) {
280
235
  var togglePlayPauseAction = _ref2.togglePlayPauseAction,
281
- toggleMute = _ref2.toggleMute,
282
- skipBackward = _ref2.skipBackward,
283
- skipForward = _ref2.skipForward;
236
+ toggleMute = _ref2.toggleMute,
237
+ skipBackward = _ref2.skipBackward,
238
+ skipForward = _ref2.skipForward;
284
239
  var isShortcutEnabled = _this.props.isShortcutEnabled;
285
240
  var isFullScreenEnabled = _this.state.isFullScreenEnabled;
286
241
  var shortcuts = (isShortcutEnabled || isFullScreenEnabled) && [/*#__PURE__*/React.createElement(Shortcut, {
@@ -292,7 +247,6 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
292
247
  code: keyCodes.m,
293
248
  handler: _this.getKeyboardShortcutHandler(toggleMute, 'mute')
294
249
  })];
295
-
296
250
  if (shortcuts && isFullScreenEnabled) {
297
251
  // Fullscreen shortcuts only. We don't want to override left/right keys in media-viewer settings
298
252
  shortcuts.push( /*#__PURE__*/React.createElement(Shortcut, {
@@ -306,10 +260,8 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
306
260
  handler: _this.getKeyboardShortcutHandler(skipForward, 'rightArrow')
307
261
  }));
308
262
  }
309
-
310
263
  return shortcuts;
311
264
  });
312
-
313
265
  _defineProperty(_assertThisInitialized(_this), "renderPlayPauseButton", function (isPlaying) {
314
266
  var formatMessage = _this.props.intl.formatMessage;
315
267
  var toggleButtonIcon = isPlaying ? /*#__PURE__*/React.createElement(PauseIcon, {
@@ -327,7 +279,6 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
327
279
  onClick: isPlaying ? _this.pausePlayByButtonClick : _this.startPlayByButtonClick
328
280
  }));
329
281
  });
330
-
331
282
  _defineProperty(_assertThisInitialized(_this), "renderSkipBackwardButton", function (skipBackward) {
332
283
  var formatMessage = _this.props.intl.formatMessage;
333
284
  return /*#__PURE__*/React.createElement(Tooltip, {
@@ -341,7 +292,6 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
341
292
  onClick: _this.getMediaButtonClickHandler(skipBackward, 'skipBackwardButton')
342
293
  }));
343
294
  });
344
-
345
295
  _defineProperty(_assertThisInitialized(_this), "renderSkipForwardButton", function (skipForward) {
346
296
  var formatMessage = _this.props.intl.formatMessage;
347
297
  return /*#__PURE__*/React.createElement(Tooltip, {
@@ -355,71 +305,58 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
355
305
  onClick: _this.getMediaButtonClickHandler(skipForward, 'skipForwardButton')
356
306
  }));
357
307
  });
358
-
359
308
  _defineProperty(_assertThisInitialized(_this), "renderSpinner", function () {
360
309
  return /*#__PURE__*/React.createElement(SpinnerWrapper, null, /*#__PURE__*/React.createElement(Spinner, {
361
310
  appearance: "invert",
362
311
  size: "large"
363
312
  }));
364
313
  });
365
-
366
314
  _defineProperty(_assertThisInitialized(_this), "pause", function () {
367
315
  if (_this.actions) {
368
316
  _this.actions.pause();
369
317
  }
370
318
  });
371
-
372
319
  _defineProperty(_assertThisInitialized(_this), "play", function () {
373
320
  var onFirstPlay = _this.props.onFirstPlay;
374
-
375
321
  if (_this.actions) {
376
322
  _this.actions.play();
377
323
  }
378
-
379
324
  simultaneousPlayManager.pauseOthers(_assertThisInitialized(_this));
380
-
381
325
  if (!_this.wasPlayedOnce && onFirstPlay) {
382
326
  _this.wasPlayedOnce = true;
383
327
  onFirstPlay();
384
328
  }
385
329
  });
386
-
387
330
  _defineProperty(_assertThisInitialized(_this), "getMediaButtonClickHandler", function (action, buttonType) {
388
331
  return function () {
389
332
  action();
390
-
391
333
  _this.createAndFireUIEvent('mediaButtonClick', buttonType);
392
334
  };
393
335
  });
394
-
395
336
  _defineProperty(_assertThisInitialized(_this), "getKeyboardShortcutHandler", function (action, shortcutType) {
396
337
  return function () {
397
338
  var showControls = _this.props.showControls;
398
339
  action();
399
-
400
340
  if (showControls) {
401
341
  showControls();
402
342
  }
403
-
404
343
  _this.createAndFireUIEvent('shortcutPress', shortcutType);
405
344
  };
406
345
  });
407
-
408
346
  _defineProperty(_assertThisInitialized(_this), "onViewed", function (videoState) {
409
347
  var _this$props4 = _this.props,
410
- createAnalyticsEvent = _this$props4.createAnalyticsEvent,
411
- fileId = _this$props4.fileId,
412
- isAutoPlay = _this$props4.isAutoPlay,
413
- isHDAvailable = _this$props4.isHDAvailable,
414
- isHDActive = _this$props4.isHDActive,
415
- type = _this$props4.type;
348
+ createAnalyticsEvent = _this$props4.createAnalyticsEvent,
349
+ fileId = _this$props4.fileId,
350
+ isAutoPlay = _this$props4.isAutoPlay,
351
+ isHDAvailable = _this$props4.isHDAvailable,
352
+ isHDActive = _this$props4.isHDActive,
353
+ type = _this$props4.type;
416
354
  var _this$state = _this.state,
417
- isFullScreenEnabled = _this$state.isFullScreenEnabled,
418
- playerSize = _this$state.playerSize,
419
- playbackSpeed = _this$state.playbackSpeed;
355
+ isFullScreenEnabled = _this$state.isFullScreenEnabled,
356
+ playerSize = _this$state.playerSize,
357
+ playbackSpeed = _this$state.playbackSpeed;
420
358
  var status = videoState.status,
421
- currentTime = videoState.currentTime;
422
-
359
+ currentTime = videoState.currentTime;
423
360
  if (status === 'playing' && (currentTime < _this.lastCurrentTime || currentTime >= _this.lastCurrentTime + VIEWED_TRACKING_SECS)) {
424
361
  fireAnalyticsEvent(createPlayedTrackEvent(type, _objectSpread(_objectSpread({}, videoState), {}, {
425
362
  isAutoPlay: isAutoPlay,
@@ -432,60 +369,48 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
432
369
  _this.lastCurrentTime = currentTime;
433
370
  }
434
371
  });
435
-
436
372
  _defineProperty(_assertThisInitialized(_this), "resetPendingPlayPauseToggleTimer", function () {
437
373
  if (_this.clickToTogglePlayTimoutId !== undefined) {
438
374
  clearTimeout(_this.clickToTogglePlayTimoutId);
439
375
  }
440
376
  });
441
-
442
377
  _defineProperty(_assertThisInitialized(_this), "doubleClickToFullscreen", function () {
443
378
  _this.resetPendingPlayPauseToggleTimer();
444
-
445
- _this.toggleFullscreen(); // TODO Add an event similar to "playPauseBlanketClick" but for fullscreen trigger
446
-
379
+ _this.toggleFullscreen();
380
+ // TODO Add an event similar to "playPauseBlanketClick" but for fullscreen trigger
447
381
  });
448
-
449
382
  _defineProperty(_assertThisInitialized(_this), "togglePlayByBlanketClick", function (action) {
450
383
  _this.resetPendingPlayPauseToggleTimer();
451
-
452
384
  _this.clickToTogglePlayTimoutId = setTimeout(function () {
453
385
  action();
454
-
455
386
  _this.createAndFireUIEvent('playPauseBlanketClick');
456
387
  }, 200);
457
388
  });
458
-
459
389
  _defineProperty(_assertThisInitialized(_this), "startPlayByBlanketClick", function () {
460
390
  _this.togglePlayByBlanketClick(_this.play);
461
391
  });
462
-
463
392
  _defineProperty(_assertThisInitialized(_this), "pausePlayByBlanketClick", function () {
464
393
  _this.togglePlayByBlanketClick(_this.pause);
465
394
  });
466
-
467
395
  _defineProperty(_assertThisInitialized(_this), "startPlayByButtonClick", _this.getMediaButtonClickHandler(_this.play, 'playButton'));
468
-
469
396
  _defineProperty(_assertThisInitialized(_this), "pausePlayByButtonClick", _this.getMediaButtonClickHandler(_this.pause, 'pauseButton'));
470
-
471
397
  return _this;
472
398
  }
473
-
474
399
  _createClass(CustomMediaPlayerBase, [{
475
400
  key: "componentDidMount",
476
401
  value: function componentDidMount() {
477
402
  var _this$props5 = this.props,
478
- type = _this$props5.type,
479
- fileId = _this$props5.fileId,
480
- isAutoPlay = _this$props5.isAutoPlay,
481
- isHDAvailable = _this$props5.isHDAvailable,
482
- isHDActive = _this$props5.isHDActive,
483
- onFirstPlay = _this$props5.onFirstPlay,
484
- createAnalyticsEvent = _this$props5.createAnalyticsEvent;
403
+ type = _this$props5.type,
404
+ fileId = _this$props5.fileId,
405
+ isAutoPlay = _this$props5.isAutoPlay,
406
+ isHDAvailable = _this$props5.isHDAvailable,
407
+ isHDActive = _this$props5.isHDActive,
408
+ onFirstPlay = _this$props5.onFirstPlay,
409
+ createAnalyticsEvent = _this$props5.createAnalyticsEvent;
485
410
  var _this$state2 = this.state,
486
- isFullScreenEnabled = _this$state2.isFullScreenEnabled,
487
- playerSize = _this$state2.playerSize,
488
- playbackSpeed = _this$state2.playbackSpeed;
411
+ isFullScreenEnabled = _this$state2.isFullScreenEnabled,
412
+ playerSize = _this$state2.playerSize,
413
+ playbackSpeed = _this$state2.playbackSpeed;
489
414
  fireAnalyticsEvent(createCustomMediaPlayerScreenEvent(type, {
490
415
  isAutoPlay: isAutoPlay,
491
416
  isHDAvailable: isHDAvailable,
@@ -494,16 +419,12 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
494
419
  playerSize: playerSize,
495
420
  playbackSpeed: playbackSpeed
496
421
  }, fileId), createAnalyticsEvent);
497
-
498
422
  if (this.videoWrapperRef.current) {
499
423
  this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
500
424
  }
501
-
502
425
  simultaneousPlayManager.subscribe(this);
503
-
504
426
  if (isAutoPlay) {
505
427
  simultaneousPlayManager.pauseOthers(this);
506
-
507
428
  if (onFirstPlay) {
508
429
  fireAnalyticsEvent(createFirstPlayedTrackEvent(type, {
509
430
  isAutoPlay: isAutoPlay,
@@ -524,13 +445,10 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
524
445
  if (this.videoWrapperRef.current) {
525
446
  this.videoWrapperRef.current.removeEventListener('fullscreenchange', this.onFullScreenChange);
526
447
  }
527
-
528
448
  if (this.state.isFullScreenEnabled) {
529
449
  var _this$props$onFullscr2, _this$props6;
530
-
531
450
  (_this$props$onFullscr2 = (_this$props6 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 ? void 0 : _this$props$onFullscr2.call(_this$props6, false);
532
451
  }
533
-
534
452
  simultaneousPlayManager.unsubscribe(this);
535
453
  }
536
454
  }, {
@@ -546,17 +464,16 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
546
464
  key: "createAndFireUIEvent",
547
465
  value: function createAndFireUIEvent(eventType, actionSubjectId) {
548
466
  var _this$props7 = this.props,
549
- type = _this$props7.type,
550
- fileId = _this$props7.fileId,
551
- isHDActive = _this$props7.isHDActive,
552
- isHDAvailable = _this$props7.isHDAvailable,
553
- isAutoPlay = _this$props7.isAutoPlay,
554
- createAnalyticsEvent = _this$props7.createAnalyticsEvent;
467
+ type = _this$props7.type,
468
+ fileId = _this$props7.fileId,
469
+ isHDActive = _this$props7.isHDActive,
470
+ isHDAvailable = _this$props7.isHDAvailable,
471
+ isAutoPlay = _this$props7.isAutoPlay,
472
+ createAnalyticsEvent = _this$props7.createAnalyticsEvent;
555
473
  var _this$state3 = this.state,
556
- isFullScreenEnabled = _this$state3.isFullScreenEnabled,
557
- playerSize = _this$state3.playerSize,
558
- playbackSpeed = _this$state3.playbackSpeed;
559
-
474
+ isFullScreenEnabled = _this$state3.isFullScreenEnabled,
475
+ playerSize = _this$state3.playerSize,
476
+ playbackSpeed = _this$state3.playbackSpeed;
560
477
  var playbackState = _objectSpread(_objectSpread({}, this.videoState), {}, {
561
478
  isAutoPlay: isAutoPlay,
562
479
  isHDAvailable: isHDAvailable,
@@ -565,31 +482,24 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
565
482
  playerSize: playerSize,
566
483
  playbackSpeed: playbackSpeed
567
484
  });
568
-
569
485
  var analyticsEvent;
570
-
571
486
  switch (eventType) {
572
487
  case 'mediaButtonClick':
573
488
  analyticsEvent = createMediaButtonClickedEvent(type, playbackState, actionSubjectId, fileId);
574
489
  break;
575
-
576
490
  case 'shortcutPress':
577
491
  analyticsEvent = createMediaShortcutPressedEvent(type, playbackState, actionSubjectId, fileId);
578
492
  break;
579
-
580
493
  case 'playPauseBlanketClick':
581
494
  analyticsEvent = createPlayPauseBlanketClickedEvent(type, playbackState, fileId);
582
495
  break;
583
-
584
496
  case 'timeRangeNavigate':
585
497
  case 'volumeRangeNavigate':
586
498
  analyticsEvent = createTimeRangeNavigatedEvent(type, playbackState, actionSubjectId, fileId);
587
499
  break;
588
-
589
500
  case 'playbackSpeedChange':
590
501
  analyticsEvent = createPlaybackSpeedChangedEvent(type, playbackState, fileId);
591
502
  break;
592
-
593
503
  default:
594
504
  analyticsEvent = {
595
505
  eventType: 'ui',
@@ -600,21 +510,19 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
600
510
  }
601
511
  };
602
512
  }
603
-
604
513
  fireAnalyticsEvent(analyticsEvent, createAnalyticsEvent);
605
514
  }
606
515
  }, {
607
516
  key: "render",
608
517
  value: function render() {
609
518
  var _this2 = this;
610
-
611
519
  var _this$props8 = this.props,
612
- type = _this$props8.type,
613
- src = _this$props8.src,
614
- isAutoPlay = _this$props8.isAutoPlay,
615
- onCanPlay = _this$props8.onCanPlay,
616
- onError = _this$props8.onError,
617
- poster = _this$props8.poster;
520
+ type = _this$props8.type,
521
+ src = _this$props8.src,
522
+ isAutoPlay = _this$props8.isAutoPlay,
523
+ onCanPlay = _this$props8.onCanPlay,
524
+ onError = _this$props8.onError,
525
+ poster = _this$props8.poster;
618
526
  return /*#__PURE__*/React.createElement(CustomVideoWrapper, {
619
527
  ref: this.videoWrapperRef,
620
528
  "data-testid": "custom-media-player"
@@ -629,39 +537,33 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
629
537
  poster: poster
630
538
  }, function (video, videoState, actions) {
631
539
  _this2.onViewed(videoState);
632
-
633
- _this2.setActions(actions); //Video State(either prop or variable) is ReadOnly
634
-
635
-
540
+ _this2.setActions(actions);
541
+ //Video State(either prop or variable) is ReadOnly
636
542
  _this2.videoState = videoState;
637
543
  var status = videoState.status,
638
- currentTime = videoState.currentTime,
639
- buffered = videoState.buffered,
640
- duration = videoState.duration,
641
- isLoading = videoState.isLoading;
544
+ currentTime = videoState.currentTime,
545
+ buffered = videoState.buffered,
546
+ duration = videoState.duration,
547
+ isLoading = videoState.isLoading;
642
548
  var playerSize = _this2.state.playerSize;
643
549
  var isPlaying = status === 'playing';
644
550
  var isLargePlayer = playerSize === 'large';
645
551
  var isMediumPlayer = playerSize === 'medium';
646
552
  var skipAmount = 10;
647
-
648
553
  var skipBackward = function skipBackward() {
649
554
  var newTime = videoState.currentTime - skipAmount;
650
555
  actions.navigate(Math.max(newTime, 0));
651
556
  };
652
-
653
557
  var skipForward = function skipForward() {
654
558
  var newTime = videoState.currentTime + skipAmount;
655
559
  actions.navigate(Math.min(newTime, videoState.duration));
656
560
  };
657
-
658
561
  var shortcuts = _this2.renderShortcuts({
659
562
  togglePlayPauseAction: isPlaying ? _this2.pause : _this2.play,
660
563
  toggleMute: actions.toggleMute,
661
564
  skipBackward: skipBackward,
662
565
  skipForward: skipForward
663
566
  });
664
-
665
567
  return /*#__PURE__*/React.createElement(VideoWrapper, null, /*#__PURE__*/React.createElement(WidthObserver, {
666
568
  setWidth: _this2.onResize
667
569
  }), shortcuts, isLoading && _this2.renderSpinner(), /*#__PURE__*/React.createElement(PlayPauseBlanket, {
@@ -680,7 +582,6 @@ export var CustomMediaPlayerBase = /*#__PURE__*/function (_Component) {
680
582
  }));
681
583
  }
682
584
  }]);
683
-
684
585
  return CustomMediaPlayerBase;
685
586
  }(Component);
686
587
  export var CustomMediaPlayer = withMediaAnalyticsContext({
@@ -1,7 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
2
  var _templateObject;
4
-
5
3
  import styled from '@emotion/styled';
6
4
  export var PlayPauseBlanket = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n cursor: pointer;\n"])));
7
5
  PlayPauseBlanket.displayName = 'PlayPauseBlanket';