@eluvio/elv-client-js 4.0.100 → 4.0.101
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 +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/client/LiveConf.js +4 -0
- package/dist/src/client/LiveStream.js +31 -39
- package/package.json +1 -1
- package/src/client/LiveConf.js +5 -0
- package/src/client/LiveStream.js +2 -10
|
@@ -78,6 +78,7 @@ var LiveconfTemplate = {
|
|
|
78
78
|
part_ttl: 3600,
|
|
79
79
|
playout_type: "live",
|
|
80
80
|
source_timescale: null,
|
|
81
|
+
reconnect_timeout: 600,
|
|
81
82
|
xc_params: {
|
|
82
83
|
audio_bitrate: 384000,
|
|
83
84
|
audio_index: [0, 0, 0, 0, 0, 0, 0, 0],
|
|
@@ -475,6 +476,9 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
475
476
|
if (customSettings.connection_timeout) {
|
|
476
477
|
conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
|
|
477
478
|
}
|
|
479
|
+
if (customSettings.reconnect_timeout) {
|
|
480
|
+
conf.live_recording.recording_config.recording_params.reconnect_timeout = customSettings.reconnect_timeout;
|
|
481
|
+
}
|
|
478
482
|
|
|
479
483
|
// Fill in specifics for protocol
|
|
480
484
|
switch (this.probeKind()) {
|
|
@@ -1662,7 +1662,7 @@ exports.StreamInsertion = /*#__PURE__*/function () {
|
|
|
1662
1662
|
*/
|
|
1663
1663
|
exports.StreamConfig = /*#__PURE__*/function () {
|
|
1664
1664
|
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref21) {
|
|
1665
|
-
var name, _ref21$customSettings, customSettings, probeMetadata, objectId, status, libraryId, probe, mainMeta, userConfig, parsedName, hostName, streamUrl, nodes, node, endpoint,
|
|
1665
|
+
var name, _ref21$customSettings, customSettings, probeMetadata, objectId, status, libraryId, probe, mainMeta, userConfig, parsedName, hostName, streamUrl, nodes, node, endpoint, probeUrl, lc, liveRecordingConfig, e, writeToken;
|
|
1666
1666
|
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
1667
1667
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1668
1668
|
case 0:
|
|
@@ -1694,7 +1694,7 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1694
1694
|
parsedName = userConfig.url.replace("udp://", "https://").replace("rtmp://", "https://").replace("srt://", "https://");
|
|
1695
1695
|
hostName = new URL(parsedName).hostname;
|
|
1696
1696
|
streamUrl = new URL(userConfig.url);
|
|
1697
|
-
|
|
1697
|
+
this.Log("Retrieving nodes - matching: ".concat(hostName));
|
|
1698
1698
|
_context11.next = 20;
|
|
1699
1699
|
return this.SpaceNodes({
|
|
1700
1700
|
matchEndpoint: hostName
|
|
@@ -1715,7 +1715,7 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1715
1715
|
status.node = node;
|
|
1716
1716
|
endpoint = node.endpoints[0];
|
|
1717
1717
|
if (probe) {
|
|
1718
|
-
_context11.next =
|
|
1718
|
+
_context11.next = 53;
|
|
1719
1719
|
break;
|
|
1720
1720
|
}
|
|
1721
1721
|
this.SetNodes({
|
|
@@ -1724,73 +1724,65 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1724
1724
|
|
|
1725
1725
|
// Probe the stream
|
|
1726
1726
|
probe = {};
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
controller.abort();
|
|
1730
|
-
}, 60 * 1000); // milliseconds
|
|
1731
|
-
_context11.prev = 32;
|
|
1732
|
-
_context11.next = 35;
|
|
1727
|
+
_context11.prev = 30;
|
|
1728
|
+
_context11.next = 33;
|
|
1733
1729
|
return this.Rep({
|
|
1734
1730
|
libraryId: libraryId,
|
|
1735
1731
|
objectId: objectId,
|
|
1736
1732
|
rep: "probe"
|
|
1737
1733
|
});
|
|
1738
|
-
case
|
|
1734
|
+
case 33:
|
|
1739
1735
|
probeUrl = _context11.sent;
|
|
1740
1736
|
_context11.t0 = this.utils;
|
|
1741
|
-
_context11.next =
|
|
1737
|
+
_context11.next = 37;
|
|
1742
1738
|
return HttpClient.Fetch(probeUrl, {
|
|
1743
1739
|
body: JSON.stringify({
|
|
1744
1740
|
"filename": streamUrl.href,
|
|
1745
1741
|
"listen": true
|
|
1746
1742
|
}),
|
|
1747
|
-
method: "POST"
|
|
1748
|
-
signal: controller.signal
|
|
1743
|
+
method: "POST"
|
|
1749
1744
|
});
|
|
1750
|
-
case
|
|
1745
|
+
case 37:
|
|
1751
1746
|
_context11.t1 = _context11.sent;
|
|
1752
|
-
_context11.next =
|
|
1747
|
+
_context11.next = 40;
|
|
1753
1748
|
return _context11.t0.ResponseToJson.call(_context11.t0, _context11.t1);
|
|
1754
|
-
case
|
|
1749
|
+
case 40:
|
|
1755
1750
|
probe = _context11.sent;
|
|
1756
|
-
if (probe) {
|
|
1757
|
-
clearTimeout(timeoutId);
|
|
1758
|
-
}
|
|
1759
1751
|
if (!probe.errors) {
|
|
1760
|
-
_context11.next =
|
|
1752
|
+
_context11.next = 43;
|
|
1761
1753
|
break;
|
|
1762
1754
|
}
|
|
1763
1755
|
throw probe.errors[0];
|
|
1764
|
-
case
|
|
1765
|
-
_context11.next =
|
|
1756
|
+
case 43:
|
|
1757
|
+
_context11.next = 52;
|
|
1766
1758
|
break;
|
|
1767
|
-
case
|
|
1768
|
-
_context11.prev =
|
|
1769
|
-
_context11.t2 = _context11["catch"](
|
|
1759
|
+
case 45:
|
|
1760
|
+
_context11.prev = 45;
|
|
1761
|
+
_context11.t2 = _context11["catch"](30);
|
|
1770
1762
|
if (!(_context11.t2.code === "ETIMEDOUT")) {
|
|
1771
|
-
_context11.next =
|
|
1763
|
+
_context11.next = 51;
|
|
1772
1764
|
break;
|
|
1773
1765
|
}
|
|
1774
1766
|
throw "Stream probe time out - make sure the stream source is available";
|
|
1775
|
-
case
|
|
1767
|
+
case 51:
|
|
1776
1768
|
throw _context11.t2;
|
|
1777
|
-
case
|
|
1769
|
+
case 52:
|
|
1778
1770
|
probe.format.filename = streamUrl.href;
|
|
1779
|
-
case
|
|
1771
|
+
case 53:
|
|
1780
1772
|
// Create live recording config
|
|
1781
1773
|
lc = new LiveConf(probe, node.id, endpoint, false, false, true);
|
|
1782
1774
|
liveRecordingConfig = lc.generateLiveConf({
|
|
1783
1775
|
customSettings: customSettings
|
|
1784
1776
|
}); // Store live recording config into the stream object
|
|
1785
|
-
_context11.next =
|
|
1777
|
+
_context11.next = 57;
|
|
1786
1778
|
return this.EditContentObject({
|
|
1787
1779
|
libraryId: libraryId,
|
|
1788
1780
|
objectId: objectId
|
|
1789
1781
|
});
|
|
1790
|
-
case
|
|
1782
|
+
case 57:
|
|
1791
1783
|
e = _context11.sent;
|
|
1792
1784
|
writeToken = e.write_token;
|
|
1793
|
-
_context11.next =
|
|
1785
|
+
_context11.next = 61;
|
|
1794
1786
|
return this.ReplaceMetadata({
|
|
1795
1787
|
libraryId: libraryId,
|
|
1796
1788
|
objectId: objectId,
|
|
@@ -1798,8 +1790,8 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1798
1790
|
metadataSubtree: "live_recording",
|
|
1799
1791
|
metadata: liveRecordingConfig.live_recording
|
|
1800
1792
|
});
|
|
1801
|
-
case
|
|
1802
|
-
_context11.next =
|
|
1793
|
+
case 61:
|
|
1794
|
+
_context11.next = 63;
|
|
1803
1795
|
return this.ReplaceMetadata({
|
|
1804
1796
|
libraryId: libraryId,
|
|
1805
1797
|
objectId: objectId,
|
|
@@ -1807,22 +1799,22 @@ exports.StreamConfig = /*#__PURE__*/function () {
|
|
|
1807
1799
|
metadataSubtree: "live_recording_config/probe_info",
|
|
1808
1800
|
metadata: probe
|
|
1809
1801
|
});
|
|
1810
|
-
case
|
|
1811
|
-
_context11.next =
|
|
1802
|
+
case 63:
|
|
1803
|
+
_context11.next = 65;
|
|
1812
1804
|
return this.FinalizeContentObject({
|
|
1813
1805
|
libraryId: libraryId,
|
|
1814
1806
|
objectId: objectId,
|
|
1815
1807
|
writeToken: writeToken,
|
|
1816
1808
|
commitMessage: "Apply live stream configuration"
|
|
1817
1809
|
});
|
|
1818
|
-
case
|
|
1810
|
+
case 65:
|
|
1819
1811
|
status.fin = _context11.sent;
|
|
1820
1812
|
return _context11.abrupt("return", status);
|
|
1821
|
-
case
|
|
1813
|
+
case 67:
|
|
1822
1814
|
case "end":
|
|
1823
1815
|
return _context11.stop();
|
|
1824
1816
|
}
|
|
1825
|
-
}, _callee11, this, [[
|
|
1817
|
+
}, _callee11, this, [[30, 45]]);
|
|
1826
1818
|
}));
|
|
1827
1819
|
return function (_x11) {
|
|
1828
1820
|
return _ref22.apply(this, arguments);
|
package/package.json
CHANGED
package/src/client/LiveConf.js
CHANGED
|
@@ -74,6 +74,7 @@ const LiveconfTemplate = {
|
|
|
74
74
|
part_ttl: 3600,
|
|
75
75
|
playout_type: "live",
|
|
76
76
|
source_timescale: null,
|
|
77
|
+
reconnect_timeout: 600,
|
|
77
78
|
xc_params: {
|
|
78
79
|
audio_bitrate: 384000,
|
|
79
80
|
audio_index: [
|
|
@@ -459,6 +460,10 @@ class LiveConf {
|
|
|
459
460
|
conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
|
|
460
461
|
}
|
|
461
462
|
|
|
463
|
+
if(customSettings.reconnect_timeout) {
|
|
464
|
+
conf.live_recording.recording_config.recording_params.reconnect_timeout = customSettings.reconnect_timeout;
|
|
465
|
+
}
|
|
466
|
+
|
|
462
467
|
// Fill in specifics for protocol
|
|
463
468
|
switch(this.probeKind()) {
|
|
464
469
|
case "udp":
|
package/src/client/LiveStream.js
CHANGED
|
@@ -1357,7 +1357,7 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
|
|
|
1357
1357
|
const hostName = new URL(parsedName).hostname;
|
|
1358
1358
|
const streamUrl = new URL(userConfig.url);
|
|
1359
1359
|
|
|
1360
|
-
|
|
1360
|
+
this.Log(`Retrieving nodes - matching: ${hostName}`);
|
|
1361
1361
|
let nodes = await this.SpaceNodes({matchEndpoint: hostName});
|
|
1362
1362
|
if(nodes.length < 1) {
|
|
1363
1363
|
status.error = "No node matching stream URL " + streamUrl.href;
|
|
@@ -1375,12 +1375,7 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
|
|
|
1375
1375
|
|
|
1376
1376
|
// Probe the stream
|
|
1377
1377
|
probe = {};
|
|
1378
|
-
const controller = new AbortController();
|
|
1379
|
-
const timeoutId = setTimeout(() => {
|
|
1380
|
-
controller.abort();
|
|
1381
|
-
}, 60 * 1000); // milliseconds
|
|
1382
1378
|
try {
|
|
1383
|
-
|
|
1384
1379
|
let probeUrl = await this.Rep({
|
|
1385
1380
|
libraryId,
|
|
1386
1381
|
objectId,
|
|
@@ -1393,13 +1388,10 @@ exports.StreamConfig = async function({name, customSettings={}, probeMetadata})
|
|
|
1393
1388
|
"filename": streamUrl.href,
|
|
1394
1389
|
"listen": true
|
|
1395
1390
|
}),
|
|
1396
|
-
method: "POST"
|
|
1397
|
-
signal: controller.signal
|
|
1391
|
+
method: "POST"
|
|
1398
1392
|
})
|
|
1399
1393
|
);
|
|
1400
1394
|
|
|
1401
|
-
if(probe) { clearTimeout(timeoutId); }
|
|
1402
|
-
|
|
1403
1395
|
if(probe.errors) {
|
|
1404
1396
|
throw probe.errors[0];
|
|
1405
1397
|
}
|