@atlaskit/media-viewer 54.5.45 → 54.5.46

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,15 @@
1
1
  # @atlaskit/media-viewer
2
2
 
3
+ ## 54.5.46
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6098ef66f20ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6098ef66f20ae) -
8
+ [BMPT-8184] Fix video viewer showing "Something went wrong" for videos that only have an SD
9
+ (`video_640.mp4`) artifact. The viewer now prefers the HD (`video_1280.mp4`) artifact and falls
10
+ back to the SD artifact when HD is unavailable, instead of failing when no HD rendition exists.
11
+ Behind the `platform_media_video_sd_fallback` feature gate.
12
+
3
13
  ## 54.5.45
4
14
 
5
15
  ### 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 = "54.5.44";
13
+ var packageVersion = exports.packageVersion = "54.5.45";
14
14
  function getFileAttributes(fileState) {
15
15
  if (!fileState) {
16
16
  return {
@@ -13,7 +13,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
13
  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; }
14
14
  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; }
15
15
  var packageName = "@atlaskit/media-viewer";
16
- var packageVersion = "54.5.44";
16
+ var packageVersion = "54.5.45";
17
17
  var ufoExperience;
18
18
  var getExperience = function getExperience() {
19
19
  if (!ufoExperience) {
@@ -26,6 +26,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
26
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
27
27
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
28
  var hdArtifact = 'video_1280.mp4';
29
+ var sdArtifact = 'video_640.mp4';
29
30
  var VideoViewer = exports.VideoViewer = /*#__PURE__*/function (_BaseViewer) {
30
31
  function VideoViewer() {
31
32
  var _this;
@@ -132,58 +133,77 @@ var VideoViewer = exports.VideoViewer = /*#__PURE__*/function (_BaseViewer) {
132
133
  key: "init",
133
134
  value: function () {
134
135
  var _init = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
135
- var _this$props4, mediaClient, item, collectionName, contentUrl, _t;
136
+ var _this$props4, mediaClient, item, collectionName, contentUrl, preferredArtifact, _t;
136
137
  return _regenerator.default.wrap(function (_context) {
137
138
  while (1) switch (_context.prev = _context.next) {
138
139
  case 0:
139
140
  _this$props4 = this.props, mediaClient = _this$props4.mediaClient, item = _this$props4.item, collectionName = _this$props4.collectionName;
140
141
  _context.prev = 1;
141
142
  if (!(item.status === 'processed')) {
142
- _context.next = 4;
143
+ _context.next = 7;
143
144
  break;
144
145
  }
146
+ if (!(0, _platformFeatureFlags.fg)('platform_media_video_sd_fallback')) {
147
+ _context.next = 3;
148
+ break;
149
+ }
150
+ // Prefer the HD artifact, but fall back to the SD artifact when the media
151
+ // processing pipeline did not produce an HD (video_1280.mp4) rendition — this
152
+ // commonly happens for small / low-resolution sources that only get an SD
153
+ // (video_640.mp4) rendition. Previously the viewer required the HD artifact and
154
+ // threw `videoviewer-missing-artefact` synchronously, surfacing a generic
155
+ // "Something went wrong" screen with no playback attempt for SD-only videos.
156
+ preferredArtifact = (0, _mediaClient.getArtifactUrl)(item.artifacts, hdArtifact) ? hdArtifact : sdArtifact;
145
157
  _context.next = 2;
146
- return mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
158
+ return mediaClient.file.getArtifactURL(item.artifacts, preferredArtifact, collectionName);
147
159
  case 2:
148
160
  contentUrl = _context.sent;
161
+ _context.next = 5;
162
+ break;
163
+ case 3:
164
+ _context.next = 4;
165
+ return mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
166
+ case 4:
167
+ contentUrl = _context.sent;
168
+ case 5:
149
169
  if (contentUrl) {
150
- _context.next = 3;
170
+ _context.next = 6;
151
171
  break;
152
172
  }
153
173
  throw new _errors.MediaViewerError("videoviewer-missing-artefact");
154
- case 3:
155
- _context.next = 6;
174
+ case 6:
175
+ _context.next = 9;
156
176
  break;
157
- case 4:
158
- _context.next = 5;
177
+ case 7:
178
+ _context.next = 8;
159
179
  return (0, _getObjectUrlFromFileState.getObjectUrlFromFileState)(item);
160
- case 5:
180
+ case 8:
161
181
  contentUrl = _context.sent;
162
182
  if (contentUrl) {
163
- _context.next = 6;
183
+ _context.next = 9;
164
184
  break;
165
185
  }
166
186
  this.setState({
167
187
  content: _domain.Outcome.pending()
168
188
  });
169
189
  return _context.abrupt("return");
170
- case 6:
190
+ case 9:
171
191
  this.setState({
172
192
  content: _domain.Outcome.successful(contentUrl)
173
193
  });
174
- _context.next = 8;
194
+ _context.next = 11;
175
195
  break;
176
- case 7:
177
- _context.prev = 7;
196
+ case 10:
197
+ _context.prev = 10;
178
198
  _t = _context["catch"](1);
179
199
  this.setState({
180
200
  content: _domain.Outcome.failed(new _errors.MediaViewerError('videoviewer-fetch-url', _t instanceof Error ? _t : undefined))
181
201
  });
182
- case 8:
202
+ case 11:
183
203
  case "end":
184
204
  return _context.stop();
185
205
  }
186
- }, _callee, this, [[1, 7]]);
206
+ }, _callee, this, [[1, 10]]);
187
207
  }));
188
208
  function init() {
189
209
  return _init.apply(this, arguments);
@@ -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 = "54.5.44";
4
+ const packageVersion = "54.5.45";
5
5
  export { packageName, packageVersion, componentName, componentName as component };
6
6
  export function getFileAttributes(fileState) {
7
7
  if (!fileState) {
@@ -3,7 +3,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
3
3
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  const packageName = "@atlaskit/media-viewer";
6
- const packageVersion = "54.5.44";
6
+ const packageVersion = "54.5.45";
7
7
  let ufoExperience;
8
8
  const getExperience = () => {
9
9
  if (!ufoExperience) {
@@ -10,6 +10,7 @@ import { BaseViewer } from './base-viewer';
10
10
  import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  const hdArtifact = 'video_1280.mp4';
13
+ const sdArtifact = 'video_640.mp4';
13
14
  export class VideoViewer extends BaseViewer {
14
15
  constructor(...args) {
15
16
  super(...args);
@@ -113,7 +114,18 @@ export class VideoViewer extends BaseViewer {
113
114
  try {
114
115
  let contentUrl;
115
116
  if (item.status === 'processed') {
116
- contentUrl = await mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
117
+ if (fg('platform_media_video_sd_fallback')) {
118
+ // Prefer the HD artifact, but fall back to the SD artifact when the media
119
+ // processing pipeline did not produce an HD (video_1280.mp4) rendition — this
120
+ // commonly happens for small / low-resolution sources that only get an SD
121
+ // (video_640.mp4) rendition. Previously the viewer required the HD artifact and
122
+ // threw `videoviewer-missing-artefact` synchronously, surfacing a generic
123
+ // "Something went wrong" screen with no playback attempt for SD-only videos.
124
+ const preferredArtifact = getArtifactUrl(item.artifacts, hdArtifact) ? hdArtifact : sdArtifact;
125
+ contentUrl = await mediaClient.file.getArtifactURL(item.artifacts, preferredArtifact, collectionName);
126
+ } else {
127
+ contentUrl = await mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
128
+ }
117
129
  if (!contentUrl) {
118
130
  throw new MediaViewerError(`videoviewer-missing-artefact`);
119
131
  }
@@ -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 = "54.5.44";
4
+ var packageVersion = "54.5.45";
5
5
  export { packageName, packageVersion, componentName, componentName as component };
6
6
  export function getFileAttributes(fileState) {
7
7
  if (!fileState) {
@@ -6,7 +6,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
6
6
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  var packageName = "@atlaskit/media-viewer";
9
- var packageVersion = "54.5.44";
9
+ var packageVersion = "54.5.45";
10
10
  var ufoExperience;
11
11
  var getExperience = function getExperience() {
12
12
  if (!ufoExperience) {
@@ -19,6 +19,7 @@ import { BaseViewer } from './base-viewer';
19
19
  import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
20
20
  import { fg } from '@atlaskit/platform-feature-flags';
21
21
  var hdArtifact = 'video_1280.mp4';
22
+ var sdArtifact = 'video_640.mp4';
22
23
  export var VideoViewer = /*#__PURE__*/function (_BaseViewer) {
23
24
  function VideoViewer() {
24
25
  var _this;
@@ -125,58 +126,77 @@ export var VideoViewer = /*#__PURE__*/function (_BaseViewer) {
125
126
  key: "init",
126
127
  value: function () {
127
128
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
128
- var _this$props4, mediaClient, item, collectionName, contentUrl, _t;
129
+ var _this$props4, mediaClient, item, collectionName, contentUrl, preferredArtifact, _t;
129
130
  return _regeneratorRuntime.wrap(function (_context) {
130
131
  while (1) switch (_context.prev = _context.next) {
131
132
  case 0:
132
133
  _this$props4 = this.props, mediaClient = _this$props4.mediaClient, item = _this$props4.item, collectionName = _this$props4.collectionName;
133
134
  _context.prev = 1;
134
135
  if (!(item.status === 'processed')) {
135
- _context.next = 4;
136
+ _context.next = 7;
136
137
  break;
137
138
  }
139
+ if (!fg('platform_media_video_sd_fallback')) {
140
+ _context.next = 3;
141
+ break;
142
+ }
143
+ // Prefer the HD artifact, but fall back to the SD artifact when the media
144
+ // processing pipeline did not produce an HD (video_1280.mp4) rendition — this
145
+ // commonly happens for small / low-resolution sources that only get an SD
146
+ // (video_640.mp4) rendition. Previously the viewer required the HD artifact and
147
+ // threw `videoviewer-missing-artefact` synchronously, surfacing a generic
148
+ // "Something went wrong" screen with no playback attempt for SD-only videos.
149
+ preferredArtifact = getArtifactUrl(item.artifacts, hdArtifact) ? hdArtifact : sdArtifact;
138
150
  _context.next = 2;
139
- return mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
151
+ return mediaClient.file.getArtifactURL(item.artifacts, preferredArtifact, collectionName);
140
152
  case 2:
141
153
  contentUrl = _context.sent;
154
+ _context.next = 5;
155
+ break;
156
+ case 3:
157
+ _context.next = 4;
158
+ return mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
159
+ case 4:
160
+ contentUrl = _context.sent;
161
+ case 5:
142
162
  if (contentUrl) {
143
- _context.next = 3;
163
+ _context.next = 6;
144
164
  break;
145
165
  }
146
166
  throw new MediaViewerError("videoviewer-missing-artefact");
147
- case 3:
148
- _context.next = 6;
167
+ case 6:
168
+ _context.next = 9;
149
169
  break;
150
- case 4:
151
- _context.next = 5;
170
+ case 7:
171
+ _context.next = 8;
152
172
  return getObjectUrlFromFileState(item);
153
- case 5:
173
+ case 8:
154
174
  contentUrl = _context.sent;
155
175
  if (contentUrl) {
156
- _context.next = 6;
176
+ _context.next = 9;
157
177
  break;
158
178
  }
159
179
  this.setState({
160
180
  content: Outcome.pending()
161
181
  });
162
182
  return _context.abrupt("return");
163
- case 6:
183
+ case 9:
164
184
  this.setState({
165
185
  content: Outcome.successful(contentUrl)
166
186
  });
167
- _context.next = 8;
187
+ _context.next = 11;
168
188
  break;
169
- case 7:
170
- _context.prev = 7;
189
+ case 10:
190
+ _context.prev = 10;
171
191
  _t = _context["catch"](1);
172
192
  this.setState({
173
193
  content: Outcome.failed(new MediaViewerError('videoviewer-fetch-url', _t instanceof Error ? _t : undefined))
174
194
  });
175
- case 8:
195
+ case 11:
176
196
  case "end":
177
197
  return _context.stop();
178
198
  }
179
- }, _callee, this, [[1, 7]]);
199
+ }, _callee, this, [[1, 10]]);
180
200
  }));
181
201
  function init() {
182
202
  return _init.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-viewer",
3
- "version": "54.5.45",
3
+ "version": "54.5.46",
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/"
@@ -141,6 +141,9 @@
141
141
  "platform_media_archive_zip_guard": {
142
142
  "type": "boolean"
143
143
  },
144
+ "platform_media_video_sd_fallback": {
145
+ "type": "boolean"
146
+ },
144
147
  "platform_media_unsupported_mime_routing": {
145
148
  "type": "boolean"
146
149
  }