@eluvio/elv-client-js 4.0.89 → 4.0.91
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/dist/ElvClient-min.js +10 -10
- package/dist/ElvClient-node-min.js +10 -10
- package/dist/ElvFrameClient-min.js +4 -4
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +4 -4
- package/dist/ElvWalletClient-node-min.js +6 -6
- package/dist/src/HttpClient.js +26 -2
- package/dist/src/Utils.js +60 -25
- package/dist/src/client/ContentAccess.js +102 -101
- package/dist/src/client/ContentManagement.js +24 -21
- package/dist/src/client/Files.js +75 -86
- package/dist/src/client/LiveConf.js +0 -2
- package/dist/src/client/LiveStream.js +35 -34
- package/package.json +1 -1
- package/src/HttpClient.js +16 -2
- package/src/Utils.js +27 -5
- package/src/client/ContentAccess.js +63 -80
- package/src/client/ContentManagement.js +28 -13
- package/src/client/Files.js +43 -51
- package/src/client/LiveStream.js +5 -1
- package/testScripts/BasicObjectOperations.js +93 -0
package/dist/src/HttpClient.js
CHANGED
|
@@ -6,6 +6,7 @@ var URI = require("urijs");
|
|
|
6
6
|
var _Fetch = typeof fetch !== "undefined" ? fetch : require("node-fetch")["default"];
|
|
7
7
|
var _require = require("./LogMessage"),
|
|
8
8
|
LogMessage = _require.LogMessage;
|
|
9
|
+
var Utils = require("./Utils");
|
|
9
10
|
var HttpClient = /*#__PURE__*/function () {
|
|
10
11
|
"use strict";
|
|
11
12
|
|
|
@@ -96,7 +97,10 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
96
97
|
fetchParameters.body = body;
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
+
if (this.debug) {
|
|
101
|
+
this.Log("".concat(method, " - ").concat(uri.toString()));
|
|
102
|
+
this.Log("fetchParameters: ".concat(JSON.stringify(fetchParameters, null, 2)));
|
|
103
|
+
}
|
|
100
104
|
_context.prev = 9;
|
|
101
105
|
_context.next = 12;
|
|
102
106
|
return HttpClient.Fetch(uri.toString(), fetchParameters);
|
|
@@ -189,7 +193,7 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
189
193
|
body: errorBody,
|
|
190
194
|
requestParams: fetchParameters
|
|
191
195
|
};
|
|
192
|
-
this.Log(JSON.stringify(error, null, 2), true);
|
|
196
|
+
if (this.debug) this.Log(JSON.stringify(error, null, 2), true);
|
|
193
197
|
throw error;
|
|
194
198
|
case 47:
|
|
195
199
|
this.Log("".concat(response.status, " - ").concat(method, " ").concat(uri.toString()));
|
|
@@ -261,6 +265,26 @@ var HttpClient = /*#__PURE__*/function () {
|
|
|
261
265
|
return _RequestAll.apply(this, arguments);
|
|
262
266
|
}
|
|
263
267
|
return RequestAll;
|
|
268
|
+
}() // Perform http request and then return response body parsed as JSON
|
|
269
|
+
// ResponseToJson() will log response if this.debug === true
|
|
270
|
+
}, {
|
|
271
|
+
key: "RequestJsonBody",
|
|
272
|
+
value: function () {
|
|
273
|
+
var _RequestJsonBody = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params) {
|
|
274
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
275
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
276
|
+
case 0:
|
|
277
|
+
return _context4.abrupt("return", Utils.ResponseToJson(this.Request(params), this.debug, this.Log.bind(this)));
|
|
278
|
+
case 1:
|
|
279
|
+
case "end":
|
|
280
|
+
return _context4.stop();
|
|
281
|
+
}
|
|
282
|
+
}, _callee4, this);
|
|
283
|
+
}));
|
|
284
|
+
function RequestJsonBody(_x4) {
|
|
285
|
+
return _RequestJsonBody.apply(this, arguments);
|
|
286
|
+
}
|
|
287
|
+
return RequestJsonBody;
|
|
264
288
|
}()
|
|
265
289
|
}, {
|
|
266
290
|
key: "URL",
|
package/dist/src/Utils.js
CHANGED
|
@@ -570,13 +570,29 @@ var Utils = {
|
|
|
570
570
|
}
|
|
571
571
|
return LimitedMap;
|
|
572
572
|
}(),
|
|
573
|
+
/**
|
|
574
|
+
* Interprets an http response body obtained from an http call as JSON and returns result of parsing it.
|
|
575
|
+
*
|
|
576
|
+
* @param {Promise} response - An http response from node-fetch
|
|
577
|
+
* @param {boolean=} debug - Whether or not to log the body
|
|
578
|
+
* @param {Function} logFn - Log function to use if debug is truthy
|
|
579
|
+
* @return {*} - Result of parsing response body as JSON
|
|
580
|
+
*/
|
|
573
581
|
ResponseToJson: function () {
|
|
574
582
|
var _ResponseToJson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(response) {
|
|
583
|
+
var debug,
|
|
584
|
+
logFn,
|
|
585
|
+
_args4 = arguments;
|
|
575
586
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
576
587
|
while (1) switch (_context4.prev = _context4.next) {
|
|
577
588
|
case 0:
|
|
578
|
-
|
|
579
|
-
|
|
589
|
+
debug = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : false;
|
|
590
|
+
logFn = _args4.length > 2 ? _args4[2] : undefined;
|
|
591
|
+
_context4.next = 4;
|
|
592
|
+
return Utils.ResponseToFormat("json", response, debug, logFn);
|
|
593
|
+
case 4:
|
|
594
|
+
return _context4.abrupt("return", _context4.sent);
|
|
595
|
+
case 5:
|
|
580
596
|
case "end":
|
|
581
597
|
return _context4.stop();
|
|
582
598
|
}
|
|
@@ -587,51 +603,70 @@ var Utils = {
|
|
|
587
603
|
}
|
|
588
604
|
return ResponseToJson;
|
|
589
605
|
}(),
|
|
606
|
+
/**
|
|
607
|
+
* Interprets an http response body obtained from an http call as a requested format and returns result of converting/formatting.
|
|
608
|
+
*
|
|
609
|
+
* @param {string} format - The format to use when interpreting response body (e.g. "json", "text" et. al.)
|
|
610
|
+
* @param {Promise} response - An http response from node-fetch
|
|
611
|
+
* @param {boolean=} debug - Whether or not to log a debug statement containing the body (ignored for formats other than "json" and "text")
|
|
612
|
+
* @param {Function} logFn - Log function to use if debug is truthy
|
|
613
|
+
* @return {*} - Result of converting response body into the requested format
|
|
614
|
+
*/
|
|
590
615
|
ResponseToFormat: function () {
|
|
591
616
|
var _ResponseToFormat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(format, response) {
|
|
617
|
+
var debug,
|
|
618
|
+
logFn,
|
|
619
|
+
formattedBody,
|
|
620
|
+
_args5 = arguments;
|
|
592
621
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
593
622
|
while (1) switch (_context5.prev = _context5.next) {
|
|
594
623
|
case 0:
|
|
595
|
-
|
|
624
|
+
debug = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : false;
|
|
625
|
+
logFn = _args5.length > 3 ? _args5[3] : undefined;
|
|
626
|
+
_context5.next = 4;
|
|
596
627
|
return response;
|
|
597
|
-
case
|
|
628
|
+
case 4:
|
|
598
629
|
response = _context5.sent;
|
|
599
630
|
_context5.t0 = format.toLowerCase();
|
|
600
|
-
_context5.next = _context5.t0 === "json" ?
|
|
631
|
+
_context5.next = _context5.t0 === "json" ? 8 : _context5.t0 === "text" ? 13 : _context5.t0 === "blob" ? 18 : _context5.t0 === "arraybuffer" ? 21 : _context5.t0 === "formdata" ? 24 : _context5.t0 === "buffer" ? 27 : 30;
|
|
601
632
|
break;
|
|
602
|
-
case 6:
|
|
603
|
-
_context5.next = 8;
|
|
604
|
-
return response.json();
|
|
605
633
|
case 8:
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
634
|
+
_context5.next = 10;
|
|
635
|
+
return response.json();
|
|
636
|
+
case 10:
|
|
637
|
+
formattedBody = _context5.sent;
|
|
638
|
+
if (debug) logFn("response body: ".concat(JSON.stringify(formattedBody, null, 2)));
|
|
639
|
+
return _context5.abrupt("return", formattedBody);
|
|
640
|
+
case 13:
|
|
641
|
+
_context5.next = 15;
|
|
609
642
|
return response.text();
|
|
610
|
-
case 11:
|
|
611
|
-
return _context5.abrupt("return", _context5.sent);
|
|
612
|
-
case 12:
|
|
613
|
-
_context5.next = 14;
|
|
614
|
-
return response.blob();
|
|
615
|
-
case 14:
|
|
616
|
-
return _context5.abrupt("return", _context5.sent);
|
|
617
643
|
case 15:
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
return _context5.abrupt("return", _context5.sent);
|
|
644
|
+
formattedBody = _context5.sent;
|
|
645
|
+
if (debug) logFn("response body: ".concat(formattedBody));
|
|
646
|
+
return _context5.abrupt("return", formattedBody);
|
|
622
647
|
case 18:
|
|
623
648
|
_context5.next = 20;
|
|
624
|
-
return response.
|
|
649
|
+
return response.blob();
|
|
625
650
|
case 20:
|
|
626
651
|
return _context5.abrupt("return", _context5.sent);
|
|
627
652
|
case 21:
|
|
628
653
|
_context5.next = 23;
|
|
629
|
-
return response.
|
|
654
|
+
return response.arrayBuffer();
|
|
630
655
|
case 23:
|
|
631
656
|
return _context5.abrupt("return", _context5.sent);
|
|
632
657
|
case 24:
|
|
658
|
+
_context5.next = 26;
|
|
659
|
+
return response.formData();
|
|
660
|
+
case 26:
|
|
661
|
+
return _context5.abrupt("return", _context5.sent);
|
|
662
|
+
case 27:
|
|
663
|
+
_context5.next = 29;
|
|
664
|
+
return response.buffer();
|
|
665
|
+
case 29:
|
|
666
|
+
return _context5.abrupt("return", _context5.sent);
|
|
667
|
+
case 30:
|
|
633
668
|
return _context5.abrupt("return", response);
|
|
634
|
-
case
|
|
669
|
+
case 31:
|
|
635
670
|
case "end":
|
|
636
671
|
return _context5.stop();
|
|
637
672
|
}
|
|
@@ -693,29 +693,27 @@ exports.ContentLibrary = /*#__PURE__*/function () {
|
|
|
693
693
|
libraryId = _ref15.libraryId;
|
|
694
694
|
ValidateLibrary(libraryId);
|
|
695
695
|
path = UrlJoin("qlibs", libraryId);
|
|
696
|
-
_context10.t0 = this.
|
|
697
|
-
_context10.
|
|
698
|
-
_context10.next = 7;
|
|
696
|
+
_context10.t0 = this.HttpClient;
|
|
697
|
+
_context10.next = 6;
|
|
699
698
|
return this.authClient.AuthorizationHeader({
|
|
700
699
|
libraryId: libraryId
|
|
701
700
|
});
|
|
702
|
-
case
|
|
703
|
-
_context10.
|
|
704
|
-
_context10.
|
|
705
|
-
_context10.
|
|
706
|
-
headers: _context10.
|
|
701
|
+
case 6:
|
|
702
|
+
_context10.t1 = _context10.sent;
|
|
703
|
+
_context10.t2 = path;
|
|
704
|
+
_context10.t3 = {
|
|
705
|
+
headers: _context10.t1,
|
|
707
706
|
method: "GET",
|
|
708
|
-
path: _context10.
|
|
707
|
+
path: _context10.t2
|
|
709
708
|
};
|
|
710
|
-
_context10.
|
|
711
|
-
_context10.
|
|
712
|
-
|
|
713
|
-
case 13:
|
|
709
|
+
_context10.next = 11;
|
|
710
|
+
return _context10.t0.RequestJsonBody.call(_context10.t0, _context10.t3);
|
|
711
|
+
case 11:
|
|
714
712
|
library = _context10.sent;
|
|
715
713
|
return _context10.abrupt("return", _objectSpread(_objectSpread({}, library), {}, {
|
|
716
714
|
meta: library.meta || {}
|
|
717
715
|
}));
|
|
718
|
-
case
|
|
716
|
+
case 13:
|
|
719
717
|
case "end":
|
|
720
718
|
return _context10.stop();
|
|
721
719
|
}
|
|
@@ -945,28 +943,26 @@ exports.ContentObjects = /*#__PURE__*/function () {
|
|
|
945
943
|
}
|
|
946
944
|
this.Log("Filter options:");
|
|
947
945
|
this.Log(filterOptions);
|
|
948
|
-
_context14.t0 = this.
|
|
949
|
-
_context14.
|
|
950
|
-
_context14.next = 19;
|
|
946
|
+
_context14.t0 = this.HttpClient;
|
|
947
|
+
_context14.next = 18;
|
|
951
948
|
return this.authClient.AuthorizationHeader({
|
|
952
949
|
libraryId: libraryId
|
|
953
950
|
});
|
|
954
|
-
case
|
|
955
|
-
_context14.
|
|
956
|
-
_context14.
|
|
957
|
-
_context14.
|
|
958
|
-
_context14.
|
|
959
|
-
headers: _context14.
|
|
951
|
+
case 18:
|
|
952
|
+
_context14.t1 = _context14.sent;
|
|
953
|
+
_context14.t2 = path;
|
|
954
|
+
_context14.t3 = queryParams;
|
|
955
|
+
_context14.t4 = {
|
|
956
|
+
headers: _context14.t1,
|
|
960
957
|
method: "GET",
|
|
961
|
-
path: _context14.
|
|
962
|
-
queryParams: _context14.
|
|
958
|
+
path: _context14.t2,
|
|
959
|
+
queryParams: _context14.t3
|
|
963
960
|
};
|
|
964
|
-
_context14.
|
|
965
|
-
_context14.
|
|
966
|
-
|
|
967
|
-
case 26:
|
|
961
|
+
_context14.next = 24;
|
|
962
|
+
return _context14.t0.RequestJsonBody.call(_context14.t0, _context14.t4);
|
|
963
|
+
case 24:
|
|
968
964
|
return _context14.abrupt("return", _context14.sent);
|
|
969
|
-
case
|
|
965
|
+
case 25:
|
|
970
966
|
case "end":
|
|
971
967
|
return _context14.stop();
|
|
972
968
|
}
|
|
@@ -1006,28 +1002,26 @@ exports.ContentObject = /*#__PURE__*/function () {
|
|
|
1006
1002
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1007
1003
|
}
|
|
1008
1004
|
path = UrlJoin("q", writeToken || versionHash || objectId);
|
|
1009
|
-
_context15.t0 = this.
|
|
1010
|
-
_context15.
|
|
1011
|
-
_context15.next = 9;
|
|
1005
|
+
_context15.t0 = this.HttpClient;
|
|
1006
|
+
_context15.next = 8;
|
|
1012
1007
|
return this.authClient.AuthorizationHeader({
|
|
1013
1008
|
libraryId: libraryId,
|
|
1014
1009
|
objectId: objectId,
|
|
1015
1010
|
versionHash: versionHash
|
|
1016
1011
|
});
|
|
1017
|
-
case
|
|
1018
|
-
_context15.
|
|
1019
|
-
_context15.
|
|
1020
|
-
_context15.
|
|
1021
|
-
headers: _context15.
|
|
1012
|
+
case 8:
|
|
1013
|
+
_context15.t1 = _context15.sent;
|
|
1014
|
+
_context15.t2 = path;
|
|
1015
|
+
_context15.t3 = {
|
|
1016
|
+
headers: _context15.t1,
|
|
1022
1017
|
method: "GET",
|
|
1023
|
-
path: _context15.
|
|
1018
|
+
path: _context15.t2
|
|
1024
1019
|
};
|
|
1025
|
-
_context15.
|
|
1026
|
-
_context15.
|
|
1027
|
-
|
|
1028
|
-
case 15:
|
|
1020
|
+
_context15.next = 13;
|
|
1021
|
+
return _context15.t0.RequestJsonBody.call(_context15.t0, _context15.t3);
|
|
1022
|
+
case 13:
|
|
1029
1023
|
return _context15.abrupt("return", _context15.sent);
|
|
1030
|
-
case
|
|
1024
|
+
case 14:
|
|
1031
1025
|
case "end":
|
|
1032
1026
|
return _context15.stop();
|
|
1033
1027
|
}
|
|
@@ -1588,7 +1582,7 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
|
|
|
1588
1582
|
delete queryParams.authorization;
|
|
1589
1583
|
_context24.prev = 17;
|
|
1590
1584
|
_context24.next = 20;
|
|
1591
|
-
return this.
|
|
1585
|
+
return this.HttpClient.RequestJsonBody({
|
|
1592
1586
|
headers: {
|
|
1593
1587
|
"Authorization": authTokens.map(function (token) {
|
|
1594
1588
|
return "Bearer ".concat(token);
|
|
@@ -1604,7 +1598,7 @@ exports.ContentObjectMetadata = /*#__PURE__*/function () {
|
|
|
1604
1598
|
}),
|
|
1605
1599
|
method: "GET",
|
|
1606
1600
|
path: path
|
|
1607
|
-
})
|
|
1601
|
+
});
|
|
1608
1602
|
case 20:
|
|
1609
1603
|
metadata = _context24.sent;
|
|
1610
1604
|
_context24.next = 33;
|
|
@@ -1811,24 +1805,22 @@ exports.ContentObjectVersions = /*#__PURE__*/function () {
|
|
|
1811
1805
|
});
|
|
1812
1806
|
this.Log("Retrieving content object versions: ".concat(libraryId || "", " ").concat(objectId));
|
|
1813
1807
|
path = UrlJoin("qid", objectId);
|
|
1814
|
-
_context26.t0 = this.
|
|
1815
|
-
_context26.
|
|
1816
|
-
_context26.next = 8;
|
|
1808
|
+
_context26.t0 = this.HttpClient;
|
|
1809
|
+
_context26.next = 7;
|
|
1817
1810
|
return this.authClient.AuthorizationHeader({
|
|
1818
1811
|
libraryId: libraryId,
|
|
1819
1812
|
objectId: objectId
|
|
1820
1813
|
});
|
|
1821
|
-
case
|
|
1822
|
-
_context26.
|
|
1823
|
-
_context26.
|
|
1824
|
-
_context26.
|
|
1825
|
-
headers: _context26.
|
|
1814
|
+
case 7:
|
|
1815
|
+
_context26.t1 = _context26.sent;
|
|
1816
|
+
_context26.t2 = path;
|
|
1817
|
+
_context26.t3 = {
|
|
1818
|
+
headers: _context26.t1,
|
|
1826
1819
|
method: "GET",
|
|
1827
|
-
path: _context26.
|
|
1820
|
+
path: _context26.t2
|
|
1828
1821
|
};
|
|
1829
|
-
_context26.
|
|
1830
|
-
|
|
1831
|
-
case 13:
|
|
1822
|
+
return _context26.abrupt("return", _context26.t0.RequestJsonBody.call(_context26.t0, _context26.t3));
|
|
1823
|
+
case 11:
|
|
1832
1824
|
case "end":
|
|
1833
1825
|
return _context26.stop();
|
|
1834
1826
|
}
|
|
@@ -1943,40 +1935,38 @@ exports.LatestVersionHashV2 = /*#__PURE__*/function () {
|
|
|
1943
1935
|
ValidateObject(objectId);
|
|
1944
1936
|
_context28.prev = 3;
|
|
1945
1937
|
path = UrlJoin("q", objectId);
|
|
1946
|
-
_context28.t0 = this.
|
|
1947
|
-
_context28.
|
|
1948
|
-
_context28.next = 9;
|
|
1938
|
+
_context28.t0 = this.HttpClient;
|
|
1939
|
+
_context28.next = 8;
|
|
1949
1940
|
return this.authClient.AuthorizationHeader({
|
|
1950
1941
|
objectId: objectId
|
|
1951
1942
|
});
|
|
1952
|
-
case
|
|
1953
|
-
_context28.
|
|
1954
|
-
_context28.
|
|
1955
|
-
_context28.
|
|
1956
|
-
headers: _context28.
|
|
1943
|
+
case 8:
|
|
1944
|
+
_context28.t1 = _context28.sent;
|
|
1945
|
+
_context28.t2 = path;
|
|
1946
|
+
_context28.t3 = {
|
|
1947
|
+
headers: _context28.t1,
|
|
1957
1948
|
method: "GET",
|
|
1958
|
-
path: _context28.
|
|
1949
|
+
path: _context28.t2
|
|
1959
1950
|
};
|
|
1960
|
-
_context28.
|
|
1961
|
-
_context28.
|
|
1962
|
-
|
|
1963
|
-
case 15:
|
|
1951
|
+
_context28.next = 13;
|
|
1952
|
+
return _context28.t0.RequestJsonBody.call(_context28.t0, _context28.t3);
|
|
1953
|
+
case 13:
|
|
1964
1954
|
q = _context28.sent;
|
|
1965
1955
|
latestHash = q.hash;
|
|
1966
|
-
_context28.next =
|
|
1956
|
+
_context28.next = 21;
|
|
1967
1957
|
break;
|
|
1968
|
-
case
|
|
1969
|
-
_context28.prev =
|
|
1970
|
-
_context28.
|
|
1971
|
-
_context28.
|
|
1972
|
-
throw _context28.
|
|
1973
|
-
case
|
|
1958
|
+
case 17:
|
|
1959
|
+
_context28.prev = 17;
|
|
1960
|
+
_context28.t4 = _context28["catch"](3);
|
|
1961
|
+
_context28.t4.message = "Unable to determine latest version hash for ".concat(versionHash || objectId);
|
|
1962
|
+
throw _context28.t4;
|
|
1963
|
+
case 21:
|
|
1974
1964
|
return _context28.abrupt("return", latestHash);
|
|
1975
|
-
case
|
|
1965
|
+
case 22:
|
|
1976
1966
|
case "end":
|
|
1977
1967
|
return _context28.stop();
|
|
1978
1968
|
}
|
|
1979
|
-
}, _callee28, this, [[3,
|
|
1969
|
+
}, _callee28, this, [[3, 17]]);
|
|
1980
1970
|
}));
|
|
1981
1971
|
return function (_x29) {
|
|
1982
1972
|
return _ref49.apply(this, arguments);
|
|
@@ -2036,7 +2026,6 @@ exports.AvailableDRMs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerato
|
|
|
2036
2026
|
}
|
|
2037
2027
|
return _context29.abrupt("return", availableDRMs);
|
|
2038
2028
|
case 6:
|
|
2039
|
-
_context29.prev = 6;
|
|
2040
2029
|
config = [{
|
|
2041
2030
|
initDataTypes: ["cenc"],
|
|
2042
2031
|
audioCapabilities: [{
|
|
@@ -2046,23 +2035,38 @@ exports.AvailableDRMs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerato
|
|
|
2046
2035
|
contentType: "video/mp4;codecs=\"avc1.42E01E\""
|
|
2047
2036
|
}]
|
|
2048
2037
|
}];
|
|
2038
|
+
_context29.prev = 7;
|
|
2049
2039
|
_context29.next = 10;
|
|
2050
2040
|
return navigator.requestMediaKeySystemAccess("com.widevine.alpha", config);
|
|
2051
2041
|
case 10:
|
|
2052
2042
|
availableDRMs.push("widevine");
|
|
2043
|
+
// console.log("widevine detected");
|
|
2053
2044
|
// eslint-disable-next-line no-empty
|
|
2054
2045
|
_context29.next = 15;
|
|
2055
2046
|
break;
|
|
2056
2047
|
case 13:
|
|
2057
2048
|
_context29.prev = 13;
|
|
2058
|
-
_context29.t0 = _context29["catch"](
|
|
2049
|
+
_context29.t0 = _context29["catch"](7);
|
|
2059
2050
|
case 15:
|
|
2051
|
+
_context29.prev = 15;
|
|
2052
|
+
_context29.next = 18;
|
|
2053
|
+
return navigator.requestMediaKeySystemAccess("com.microsoft.playready", config);
|
|
2054
|
+
case 18:
|
|
2055
|
+
availableDRMs.push("playready");
|
|
2056
|
+
// console.log("playready detected");
|
|
2057
|
+
// eslint-disable-next-line no-empty
|
|
2058
|
+
_context29.next = 23;
|
|
2059
|
+
break;
|
|
2060
|
+
case 21:
|
|
2061
|
+
_context29.prev = 21;
|
|
2062
|
+
_context29.t1 = _context29["catch"](15);
|
|
2063
|
+
case 23:
|
|
2060
2064
|
return _context29.abrupt("return", availableDRMs);
|
|
2061
|
-
case
|
|
2065
|
+
case 24:
|
|
2062
2066
|
case "end":
|
|
2063
2067
|
return _context29.stop();
|
|
2064
2068
|
}
|
|
2065
|
-
}, _callee29, null, [[
|
|
2069
|
+
}, _callee29, null, [[7, 13], [15, 21]]);
|
|
2066
2070
|
}));
|
|
2067
2071
|
exports.PlayoutPathResolution = /*#__PURE__*/function () {
|
|
2068
2072
|
var _ref52 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref51) {
|
|
@@ -2250,13 +2254,13 @@ exports.AvailableOfferings = /*#__PURE__*/function () {
|
|
|
2250
2254
|
return token;
|
|
2251
2255
|
});
|
|
2252
2256
|
_context31.next = 27;
|
|
2253
|
-
return this.
|
|
2257
|
+
return this.HttpClient.RequestJsonBody({
|
|
2254
2258
|
path: path,
|
|
2255
2259
|
method: "GET",
|
|
2256
2260
|
headers: {
|
|
2257
2261
|
Authorization: "Bearer ".concat(authorization.join(","))
|
|
2258
2262
|
}
|
|
2259
|
-
})
|
|
2263
|
+
});
|
|
2260
2264
|
case 27:
|
|
2261
2265
|
return _context31.abrupt("return", _context31.sent);
|
|
2262
2266
|
case 30:
|
|
@@ -2299,7 +2303,7 @@ exports.AvailableOfferings = /*#__PURE__*/function () {
|
|
|
2299
2303
|
* @param {string=} linkPath - If playing from a link, the path to the link
|
|
2300
2304
|
* @param {boolean=} signedLink - Specify if linkPath is referring to a signed link
|
|
2301
2305
|
* @param {Array<string>} protocols=["dash","hls"]] - Acceptable playout protocols ("dash", "hls")
|
|
2302
|
-
* @param {Array<string>} drms - Acceptable DRM formats ("clear", "aes
|
|
2306
|
+
* @param {Array<string>} drms - Acceptable DRM formats ("aes-128", "clear", "fairplay", "playready", "sample-aes", "widevine")
|
|
2303
2307
|
* @param {string=} handler=playout - The handler to use for playout (not used with links)
|
|
2304
2308
|
* @param {string=} offering=default - The offering to play
|
|
2305
2309
|
* @param {string=} playoutType - The type of playout
|
|
@@ -2450,11 +2454,11 @@ exports.PlayoutOptions = /*#__PURE__*/function () {
|
|
|
2450
2454
|
}, options);
|
|
2451
2455
|
_context34.t11 = Object;
|
|
2452
2456
|
_context34.next = 60;
|
|
2453
|
-
return this.
|
|
2457
|
+
return this.HttpClient.RequestJsonBody({
|
|
2454
2458
|
path: path,
|
|
2455
2459
|
method: "GET",
|
|
2456
2460
|
queryParams: queryParams
|
|
2457
|
-
})
|
|
2461
|
+
});
|
|
2458
2462
|
case 60:
|
|
2459
2463
|
_context34.t12 = _context34.sent;
|
|
2460
2464
|
playoutOptions = _context34.t11.values.call(_context34.t11, _context34.t12);
|
|
@@ -2595,9 +2599,8 @@ exports.PlayoutOptions = /*#__PURE__*/function () {
|
|
|
2595
2599
|
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
2596
2600
|
while (1) switch (_context32.prev = _context32.next) {
|
|
2597
2601
|
case 0:
|
|
2598
|
-
_context32.
|
|
2599
|
-
|
|
2600
|
-
return _this9.HttpClient.Request({
|
|
2602
|
+
_context32.next = 2;
|
|
2603
|
+
return _this9.HttpClient.RequestJsonBody({
|
|
2601
2604
|
path: UrlJoin("q", linkTarget.versionHash || versionHash, "rep", handler, offering, "views.json"),
|
|
2602
2605
|
method: "GET",
|
|
2603
2606
|
queryParams: {
|
|
@@ -2605,13 +2608,9 @@ exports.PlayoutOptions = /*#__PURE__*/function () {
|
|
|
2605
2608
|
authorization: authorization
|
|
2606
2609
|
}
|
|
2607
2610
|
});
|
|
2608
|
-
case
|
|
2609
|
-
_context32.t1 = _context32.sent;
|
|
2610
|
-
_context32.next = 6;
|
|
2611
|
-
return _context32.t0.ResponseToFormat.call(_context32.t0, "json", _context32.t1);
|
|
2612
|
-
case 6:
|
|
2611
|
+
case 2:
|
|
2613
2612
|
return _context32.abrupt("return", _context32.sent);
|
|
2614
|
-
case
|
|
2613
|
+
case 3:
|
|
2615
2614
|
case "end":
|
|
2616
2615
|
return _context32.stop();
|
|
2617
2616
|
}
|
|
@@ -2673,7 +2672,7 @@ exports.PlayoutOptions = /*#__PURE__*/function () {
|
|
|
2673
2672
|
* @param {string=} linkPath - If playing from a link, the path to the link
|
|
2674
2673
|
* @param {boolean=} signedLink - Specify if linkPath is referring to a signed link
|
|
2675
2674
|
* @param {Array<string>} protocols=["dash","hls"]] - Acceptable playout protocols ("dash", "hls")
|
|
2676
|
-
* @param {Array<string>} drms - Acceptable DRM formats ("clear", "
|
|
2675
|
+
* @param {Array<string>} drms - Acceptable DRM formats ("aes-128", "clear", "fairplay", "playready", "sample-aes", "widevine")
|
|
2677
2676
|
* @param {string=} handler=playout - The handler to use for playout
|
|
2678
2677
|
* @param {string=} offering=default - The offering to play
|
|
2679
2678
|
* @param {string=} playoutType - The type of playout
|
|
@@ -2883,8 +2882,10 @@ exports.CallBitcodeMethod = /*#__PURE__*/function () {
|
|
|
2883
2882
|
});
|
|
2884
2883
|
case 17:
|
|
2885
2884
|
_context36.t2 = _context36.sent;
|
|
2886
|
-
|
|
2887
|
-
|
|
2885
|
+
_context36.t3 = this.HttpClient.debug;
|
|
2886
|
+
_context36.t4 = this.HttpClient.Log.bind(this.HttpClient);
|
|
2887
|
+
return _context36.abrupt("return", _context36.t0.ResponseToFormat.call(_context36.t0, _context36.t1, _context36.t2, _context36.t3, _context36.t4));
|
|
2888
|
+
case 21:
|
|
2888
2889
|
case "end":
|
|
2889
2890
|
return _context36.stop();
|
|
2890
2891
|
}
|