@eluvio/elv-client-js 4.2.20 → 4.2.22
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/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +7 -12
- package/dist/src/ContentObjectAudit.js +2 -1
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/ElvClient.js +25 -13
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +90 -47
- package/dist/src/NetworkUrls.js +8 -0
- package/dist/src/RemoteSigner.js +170 -70
- package/dist/src/abr_profiles/abr_profile_live_drm.js +0 -10
- package/dist/src/client/ContentAccess.js +1196 -1154
- package/dist/src/client/ContentManagement.js +67 -41
- package/dist/src/client/LiveConf.js +171 -84
- package/dist/src/client/LiveStream.js +5216 -2118
- package/dist/src/client/NTP.js +172 -77
- package/dist/src/live_recording_config_profiles/live_recording_config_default.js +45 -0
- package/package.json +1 -1
- package/src/ElvClient.js +3 -1
- package/src/HttpClient.js +7 -0
- package/src/RemoteSigner.js +71 -7
- package/src/client/ContentAccess.js +7 -3
- package/src/client/ContentManagement.js +6 -2
|
@@ -1064,34 +1064,47 @@ exports.CopyContentObject = /*#__PURE__*/function () {
|
|
|
1064
1064
|
// User CAP
|
|
1065
1065
|
userCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
1066
1066
|
if (!metadata[userCapKey]) {
|
|
1067
|
-
_context13.next =
|
|
1067
|
+
_context13.next = 40;
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
|
-
|
|
1070
|
+
if (!this.signer.remoteSigner) {
|
|
1071
|
+
_context13.next = 24;
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
1074
|
+
_context13.next = 21;
|
|
1075
|
+
return this.signer.DecryptCap(metadata[userCapKey]);
|
|
1076
|
+
case 21:
|
|
1077
|
+
_context13.t0 = _context13.sent;
|
|
1078
|
+
_context13.next = 27;
|
|
1079
|
+
break;
|
|
1080
|
+
case 24:
|
|
1081
|
+
_context13.next = 26;
|
|
1071
1082
|
return this.Crypto.DecryptCap(metadata[userCapKey], this.signer._signingKey().privateKey);
|
|
1072
|
-
case
|
|
1073
|
-
|
|
1083
|
+
case 26:
|
|
1084
|
+
_context13.t0 = _context13.sent;
|
|
1085
|
+
case 27:
|
|
1086
|
+
userConkKey = _context13.t0;
|
|
1074
1087
|
userConkKey.qid = objectId;
|
|
1075
|
-
_context13.
|
|
1076
|
-
_context13.
|
|
1077
|
-
_context13.
|
|
1078
|
-
_context13.
|
|
1079
|
-
_context13.
|
|
1080
|
-
_context13.next =
|
|
1088
|
+
_context13.t1 = this;
|
|
1089
|
+
_context13.t2 = libraryId;
|
|
1090
|
+
_context13.t3 = objectId;
|
|
1091
|
+
_context13.t4 = writeToken;
|
|
1092
|
+
_context13.t5 = userCapKey;
|
|
1093
|
+
_context13.next = 36;
|
|
1081
1094
|
return this.Crypto.EncryptConk(userConkKey, this.signer._signingKey().publicKey);
|
|
1082
|
-
case
|
|
1083
|
-
_context13.
|
|
1084
|
-
_context13.
|
|
1085
|
-
libraryId: _context13.
|
|
1086
|
-
objectId: _context13.
|
|
1087
|
-
writeToken: _context13.
|
|
1088
|
-
metadataSubtree: _context13.
|
|
1089
|
-
metadata: _context13.
|
|
1095
|
+
case 36:
|
|
1096
|
+
_context13.t6 = _context13.sent;
|
|
1097
|
+
_context13.t7 = {
|
|
1098
|
+
libraryId: _context13.t2,
|
|
1099
|
+
objectId: _context13.t3,
|
|
1100
|
+
writeToken: _context13.t4,
|
|
1101
|
+
metadataSubtree: _context13.t5,
|
|
1102
|
+
metadata: _context13.t6
|
|
1090
1103
|
};
|
|
1091
|
-
_context13.next =
|
|
1092
|
-
return _context13.
|
|
1093
|
-
case
|
|
1094
|
-
_context13.next =
|
|
1104
|
+
_context13.next = 40;
|
|
1105
|
+
return _context13.t1.ReplaceMetadata.call(_context13.t1, _context13.t7);
|
|
1106
|
+
case 40:
|
|
1107
|
+
_context13.next = 42;
|
|
1095
1108
|
return Promise.all(Object.keys(metadata).filter(function (key) {
|
|
1096
1109
|
return key.startsWith("eluv.caps.ikms");
|
|
1097
1110
|
}).map( /*#__PURE__*/function () {
|
|
@@ -1118,28 +1131,28 @@ exports.CopyContentObject = /*#__PURE__*/function () {
|
|
|
1118
1131
|
return _ref24.apply(this, arguments);
|
|
1119
1132
|
};
|
|
1120
1133
|
}()));
|
|
1121
|
-
case
|
|
1134
|
+
case 42:
|
|
1122
1135
|
if (!(permission !== "owner")) {
|
|
1123
|
-
_context13.next =
|
|
1136
|
+
_context13.next = 45;
|
|
1124
1137
|
break;
|
|
1125
1138
|
}
|
|
1126
|
-
_context13.next =
|
|
1139
|
+
_context13.next = 45;
|
|
1127
1140
|
return this.CreateEncryptionConk({
|
|
1128
1141
|
libraryId: libraryId,
|
|
1129
1142
|
objectId: objectId,
|
|
1130
1143
|
writeToken: writeToken,
|
|
1131
1144
|
createKMSConk: true
|
|
1132
1145
|
});
|
|
1133
|
-
case
|
|
1134
|
-
_context13.next =
|
|
1146
|
+
case 45:
|
|
1147
|
+
_context13.next = 47;
|
|
1135
1148
|
return this.FinalizeContentObject({
|
|
1136
1149
|
libraryId: libraryId,
|
|
1137
1150
|
objectId: objectId,
|
|
1138
1151
|
writeToken: writeToken
|
|
1139
1152
|
});
|
|
1140
|
-
case
|
|
1153
|
+
case 47:
|
|
1141
1154
|
return _context13.abrupt("return", _context13.sent);
|
|
1142
|
-
case
|
|
1155
|
+
case 48:
|
|
1143
1156
|
case "end":
|
|
1144
1157
|
return _context13.stop();
|
|
1145
1158
|
}
|
|
@@ -1184,29 +1197,42 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
|
|
|
1184
1197
|
}
|
|
1185
1198
|
throw Error("No user cap found for current user");
|
|
1186
1199
|
case 7:
|
|
1187
|
-
|
|
1200
|
+
if (!this.signer.remoteSigner) {
|
|
1201
|
+
_context14.next = 13;
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
_context14.next = 10;
|
|
1205
|
+
return this.signer.DecryptCap(userCapValue);
|
|
1206
|
+
case 10:
|
|
1207
|
+
_context14.t0 = _context14.sent;
|
|
1208
|
+
_context14.next = 16;
|
|
1209
|
+
break;
|
|
1210
|
+
case 13:
|
|
1211
|
+
_context14.next = 15;
|
|
1188
1212
|
return this.Crypto.DecryptCap(userCapValue, this.signer._signingKey().privateKey);
|
|
1189
|
-
case
|
|
1190
|
-
|
|
1213
|
+
case 15:
|
|
1214
|
+
_context14.t0 = _context14.sent;
|
|
1215
|
+
case 16:
|
|
1216
|
+
userConk = _context14.t0;
|
|
1191
1217
|
publicAddress = this.utils.PublicKeyToAddress(publicKey);
|
|
1192
1218
|
targetUserCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(publicAddress));
|
|
1193
|
-
_context14.next =
|
|
1219
|
+
_context14.next = 21;
|
|
1194
1220
|
return this.Crypto.EncryptConk(userConk, publicKey);
|
|
1195
|
-
case
|
|
1221
|
+
case 21:
|
|
1196
1222
|
targetUserCapValue = _context14.sent;
|
|
1197
1223
|
finalize = !writeToken;
|
|
1198
1224
|
if (writeToken) {
|
|
1199
|
-
_context14.next =
|
|
1225
|
+
_context14.next = 27;
|
|
1200
1226
|
break;
|
|
1201
1227
|
}
|
|
1202
|
-
_context14.next =
|
|
1228
|
+
_context14.next = 26;
|
|
1203
1229
|
return this.EditContentObject({
|
|
1204
1230
|
libraryId: libraryId,
|
|
1205
1231
|
objectId: objectId
|
|
1206
1232
|
}).writeToken;
|
|
1207
|
-
case
|
|
1233
|
+
case 26:
|
|
1208
1234
|
writeToken = _context14.sent;
|
|
1209
|
-
case
|
|
1235
|
+
case 27:
|
|
1210
1236
|
this.ReplaceMetadata({
|
|
1211
1237
|
libraryId: libraryId,
|
|
1212
1238
|
objectId: objectId,
|
|
@@ -1215,17 +1241,17 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
|
|
|
1215
1241
|
metadata: targetUserCapValue
|
|
1216
1242
|
});
|
|
1217
1243
|
if (!finalize) {
|
|
1218
|
-
_context14.next =
|
|
1244
|
+
_context14.next = 31;
|
|
1219
1245
|
break;
|
|
1220
1246
|
}
|
|
1221
|
-
_context14.next =
|
|
1247
|
+
_context14.next = 31;
|
|
1222
1248
|
return this.FinalizeContentObject({
|
|
1223
1249
|
libraryId: libraryId,
|
|
1224
1250
|
objectId: objectId,
|
|
1225
1251
|
writeToken: writeToken,
|
|
1226
1252
|
commitMessage: "Create non-owner cap"
|
|
1227
1253
|
});
|
|
1228
|
-
case
|
|
1254
|
+
case 31:
|
|
1229
1255
|
case "end":
|
|
1230
1256
|
return _context14.stop();
|
|
1231
1257
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
2
1
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
|
+
var _objectWithoutProperties = require("@babel/runtime/helpers/objectWithoutProperties");
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
4
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
4
5
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
6
|
+
var _excluded = ["recording_config", "recording_params"];
|
|
5
7
|
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; }
|
|
6
8
|
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) { _defineProperty(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; }
|
|
7
9
|
/* eslint no-console: 0 */
|
|
8
|
-
|
|
10
|
+
var R = require("ramda");
|
|
9
11
|
var DefaultABRLadder = {
|
|
10
12
|
"video": [{
|
|
11
13
|
bit_rate: 14000000,
|
|
@@ -51,8 +53,9 @@ var LiveconfTemplate = {
|
|
|
51
53
|
},
|
|
52
54
|
playout_config: {
|
|
53
55
|
dvr_enabled: true,
|
|
54
|
-
dvr_max_duration:
|
|
56
|
+
dvr_max_duration: 14400,
|
|
55
57
|
rebroadcast_start_time_sec_epoch: 0,
|
|
58
|
+
playout_sharding_level: 2,
|
|
56
59
|
vod_enabled: false
|
|
57
60
|
},
|
|
58
61
|
recording_config: {
|
|
@@ -60,11 +63,11 @@ var LiveconfTemplate = {
|
|
|
60
63
|
description: "",
|
|
61
64
|
ladder_specs: [],
|
|
62
65
|
listen: true,
|
|
63
|
-
live_delay_nano:
|
|
66
|
+
live_delay_nano: 6000000000,
|
|
64
67
|
max_duration_sec: -1,
|
|
65
68
|
name: "",
|
|
66
69
|
origin_url: "",
|
|
67
|
-
part_ttl:
|
|
70
|
+
part_ttl: 86400,
|
|
68
71
|
playout_type: "live",
|
|
69
72
|
source_timescale: null,
|
|
70
73
|
reconnect_timeout: 600,
|
|
@@ -101,20 +104,52 @@ var LiveconfTemplate = {
|
|
|
101
104
|
var LiveConf = /*#__PURE__*/function () {
|
|
102
105
|
"use strict";
|
|
103
106
|
|
|
104
|
-
function LiveConf(
|
|
107
|
+
function LiveConf(_ref) {
|
|
108
|
+
var url = _ref.url,
|
|
109
|
+
probeData = _ref.probeData,
|
|
110
|
+
nodeId = _ref.nodeId,
|
|
111
|
+
nodeUrl = _ref.nodeUrl,
|
|
112
|
+
includeAVSegDurations = _ref.includeAVSegDurations,
|
|
113
|
+
overwriteOriginUrl = _ref.overwriteOriginUrl,
|
|
114
|
+
syncAudioToVideo = _ref.syncAudioToVideo,
|
|
115
|
+
liveRecordingMeta = _ref.liveRecordingMeta;
|
|
105
116
|
_classCallCheck(this, LiveConf);
|
|
117
|
+
this.url = url;
|
|
106
118
|
this.probeData = probeData;
|
|
107
119
|
this.nodeId = nodeId;
|
|
108
120
|
this.nodeUrl = nodeUrl;
|
|
109
121
|
this.includeAVSegDurations = includeAVSegDurations;
|
|
110
122
|
this.overwriteOriginUrl = overwriteOriginUrl;
|
|
111
123
|
this.syncAudioToVideo = syncAudioToVideo;
|
|
124
|
+
this.currentLiveRecordingMeta = liveRecordingMeta;
|
|
112
125
|
}
|
|
113
126
|
_createClass(LiveConf, [{
|
|
114
|
-
key: "
|
|
115
|
-
value: function
|
|
116
|
-
var
|
|
117
|
-
|
|
127
|
+
key: "getFormat",
|
|
128
|
+
value: function getFormat() {
|
|
129
|
+
var _this$probeData$forma;
|
|
130
|
+
if (this.probeData.format.format_name) {
|
|
131
|
+
return this.probeData.format.format_name;
|
|
132
|
+
}
|
|
133
|
+
var fileNameSplit = (_this$probeData$forma = this.probeData.format) === null || _this$probeData$forma === void 0 || (_this$probeData$forma = _this$probeData$forma.filename) === null || _this$probeData$forma === void 0 ? void 0 : _this$probeData$forma.split(":");
|
|
134
|
+
if (fileNameSplit.length > 1) {
|
|
135
|
+
var protoScheme = fileNameSplit[0];
|
|
136
|
+
switch (protoScheme) {
|
|
137
|
+
case "rtmp":
|
|
138
|
+
return "flv";
|
|
139
|
+
case "udp":
|
|
140
|
+
case "rtp":
|
|
141
|
+
case "srt":
|
|
142
|
+
return "mpegts";
|
|
143
|
+
default:
|
|
144
|
+
return "format_unknown";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "getProtocol",
|
|
150
|
+
value: function getProtocol() {
|
|
151
|
+
var protoScheme = this.url.split(":")[0];
|
|
152
|
+
return protoScheme;
|
|
118
153
|
}
|
|
119
154
|
}, {
|
|
120
155
|
key: "getStreamDataForCodecType",
|
|
@@ -132,19 +167,27 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
132
167
|
// Used by generateAudioStreamsConfig()
|
|
133
168
|
}, {
|
|
134
169
|
key: "getAudioStreamsFromProbe",
|
|
135
|
-
value: function getAudioStreamsFromProbe() {
|
|
170
|
+
value: function getAudioStreamsFromProbe(_ref2) {
|
|
171
|
+
var ladderProfile = _ref2.ladderProfile;
|
|
136
172
|
var audioStreams = {};
|
|
137
173
|
var audioStreamData = this.probeData.streams.filter(function (value) {
|
|
138
174
|
return value.codec_type === "audio";
|
|
139
175
|
});
|
|
140
|
-
|
|
176
|
+
var _loop = function _loop() {
|
|
177
|
+
var _ladderProfile$audio, _profileAudioForType$, _currentStreamData$bi;
|
|
141
178
|
var currentStreamIndex = audioStreamData[index].stream_index;
|
|
142
179
|
var currentStreamData = audioStreamData[index];
|
|
180
|
+
var profileAudioForType = ladderProfile === null || ladderProfile === void 0 || (_ladderProfile$audio = ladderProfile.audio) === null || _ladderProfile$audio === void 0 ? void 0 : _ladderProfile$audio.find(function (a) {
|
|
181
|
+
return a.channels === currentStreamData.channels;
|
|
182
|
+
});
|
|
143
183
|
audioStreams[currentStreamIndex] = {
|
|
144
|
-
recordingBitrate: Math.max(currentStreamData.bit_rate,
|
|
184
|
+
recordingBitrate: (_profileAudioForType$ = profileAudioForType === null || profileAudioForType === void 0 ? void 0 : profileAudioForType.bit_rate) !== null && _profileAudioForType$ !== void 0 ? _profileAudioForType$ : Math.max((_currentStreamData$bi = currentStreamData.bit_rate) !== null && _currentStreamData$bi !== void 0 ? _currentStreamData$bi : 0, 12800),
|
|
145
185
|
recordingChannels: currentStreamData.channels,
|
|
146
186
|
playoutLabel: "Audio ".concat(index + 1)
|
|
147
187
|
};
|
|
188
|
+
};
|
|
189
|
+
for (var index = 0; index < audioStreamData.length; index++) {
|
|
190
|
+
_loop();
|
|
148
191
|
}
|
|
149
192
|
return audioStreams;
|
|
150
193
|
}
|
|
@@ -199,21 +242,20 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
199
242
|
*/
|
|
200
243
|
}, {
|
|
201
244
|
key: "calcSegDuration",
|
|
202
|
-
value: function calcSegDuration(
|
|
203
|
-
var sourceTimescale =
|
|
204
|
-
sampleRate =
|
|
205
|
-
audioCodec =
|
|
245
|
+
value: function calcSegDuration(_ref3) {
|
|
246
|
+
var sourceTimescale = _ref3.sourceTimescale,
|
|
247
|
+
sampleRate = _ref3.sampleRate,
|
|
248
|
+
audioCodec = _ref3.audioCodec;
|
|
206
249
|
var seg = {};
|
|
207
|
-
switch (this.
|
|
208
|
-
case "
|
|
250
|
+
switch (this.getFormat()) {
|
|
251
|
+
case "flv":
|
|
209
252
|
seg = this.calcSegDurationRtmp({
|
|
210
253
|
sourceTimescale: sourceTimescale,
|
|
211
254
|
sampleRate: sampleRate,
|
|
212
255
|
audioCodec: audioCodec
|
|
213
256
|
});
|
|
214
257
|
break;
|
|
215
|
-
case "
|
|
216
|
-
case "srt":
|
|
258
|
+
case "mpegts":
|
|
217
259
|
seg = this.calcSegDurationMpegts({
|
|
218
260
|
sourceTimescale: sourceTimescale,
|
|
219
261
|
sampleRate: sampleRate,
|
|
@@ -221,7 +263,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
221
263
|
});
|
|
222
264
|
break;
|
|
223
265
|
default:
|
|
224
|
-
throw "protocol not supported - " + this.
|
|
266
|
+
throw "protocol not supported - " + this.getFormat();
|
|
225
267
|
}
|
|
226
268
|
if (audioCodec == "aac") {
|
|
227
269
|
seg.audio = 29.76 * sampleRate;
|
|
@@ -245,8 +287,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
245
287
|
}
|
|
246
288
|
}, {
|
|
247
289
|
key: "calcSegDurationMpegts",
|
|
248
|
-
value: function calcSegDurationMpegts(
|
|
249
|
-
var sourceTimescale =
|
|
290
|
+
value: function calcSegDurationMpegts(_ref4) {
|
|
291
|
+
var sourceTimescale = _ref4.sourceTimescale;
|
|
250
292
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
251
293
|
var frameRate = videoStream.frame_rate;
|
|
252
294
|
|
|
@@ -308,8 +350,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
308
350
|
}
|
|
309
351
|
}, {
|
|
310
352
|
key: "calcSegDurationRtmp",
|
|
311
|
-
value: function calcSegDurationRtmp(
|
|
312
|
-
var sourceTimescale =
|
|
353
|
+
value: function calcSegDurationRtmp(_ref5) {
|
|
354
|
+
var sourceTimescale = _ref5.sourceTimescale;
|
|
313
355
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
314
356
|
var frameRate = videoStream.frame_rate;
|
|
315
357
|
var seg = {};
|
|
@@ -372,60 +414,123 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
372
414
|
value: function syncAudioToStreamIdValue() {
|
|
373
415
|
var sync_id = -1;
|
|
374
416
|
var videoStream = this.getStreamDataForCodecType("video");
|
|
375
|
-
switch (this.
|
|
376
|
-
case "
|
|
377
|
-
case "srt":
|
|
417
|
+
switch (this.getFormat()) {
|
|
418
|
+
case "mpegts":
|
|
378
419
|
sync_id = videoStream.stream_id;
|
|
379
420
|
break;
|
|
380
|
-
case "
|
|
421
|
+
case "flv":
|
|
381
422
|
sync_id = videoStream.stream_index;
|
|
382
423
|
break;
|
|
383
424
|
}
|
|
384
425
|
return sync_id;
|
|
385
426
|
}
|
|
386
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Map custom live recording profile to the expected config structure
|
|
430
|
+
* @param {Object} customProfile - User's custom recording profile
|
|
431
|
+
* @return {Object} - Mapped config in live_recording format
|
|
432
|
+
*/
|
|
433
|
+
}, {
|
|
434
|
+
key: "MapCustomProfileToLiveConfig",
|
|
435
|
+
value: function MapCustomProfileToLiveConfig(_ref6) {
|
|
436
|
+
var customProfile = _ref6.customProfile;
|
|
437
|
+
if (!customProfile) return {};
|
|
438
|
+
var CompactDeep = function CompactDeep(obj) {
|
|
439
|
+
if (obj === null || _typeof(obj) !== "object" || Array.isArray(obj)) {
|
|
440
|
+
return obj;
|
|
441
|
+
}
|
|
442
|
+
return R.pipe(R.reject(R.isNil), R.map(function (val) {
|
|
443
|
+
return _typeof(val) === "object" ? CompactDeep(val) : val;
|
|
444
|
+
}))(obj);
|
|
445
|
+
};
|
|
446
|
+
var recording_config = customProfile.recording_config,
|
|
447
|
+
recording_params = customProfile.recording_params,
|
|
448
|
+
rest = _objectWithoutProperties(customProfile, _excluded);
|
|
449
|
+
return CompactDeep({
|
|
450
|
+
live_recording: _objectSpread(_objectSpread({}, rest), {}, {
|
|
451
|
+
recording_config: {
|
|
452
|
+
recording_params: _objectSpread(_objectSpread({}, recording_params), {}, {
|
|
453
|
+
part_ttl: recording_config === null || recording_config === void 0 ? void 0 : recording_config.part_ttl,
|
|
454
|
+
reconnect_timeout: recording_config === null || recording_config === void 0 ? void 0 : recording_config.reconnect_timeout,
|
|
455
|
+
xc_params: _objectSpread(_objectSpread({}, (recording_params === null || recording_params === void 0 ? void 0 : recording_params.xc_params) || {}), {}, {
|
|
456
|
+
connection_timeout: recording_config === null || recording_config === void 0 ? void 0 : recording_config.connection_timeout,
|
|
457
|
+
copy_mpegts: recording_config === null || recording_config === void 0 ? void 0 : recording_config.copy_mpegts,
|
|
458
|
+
input_cfg: recording_config === null || recording_config === void 0 ? void 0 : recording_config.input_cfg
|
|
459
|
+
})
|
|
460
|
+
})
|
|
461
|
+
}
|
|
462
|
+
})
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
387
466
|
/*
|
|
388
467
|
* Generate audio streams recording configuration based on the optional custom settings.
|
|
389
468
|
* If no custom "audio" section is present, record all the acceptable audio streams found in the probe
|
|
390
469
|
*/
|
|
391
470
|
}, {
|
|
392
471
|
key: "generateAudioStreamsConfig",
|
|
393
|
-
value: function generateAudioStreamsConfig(
|
|
394
|
-
var
|
|
472
|
+
value: function generateAudioStreamsConfig(_ref7) {
|
|
473
|
+
var _liveRecordingConfigP, _liveRecordingConfigP2;
|
|
474
|
+
var liveRecordingConfigProfile = _ref7.liveRecordingConfigProfile;
|
|
475
|
+
var ladderProfile = (liveRecordingConfigProfile === null || liveRecordingConfigProfile === void 0 || (_liveRecordingConfigP = liveRecordingConfigProfile.playout_config) === null || _liveRecordingConfigP === void 0 ? void 0 : _liveRecordingConfigP.ladder_specs) || DefaultABRLadder;
|
|
476
|
+
var audioSettings = liveRecordingConfigProfile === null || liveRecordingConfigProfile === void 0 || (_liveRecordingConfigP2 = liveRecordingConfigProfile.recording_stream_config) === null || _liveRecordingConfigP2 === void 0 ? void 0 : _liveRecordingConfigP2.audio;
|
|
395
477
|
var audioStreams = {};
|
|
396
|
-
if (
|
|
397
|
-
|
|
398
|
-
var
|
|
399
|
-
var
|
|
478
|
+
if (audioSettings && Object.keys(audioSettings).length > 0) {
|
|
479
|
+
var _loop2 = function _loop2() {
|
|
480
|
+
var _audio$recording_bitr;
|
|
481
|
+
var audioIdx = Object.keys(audioSettings)[i];
|
|
482
|
+
var audio = audioSettings[audioIdx];
|
|
483
|
+
var profileAudioForType = ladderProfile === null || ladderProfile === void 0 ? void 0 : ladderProfile.audio.find(function (a) {
|
|
484
|
+
var _audio$channels;
|
|
485
|
+
return a.channels === ((_audio$channels = audio.channels) !== null && _audio$channels !== void 0 ? _audio$channels : 2);
|
|
486
|
+
});
|
|
400
487
|
audioStreams[audioIdx] = {
|
|
401
|
-
recordingBitrate: audio.recording_bitrate
|
|
402
|
-
recordingChannels: audio.recording_channels || 2
|
|
488
|
+
recordingBitrate: ladderProfile !== null && ladderProfile !== void 0 && ladderProfile.audio ? profileAudioForType.bit_rate : (_audio$recording_bitr = audio.recording_bitrate) !== null && _audio$recording_bitr !== void 0 ? _audio$recording_bitr : 192000,
|
|
489
|
+
recordingChannels: audio.recording_channels || 2,
|
|
490
|
+
lang: audio.lang,
|
|
491
|
+
isDefault: audio["default"]
|
|
403
492
|
};
|
|
404
493
|
if (audio.playout) {
|
|
405
494
|
audioStreams[audioIdx].playoutLabel = audio.playout_label || "Audio ".concat(i + 1);
|
|
406
495
|
}
|
|
496
|
+
};
|
|
497
|
+
for (var i = 0; i < Object.keys(audioSettings).length; i++) {
|
|
498
|
+
_loop2();
|
|
407
499
|
}
|
|
408
500
|
}
|
|
409
501
|
|
|
410
502
|
// If no audio streams specified in custom config, set up all the suitable audio streams in the probe
|
|
411
|
-
if (!
|
|
412
|
-
audioStreams = this.getAudioStreamsFromProbe(
|
|
503
|
+
if (!audioSettings || Object.keys(audioSettings).length === 0) {
|
|
504
|
+
audioStreams = this.getAudioStreamsFromProbe({
|
|
505
|
+
ladderProfile: ladderProfile
|
|
506
|
+
});
|
|
413
507
|
}
|
|
414
508
|
return audioStreams;
|
|
415
509
|
}
|
|
416
510
|
|
|
417
511
|
/*
|
|
418
|
-
* Generate the live recording config as required by QFAB, based on defaults and optional custom settings.
|
|
512
|
+
* Generate the live recording config as required by QFAB, based on defaults, existing settings and optional custom settings.
|
|
419
513
|
*/
|
|
420
514
|
}, {
|
|
421
515
|
key: "generateLiveConf",
|
|
422
|
-
value: function generateLiveConf(
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
var
|
|
516
|
+
value: function generateLiveConf(_ref8) {
|
|
517
|
+
var _customSettings$liveR, _customSettings$liveR2, _ladder_specs$video;
|
|
518
|
+
var customSettings = _ref8.customSettings;
|
|
519
|
+
// Saved config overrides defaults and is preserved on reconfiguration
|
|
520
|
+
var conf = R.clone(LiveconfTemplate);
|
|
521
|
+
if (this.currentLiveRecordingMeta) {
|
|
522
|
+
conf = R.mergeDeepRight(conf, {
|
|
523
|
+
live_recording: this.currentLiveRecordingMeta
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if (customSettings.liveRecordingConfigProfile) {
|
|
527
|
+
conf = R.mergeDeepRight(conf, this.MapCustomProfileToLiveConfig({
|
|
528
|
+
customProfile: customSettings.liveRecordingConfigProfile
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
var fileName = this.url;
|
|
427
532
|
var audioStreams = this.generateAudioStreamsConfig({
|
|
428
|
-
|
|
533
|
+
liveRecordingConfigProfile: customSettings.liveRecordingConfigProfile
|
|
429
534
|
});
|
|
430
535
|
|
|
431
536
|
// Retrieve one audio stream from the probe to read the sample rate and codec name
|
|
@@ -453,17 +558,13 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
453
558
|
}
|
|
454
559
|
|
|
455
560
|
// Fill in specifics for protocol
|
|
456
|
-
switch (this.
|
|
457
|
-
case "
|
|
561
|
+
switch (this.getFormat()) {
|
|
562
|
+
case "mpegts":
|
|
458
563
|
sourceTimescale = 90000;
|
|
459
564
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
460
565
|
break;
|
|
461
|
-
case "srt":
|
|
462
|
-
sourceTimescale = 90000;
|
|
463
|
-
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
464
|
-
conf.live_recording.recording_config.recording_params.live_delay_nano = 4000000000;
|
|
465
|
-
break;
|
|
466
566
|
case "rtmp":
|
|
567
|
+
case "flv":
|
|
467
568
|
sourceTimescale = 16000;
|
|
468
569
|
conf.live_recording.recording_config.recording_params.source_timescale = sourceTimescale;
|
|
469
570
|
break;
|
|
@@ -471,7 +572,14 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
471
572
|
console.log("HLS detected. Not yet implemented");
|
|
472
573
|
break;
|
|
473
574
|
default:
|
|
474
|
-
console.log("Unsupported media", this.
|
|
575
|
+
console.log("Unsupported media", this.getFormat());
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
switch (this.getProtocol()) {
|
|
579
|
+
case "srt":
|
|
580
|
+
if (!((_customSettings$liveR = customSettings.liveRecordingConfigProfile) !== null && _customSettings$liveR !== void 0 && (_customSettings$liveR = _customSettings$liveR.recording_params) !== null && _customSettings$liveR !== void 0 && _customSettings$liveR.live_delay_nano)) {
|
|
581
|
+
conf.live_recording.recording_config.recording_params.live_delay_nano = 6000000000;
|
|
582
|
+
}
|
|
475
583
|
break;
|
|
476
584
|
}
|
|
477
585
|
var segDurations = this.calcSegDuration({
|
|
@@ -496,10 +604,14 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
496
604
|
if (segDurations.videoFrameDurationTs) {
|
|
497
605
|
conf.live_recording.recording_config.recording_params.xc_params.video_frame_duration_ts = segDurations.videoFrameDurationTs;
|
|
498
606
|
}
|
|
499
|
-
var
|
|
607
|
+
var ladder_specs = (_customSettings$liveR2 = customSettings.liveRecordingConfigProfile) === null || _customSettings$liveR2 === void 0 || (_customSettings$liveR2 = _customSettings$liveR2.playout_config) === null || _customSettings$liveR2 === void 0 ? void 0 : _customSettings$liveR2.ladder_specs;
|
|
608
|
+
var ladderProfile = (ladder_specs === null || ladder_specs === void 0 || (_ladder_specs$video = ladder_specs.video) === null || _ladder_specs$video === void 0 ? void 0 : _ladder_specs$video.length) > 0 ? ladder_specs : DefaultABRLadder;
|
|
500
609
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
|
|
501
610
|
conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
|
|
502
611
|
|
|
612
|
+
// Reset ladder specs (updating existing stream will carry over old specs
|
|
613
|
+
conf.live_recording.recording_config.recording_params.ladder_specs = [];
|
|
614
|
+
|
|
503
615
|
// Determine video recording bitrate and ABR ladder
|
|
504
616
|
var topLadderRate = 0;
|
|
505
617
|
for (var _i = 0; _i < ladderProfile.video.length; _i++) {
|
|
@@ -521,6 +633,7 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
521
633
|
var globalAudioBitrate = 0;
|
|
522
634
|
var nAudio = 0;
|
|
523
635
|
for (var _i2 = 0; _i2 < Object.keys(audioStreams).length; _i2++) {
|
|
636
|
+
var _audio$lang;
|
|
524
637
|
var audioLadderSpec = {};
|
|
525
638
|
var audioIndex = Object.keys(audioStreams)[_i2];
|
|
526
639
|
var audio = audioStreams[audioIndex];
|
|
@@ -543,7 +656,8 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
543
656
|
audioLadderSpec.stream_name = "audio_".concat(audioIndex);
|
|
544
657
|
audioLadderSpec.stream_label = audio.playoutLabel ? audio.playoutLabel : null;
|
|
545
658
|
audioLadderSpec.media_type = 2;
|
|
546
|
-
|
|
659
|
+
audioLadderSpec.lang = (_audio$lang = audio.lang) !== null && _audio$lang !== void 0 ? _audio$lang : "";
|
|
660
|
+
if (Object.keys(audioStreams).length === 1 || audio.isDefault) {
|
|
547
661
|
audioLadderSpec["default"] = true;
|
|
548
662
|
}
|
|
549
663
|
conf.live_recording.recording_config.recording_params.ladder_specs.push(audioLadderSpec);
|
|
@@ -556,33 +670,6 @@ var LiveConf = /*#__PURE__*/function () {
|
|
|
556
670
|
// Global recording bitrate for all audio streams
|
|
557
671
|
conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = globalAudioBitrate;
|
|
558
672
|
conf.live_recording.recording_config.recording_params.xc_params.n_audio = nAudio;
|
|
559
|
-
|
|
560
|
-
// Iterate through custom settings (which will override any existing setting)
|
|
561
|
-
function SetByPath(_ref6) {
|
|
562
|
-
var obj = _ref6.obj,
|
|
563
|
-
path = _ref6.path,
|
|
564
|
-
value = _ref6.value;
|
|
565
|
-
var keys = path.split(".");
|
|
566
|
-
var temp = obj;
|
|
567
|
-
for (var _i3 = 0; _i3 < keys.length - 1; _i3++) {
|
|
568
|
-
if (!temp[keys[_i3]]) {
|
|
569
|
-
temp[keys[_i3]] = {};
|
|
570
|
-
}
|
|
571
|
-
temp = temp[keys[_i3]];
|
|
572
|
-
}
|
|
573
|
-
temp[keys[keys.length - 1]] = value;
|
|
574
|
-
}
|
|
575
|
-
var metaPathValues = customSettings.metaPathValues;
|
|
576
|
-
for (var _i4 = 0, _Object$entries = Object.entries(metaPathValues || {}); _i4 < _Object$entries.length; _i4++) {
|
|
577
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i4], 2),
|
|
578
|
-
path = _Object$entries$_i[0],
|
|
579
|
-
value = _Object$entries$_i[1];
|
|
580
|
-
SetByPath({
|
|
581
|
-
obj: conf,
|
|
582
|
-
path: path,
|
|
583
|
-
value: value
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
673
|
return conf;
|
|
587
674
|
}
|
|
588
675
|
}]);
|