@atlaskit/media-card 79.3.1 → 79.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.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/inlinePlayer.js +88 -57
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/inlinePlayer.js +42 -26
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/inlinePlayer.js +89 -58
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#134528](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134528)
|
|
8
|
+
[`61165836daa36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/61165836daa36) -
|
|
9
|
+
[ux] Use latest media token on video resume or seek
|
|
10
|
+
|
|
11
|
+
Previously when resuming a video after the current token had expired the video player would fail
|
|
12
|
+
to load and would show an error boundary page.
|
|
13
|
+
|
|
14
|
+
The same bug would occur when seeking to a new `currentTime` after the token expired.
|
|
15
|
+
|
|
16
|
+
Now both the dedicated and inline player will update their `src` to a new URL with the latest
|
|
17
|
+
cached token.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 79.3.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -21,7 +21,7 @@ var _excluded = ["identifier"];
|
|
|
21
21
|
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); }
|
|
22
22
|
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; }
|
|
23
23
|
var packageName = "@atlaskit/media-card";
|
|
24
|
-
var packageVersion = "79.3.
|
|
24
|
+
var packageVersion = "79.3.2";
|
|
25
25
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
26
26
|
var identifier = _ref.identifier,
|
|
27
27
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -74,12 +74,77 @@ var InlinePlayerBase = exports.InlinePlayerBase = function InlinePlayerBase(_ref
|
|
|
74
74
|
occurrenceKey: occurrenceKey
|
|
75
75
|
}),
|
|
76
76
|
fileState = _useFileState.fileState;
|
|
77
|
+
var init = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
78
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(fileState) {
|
|
79
|
+
var artifactName, artifacts, newFileSrc, _newFileSrc;
|
|
80
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
81
|
+
while (1) switch (_context.prev = _context.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
84
|
+
_context.next = 2;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
return _context.abrupt("return");
|
|
88
|
+
case 2:
|
|
89
|
+
artifactName = getPreferredVideoArtifact(fileState);
|
|
90
|
+
artifacts = fileState.artifacts;
|
|
91
|
+
if (!(!artifactName || !artifacts)) {
|
|
92
|
+
_context.next = 16;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
_context.prev = 5;
|
|
96
|
+
_context.next = 8;
|
|
97
|
+
return mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
98
|
+
case 8:
|
|
99
|
+
newFileSrc = _context.sent;
|
|
100
|
+
setFileSrc(newFileSrc);
|
|
101
|
+
_context.next = 15;
|
|
102
|
+
break;
|
|
103
|
+
case 12:
|
|
104
|
+
_context.prev = 12;
|
|
105
|
+
_context.t0 = _context["catch"](5);
|
|
106
|
+
if (onErrorRef.current && _context.t0 instanceof Error) {
|
|
107
|
+
onErrorRef.current(_context.t0);
|
|
108
|
+
}
|
|
109
|
+
case 15:
|
|
110
|
+
return _context.abrupt("return");
|
|
111
|
+
case 16:
|
|
112
|
+
_context.prev = 16;
|
|
113
|
+
_context.next = 19;
|
|
114
|
+
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
115
|
+
case 19:
|
|
116
|
+
_newFileSrc = _context.sent;
|
|
117
|
+
setFileSrc(_newFileSrc);
|
|
118
|
+
_context.next = 26;
|
|
119
|
+
break;
|
|
120
|
+
case 23:
|
|
121
|
+
_context.prev = 23;
|
|
122
|
+
_context.t1 = _context["catch"](16);
|
|
123
|
+
if (onErrorRef.current && _context.t1 instanceof Error) {
|
|
124
|
+
onErrorRef.current(_context.t1);
|
|
125
|
+
}
|
|
126
|
+
case 26:
|
|
127
|
+
case "end":
|
|
128
|
+
return _context.stop();
|
|
129
|
+
}
|
|
130
|
+
}, _callee, null, [[5, 12], [16, 23]]);
|
|
131
|
+
}));
|
|
132
|
+
return function (_x) {
|
|
133
|
+
return _ref2.apply(this, arguments);
|
|
134
|
+
};
|
|
135
|
+
}(), [collectionName, id, mediaClient.file]);
|
|
136
|
+
var onPlay = function onPlay() {
|
|
137
|
+
if ((0, _platformFeatureFlags.fg)('platform_media_resume_video_on_token_expiry')) {
|
|
138
|
+
fileState && init(fileState);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
var onTimeChanged = onPlay;
|
|
77
142
|
(0, _react.useEffect)(function () {
|
|
78
143
|
var subscribeFileState = /*#__PURE__*/function () {
|
|
79
|
-
var
|
|
80
|
-
var _yield$fileState$prev, value, newFileSrc
|
|
81
|
-
return _regenerator.default.wrap(function
|
|
82
|
-
while (1) switch (
|
|
144
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(fileState) {
|
|
145
|
+
var _yield$fileState$prev, value, newFileSrc;
|
|
146
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
147
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
83
148
|
case 0:
|
|
84
149
|
if (fileState.status === 'uploading') {
|
|
85
150
|
setIsUploading(true);
|
|
@@ -90,83 +155,45 @@ var InlinePlayerBase = exports.InlinePlayerBase = function InlinePlayerBase(_ref
|
|
|
90
155
|
|
|
91
156
|
// We reuse the existing fileSrc to prevent re renders, therefore we only perform fileSrc updates when there isn't any
|
|
92
157
|
if (!fileSrc) {
|
|
93
|
-
|
|
158
|
+
_context2.next = 3;
|
|
94
159
|
break;
|
|
95
160
|
}
|
|
96
|
-
return
|
|
161
|
+
return _context2.abrupt("return");
|
|
97
162
|
case 3:
|
|
98
163
|
if (!(fileState.status !== 'error' && fileState.preview)) {
|
|
99
|
-
|
|
164
|
+
_context2.next = 12;
|
|
100
165
|
break;
|
|
101
166
|
}
|
|
102
|
-
|
|
167
|
+
_context2.next = 6;
|
|
103
168
|
return fileState.preview;
|
|
104
169
|
case 6:
|
|
105
|
-
_yield$fileState$prev =
|
|
170
|
+
_yield$fileState$prev = _context2.sent;
|
|
106
171
|
value = _yield$fileState$prev.value;
|
|
107
172
|
if (!(value instanceof Blob && value.type.indexOf('video/') === 0)) {
|
|
108
|
-
|
|
173
|
+
_context2.next = 12;
|
|
109
174
|
break;
|
|
110
175
|
}
|
|
111
176
|
newFileSrc = URL.createObjectURL(value);
|
|
112
177
|
setFileSrc(newFileSrc);
|
|
113
|
-
return
|
|
178
|
+
return _context2.abrupt("return");
|
|
114
179
|
case 12:
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
artifactName = getPreferredVideoArtifact(fileState);
|
|
120
|
-
artifacts = fileState.artifacts;
|
|
121
|
-
if (!(!artifactName || !artifacts)) {
|
|
122
|
-
_context.next = 27;
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
_context.prev = 16;
|
|
126
|
-
_context.next = 19;
|
|
127
|
-
return mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
128
|
-
case 19:
|
|
129
|
-
_newFileSrc = _context.sent;
|
|
130
|
-
setFileSrc(_newFileSrc);
|
|
131
|
-
_context.next = 26;
|
|
132
|
-
break;
|
|
133
|
-
case 23:
|
|
134
|
-
_context.prev = 23;
|
|
135
|
-
_context.t0 = _context["catch"](16);
|
|
136
|
-
if (onErrorRef.current && _context.t0 instanceof Error) {
|
|
137
|
-
onErrorRef.current(_context.t0);
|
|
138
|
-
}
|
|
139
|
-
case 26:
|
|
140
|
-
return _context.abrupt("return");
|
|
141
|
-
case 27:
|
|
142
|
-
_context.prev = 27;
|
|
143
|
-
_context.next = 30;
|
|
144
|
-
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
145
|
-
case 30:
|
|
146
|
-
_newFileSrc2 = _context.sent;
|
|
147
|
-
setFileSrc(_newFileSrc2);
|
|
148
|
-
_context.next = 37;
|
|
149
|
-
break;
|
|
150
|
-
case 34:
|
|
151
|
-
_context.prev = 34;
|
|
152
|
-
_context.t1 = _context["catch"](27);
|
|
153
|
-
if (onErrorRef.current && _context.t1 instanceof Error) {
|
|
154
|
-
onErrorRef.current(_context.t1);
|
|
180
|
+
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
181
|
+
init(fileState);
|
|
155
182
|
}
|
|
156
|
-
case
|
|
183
|
+
case 13:
|
|
157
184
|
case "end":
|
|
158
|
-
return
|
|
185
|
+
return _context2.stop();
|
|
159
186
|
}
|
|
160
|
-
},
|
|
187
|
+
}, _callee2);
|
|
161
188
|
}));
|
|
162
|
-
return function subscribeFileState(
|
|
163
|
-
return
|
|
189
|
+
return function subscribeFileState(_x2) {
|
|
190
|
+
return _ref3.apply(this, arguments);
|
|
164
191
|
};
|
|
165
192
|
}();
|
|
166
193
|
if (fileState) {
|
|
167
194
|
subscribeFileState(fileState);
|
|
168
195
|
}
|
|
169
|
-
}, [fileState, collectionName, fileSrc, id, mediaClient]);
|
|
196
|
+
}, [fileState, collectionName, fileSrc, id, mediaClient, init]);
|
|
170
197
|
(0, _react.useEffect)(function () {
|
|
171
198
|
return function () {
|
|
172
199
|
fileSrc && URL.revokeObjectURL(fileSrc);
|
|
@@ -200,6 +227,8 @@ var InlinePlayerBase = exports.InlinePlayerBase = function InlinePlayerBase(_ref
|
|
|
200
227
|
viewingLevel: 'full'
|
|
201
228
|
});
|
|
202
229
|
},
|
|
230
|
+
onPlay: onPlay,
|
|
231
|
+
onTimeChanged: onTimeChanged,
|
|
203
232
|
lastWatchTimeConfig: {
|
|
204
233
|
contentId: id
|
|
205
234
|
},
|
|
@@ -224,6 +253,8 @@ var InlinePlayerBase = exports.InlinePlayerBase = function InlinePlayerBase(_ref
|
|
|
224
253
|
viewingLevel: 'full'
|
|
225
254
|
});
|
|
226
255
|
},
|
|
256
|
+
onPlay: onPlay,
|
|
257
|
+
onTimeChanged: onTimeChanged,
|
|
227
258
|
lastWatchTimeConfig: {
|
|
228
259
|
contentId: id
|
|
229
260
|
},
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "79.3.
|
|
90
|
+
var packageVersion = "79.3.2";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -117,7 +117,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
117
117
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
118
118
|
var analyticsContext = {
|
|
119
119
|
packageVersion: "@atlaskit/media-card",
|
|
120
|
-
packageName: "79.3.
|
|
120
|
+
packageName: "79.3.2",
|
|
121
121
|
componentName: 'mediaInlineCard',
|
|
122
122
|
component: 'mediaInlineCard'
|
|
123
123
|
};
|
|
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
var packageName = "@atlaskit/media-card";
|
|
18
|
-
var packageVersion = "79.3.
|
|
18
|
+
var packageVersion = "79.3.2";
|
|
19
19
|
var SAMPLE_RATE = 0.05;
|
|
20
20
|
var concurrentExperience;
|
|
21
21
|
var getExperience = function getExperience(id) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "79.3.
|
|
12
|
+
const packageVersion = "79.3.2";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
4
4
|
import { CustomMediaPlayer, MediaPlayer, InactivityDetector } from '@atlaskit/media-ui';
|
|
5
5
|
import { defaultImageCardDimensions } from '../utils';
|
|
@@ -57,6 +57,41 @@ export const InlinePlayerBase = ({
|
|
|
57
57
|
collectionName,
|
|
58
58
|
occurrenceKey
|
|
59
59
|
});
|
|
60
|
+
const init = useCallback(async fileState => {
|
|
61
|
+
if (!(fileState.status === 'processed' || fileState.status === 'processing')) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const artifactName = getPreferredVideoArtifact(fileState);
|
|
65
|
+
const {
|
|
66
|
+
artifacts
|
|
67
|
+
} = fileState;
|
|
68
|
+
if (!artifactName || !artifacts) {
|
|
69
|
+
// Tries to use the binary artifact to provide something to play while the video is still processing
|
|
70
|
+
try {
|
|
71
|
+
const newFileSrc = await mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
72
|
+
setFileSrc(newFileSrc);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (onErrorRef.current && error instanceof Error) {
|
|
75
|
+
onErrorRef.current(error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const newFileSrc = await mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
82
|
+
setFileSrc(newFileSrc);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (onErrorRef.current && error instanceof Error) {
|
|
85
|
+
onErrorRef.current(error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [collectionName, id, mediaClient.file]);
|
|
89
|
+
const onPlay = () => {
|
|
90
|
+
if (fg('platform_media_resume_video_on_token_expiry')) {
|
|
91
|
+
fileState && init(fileState);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const onTimeChanged = onPlay;
|
|
60
95
|
useEffect(() => {
|
|
61
96
|
const subscribeFileState = async fileState => {
|
|
62
97
|
if (fileState.status === 'uploading') {
|
|
@@ -81,36 +116,13 @@ export const InlinePlayerBase = ({
|
|
|
81
116
|
}
|
|
82
117
|
}
|
|
83
118
|
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
84
|
-
|
|
85
|
-
const {
|
|
86
|
-
artifacts
|
|
87
|
-
} = fileState;
|
|
88
|
-
if (!artifactName || !artifacts) {
|
|
89
|
-
// Tries to use the binary artifact to provide something to play while the video is still processing
|
|
90
|
-
try {
|
|
91
|
-
const newFileSrc = await mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
92
|
-
setFileSrc(newFileSrc);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
if (onErrorRef.current && error instanceof Error) {
|
|
95
|
-
onErrorRef.current(error);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
try {
|
|
101
|
-
const newFileSrc = await mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
102
|
-
setFileSrc(newFileSrc);
|
|
103
|
-
} catch (error) {
|
|
104
|
-
if (onErrorRef.current && error instanceof Error) {
|
|
105
|
-
onErrorRef.current(error);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
119
|
+
init(fileState);
|
|
108
120
|
}
|
|
109
121
|
};
|
|
110
122
|
if (fileState) {
|
|
111
123
|
subscribeFileState(fileState);
|
|
112
124
|
}
|
|
113
|
-
}, [fileState, collectionName, fileSrc, id, mediaClient]);
|
|
125
|
+
}, [fileState, collectionName, fileSrc, id, mediaClient, init]);
|
|
114
126
|
useEffect(() => {
|
|
115
127
|
return () => {
|
|
116
128
|
fileSrc && URL.revokeObjectURL(fileSrc);
|
|
@@ -143,6 +155,8 @@ export const InlinePlayerBase = ({
|
|
|
143
155
|
viewingLevel: 'full'
|
|
144
156
|
});
|
|
145
157
|
},
|
|
158
|
+
onPlay: onPlay,
|
|
159
|
+
onTimeChanged: onTimeChanged,
|
|
146
160
|
lastWatchTimeConfig: {
|
|
147
161
|
contentId: id
|
|
148
162
|
},
|
|
@@ -167,6 +181,8 @@ export const InlinePlayerBase = ({
|
|
|
167
181
|
viewingLevel: 'full'
|
|
168
182
|
});
|
|
169
183
|
},
|
|
184
|
+
onPlay: onPlay,
|
|
185
|
+
onTimeChanged: onTimeChanged,
|
|
170
186
|
lastWatchTimeConfig: {
|
|
171
187
|
contentId: id
|
|
172
188
|
},
|
|
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
|
|
|
66
66
|
}
|
|
67
67
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
68
68
|
const packageName = "@atlaskit/media-card";
|
|
69
|
-
const packageVersion = "79.3.
|
|
69
|
+
const packageVersion = "79.3.2";
|
|
70
70
|
|
|
71
71
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
72
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "79.3.
|
|
40
|
+
packageName: "79.3.2",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -5,7 +5,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
5
5
|
import { MediaCardError } from '../errors';
|
|
6
6
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
7
7
|
const packageName = "@atlaskit/media-card";
|
|
8
|
-
const packageVersion = "79.3.
|
|
8
|
+
const packageVersion = "79.3.2";
|
|
9
9
|
const SAMPLE_RATE = 0.05;
|
|
10
10
|
let concurrentExperience;
|
|
11
11
|
const getExperience = id => {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
12
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "79.3.
|
|
14
|
+
var packageVersion = "79.3.2";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
5
|
+
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
|
6
6
|
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
7
7
|
import { CustomMediaPlayer, MediaPlayer, InactivityDetector } from '@atlaskit/media-ui';
|
|
8
8
|
import { defaultImageCardDimensions } from '../utils';
|
|
@@ -64,12 +64,77 @@ export var InlinePlayerBase = function InlinePlayerBase(_ref) {
|
|
|
64
64
|
occurrenceKey: occurrenceKey
|
|
65
65
|
}),
|
|
66
66
|
fileState = _useFileState.fileState;
|
|
67
|
+
var init = useCallback( /*#__PURE__*/function () {
|
|
68
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileState) {
|
|
69
|
+
var artifactName, artifacts, newFileSrc, _newFileSrc;
|
|
70
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
71
|
+
while (1) switch (_context.prev = _context.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
74
|
+
_context.next = 2;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return _context.abrupt("return");
|
|
78
|
+
case 2:
|
|
79
|
+
artifactName = getPreferredVideoArtifact(fileState);
|
|
80
|
+
artifacts = fileState.artifacts;
|
|
81
|
+
if (!(!artifactName || !artifacts)) {
|
|
82
|
+
_context.next = 16;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
_context.prev = 5;
|
|
86
|
+
_context.next = 8;
|
|
87
|
+
return mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
88
|
+
case 8:
|
|
89
|
+
newFileSrc = _context.sent;
|
|
90
|
+
setFileSrc(newFileSrc);
|
|
91
|
+
_context.next = 15;
|
|
92
|
+
break;
|
|
93
|
+
case 12:
|
|
94
|
+
_context.prev = 12;
|
|
95
|
+
_context.t0 = _context["catch"](5);
|
|
96
|
+
if (onErrorRef.current && _context.t0 instanceof Error) {
|
|
97
|
+
onErrorRef.current(_context.t0);
|
|
98
|
+
}
|
|
99
|
+
case 15:
|
|
100
|
+
return _context.abrupt("return");
|
|
101
|
+
case 16:
|
|
102
|
+
_context.prev = 16;
|
|
103
|
+
_context.next = 19;
|
|
104
|
+
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
105
|
+
case 19:
|
|
106
|
+
_newFileSrc = _context.sent;
|
|
107
|
+
setFileSrc(_newFileSrc);
|
|
108
|
+
_context.next = 26;
|
|
109
|
+
break;
|
|
110
|
+
case 23:
|
|
111
|
+
_context.prev = 23;
|
|
112
|
+
_context.t1 = _context["catch"](16);
|
|
113
|
+
if (onErrorRef.current && _context.t1 instanceof Error) {
|
|
114
|
+
onErrorRef.current(_context.t1);
|
|
115
|
+
}
|
|
116
|
+
case 26:
|
|
117
|
+
case "end":
|
|
118
|
+
return _context.stop();
|
|
119
|
+
}
|
|
120
|
+
}, _callee, null, [[5, 12], [16, 23]]);
|
|
121
|
+
}));
|
|
122
|
+
return function (_x) {
|
|
123
|
+
return _ref2.apply(this, arguments);
|
|
124
|
+
};
|
|
125
|
+
}(), [collectionName, id, mediaClient.file]);
|
|
126
|
+
var onPlay = function onPlay() {
|
|
127
|
+
if (fg('platform_media_resume_video_on_token_expiry')) {
|
|
128
|
+
fileState && init(fileState);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var onTimeChanged = onPlay;
|
|
67
132
|
useEffect(function () {
|
|
68
133
|
var subscribeFileState = /*#__PURE__*/function () {
|
|
69
|
-
var
|
|
70
|
-
var _yield$fileState$prev, value, newFileSrc
|
|
71
|
-
return _regeneratorRuntime.wrap(function
|
|
72
|
-
while (1) switch (
|
|
134
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileState) {
|
|
135
|
+
var _yield$fileState$prev, value, newFileSrc;
|
|
136
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
137
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
73
138
|
case 0:
|
|
74
139
|
if (fileState.status === 'uploading') {
|
|
75
140
|
setIsUploading(true);
|
|
@@ -80,83 +145,45 @@ export var InlinePlayerBase = function InlinePlayerBase(_ref) {
|
|
|
80
145
|
|
|
81
146
|
// We reuse the existing fileSrc to prevent re renders, therefore we only perform fileSrc updates when there isn't any
|
|
82
147
|
if (!fileSrc) {
|
|
83
|
-
|
|
148
|
+
_context2.next = 3;
|
|
84
149
|
break;
|
|
85
150
|
}
|
|
86
|
-
return
|
|
151
|
+
return _context2.abrupt("return");
|
|
87
152
|
case 3:
|
|
88
153
|
if (!(fileState.status !== 'error' && fileState.preview)) {
|
|
89
|
-
|
|
154
|
+
_context2.next = 12;
|
|
90
155
|
break;
|
|
91
156
|
}
|
|
92
|
-
|
|
157
|
+
_context2.next = 6;
|
|
93
158
|
return fileState.preview;
|
|
94
159
|
case 6:
|
|
95
|
-
_yield$fileState$prev =
|
|
160
|
+
_yield$fileState$prev = _context2.sent;
|
|
96
161
|
value = _yield$fileState$prev.value;
|
|
97
162
|
if (!(value instanceof Blob && value.type.indexOf('video/') === 0)) {
|
|
98
|
-
|
|
163
|
+
_context2.next = 12;
|
|
99
164
|
break;
|
|
100
165
|
}
|
|
101
166
|
newFileSrc = URL.createObjectURL(value);
|
|
102
167
|
setFileSrc(newFileSrc);
|
|
103
|
-
return
|
|
168
|
+
return _context2.abrupt("return");
|
|
104
169
|
case 12:
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
artifactName = getPreferredVideoArtifact(fileState);
|
|
110
|
-
artifacts = fileState.artifacts;
|
|
111
|
-
if (!(!artifactName || !artifacts)) {
|
|
112
|
-
_context.next = 27;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
_context.prev = 16;
|
|
116
|
-
_context.next = 19;
|
|
117
|
-
return mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
118
|
-
case 19:
|
|
119
|
-
_newFileSrc = _context.sent;
|
|
120
|
-
setFileSrc(_newFileSrc);
|
|
121
|
-
_context.next = 26;
|
|
122
|
-
break;
|
|
123
|
-
case 23:
|
|
124
|
-
_context.prev = 23;
|
|
125
|
-
_context.t0 = _context["catch"](16);
|
|
126
|
-
if (onErrorRef.current && _context.t0 instanceof Error) {
|
|
127
|
-
onErrorRef.current(_context.t0);
|
|
128
|
-
}
|
|
129
|
-
case 26:
|
|
130
|
-
return _context.abrupt("return");
|
|
131
|
-
case 27:
|
|
132
|
-
_context.prev = 27;
|
|
133
|
-
_context.next = 30;
|
|
134
|
-
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
135
|
-
case 30:
|
|
136
|
-
_newFileSrc2 = _context.sent;
|
|
137
|
-
setFileSrc(_newFileSrc2);
|
|
138
|
-
_context.next = 37;
|
|
139
|
-
break;
|
|
140
|
-
case 34:
|
|
141
|
-
_context.prev = 34;
|
|
142
|
-
_context.t1 = _context["catch"](27);
|
|
143
|
-
if (onErrorRef.current && _context.t1 instanceof Error) {
|
|
144
|
-
onErrorRef.current(_context.t1);
|
|
170
|
+
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
171
|
+
init(fileState);
|
|
145
172
|
}
|
|
146
|
-
case
|
|
173
|
+
case 13:
|
|
147
174
|
case "end":
|
|
148
|
-
return
|
|
175
|
+
return _context2.stop();
|
|
149
176
|
}
|
|
150
|
-
},
|
|
177
|
+
}, _callee2);
|
|
151
178
|
}));
|
|
152
|
-
return function subscribeFileState(
|
|
153
|
-
return
|
|
179
|
+
return function subscribeFileState(_x2) {
|
|
180
|
+
return _ref3.apply(this, arguments);
|
|
154
181
|
};
|
|
155
182
|
}();
|
|
156
183
|
if (fileState) {
|
|
157
184
|
subscribeFileState(fileState);
|
|
158
185
|
}
|
|
159
|
-
}, [fileState, collectionName, fileSrc, id, mediaClient]);
|
|
186
|
+
}, [fileState, collectionName, fileSrc, id, mediaClient, init]);
|
|
160
187
|
useEffect(function () {
|
|
161
188
|
return function () {
|
|
162
189
|
fileSrc && URL.revokeObjectURL(fileSrc);
|
|
@@ -190,6 +217,8 @@ export var InlinePlayerBase = function InlinePlayerBase(_ref) {
|
|
|
190
217
|
viewingLevel: 'full'
|
|
191
218
|
});
|
|
192
219
|
},
|
|
220
|
+
onPlay: onPlay,
|
|
221
|
+
onTimeChanged: onTimeChanged,
|
|
193
222
|
lastWatchTimeConfig: {
|
|
194
223
|
contentId: id
|
|
195
224
|
},
|
|
@@ -214,6 +243,8 @@ export var InlinePlayerBase = function InlinePlayerBase(_ref) {
|
|
|
214
243
|
viewingLevel: 'full'
|
|
215
244
|
});
|
|
216
245
|
},
|
|
246
|
+
onPlay: onPlay,
|
|
247
|
+
onTimeChanged: onTimeChanged,
|
|
217
248
|
lastWatchTimeConfig: {
|
|
218
249
|
contentId: id
|
|
219
250
|
},
|
|
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
80
80
|
}(React.Component);
|
|
81
81
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
82
82
|
var packageName = "@atlaskit/media-card";
|
|
83
|
-
var packageVersion = "79.3.
|
|
83
|
+
var packageVersion = "79.3.2";
|
|
84
84
|
|
|
85
85
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
86
86
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
102
102
|
var analyticsContext = {
|
|
103
103
|
packageVersion: "@atlaskit/media-card",
|
|
104
|
-
packageName: "79.3.
|
|
104
|
+
packageName: "79.3.2",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -8,7 +8,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
8
8
|
import { MediaCardError } from '../errors';
|
|
9
9
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
10
10
|
var packageName = "@atlaskit/media-card";
|
|
11
|
-
var packageVersion = "79.3.
|
|
11
|
+
var packageVersion = "79.3.2";
|
|
12
12
|
var SAMPLE_RATE = 0.05;
|
|
13
13
|
var concurrentExperience;
|
|
14
14
|
var getExperience = function getExperience(id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.3.
|
|
3
|
+
"version": "79.3.2",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
41
41
|
"@atlaskit/dropdown-menu": "^16.0.0",
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
43
|
-
"@atlaskit/icon": "^26.
|
|
43
|
+
"@atlaskit/icon": "^26.4.0",
|
|
44
44
|
"@atlaskit/link": "^3.2.0",
|
|
45
45
|
"@atlaskit/media-client": "^33.3.0",
|
|
46
46
|
"@atlaskit/media-client-react": "^4.1.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/spinner": "^18.0.0",
|
|
56
56
|
"@atlaskit/theme": "^18.0.0",
|
|
57
57
|
"@atlaskit/tokens": "^4.9.0",
|
|
58
|
-
"@atlaskit/tooltip": "^20.
|
|
58
|
+
"@atlaskit/tooltip": "^20.2.0",
|
|
59
59
|
"@atlaskit/ufo": "^0.4.0",
|
|
60
60
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|
|
@@ -139,6 +139,9 @@
|
|
|
139
139
|
},
|
|
140
140
|
"platform_media_video_captions": {
|
|
141
141
|
"type": "boolean"
|
|
142
|
+
},
|
|
143
|
+
"platform_media_resume_video_on_token_expiry": {
|
|
144
|
+
"type": "boolean"
|
|
142
145
|
}
|
|
143
146
|
},
|
|
144
147
|
"techstack": {
|