@atlaskit/media-viewer 52.0.16 → 52.1.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-viewer
2
2
 
3
+ ## 52.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#153282](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/153282)
8
+ [`b271b4820aef9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b271b4820aef9) -
9
+ Added support for Video Captions (experimental)
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 52.0.16
4
16
 
5
17
  ### Patch Changes
@@ -10,7 +10,7 @@ exports.packageVersion = exports.packageName = void 0;
10
10
  var _analytics = require("@atlaskit/media-common/analytics");
11
11
  var componentName = exports.component = exports.componentName = 'mediaViewer';
12
12
  var packageName = exports.packageName = "@atlaskit/media-viewer";
13
- var packageVersion = exports.packageVersion = "52.0.16";
13
+ var packageVersion = exports.packageVersion = "52.1.0";
14
14
  function getFileAttributes(fileState) {
15
15
  if (!fileState) {
16
16
  return {
@@ -12,7 +12,7 @@ var _mediaCommon = require("@atlaskit/media-common");
12
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
14
  var packageName = "@atlaskit/media-viewer";
15
- var packageVersion = "52.0.16";
15
+ var packageVersion = "52.1.0";
16
16
  var ufoExperience;
17
17
  var getExperience = function getExperience() {
18
18
  if (!ufoExperience) {
@@ -13,6 +13,7 @@ var _mediaViewer = require("../media-viewer");
13
13
  var _utils = require("../utils");
14
14
  var _mediaClient = require("@atlaskit/media-client");
15
15
  var _mediaClientReact = require("@atlaskit/media-client-react");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
17
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -90,6 +91,9 @@ var MediaViewerBase = exports.MediaViewerBase = function MediaViewerBase(_ref) {
90
91
  // export const MediaViewerWithMediaClient = withMediaClient(MediaViewerBase)
91
92
  var MediaViewerWithMediaClient = exports.MediaViewerWithMediaClient = function MediaViewerWithMediaClient(props) {
92
93
  var ViewerComponent = _react.default.useMemo(function () {
94
+ if ((0, _platformFeatureFlags.fg)('platform_media_video_captions')) {
95
+ return (0, _mediaClientReact.withMediaClientAndSettings)(MediaViewerBase);
96
+ }
93
97
  return (0, _mediaClientReact.withMediaClient)(MediaViewerBase);
94
98
  }, []);
95
99
  return /*#__PURE__*/_react.default.createElement(ViewerComponent, props);
@@ -266,6 +266,7 @@ var ItemViewerBase = exports.ItemViewerBase = function ItemViewerBase(_ref) {
266
266
  }, viewerProps));
267
267
  case 'video':
268
268
  return /*#__PURE__*/_react.default.createElement(VideoViewer, (0, _extends2.default)({
269
+ identifier: identifier,
269
270
  showControls: showControls,
270
271
  onCanPlay: onSuccess,
271
272
  onError: onLoadFail
@@ -79,14 +79,30 @@ var VideoViewer = exports.VideoViewer = /*#__PURE__*/function (_BaseViewer) {
79
79
  var _this$props2 = this.props,
80
80
  item = _this$props2.item,
81
81
  showControls = _this$props2.showControls,
82
- previewCount = _this$props2.previewCount;
82
+ previewCount = _this$props2.previewCount,
83
+ identifier = _this$props2.identifier;
83
84
  var useCustomVideoPlayer = !(0, _isIE.isIE)();
84
85
  var isAutoPlay = previewCount === 0;
85
86
  var hdAvailable = isHDAvailable(item);
86
87
  var hdActiveOverride = (0, _platformFeatureFlags.fg)('platform_media_disable_video_640p_artifact_usage') ? hdAvailable : isHDActive;
87
88
  return useCustomVideoPlayer ? /*#__PURE__*/_react.default.createElement(_styleWrappers.CustomVideoPlayerWrapper, {
88
89
  "data-testid": "media-viewer-video-content"
89
- }, /*#__PURE__*/_react.default.createElement(_mediaUi.CustomMediaPlayer, {
90
+ }, (0, _mediaClient.isFileIdentifier)(identifier) && (0, _platformFeatureFlags.fg)('platform_media_video_captions') ? /*#__PURE__*/_react.default.createElement(_mediaUi.MediaPlayer, {
91
+ identifier: identifier,
92
+ type: "video",
93
+ isAutoPlay: isAutoPlay,
94
+ onHDToggleClick: this.onHDChange,
95
+ showControls: showControls,
96
+ src: content,
97
+ isHDActive: hdActiveOverride,
98
+ isHDAvailable: hdAvailable,
99
+ isShortcutEnabled: true,
100
+ onFirstPlay: this.onFirstPlay,
101
+ onError: this.onError,
102
+ lastWatchTimeConfig: {
103
+ contentId: item.id
104
+ }
105
+ }) : /*#__PURE__*/_react.default.createElement(_mediaUi.CustomMediaPlayer, {
90
106
  type: "video",
91
107
  isAutoPlay: isAutoPlay,
92
108
  onHDToggleClick: this.onHDChange,
@@ -1,7 +1,7 @@
1
1
  import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
2
2
  const componentName = 'mediaViewer';
3
3
  const packageName = "@atlaskit/media-viewer";
4
- const packageVersion = "52.0.16";
4
+ const packageVersion = "52.1.0";
5
5
  export { packageName, packageVersion, componentName, componentName as component };
6
6
  export function getFileAttributes(fileState) {
7
7
  if (!fileState) {
@@ -2,7 +2,7 @@ import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atl
2
2
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
3
3
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
4
4
  const packageName = "@atlaskit/media-viewer";
5
- const packageVersion = "52.0.16";
5
+ const packageVersion = "52.1.0";
6
6
  let ufoExperience;
7
7
  const getExperience = () => {
8
8
  if (!ufoExperience) {
@@ -2,7 +2,8 @@ import React, { useEffect, useMemo } from 'react';
2
2
  import { MediaViewer as MediaViewerNextGen } from '../media-viewer';
3
3
  import { isSameIdentifier } from '../utils';
4
4
  import { isFileIdentifier } from '@atlaskit/media-client';
5
- import { withMediaClient } from '@atlaskit/media-client-react';
5
+ import { withMediaClient, withMediaClientAndSettings } from '@atlaskit/media-client-react';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  const ensureCollectionName = (identifier, collectionName) => isFileIdentifier(identifier) ? {
7
8
  ...identifier,
8
9
  collectionName: identifier.collectionName || collectionName
@@ -75,6 +76,9 @@ export const MediaViewerBase = ({
75
76
  // export const MediaViewerWithMediaClient = withMediaClient(MediaViewerBase)
76
77
  export const MediaViewerWithMediaClient = props => {
77
78
  const ViewerComponent = React.useMemo(() => {
79
+ if (fg('platform_media_video_captions')) {
80
+ return withMediaClientAndSettings(MediaViewerBase);
81
+ }
78
82
  return withMediaClient(MediaViewerBase);
79
83
  }, []);
80
84
  return /*#__PURE__*/React.createElement(ViewerComponent, props);
@@ -203,6 +203,7 @@ export const ItemViewerBase = ({
203
203
  }, viewerProps));
204
204
  case 'video':
205
205
  return /*#__PURE__*/React.createElement(VideoViewer, _extends({
206
+ identifier: identifier,
206
207
  showControls: showControls,
207
208
  onCanPlay: onSuccess,
208
209
  onError: onLoadFail
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { getArtifactUrl, globalMediaEventEmitter } from '@atlaskit/media-client';
4
- import { CustomMediaPlayer } from '@atlaskit/media-ui';
3
+ import { getArtifactUrl, globalMediaEventEmitter, isFileIdentifier } from '@atlaskit/media-client';
4
+ import { CustomMediaPlayer, MediaPlayer } from '@atlaskit/media-ui';
5
5
  import { Outcome } from '../domain';
6
6
  import { MediaViewerError } from '../errors';
7
7
  import { Video, CustomVideoPlayerWrapper } from '../styleWrappers';
@@ -59,7 +59,8 @@ export class VideoViewer extends BaseViewer {
59
59
  const {
60
60
  item,
61
61
  showControls,
62
- previewCount
62
+ previewCount,
63
+ identifier
63
64
  } = this.props;
64
65
  const useCustomVideoPlayer = !isIE();
65
66
  const isAutoPlay = previewCount === 0;
@@ -67,7 +68,22 @@ export class VideoViewer extends BaseViewer {
67
68
  const hdActiveOverride = fg('platform_media_disable_video_640p_artifact_usage') ? hdAvailable : isHDActive;
68
69
  return useCustomVideoPlayer ? /*#__PURE__*/React.createElement(CustomVideoPlayerWrapper, {
69
70
  "data-testid": "media-viewer-video-content"
70
- }, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
71
+ }, isFileIdentifier(identifier) && fg('platform_media_video_captions') ? /*#__PURE__*/React.createElement(MediaPlayer, {
72
+ identifier: identifier,
73
+ type: "video",
74
+ isAutoPlay: isAutoPlay,
75
+ onHDToggleClick: this.onHDChange,
76
+ showControls: showControls,
77
+ src: content,
78
+ isHDActive: hdActiveOverride,
79
+ isHDAvailable: hdAvailable,
80
+ isShortcutEnabled: true,
81
+ onFirstPlay: this.onFirstPlay,
82
+ onError: this.onError,
83
+ lastWatchTimeConfig: {
84
+ contentId: item.id
85
+ }
86
+ }) : /*#__PURE__*/React.createElement(CustomMediaPlayer, {
71
87
  type: "video",
72
88
  isAutoPlay: isAutoPlay,
73
89
  onHDToggleClick: this.onHDChange,
@@ -1,7 +1,7 @@
1
1
  import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
2
2
  var componentName = 'mediaViewer';
3
3
  var packageName = "@atlaskit/media-viewer";
4
- var packageVersion = "52.0.16";
4
+ var packageVersion = "52.1.0";
5
5
  export { packageName, packageVersion, componentName, componentName as component };
6
6
  export function getFileAttributes(fileState) {
7
7
  if (!fileState) {
@@ -5,7 +5,7 @@ import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atl
5
5
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
6
6
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
7
7
  var packageName = "@atlaskit/media-viewer";
8
- var packageVersion = "52.0.16";
8
+ var packageVersion = "52.1.0";
9
9
  var ufoExperience;
10
10
  var getExperience = function getExperience() {
11
11
  if (!ufoExperience) {
@@ -6,7 +6,8 @@ import React, { useEffect, useMemo } from 'react';
6
6
  import { MediaViewer as MediaViewerNextGen } from '../media-viewer';
7
7
  import { isSameIdentifier } from '../utils';
8
8
  import { isFileIdentifier } from '@atlaskit/media-client';
9
- import { withMediaClient } from '@atlaskit/media-client-react';
9
+ import { withMediaClient, withMediaClientAndSettings } from '@atlaskit/media-client-react';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  var ensureCollectionName = function ensureCollectionName(identifier, collectionName) {
11
12
  return isFileIdentifier(identifier) ? _objectSpread(_objectSpread({}, identifier), {}, {
12
13
  collectionName: identifier.collectionName || collectionName
@@ -80,6 +81,9 @@ export var MediaViewerBase = function MediaViewerBase(_ref) {
80
81
  // export const MediaViewerWithMediaClient = withMediaClient(MediaViewerBase)
81
82
  export var MediaViewerWithMediaClient = function MediaViewerWithMediaClient(props) {
82
83
  var ViewerComponent = React.useMemo(function () {
84
+ if (fg('platform_media_video_captions')) {
85
+ return withMediaClientAndSettings(MediaViewerBase);
86
+ }
83
87
  return withMediaClient(MediaViewerBase);
84
88
  }, []);
85
89
  return /*#__PURE__*/React.createElement(ViewerComponent, props);
@@ -244,6 +244,7 @@ export var ItemViewerBase = function ItemViewerBase(_ref) {
244
244
  }, viewerProps));
245
245
  case 'video':
246
246
  return /*#__PURE__*/React.createElement(VideoViewer, _extends({
247
+ identifier: identifier,
247
248
  showControls: showControls,
248
249
  onCanPlay: onSuccess,
249
250
  onError: onLoadFail
@@ -9,8 +9,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import React from 'react';
12
- import { getArtifactUrl, globalMediaEventEmitter } from '@atlaskit/media-client';
13
- import { CustomMediaPlayer } from '@atlaskit/media-ui';
12
+ import { getArtifactUrl, globalMediaEventEmitter, isFileIdentifier } from '@atlaskit/media-client';
13
+ import { CustomMediaPlayer, MediaPlayer } from '@atlaskit/media-ui';
14
14
  import { Outcome } from '../domain';
15
15
  import { MediaViewerError } from '../errors';
16
16
  import { Video, CustomVideoPlayerWrapper } from '../styleWrappers';
@@ -72,14 +72,30 @@ export var VideoViewer = /*#__PURE__*/function (_BaseViewer) {
72
72
  var _this$props2 = this.props,
73
73
  item = _this$props2.item,
74
74
  showControls = _this$props2.showControls,
75
- previewCount = _this$props2.previewCount;
75
+ previewCount = _this$props2.previewCount,
76
+ identifier = _this$props2.identifier;
76
77
  var useCustomVideoPlayer = !isIE();
77
78
  var isAutoPlay = previewCount === 0;
78
79
  var hdAvailable = isHDAvailable(item);
79
80
  var hdActiveOverride = fg('platform_media_disable_video_640p_artifact_usage') ? hdAvailable : isHDActive;
80
81
  return useCustomVideoPlayer ? /*#__PURE__*/React.createElement(CustomVideoPlayerWrapper, {
81
82
  "data-testid": "media-viewer-video-content"
82
- }, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
83
+ }, isFileIdentifier(identifier) && fg('platform_media_video_captions') ? /*#__PURE__*/React.createElement(MediaPlayer, {
84
+ identifier: identifier,
85
+ type: "video",
86
+ isAutoPlay: isAutoPlay,
87
+ onHDToggleClick: this.onHDChange,
88
+ showControls: showControls,
89
+ src: content,
90
+ isHDActive: hdActiveOverride,
91
+ isHDAvailable: hdAvailable,
92
+ isShortcutEnabled: true,
93
+ onFirstPlay: this.onFirstPlay,
94
+ onError: this.onError,
95
+ lastWatchTimeConfig: {
96
+ contentId: item.id
97
+ }
98
+ }) : /*#__PURE__*/React.createElement(CustomMediaPlayer, {
83
99
  type: "video",
84
100
  isAutoPlay: isAutoPlay,
85
101
  onHDToggleClick: this.onHDChange,
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { type MediaClient, type FileState } from '@atlaskit/media-client';
2
+ import { type MediaClient, type FileState, type Identifier } from '@atlaskit/media-client';
3
3
  import { type WithShowControlMethodProp } from '@atlaskit/media-ui';
4
4
  import { Outcome } from '../domain';
5
5
  import { MediaViewerError } from '../errors';
6
6
  import { type BaseState, BaseViewer } from './base-viewer';
7
7
  import { type MediaTraceContext } from '@atlaskit/media-common';
8
8
  export type Props = Readonly<{
9
+ identifier: Identifier;
9
10
  item: FileState;
10
11
  mediaClient: MediaClient;
11
12
  collectionName?: string;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { type MediaClient, type FileState } from '@atlaskit/media-client';
2
+ import { type MediaClient, type FileState, type Identifier } from '@atlaskit/media-client';
3
3
  import { type WithShowControlMethodProp } from '@atlaskit/media-ui';
4
4
  import { Outcome } from '../domain';
5
5
  import { MediaViewerError } from '../errors';
6
6
  import { type BaseState, BaseViewer } from './base-viewer';
7
7
  import { type MediaTraceContext } from '@atlaskit/media-common';
8
8
  export type Props = Readonly<{
9
+ identifier: Identifier;
9
10
  item: FileState;
10
11
  mediaClient: MediaClient;
11
12
  collectionName?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "52.0.16",
3
+ "version": "52.1.0",
4
4
  "description": "MediaViewer is Atlassian's powerful solution for viewing files on the web. It's both powerful and extendable yet easy-to-integrate",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,26 +37,26 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/analytics-next": "^11.0.0",
40
- "@atlaskit/button": "^23.0.0",
40
+ "@atlaskit/button": "^23.2.0",
41
41
  "@atlaskit/code": "^17.2.0",
42
42
  "@atlaskit/form": "^12.0.0",
43
43
  "@atlaskit/heading": "^5.2.0",
44
- "@atlaskit/icon": "^26.0.0",
44
+ "@atlaskit/icon": "^26.1.0",
45
45
  "@atlaskit/icon-file-type": "^7.0.0",
46
- "@atlaskit/icon-lab": "^4.12.0",
46
+ "@atlaskit/icon-lab": "^4.13.0",
47
47
  "@atlaskit/media-client": "^33.3.0",
48
48
  "@atlaskit/media-client-react": "^4.1.0",
49
- "@atlaskit/media-common": "^12.0.0",
50
- "@atlaskit/media-svg": "^2.0.0",
51
- "@atlaskit/media-ui": "^28.1.0",
49
+ "@atlaskit/media-common": "^12.1.0",
50
+ "@atlaskit/media-svg": "^2.1.0",
51
+ "@atlaskit/media-ui": "^28.2.0",
52
52
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
53
  "@atlaskit/portal": "^5.1.0",
54
- "@atlaskit/primitives": "^14.7.0",
55
- "@atlaskit/side-navigation": "^10.0.0",
54
+ "@atlaskit/primitives": "^14.8.0",
55
+ "@atlaskit/side-navigation": "^10.1.0",
56
56
  "@atlaskit/spinner": "^18.0.0",
57
57
  "@atlaskit/textfield": "^8.0.0",
58
58
  "@atlaskit/theme": "^18.0.0",
59
- "@atlaskit/tokens": "^4.8.0",
59
+ "@atlaskit/tokens": "^4.9.0",
60
60
  "@atlaskit/tooltip": "^20.0.0",
61
61
  "@atlaskit/ufo": "^0.4.0",
62
62
  "@babel/runtime": "^7.0.0",
@@ -114,6 +114,9 @@
114
114
  },
115
115
  "platform_media_compiled": {
116
116
  "type": "boolean"
117
+ },
118
+ "platform_media_video_captions": {
119
+ "type": "boolean"
117
120
  }
118
121
  },
119
122
  "techstack": {