@atlaskit/media-client 18.0.0 → 18.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 +11 -0
- package/dist/cjs/client/media-client.js +2 -2
- package/dist/cjs/client/media-store/index.js +22 -11
- package/dist/cjs/utils/getVideoDimensionsFromBlob.js +23 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/media-client.js +2 -2
- package/dist/es2019/client/media-store/index.js +14 -5
- package/dist/es2019/utils/getVideoDimensionsFromBlob.js +21 -7
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/media-client.js +2 -2
- package/dist/esm/client/media-store/index.js +19 -10
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +21 -16
- package/dist/esm/version.json +1 -1
- package/dist/types/client/media-client.d.ts +1 -1
- package/dist/types/client/media-store/index.d.ts +8 -1
- package/dist/types/utils/getVideoDimensionsFromBlob.d.ts +3 -4
- package/dist/types/utils/request/helpers.d.ts +1 -1
- package/dist/types-ts4.0/client/media-client.d.ts +1 -1
- package/dist/types-ts4.0/client/media-store/index.d.ts +8 -1
- package/dist/types-ts4.0/utils/getVideoDimensionsFromBlob.d.ts +3 -4
- package/dist/types-ts4.0/utils/request/helpers.d.ts +1 -1
- package/example-helpers/styles.ts +9 -8
- package/package.json +10 -6
- package/report.api.md +806 -500
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 18.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2c402e87213`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c402e87213) - [Experimental] Add traceId in media card get image request.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`bf8302c838a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bf8302c838a) - Implemented internal functionality to create local video preview.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 18.0.0
|
|
4
15
|
|
|
5
16
|
### Major Changes
|
|
@@ -51,8 +51,8 @@ var MediaClient = /*#__PURE__*/function () {
|
|
|
51
51
|
|
|
52
52
|
(0, _createClass2.default)(MediaClient, [{
|
|
53
53
|
key: "getImage",
|
|
54
|
-
value: function getImage(id, params, controller, fetchMaxRes) {
|
|
55
|
-
return this.mediaStore.getImage(id, params, controller, fetchMaxRes);
|
|
54
|
+
value: function getImage(id, params, controller, fetchMaxRes, traceId) {
|
|
55
|
+
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceId);
|
|
56
56
|
}
|
|
57
57
|
}, {
|
|
58
58
|
key: "getImageUrl",
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "MediaStoreError", {
|
|
|
12
12
|
return _error.MediaStoreError;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
exports.getMediaRegion = exports.getMediaEnvironment = void 0;
|
|
15
|
+
exports.getMediaRegion = exports.getMediaEnvironment = exports.ZipkinHeaderKeys = void 0;
|
|
16
16
|
Object.defineProperty(exports, "isMediaStoreError", {
|
|
17
17
|
enumerable: true,
|
|
18
18
|
get: function get() {
|
|
@@ -30,6 +30,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
30
30
|
|
|
31
31
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
32
32
|
|
|
33
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
34
|
+
|
|
33
35
|
var _constants = require("../../constants");
|
|
34
36
|
|
|
35
37
|
var _artifacts = require("../../models/artifacts");
|
|
@@ -70,6 +72,14 @@ var jsonHeaders = {
|
|
|
70
72
|
Accept: 'application/json',
|
|
71
73
|
'Content-Type': 'application/json'
|
|
72
74
|
};
|
|
75
|
+
var ZipkinHeaderKeys = {
|
|
76
|
+
traceId: 'x-b3-traceid',
|
|
77
|
+
spanId: 'x-b3-spanid',
|
|
78
|
+
parentSpanId: 'x-b3-parentspanid',
|
|
79
|
+
sampled: 'x-b3-sampled',
|
|
80
|
+
flags: 'x-b3-flags'
|
|
81
|
+
};
|
|
82
|
+
exports.ZipkinHeaderKeys = ZipkinHeaderKeys;
|
|
73
83
|
|
|
74
84
|
var MediaStore = /*#__PURE__*/function () {
|
|
75
85
|
function MediaStore(config, featureFlags) {
|
|
@@ -495,7 +505,9 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
495
505
|
}, {
|
|
496
506
|
key: "getImage",
|
|
497
507
|
value: function () {
|
|
498
|
-
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes) {
|
|
508
|
+
var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(id, params, controller, fetchMaxRes, traceId) {
|
|
509
|
+
var _ref4;
|
|
510
|
+
|
|
499
511
|
var isWebpSupported, headers, metadata, options;
|
|
500
512
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
501
513
|
while (1) {
|
|
@@ -503,11 +515,10 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
503
515
|
case 0:
|
|
504
516
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
505
517
|
isWebpSupported = false;
|
|
518
|
+
headers = !!traceId ? (_ref4 = {}, (0, _defineProperty2.default)(_ref4, ZipkinHeaderKeys.traceId, traceId), (0, _defineProperty2.default)(_ref4, ZipkinHeaderKeys.spanId, (0, _mediaCommon.getRandomHex)(16)), _ref4) : {};
|
|
506
519
|
|
|
507
520
|
if (isWebpSupported) {
|
|
508
|
-
headers =
|
|
509
|
-
accept: 'image/webp,image/*,*/*;q=0.8'
|
|
510
|
-
};
|
|
521
|
+
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
511
522
|
}
|
|
512
523
|
|
|
513
524
|
metadata = {
|
|
@@ -523,7 +534,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
523
534
|
});
|
|
524
535
|
return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then((0, _helpers.createMapResponseToBlob)(metadata)));
|
|
525
536
|
|
|
526
|
-
case
|
|
537
|
+
case 6:
|
|
527
538
|
case "end":
|
|
528
539
|
return _context7.stop();
|
|
529
540
|
}
|
|
@@ -531,7 +542,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
531
542
|
}, _callee7, this);
|
|
532
543
|
}));
|
|
533
544
|
|
|
534
|
-
function getImage(_x15, _x16, _x17, _x18) {
|
|
545
|
+
function getImage(_x15, _x16, _x17, _x18, _x19) {
|
|
535
546
|
return _getImage.apply(this, arguments);
|
|
536
547
|
}
|
|
537
548
|
|
|
@@ -576,7 +587,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
576
587
|
}, _callee8, this);
|
|
577
588
|
}));
|
|
578
589
|
|
|
579
|
-
function getItems(
|
|
590
|
+
function getItems(_x20, _x21) {
|
|
580
591
|
return _getItems.apply(this, arguments);
|
|
581
592
|
}
|
|
582
593
|
|
|
@@ -611,7 +622,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
611
622
|
}, _callee9, this);
|
|
612
623
|
}));
|
|
613
624
|
|
|
614
|
-
function getImageMetadata(
|
|
625
|
+
function getImageMetadata(_x22, _x23) {
|
|
615
626
|
return _getImageMetadata.apply(this, arguments);
|
|
616
627
|
}
|
|
617
628
|
|
|
@@ -648,7 +659,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
648
659
|
}, _callee10, this);
|
|
649
660
|
}));
|
|
650
661
|
|
|
651
|
-
function appendChunksToUpload(
|
|
662
|
+
function appendChunksToUpload(_x24, _x25, _x26) {
|
|
652
663
|
return _appendChunksToUpload.apply(this, arguments);
|
|
653
664
|
}
|
|
654
665
|
|
|
@@ -733,7 +744,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
733
744
|
}, _callee11, this);
|
|
734
745
|
}));
|
|
735
746
|
|
|
736
|
-
function request(
|
|
747
|
+
function request(_x27) {
|
|
737
748
|
return _request2.apply(this, arguments);
|
|
738
749
|
}
|
|
739
750
|
|
|
@@ -11,35 +11,39 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
|
|
14
|
-
var _videoSnapshot = _interopRequireDefault(require("video-snapshot"));
|
|
15
|
-
|
|
16
14
|
var getVideoDimensionsFromBlob = /*#__PURE__*/function () {
|
|
17
15
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(blob) {
|
|
18
|
-
var snapshoter,
|
|
19
|
-
_args = arguments;
|
|
20
16
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
17
|
while (1) {
|
|
22
18
|
switch (_context.prev = _context.next) {
|
|
23
19
|
case 0:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
21
|
+
var url = URL.createObjectURL(blob);
|
|
22
|
+
var video = document.createElement('video');
|
|
23
|
+
video.preload = 'metadata';
|
|
24
|
+
video.src = url;
|
|
25
|
+
video.muted = true; // loadedmetadata, loadeddata, play, playing
|
|
26
|
+
|
|
27
|
+
video.addEventListener('loadedmetadata', function timeupdateHandler() {
|
|
28
|
+
video.removeEventListener('loadedmetadata', timeupdateHandler);
|
|
29
|
+
resolve({
|
|
30
|
+
width: video.videoWidth,
|
|
31
|
+
height: video.videoHeight
|
|
32
|
+
});
|
|
33
|
+
URL.revokeObjectURL(url);
|
|
34
|
+
});
|
|
35
|
+
video.addEventListener('error', function () {
|
|
36
|
+
reject(new Error('failed to load video'));
|
|
37
|
+
URL.revokeObjectURL(url);
|
|
38
|
+
});
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
case 1:
|
|
38
42
|
case "end":
|
|
39
43
|
return _context.stop();
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
}, _callee
|
|
46
|
+
}, _callee);
|
|
43
47
|
}));
|
|
44
48
|
|
|
45
49
|
return function getVideoDimensionsFromBlob(_x) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -20,8 +20,8 @@ export class MediaClient {
|
|
|
20
20
|
this.stargate = new StargateClient(mediaClientConfig.stargateBaseUrl);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
getImage(id, params, controller, fetchMaxRes) {
|
|
24
|
-
return this.mediaStore.getImage(id, params, controller, fetchMaxRes);
|
|
23
|
+
getImage(id, params, controller, fetchMaxRes, traceId) {
|
|
24
|
+
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceId);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
getImageUrl(id, params) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
2
3
|
import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
|
|
3
4
|
import { getArtifactUrl } from '../../models/artifacts';
|
|
4
5
|
import { request } from '../../utils/request';
|
|
@@ -31,6 +32,13 @@ const jsonHeaders = {
|
|
|
31
32
|
Accept: 'application/json',
|
|
32
33
|
'Content-Type': 'application/json'
|
|
33
34
|
};
|
|
35
|
+
export const ZipkinHeaderKeys = {
|
|
36
|
+
traceId: 'x-b3-traceid',
|
|
37
|
+
spanId: 'x-b3-spanid',
|
|
38
|
+
parentSpanId: 'x-b3-parentspanid',
|
|
39
|
+
sampled: 'x-b3-sampled',
|
|
40
|
+
flags: 'x-b3-flags'
|
|
41
|
+
};
|
|
34
42
|
export class MediaStore {
|
|
35
43
|
constructor(config, featureFlags) {
|
|
36
44
|
_defineProperty(this, "resolveAuth", authContext => resolveAuth(this.config.authProvider, authContext));
|
|
@@ -270,15 +278,16 @@ export class MediaStore {
|
|
|
270
278
|
return createUrl(`${auth.baseUrl}${artifactUrl}`, options);
|
|
271
279
|
}
|
|
272
280
|
|
|
273
|
-
async getImage(id, params, controller, fetchMaxRes) {
|
|
281
|
+
async getImage(id, params, controller, fetchMaxRes, traceId) {
|
|
274
282
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
275
283
|
const isWebpSupported = false;
|
|
276
|
-
let headers
|
|
284
|
+
let headers = !!traceId ? {
|
|
285
|
+
[ZipkinHeaderKeys.traceId]: traceId,
|
|
286
|
+
[ZipkinHeaderKeys.spanId]: getRandomHex(16)
|
|
287
|
+
} : {};
|
|
277
288
|
|
|
278
289
|
if (isWebpSupported) {
|
|
279
|
-
headers =
|
|
280
|
-
accept: 'image/webp,image/*,*/*;q=0.8'
|
|
281
|
-
};
|
|
290
|
+
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
282
291
|
}
|
|
283
292
|
|
|
284
293
|
const metadata = {
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export const getVideoDimensionsFromBlob = async blob => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
const url = URL.createObjectURL(blob);
|
|
4
|
+
const video = document.createElement('video');
|
|
5
|
+
video.preload = 'metadata';
|
|
6
|
+
video.src = url;
|
|
7
|
+
video.muted = true; // loadedmetadata, loadeddata, play, playing
|
|
8
|
+
|
|
9
|
+
video.addEventListener('loadedmetadata', function timeupdateHandler() {
|
|
10
|
+
video.removeEventListener('loadedmetadata', timeupdateHandler);
|
|
11
|
+
resolve({
|
|
12
|
+
width: video.videoWidth,
|
|
13
|
+
height: video.videoHeight
|
|
14
|
+
});
|
|
15
|
+
URL.revokeObjectURL(url);
|
|
16
|
+
});
|
|
17
|
+
video.addEventListener('error', () => {
|
|
18
|
+
reject(new Error('failed to load video'));
|
|
19
|
+
URL.revokeObjectURL(url);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
8
22
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -28,8 +28,8 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
28
28
|
|
|
29
29
|
_createClass(MediaClient, [{
|
|
30
30
|
key: "getImage",
|
|
31
|
-
value: function getImage(id, params, controller, fetchMaxRes) {
|
|
32
|
-
return this.mediaStore.getImage(id, params, controller, fetchMaxRes);
|
|
31
|
+
value: function getImage(id, params, controller, fetchMaxRes, traceId) {
|
|
32
|
+
return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceId);
|
|
33
33
|
}
|
|
34
34
|
}, {
|
|
35
35
|
key: "getImageUrl",
|
|
@@ -8,6 +8,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
8
|
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
|
|
11
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
11
12
|
import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
|
|
12
13
|
import { getArtifactUrl } from '../../models/artifacts';
|
|
13
14
|
import { request as _request } from '../../utils/request';
|
|
@@ -38,6 +39,13 @@ var jsonHeaders = {
|
|
|
38
39
|
Accept: 'application/json',
|
|
39
40
|
'Content-Type': 'application/json'
|
|
40
41
|
};
|
|
42
|
+
export var ZipkinHeaderKeys = {
|
|
43
|
+
traceId: 'x-b3-traceid',
|
|
44
|
+
spanId: 'x-b3-spanid',
|
|
45
|
+
parentSpanId: 'x-b3-parentspanid',
|
|
46
|
+
sampled: 'x-b3-sampled',
|
|
47
|
+
flags: 'x-b3-flags'
|
|
48
|
+
};
|
|
41
49
|
export var MediaStore = /*#__PURE__*/function () {
|
|
42
50
|
function MediaStore(config, featureFlags) {
|
|
43
51
|
var _this = this;
|
|
@@ -465,7 +473,9 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
465
473
|
}, {
|
|
466
474
|
key: "getImage",
|
|
467
475
|
value: function () {
|
|
468
|
-
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, params, controller, fetchMaxRes) {
|
|
476
|
+
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, params, controller, fetchMaxRes, traceId) {
|
|
477
|
+
var _ref4;
|
|
478
|
+
|
|
469
479
|
var isWebpSupported, headers, metadata, options;
|
|
470
480
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
471
481
|
while (1) {
|
|
@@ -473,11 +483,10 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
473
483
|
case 0:
|
|
474
484
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
475
485
|
isWebpSupported = false;
|
|
486
|
+
headers = !!traceId ? (_ref4 = {}, _defineProperty(_ref4, ZipkinHeaderKeys.traceId, traceId), _defineProperty(_ref4, ZipkinHeaderKeys.spanId, getRandomHex(16)), _ref4) : {};
|
|
476
487
|
|
|
477
488
|
if (isWebpSupported) {
|
|
478
|
-
headers =
|
|
479
|
-
accept: 'image/webp,image/*,*/*;q=0.8'
|
|
480
|
-
};
|
|
489
|
+
headers.accept = 'image/webp,image/*,*/*;q=0.8';
|
|
481
490
|
}
|
|
482
491
|
|
|
483
492
|
metadata = {
|
|
@@ -493,7 +502,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
493
502
|
});
|
|
494
503
|
return _context7.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
|
|
495
504
|
|
|
496
|
-
case
|
|
505
|
+
case 6:
|
|
497
506
|
case "end":
|
|
498
507
|
return _context7.stop();
|
|
499
508
|
}
|
|
@@ -501,7 +510,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
501
510
|
}, _callee7, this);
|
|
502
511
|
}));
|
|
503
512
|
|
|
504
|
-
function getImage(_x15, _x16, _x17, _x18) {
|
|
513
|
+
function getImage(_x15, _x16, _x17, _x18, _x19) {
|
|
505
514
|
return _getImage.apply(this, arguments);
|
|
506
515
|
}
|
|
507
516
|
|
|
@@ -546,7 +555,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
546
555
|
}, _callee8, this);
|
|
547
556
|
}));
|
|
548
557
|
|
|
549
|
-
function getItems(
|
|
558
|
+
function getItems(_x20, _x21) {
|
|
550
559
|
return _getItems.apply(this, arguments);
|
|
551
560
|
}
|
|
552
561
|
|
|
@@ -581,7 +590,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
581
590
|
}, _callee9, this);
|
|
582
591
|
}));
|
|
583
592
|
|
|
584
|
-
function getImageMetadata(
|
|
593
|
+
function getImageMetadata(_x22, _x23) {
|
|
585
594
|
return _getImageMetadata.apply(this, arguments);
|
|
586
595
|
}
|
|
587
596
|
|
|
@@ -618,7 +627,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
618
627
|
}, _callee10, this);
|
|
619
628
|
}));
|
|
620
629
|
|
|
621
|
-
function appendChunksToUpload(
|
|
630
|
+
function appendChunksToUpload(_x24, _x25, _x26) {
|
|
622
631
|
return _appendChunksToUpload.apply(this, arguments);
|
|
623
632
|
}
|
|
624
633
|
|
|
@@ -703,7 +712,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
703
712
|
}, _callee11, this);
|
|
704
713
|
}));
|
|
705
714
|
|
|
706
|
-
function request(
|
|
715
|
+
function request(_x27) {
|
|
707
716
|
return _request2.apply(this, arguments);
|
|
708
717
|
}
|
|
709
718
|
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import VideoSnapshot from 'video-snapshot';
|
|
4
3
|
export var getVideoDimensionsFromBlob = /*#__PURE__*/function () {
|
|
5
4
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(blob) {
|
|
6
|
-
var snapshoter,
|
|
7
|
-
_args = arguments;
|
|
8
5
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9
6
|
while (1) {
|
|
10
7
|
switch (_context.prev = _context.next) {
|
|
11
8
|
case 0:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
10
|
+
var url = URL.createObjectURL(blob);
|
|
11
|
+
var video = document.createElement('video');
|
|
12
|
+
video.preload = 'metadata';
|
|
13
|
+
video.src = url;
|
|
14
|
+
video.muted = true; // loadedmetadata, loadeddata, play, playing
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
video.addEventListener('loadedmetadata', function timeupdateHandler() {
|
|
17
|
+
video.removeEventListener('loadedmetadata', timeupdateHandler);
|
|
18
|
+
resolve({
|
|
19
|
+
width: video.videoWidth,
|
|
20
|
+
height: video.videoHeight
|
|
21
|
+
});
|
|
22
|
+
URL.revokeObjectURL(url);
|
|
23
|
+
});
|
|
24
|
+
video.addEventListener('error', function () {
|
|
25
|
+
reject(new Error('failed to load video'));
|
|
26
|
+
URL.revokeObjectURL(url);
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
19
29
|
|
|
20
|
-
case
|
|
21
|
-
_context.prev = 5;
|
|
22
|
-
snapshoter.end();
|
|
23
|
-
return _context.finish(5);
|
|
24
|
-
|
|
25
|
-
case 8:
|
|
30
|
+
case 1:
|
|
26
31
|
case "end":
|
|
27
32
|
return _context.stop();
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
}, _callee
|
|
35
|
+
}, _callee);
|
|
31
36
|
}));
|
|
32
37
|
|
|
33
38
|
return function getVideoDimensionsFromBlob(_x) {
|
package/dist/esm/version.json
CHANGED
|
@@ -17,7 +17,7 @@ export declare class MediaClient {
|
|
|
17
17
|
private mobileUpload?;
|
|
18
18
|
readonly config: MediaClientConfig;
|
|
19
19
|
constructor(mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
20
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
20
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
21
21
|
getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
22
22
|
getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
23
23
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
|
|
@@ -5,6 +5,13 @@ import { MediaChunksProbe, MediaCollectionItemFullDetails, MediaCollectionItems,
|
|
|
5
5
|
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
6
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
7
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
+
export declare const ZipkinHeaderKeys: {
|
|
9
|
+
traceId: string;
|
|
10
|
+
spanId: string;
|
|
11
|
+
parentSpanId: string;
|
|
12
|
+
sampled: string;
|
|
13
|
+
flags: string;
|
|
14
|
+
};
|
|
8
15
|
export declare class MediaStore {
|
|
9
16
|
private readonly config;
|
|
10
17
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
@@ -29,7 +36,7 @@ export declare class MediaStore {
|
|
|
29
36
|
private createFileImageURL;
|
|
30
37
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
31
38
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
32
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
39
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
33
40
|
getItems(ids: string[], collectionName?: string): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
34
41
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<{
|
|
35
42
|
metadata: ImageMetadata;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type Dimensions = {
|
|
1
|
+
export interface Dimensions {
|
|
3
2
|
width: number;
|
|
4
3
|
height: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const getVideoDimensionsFromBlob: (blob: Blob
|
|
4
|
+
}
|
|
5
|
+
export declare const getVideoDimensionsFromBlob: (blob: Blob) => Promise<Dimensions>;
|
|
@@ -8,7 +8,7 @@ export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
|
8
8
|
export declare function isRateLimitedError(error: Error | undefined): boolean;
|
|
9
9
|
export declare function mapAuthToRequestHeaders(auth: Auth): RequestHeaders;
|
|
10
10
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
11
|
-
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) =>
|
|
11
|
+
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) => Record<string, string> | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
14
14
|
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
@@ -17,7 +17,7 @@ export declare class MediaClient {
|
|
|
17
17
|
private mobileUpload?;
|
|
18
18
|
readonly config: MediaClientConfig;
|
|
19
19
|
constructor(mediaClientConfig: MediaClientConfig, featureFlags?: MediaFeatureFlags | undefined);
|
|
20
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
20
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
21
21
|
getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
|
|
22
22
|
getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
23
23
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
|
|
@@ -5,6 +5,13 @@ import { MediaChunksProbe, MediaCollectionItemFullDetails, MediaCollectionItems,
|
|
|
5
5
|
import { ClientOptions, RequestHeaders, RequestMethod, RequestParams, RequestMetadata } from '../../utils/request/types';
|
|
6
6
|
export type { MediaStoreErrorReason, MediaStoreErrorAttributes } from './error';
|
|
7
7
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
8
|
+
export declare const ZipkinHeaderKeys: {
|
|
9
|
+
traceId: string;
|
|
10
|
+
spanId: string;
|
|
11
|
+
parentSpanId: string;
|
|
12
|
+
sampled: string;
|
|
13
|
+
flags: string;
|
|
14
|
+
};
|
|
8
15
|
export declare class MediaStore {
|
|
9
16
|
private readonly config;
|
|
10
17
|
readonly featureFlags?: MediaFeatureFlags | undefined;
|
|
@@ -29,7 +36,7 @@ export declare class MediaStore {
|
|
|
29
36
|
private createFileImageURL;
|
|
30
37
|
getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
|
|
31
38
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
32
|
-
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean): Promise<Blob>;
|
|
39
|
+
getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceId?: string): Promise<Blob>;
|
|
33
40
|
getItems(ids: string[], collectionName?: string): Promise<MediaStoreResponse<ItemsPayload>>;
|
|
34
41
|
getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<{
|
|
35
42
|
metadata: ImageMetadata;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type Dimensions = {
|
|
1
|
+
export interface Dimensions {
|
|
3
2
|
width: number;
|
|
4
3
|
height: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const getVideoDimensionsFromBlob: (blob: Blob
|
|
4
|
+
}
|
|
5
|
+
export declare const getVideoDimensionsFromBlob: (blob: Blob) => Promise<Dimensions>;
|
|
@@ -8,7 +8,7 @@ export declare function isFetchNetworkError(err: any): err is TypeError;
|
|
|
8
8
|
export declare function isRateLimitedError(error: Error | undefined): boolean;
|
|
9
9
|
export declare function mapAuthToRequestHeaders(auth: Auth): RequestHeaders;
|
|
10
10
|
export declare function createUrl(url: string, { params, auth }: CreateUrlOptions): string;
|
|
11
|
-
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) =>
|
|
11
|
+
export declare function withAuth(auth?: Auth): (headers?: RequestHeaders | undefined) => Record<string, string> | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Helper is deprecated and will be removed in the next major version.
|
|
14
14
|
* TODO: https://product-fabric.atlassian.net/browse/BMPT-1354
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { token } from '@atlaskit/tokens';
|
|
1
2
|
import { css } from '@emotion/react';
|
|
2
3
|
import { FileStatus } from '../src';
|
|
3
4
|
|
|
@@ -29,11 +30,11 @@ export interface FilesWrapperProps {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const statusColorMap: { [key in FileStatus]: string } = {
|
|
32
|
-
uploading: 'cornflowerblue',
|
|
33
|
-
processing: 'peachpuff',
|
|
34
|
-
processed: 'darkseagreen',
|
|
35
|
-
error: 'indianred',
|
|
36
|
-
'failed-processing': 'indianred',
|
|
33
|
+
uploading: token('color.background.accent.blue.subtle', 'cornflowerblue'),
|
|
34
|
+
processing: token('color.background.accent.orange.subtler', 'peachpuff'),
|
|
35
|
+
processed: token('color.background.accent.green.subtle', 'darkseagreen'),
|
|
36
|
+
error: token('color.background.accent.red.subtle', 'indianred'),
|
|
37
|
+
'failed-processing': token('color.background.accent.red.subtle', 'indianred'),
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export const fileWrapperStyles = (status: FileStatus) => css`
|
|
@@ -47,11 +48,11 @@ export const fileWrapperStyles = (status: FileStatus) => css`
|
|
|
47
48
|
export const cardsWrapperStyles = css`
|
|
48
49
|
width: 900px;
|
|
49
50
|
padding: 10px;
|
|
50
|
-
border-right: 1px solid #ccc;
|
|
51
|
+
border-right: 1px solid ${token('color.border', '#ccc')};
|
|
51
52
|
|
|
52
53
|
h1 {
|
|
53
54
|
text-align: center;
|
|
54
|
-
border-bottom: 1px solid #ccc;
|
|
55
|
+
border-bottom: 1px solid ${token('color.border', '#ccc')};
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
> div {
|
|
@@ -68,7 +69,7 @@ export const headerStyles = css`
|
|
|
68
69
|
`;
|
|
69
70
|
|
|
70
71
|
export const fileStateWrapperStyles = css`
|
|
71
|
-
border: 1px solid;
|
|
72
|
+
border: 1px solid ${token('color.border', '#ccc')};
|
|
72
73
|
margin: 10px;
|
|
73
74
|
padding: 10px;
|
|
74
75
|
width: 500px;
|