@atlaskit/media-ui 22.3.0 → 22.3.1

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 +6 -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 +2 -2
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
4
3
  // Keep media player components used in media-viewer to use static colors from the new color palette to
5
4
  // support the hybrid theming in media viewer https://product-fabric.atlassian.net/browse/DSP-6067
@@ -35,7 +34,7 @@ import Tooltip from '@atlaskit/tooltip';
35
34
  import { SkipTenBackwardIcon, SkipTenForwardIcon } from './icons';
36
35
  import { getControlsWrapperClassName } from './getControlsWrapperClassName';
37
36
  const packageName = "@atlaskit/media-ui";
38
- const packageVersion = "22.3.0";
37
+ const packageVersion = "22.3.1";
39
38
  const MEDIUM_VIDEO_MAX_WIDTH = 400;
40
39
  const SMALL_VIDEO_MAX_WIDTH = 160;
41
40
  const MINIMUM_DURATION_BEFORE_SAVING_TIME = 60;
@@ -43,9 +42,7 @@ const VIEWED_TRACKING_SECS = 2;
43
42
  export class CustomMediaPlayerBase extends Component {
44
43
  constructor(...args) {
45
44
  super(...args);
46
-
47
45
  _defineProperty(this, "videoWrapperRef", /*#__PURE__*/React.createRef());
48
-
49
46
  _defineProperty(this, "videoState", {
50
47
  isLoading: true,
51
48
  buffered: 0,
@@ -55,47 +52,36 @@ export class CustomMediaPlayerBase extends Component {
55
52
  duration: 0,
56
53
  isMuted: false
57
54
  });
58
-
59
55
  _defineProperty(this, "wasPlayedOnce", false);
60
-
61
56
  _defineProperty(this, "lastCurrentTime", 0);
62
-
63
57
  _defineProperty(this, "timeSaver", new TimeSaver(this.props.lastWatchTimeConfig));
64
-
65
58
  _defineProperty(this, "state", {
66
59
  isFullScreenEnabled: false,
67
60
  playerSize: 'large',
68
61
  playbackSpeed: 1
69
62
  });
70
-
71
63
  _defineProperty(this, "onFullScreenChange", e => {
72
64
  if (e.target !== this.videoWrapperRef.current) {
73
65
  return;
74
66
  }
75
-
76
67
  const {
77
68
  isFullScreenEnabled: currentFullScreenMode
78
69
  } = this.state;
79
70
  const isFullScreenEnabled = !!getFullscreenElement();
80
-
81
71
  if (currentFullScreenMode !== isFullScreenEnabled) {
82
72
  var _this$props$onFullscr, _this$props;
83
-
84
73
  (_this$props$onFullscr = (_this$props = this.props).onFullscreenChange) === null || _this$props$onFullscr === void 0 ? void 0 : _this$props$onFullscr.call(_this$props, isFullScreenEnabled);
85
74
  this.setState({
86
75
  isFullScreenEnabled
87
76
  });
88
77
  }
89
78
  });
90
-
91
79
  _defineProperty(this, "onTimeChanged", () => {
92
80
  this.createAndFireUIEvent('timeRangeNavigate', 'time');
93
81
  });
94
-
95
82
  _defineProperty(this, "onVolumeChanged", () => {
96
83
  this.createAndFireUIEvent('volumeRangeNavigate', 'volume');
97
84
  });
98
-
99
85
  _defineProperty(this, "onCurrentTimeChange", (currentTime, duration) => {
100
86
  if (duration - currentTime > MINIMUM_DURATION_BEFORE_SAVING_TIME) {
101
87
  this.timeSaver.defaultTime = currentTime;
@@ -103,7 +89,6 @@ export class CustomMediaPlayerBase extends Component {
103
89
  this.timeSaver.defaultTime = 0;
104
90
  }
105
91
  });
106
-
107
92
  _defineProperty(this, "renderCurrentTime", ({
108
93
  currentTime,
109
94
  duration
@@ -112,7 +97,6 @@ export class CustomMediaPlayerBase extends Component {
112
97
  draggable: false
113
98
  }, formatDuration(currentTime), " / ", formatDuration(duration));
114
99
  });
115
-
116
100
  _defineProperty(this, "renderHDButton", () => {
117
101
  const {
118
102
  type,
@@ -120,11 +104,9 @@ export class CustomMediaPlayerBase extends Component {
120
104
  isHDActive,
121
105
  onHDToggleClick
122
106
  } = this.props;
123
-
124
107
  if (type === 'audio' || !isHDAvailable) {
125
108
  return;
126
109
  }
127
-
128
110
  const primaryColor = isHDActive ? '#579DFF' : '#c7d1db';
129
111
  const secondaryColor = isHDActive ? N0 : DN60;
130
112
  return /*#__PURE__*/React.createElement(MediaButton, {
@@ -137,19 +119,16 @@ export class CustomMediaPlayerBase extends Component {
137
119
  })
138
120
  });
139
121
  });
140
-
141
122
  _defineProperty(this, "onPlaybackSpeedChange", playbackSpeed => {
142
123
  if (!this.actions) {
143
124
  return;
144
125
  }
145
-
146
126
  this.actions.setPlaybackSpeed(playbackSpeed);
147
127
  this.setState({
148
128
  playbackSpeed
149
129
  });
150
130
  this.createAndFireUIEvent('playbackSpeedChange');
151
131
  });
152
-
153
132
  _defineProperty(this, "renderSpeedControls", () => {
154
133
  const {
155
134
  playbackSpeed
@@ -164,7 +143,6 @@ export class CustomMediaPlayerBase extends Component {
164
143
  onClick: () => this.createAndFireUIEvent('mediaButtonClick', 'playbackSpeedButton')
165
144
  });
166
145
  });
167
-
168
146
  _defineProperty(this, "renderVolume", (videoState, actions, showSlider) => /*#__PURE__*/React.createElement(VolumeWrapper, {
169
147
  showSlider: showSlider
170
148
  }, /*#__PURE__*/React.createElement(VolumeToggleWrapper, {
@@ -186,14 +164,11 @@ export class CustomMediaPlayerBase extends Component {
186
164
  isAlwaysActive: true,
187
165
  onChanged: this.onVolumeChanged
188
166
  }))));
189
-
190
167
  _defineProperty(this, "toggleFullscreen", () => this.videoWrapperRef.current && toggleFullscreen(this.videoWrapperRef.current));
191
-
192
168
  _defineProperty(this, "onFullScreenButtonClick", () => {
193
169
  this.toggleFullscreen();
194
170
  this.createAndFireUIEvent('mediaButtonClick', 'fullScreenButton');
195
171
  });
196
-
197
172
  _defineProperty(this, "onResize", width => {
198
173
  if (width > MEDIUM_VIDEO_MAX_WIDTH) {
199
174
  this.setState({
@@ -209,7 +184,6 @@ export class CustomMediaPlayerBase extends Component {
209
184
  });
210
185
  }
211
186
  });
212
-
213
187
  _defineProperty(this, "renderFullScreenButton", () => {
214
188
  const {
215
189
  intl: {
@@ -217,11 +191,9 @@ export class CustomMediaPlayerBase extends Component {
217
191
  },
218
192
  type
219
193
  } = this.props;
220
-
221
194
  if (type === 'audio') {
222
195
  return;
223
196
  }
224
-
225
197
  const {
226
198
  isFullScreenEnabled
227
199
  } = this.state;
@@ -236,16 +208,13 @@ export class CustomMediaPlayerBase extends Component {
236
208
  iconBefore: icon
237
209
  });
238
210
  });
239
-
240
211
  _defineProperty(this, "renderDownloadButton", () => {
241
212
  const {
242
213
  onDownloadClick
243
214
  } = this.props;
244
-
245
215
  if (!onDownloadClick) {
246
216
  return;
247
217
  }
248
-
249
218
  return /*#__PURE__*/React.createElement(MediaButton, {
250
219
  testId: "custom-media-player-download-button",
251
220
  onClick: this.getMediaButtonClickHandler(onDownloadClick, 'downloadButton'),
@@ -254,7 +223,6 @@ export class CustomMediaPlayerBase extends Component {
254
223
  })
255
224
  });
256
225
  });
257
-
258
226
  _defineProperty(this, "renderShortcuts", ({
259
227
  togglePlayPauseAction,
260
228
  toggleMute,
@@ -276,7 +244,6 @@ export class CustomMediaPlayerBase extends Component {
276
244
  code: keyCodes.m,
277
245
  handler: this.getKeyboardShortcutHandler(toggleMute, 'mute')
278
246
  })];
279
-
280
247
  if (shortcuts && isFullScreenEnabled) {
281
248
  // Fullscreen shortcuts only. We don't want to override left/right keys in media-viewer settings
282
249
  shortcuts.push( /*#__PURE__*/React.createElement(Shortcut, {
@@ -290,10 +257,8 @@ export class CustomMediaPlayerBase extends Component {
290
257
  handler: this.getKeyboardShortcutHandler(skipForward, 'rightArrow')
291
258
  }));
292
259
  }
293
-
294
260
  return shortcuts;
295
261
  });
296
-
297
262
  _defineProperty(this, "renderPlayPauseButton", isPlaying => {
298
263
  const {
299
264
  intl: {
@@ -315,7 +280,6 @@ export class CustomMediaPlayerBase extends Component {
315
280
  onClick: isPlaying ? this.pausePlayByButtonClick : this.startPlayByButtonClick
316
281
  }));
317
282
  });
318
-
319
283
  _defineProperty(this, "renderSkipBackwardButton", skipBackward => {
320
284
  const {
321
285
  intl: {
@@ -333,7 +297,6 @@ export class CustomMediaPlayerBase extends Component {
333
297
  onClick: this.getMediaButtonClickHandler(skipBackward, 'skipBackwardButton')
334
298
  }));
335
299
  });
336
-
337
300
  _defineProperty(this, "renderSkipForwardButton", skipForward => {
338
301
  const {
339
302
  intl: {
@@ -351,53 +314,42 @@ export class CustomMediaPlayerBase extends Component {
351
314
  onClick: this.getMediaButtonClickHandler(skipForward, 'skipForwardButton')
352
315
  }));
353
316
  });
354
-
355
317
  _defineProperty(this, "renderSpinner", () => /*#__PURE__*/React.createElement(SpinnerWrapper, null, /*#__PURE__*/React.createElement(Spinner, {
356
318
  appearance: "invert",
357
319
  size: "large"
358
320
  })));
359
-
360
321
  _defineProperty(this, "pause", () => {
361
322
  if (this.actions) {
362
323
  this.actions.pause();
363
324
  }
364
325
  });
365
-
366
326
  _defineProperty(this, "play", () => {
367
327
  const {
368
328
  onFirstPlay
369
329
  } = this.props;
370
-
371
330
  if (this.actions) {
372
331
  this.actions.play();
373
332
  }
374
-
375
333
  simultaneousPlayManager.pauseOthers(this);
376
-
377
334
  if (!this.wasPlayedOnce && onFirstPlay) {
378
335
  this.wasPlayedOnce = true;
379
336
  onFirstPlay();
380
337
  }
381
338
  });
382
-
383
339
  _defineProperty(this, "getMediaButtonClickHandler", (action, buttonType) => () => {
384
340
  action();
385
341
  this.createAndFireUIEvent('mediaButtonClick', buttonType);
386
342
  });
387
-
388
343
  _defineProperty(this, "getKeyboardShortcutHandler", (action, shortcutType) => () => {
389
344
  const {
390
345
  showControls
391
346
  } = this.props;
392
347
  action();
393
-
394
348
  if (showControls) {
395
349
  showControls();
396
350
  }
397
-
398
351
  this.createAndFireUIEvent('shortcutPress', shortcutType);
399
352
  });
400
-
401
353
  _defineProperty(this, "onViewed", videoState => {
402
354
  const {
403
355
  createAnalyticsEvent,
@@ -416,9 +368,9 @@ export class CustomMediaPlayerBase extends Component {
416
368
  status,
417
369
  currentTime
418
370
  } = videoState;
419
-
420
371
  if (status === 'playing' && (currentTime < this.lastCurrentTime || currentTime >= this.lastCurrentTime + VIEWED_TRACKING_SECS)) {
421
- fireAnalyticsEvent(createPlayedTrackEvent(type, { ...videoState,
372
+ fireAnalyticsEvent(createPlayedTrackEvent(type, {
373
+ ...videoState,
422
374
  isAutoPlay,
423
375
  isHDAvailable,
424
376
  isHDActive,
@@ -429,18 +381,16 @@ export class CustomMediaPlayerBase extends Component {
429
381
  this.lastCurrentTime = currentTime;
430
382
  }
431
383
  });
432
-
433
384
  _defineProperty(this, "resetPendingPlayPauseToggleTimer", () => {
434
385
  if (this.clickToTogglePlayTimoutId !== undefined) {
435
386
  clearTimeout(this.clickToTogglePlayTimoutId);
436
387
  }
437
388
  });
438
-
439
389
  _defineProperty(this, "doubleClickToFullscreen", () => {
440
390
  this.resetPendingPlayPauseToggleTimer();
441
- this.toggleFullscreen(); // TODO Add an event similar to "playPauseBlanketClick" but for fullscreen trigger
391
+ this.toggleFullscreen();
392
+ // TODO Add an event similar to "playPauseBlanketClick" but for fullscreen trigger
442
393
  });
443
-
444
394
  _defineProperty(this, "togglePlayByBlanketClick", action => {
445
395
  this.resetPendingPlayPauseToggleTimer();
446
396
  this.clickToTogglePlayTimoutId = setTimeout(() => {
@@ -448,20 +398,15 @@ export class CustomMediaPlayerBase extends Component {
448
398
  this.createAndFireUIEvent('playPauseBlanketClick');
449
399
  }, 200);
450
400
  });
451
-
452
401
  _defineProperty(this, "startPlayByBlanketClick", () => {
453
402
  this.togglePlayByBlanketClick(this.play);
454
403
  });
455
-
456
404
  _defineProperty(this, "pausePlayByBlanketClick", () => {
457
405
  this.togglePlayByBlanketClick(this.pause);
458
406
  });
459
-
460
407
  _defineProperty(this, "startPlayByButtonClick", this.getMediaButtonClickHandler(this.play, 'playButton'));
461
-
462
408
  _defineProperty(this, "pausePlayByButtonClick", this.getMediaButtonClickHandler(this.pause, 'pauseButton'));
463
409
  }
464
-
465
410
  componentDidMount() {
466
411
  const {
467
412
  type,
@@ -485,16 +430,12 @@ export class CustomMediaPlayerBase extends Component {
485
430
  playerSize,
486
431
  playbackSpeed
487
432
  }, fileId), createAnalyticsEvent);
488
-
489
433
  if (this.videoWrapperRef.current) {
490
434
  this.videoWrapperRef.current.addEventListener('fullscreenchange', this.onFullScreenChange);
491
435
  }
492
-
493
436
  simultaneousPlayManager.subscribe(this);
494
-
495
437
  if (isAutoPlay) {
496
438
  simultaneousPlayManager.pauseOthers(this);
497
-
498
439
  if (onFirstPlay) {
499
440
  fireAnalyticsEvent(createFirstPlayedTrackEvent(type, {
500
441
  isAutoPlay,
@@ -509,21 +450,16 @@ export class CustomMediaPlayerBase extends Component {
509
450
  }
510
451
  }
511
452
  }
512
-
513
453
  componentWillUnmount() {
514
454
  if (this.videoWrapperRef.current) {
515
455
  this.videoWrapperRef.current.removeEventListener('fullscreenchange', this.onFullScreenChange);
516
456
  }
517
-
518
457
  if (this.state.isFullScreenEnabled) {
519
458
  var _this$props$onFullscr2, _this$props2;
520
-
521
459
  (_this$props$onFullscr2 = (_this$props2 = this.props).onFullscreenChange) === null || _this$props$onFullscr2 === void 0 ? void 0 : _this$props$onFullscr2.call(_this$props2, false);
522
460
  }
523
-
524
461
  simultaneousPlayManager.unsubscribe(this);
525
462
  }
526
-
527
463
  setActions(actions) {
528
464
  // Actions are being sent constantly while the video is playing,
529
465
  // though play and pause functions are always the same objects
@@ -531,7 +467,6 @@ export class CustomMediaPlayerBase extends Component {
531
467
  this.actions = actions;
532
468
  }
533
469
  }
534
-
535
470
  createAndFireUIEvent(eventType, actionSubjectId) {
536
471
  const {
537
472
  type,
@@ -546,7 +481,8 @@ export class CustomMediaPlayerBase extends Component {
546
481
  playerSize,
547
482
  playbackSpeed
548
483
  } = this.state;
549
- const playbackState = { ...this.videoState,
484
+ const playbackState = {
485
+ ...this.videoState,
550
486
  isAutoPlay,
551
487
  isHDAvailable,
552
488
  isHDActive,
@@ -555,29 +491,23 @@ export class CustomMediaPlayerBase extends Component {
555
491
  playbackSpeed
556
492
  };
557
493
  let analyticsEvent;
558
-
559
494
  switch (eventType) {
560
495
  case 'mediaButtonClick':
561
496
  analyticsEvent = createMediaButtonClickedEvent(type, playbackState, actionSubjectId, fileId);
562
497
  break;
563
-
564
498
  case 'shortcutPress':
565
499
  analyticsEvent = createMediaShortcutPressedEvent(type, playbackState, actionSubjectId, fileId);
566
500
  break;
567
-
568
501
  case 'playPauseBlanketClick':
569
502
  analyticsEvent = createPlayPauseBlanketClickedEvent(type, playbackState, fileId);
570
503
  break;
571
-
572
504
  case 'timeRangeNavigate':
573
505
  case 'volumeRangeNavigate':
574
506
  analyticsEvent = createTimeRangeNavigatedEvent(type, playbackState, actionSubjectId, fileId);
575
507
  break;
576
-
577
508
  case 'playbackSpeedChange':
578
509
  analyticsEvent = createPlaybackSpeedChangedEvent(type, playbackState, fileId);
579
510
  break;
580
-
581
511
  default:
582
512
  analyticsEvent = {
583
513
  eventType: 'ui',
@@ -588,10 +518,8 @@ export class CustomMediaPlayerBase extends Component {
588
518
  }
589
519
  };
590
520
  }
591
-
592
521
  fireAnalyticsEvent(analyticsEvent, createAnalyticsEvent);
593
522
  }
594
-
595
523
  render() {
596
524
  const {
597
525
  type,
@@ -615,8 +543,8 @@ export class CustomMediaPlayerBase extends Component {
615
543
  poster: poster
616
544
  }, (video, videoState, actions) => {
617
545
  this.onViewed(videoState);
618
- this.setActions(actions); //Video State(either prop or variable) is ReadOnly
619
-
546
+ this.setActions(actions);
547
+ //Video State(either prop or variable) is ReadOnly
620
548
  this.videoState = videoState;
621
549
  const {
622
550
  status,
@@ -632,17 +560,14 @@ export class CustomMediaPlayerBase extends Component {
632
560
  const isLargePlayer = playerSize === 'large';
633
561
  const isMediumPlayer = playerSize === 'medium';
634
562
  const skipAmount = 10;
635
-
636
563
  const skipBackward = () => {
637
564
  const newTime = videoState.currentTime - skipAmount;
638
565
  actions.navigate(Math.max(newTime, 0));
639
566
  };
640
-
641
567
  const skipForward = () => {
642
568
  const newTime = videoState.currentTime + skipAmount;
643
569
  actions.navigate(Math.min(newTime, videoState.duration));
644
570
  };
645
-
646
571
  const shortcuts = this.renderShortcuts({
647
572
  togglePlayPauseAction: isPlaying ? this.pause : this.play,
648
573
  toggleMute: actions.toggleMute,
@@ -666,7 +591,6 @@ export class CustomMediaPlayerBase extends Component {
666
591
  })), /*#__PURE__*/React.createElement(TimebarWrapper, null, /*#__PURE__*/React.createElement(LeftControls, null, this.renderPlayPauseButton(isPlaying), isLargePlayer && this.renderSkipBackwardButton(skipBackward), isLargePlayer && this.renderSkipForwardButton(skipForward), this.renderVolume(videoState, actions, isLargePlayer)), /*#__PURE__*/React.createElement(RightControls, null, (isMediumPlayer || isLargePlayer) && this.renderCurrentTime(videoState), isLargePlayer && this.renderHDButton(), isLargePlayer && this.renderSpeedControls(), this.renderFullScreenButton(), isLargePlayer && this.renderDownloadButton()))));
667
592
  }));
668
593
  }
669
-
670
594
  }
671
595
  export const CustomMediaPlayer = withMediaAnalyticsContext({
672
596
  packageVersion,
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
4
3
  // Keep PlaybackSpeedControls to use static colors from the new color palette to support the hybrid
5
4
  // theming in media viewer https://product-fabric.atlassian.net/browse/DSP-6067
@@ -15,24 +14,19 @@ import { WidthObserver } from '@atlaskit/width-detector';
15
14
  export class PlaybackSpeedControls extends Component {
16
15
  constructor(...args) {
17
16
  super(...args);
18
-
19
17
  _defineProperty(this, "state", {
20
18
  popupHeight: 255
21
19
  });
22
-
23
20
  _defineProperty(this, "onPlaybackSpeedChange", (option, _actionMeta) => {
24
21
  const {
25
22
  onPlaybackSpeedChange
26
23
  } = this.props;
27
-
28
24
  if (!option) {
29
25
  return;
30
26
  }
31
-
32
27
  const playbackSpeed = parseFloat(`${option.value}`);
33
28
  onPlaybackSpeedChange(playbackSpeed);
34
29
  });
35
-
36
30
  _defineProperty(this, "speedOptions", () => [{
37
31
  // @ts-ignore: FormattedMessage is returning an Element which is a type mismatch with what OptionType wants. This can be fix by using 'intl' object once this packages gets refactor later.
38
32
  label: /*#__PURE__*/React.createElement(FormattedMessage, messages.playbackSpeed),
@@ -53,37 +47,38 @@ export class PlaybackSpeedControls extends Component {
53
47
  value: 2
54
48
  }]
55
49
  }]);
56
-
57
50
  _defineProperty(this, "popupCustomStyles", {
58
- container: styles => ({ ...styles,
51
+ container: styles => ({
52
+ ...styles,
59
53
  backgroundColor: '#22272b',
60
54
  boxShadow: 'inset 0px 0px 0px 1px #bcd6f00a,0px 8px 12px #0304045c,0px 0px 1px #03040480'
61
55
  }),
62
56
  // added these overrides to keep the look of the current design
63
57
  // however this does not benefit from the DS a11y changes
64
- menuList: styles => ({ ...styles,
58
+ menuList: styles => ({
59
+ ...styles,
65
60
  padding: '4px 0px'
66
61
  }),
67
62
  option: (styles, {
68
63
  isFocused,
69
64
  isSelected
70
- }) => ({ ...styles,
65
+ }) => ({
66
+ ...styles,
71
67
  color: isSelected ? '#579dff' : 'inherit',
72
68
  backgroundColor: isSelected ? '#082145' : isFocused ? '#a1bdd914' : '#22272b',
73
69
  ':active': {
74
70
  backgroundColor: '#a6c5e229'
75
71
  }
76
72
  }),
77
- groupHeading: styles => ({ ...styles,
73
+ groupHeading: styles => ({
74
+ ...styles,
78
75
  color: '#9fadbc'
79
76
  })
80
77
  });
81
-
82
78
  _defineProperty(this, "onResize", width => {
83
79
  const {
84
80
  originalDimensions
85
81
  } = this.props;
86
-
87
82
  if (originalDimensions) {
88
83
  const aspectRatio = originalDimensions.height / originalDimensions.width;
89
84
  const controlsSize = 60;
@@ -92,16 +87,14 @@ export class PlaybackSpeedControls extends Component {
92
87
  this.setState({
93
88
  popupHeight
94
89
  });
95
- } // This is a hacky solution. Please replace with a better one if you find one.
90
+ }
91
+ // This is a hacky solution. Please replace with a better one if you find one.
96
92
  // There is something inside popper.js that recalc position on scroll.
97
93
  // We enable this functionality with `eventListeners` modifier.
98
94
  // Here we simulate scroll even to trick popper.js to recalc position.
99
-
100
-
101
95
  window.dispatchEvent(new CustomEvent('scroll'));
102
96
  });
103
97
  }
104
-
105
98
  render() {
106
99
  const {
107
100
  playbackSpeed,
@@ -139,8 +132,10 @@ export class PlaybackSpeedControls extends Component {
139
132
  maxMenuHeight: popupHeight,
140
133
  options: this.speedOptions(),
141
134
  value: value,
142
- theme: theme => ({ ...theme,
143
- colors: { ...theme.colors,
135
+ theme: theme => ({
136
+ ...theme,
137
+ colors: {
138
+ ...theme.colors,
144
139
  primary25: N600
145
140
  }
146
141
  }),
@@ -162,6 +157,5 @@ export class PlaybackSpeedControls extends Component {
162
157
  popperProps: popperProps
163
158
  }));
164
159
  }
165
-
166
160
  }
167
161
  export default injectIntl(PlaybackSpeedControls);
@@ -1,15 +1,11 @@
1
1
  const players = [];
2
-
3
2
  const addPlayer = player => players.push(player);
4
-
5
3
  const removePlayer = player => {
6
4
  const playerIndex = players.indexOf(player);
7
-
8
5
  if (playerIndex > -1) {
9
6
  players.splice(playerIndex, 1);
10
7
  }
11
8
  };
12
-
13
9
  export default {
14
10
  pauseOthers: player => {
15
11
  players.forEach(otherPlayer => {