@eluvio/elv-client-js 4.0.56 → 4.0.58
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 +11 -10
- package/dist/ElvClient-node-min.js +10 -10
- package/dist/ElvFrameClient-min.js +6 -6
- package/dist/ElvPermissionsClient-min.js +9 -9
- package/dist/ElvWalletClient-min.js +10 -9
- package/dist/ElvWalletClient-node-min.js +10 -10
- package/dist/src/ElvClient.js +441 -306
- package/dist/src/FrameClient.js +2 -2
- package/dist/src/HttpClient.js +10 -1
- package/dist/src/UserProfileClient.js +206 -88
- package/dist/src/Utils.js +25 -0
- package/dist/src/Validation.js +1 -1
- package/dist/src/client/ContentAccess.js +596 -405
- package/dist/src/client/ContentManagement.js +1 -1
- package/dist/src/client/Files.js +50 -7
- package/dist/src/client/LiveConf.js +343 -0
- package/dist/src/client/LiveStream.js +1799 -0
- package/package.json +1 -1
- package/src/client/Files.js +23 -2
- package/src/client/LiveConf.js +31 -20
- package/src/client/LiveStream.js +16 -3
- package/testScripts/Test.js +0 -14
package/package.json
CHANGED
package/src/client/Files.js
CHANGED
|
@@ -516,14 +516,35 @@ exports.UploadJobStatus = async function({libraryId, objectId, writeToken, uploa
|
|
|
516
516
|
|
|
517
517
|
const path = UrlJoin("q", writeToken, "file_jobs", uploadId, "uploads", jobId);
|
|
518
518
|
|
|
519
|
-
|
|
519
|
+
let response = await this.utils.ResponseToJson(
|
|
520
520
|
this.HttpClient.Request({
|
|
521
521
|
headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
|
|
522
522
|
method: "GET",
|
|
523
523
|
path: path,
|
|
524
|
-
allowFailover: false
|
|
524
|
+
allowFailover: false,
|
|
525
|
+
queryParams: { start: 0, limit: 10000 }
|
|
525
526
|
})
|
|
526
527
|
);
|
|
528
|
+
|
|
529
|
+
while(response.next !== response.total && response.next >= 0) {
|
|
530
|
+
const newResponse = await this.utils.ResponseToJson(
|
|
531
|
+
this.HttpClient.Request({
|
|
532
|
+
headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
|
|
533
|
+
method: "GET",
|
|
534
|
+
path: path,
|
|
535
|
+
allowFailover: false,
|
|
536
|
+
queryParams: { start: response.next }
|
|
537
|
+
})
|
|
538
|
+
);
|
|
539
|
+
|
|
540
|
+
response.files = [
|
|
541
|
+
...response.files,
|
|
542
|
+
...newResponse.files
|
|
543
|
+
];
|
|
544
|
+
response.next = newResponse.next;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return response;
|
|
527
548
|
};
|
|
528
549
|
|
|
529
550
|
exports.UploadFileData = async function({libraryId, objectId, writeToken, encryption, uploadId, jobId, filePath, fileData}) {
|
package/src/client/LiveConf.js
CHANGED
|
@@ -35,14 +35,14 @@ const LadderTemplate = {
|
|
|
35
35
|
stream_name: "video",
|
|
36
36
|
width: 960
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
bit_rate:
|
|
38
|
+
"540_low": {
|
|
39
|
+
bit_rate: 900000,
|
|
40
40
|
codecs: "avc1.640028,mp4a.40.2",
|
|
41
|
-
height:
|
|
41
|
+
height: 540,
|
|
42
42
|
media_type: 1,
|
|
43
|
-
representation: "
|
|
43
|
+
representation: "videovideo_960x540_h264@900000",
|
|
44
44
|
stream_name: "video",
|
|
45
|
-
width:
|
|
45
|
+
width: 960
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -236,9 +236,9 @@ class LiveConf {
|
|
|
236
236
|
return sync_id;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
generateLiveConf() {
|
|
239
|
+
generateLiveConf({audioBitrate, audioIndex, partTtl, channelLayout}) {
|
|
240
240
|
// gather required data
|
|
241
|
-
const conf = LiveconfTemplate;
|
|
241
|
+
const conf = JSON.parse(JSON.stringify(LiveconfTemplate));
|
|
242
242
|
const fileName = this.overwriteOriginUrl || this.probeData.format.filename;
|
|
243
243
|
const audioStream = this.getStreamDataForCodecType("audio");
|
|
244
244
|
const sampleRate = parseInt(audioStream.sample_rate);
|
|
@@ -255,7 +255,7 @@ class LiveConf {
|
|
|
255
255
|
conf.live_recording.recording_config.recording_params.origin_url = fileName;
|
|
256
256
|
conf.live_recording.recording_config.recording_params.description = `Ingest stream ${fileName}`;
|
|
257
257
|
conf.live_recording.recording_config.recording_params.name = `Ingest stream ${fileName}`;
|
|
258
|
-
conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioStream.stream_index;
|
|
258
|
+
conf.live_recording.recording_config.recording_params.xc_params.audio_index[0] = audioIndex === undefined ? audioStream.stream_index : audioIndex;
|
|
259
259
|
conf.live_recording.recording_config.recording_params.xc_params.sample_rate = sampleRate;
|
|
260
260
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = videoStream.height;
|
|
261
261
|
conf.live_recording.recording_config.recording_params.xc_params.enc_width = videoStream.width;
|
|
@@ -264,6 +264,10 @@ class LiveConf {
|
|
|
264
264
|
conf.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id = this.syncAudioToStreamIdValue();
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
if(partTtl) {
|
|
268
|
+
conf.live_recording.recording_config.recording_params.part_ttl = partTtl;
|
|
269
|
+
}
|
|
270
|
+
|
|
267
271
|
// Fill in specifics for protocol
|
|
268
272
|
switch(this.probeKind()) {
|
|
269
273
|
case "udp":
|
|
@@ -297,7 +301,7 @@ class LiveConf {
|
|
|
297
301
|
LadderTemplate[1080],
|
|
298
302
|
LadderTemplate[720],
|
|
299
303
|
LadderTemplate[540],
|
|
300
|
-
LadderTemplate[
|
|
304
|
+
LadderTemplate["540_low"]
|
|
301
305
|
);
|
|
302
306
|
conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[2160].bit_rate;
|
|
303
307
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = 2160;
|
|
@@ -309,7 +313,7 @@ class LiveConf {
|
|
|
309
313
|
LadderTemplate[1080],
|
|
310
314
|
LadderTemplate[720],
|
|
311
315
|
LadderTemplate[540],
|
|
312
|
-
LadderTemplate[
|
|
316
|
+
LadderTemplate["540_low"]
|
|
313
317
|
);
|
|
314
318
|
conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[1080].bit_rate;
|
|
315
319
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = 1080;
|
|
@@ -319,7 +323,7 @@ class LiveConf {
|
|
|
319
323
|
conf.live_recording.recording_config.recording_params.ladder_specs.unshift(
|
|
320
324
|
LadderTemplate[720],
|
|
321
325
|
LadderTemplate[540],
|
|
322
|
-
LadderTemplate[
|
|
326
|
+
LadderTemplate["540_low"]
|
|
323
327
|
);
|
|
324
328
|
conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[720].bit_rate;
|
|
325
329
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = 720;
|
|
@@ -328,21 +332,28 @@ class LiveConf {
|
|
|
328
332
|
case 540:
|
|
329
333
|
conf.live_recording.recording_config.recording_params.ladder_specs.unshift(
|
|
330
334
|
LadderTemplate[540],
|
|
331
|
-
LadderTemplate[
|
|
335
|
+
LadderTemplate["540_low"]
|
|
332
336
|
);
|
|
333
337
|
conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[540].bit_rate;
|
|
334
338
|
conf.live_recording.recording_config.recording_params.xc_params.enc_height = 540;
|
|
335
339
|
conf.live_recording.recording_config.recording_params.xc_params.enc_width = 960;
|
|
336
340
|
break;
|
|
337
|
-
case 360:
|
|
338
|
-
conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[360]);
|
|
339
|
-
conf.live_recording.recording_config.recording_params.ladder_specs.unshift(LadderTemplate[360]);
|
|
340
|
-
conf.live_recording.recording_config.recording_params.xc_params.video_bitrate = LadderTemplate[360].bit_rate;
|
|
341
|
-
conf.live_recording.recording_config.recording_params.xc_params.enc_height = 360;
|
|
342
|
-
conf.live_recording.recording_config.recording_params.xc_params.enc_width = 640;
|
|
343
|
-
break;
|
|
344
341
|
default:
|
|
345
|
-
throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540]
|
|
342
|
+
throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540]");
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if(audioBitrate || channelLayout) {
|
|
346
|
+
const audioLadderSpec = conf.live_recording.recording_config.recording_params.ladder_specs.find(spec => spec.stream_name === "audio");
|
|
347
|
+
|
|
348
|
+
if(audioBitrate) {
|
|
349
|
+
conf.live_recording.recording_config.recording_params.xc_params.audio_bitrate = audioBitrate;
|
|
350
|
+
audioLadderSpec.bit_rate = audioBitrate;
|
|
351
|
+
audioLadderSpec.representation = `audioaudio_aac@${audioBitrate}`;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if(channelLayout) {
|
|
355
|
+
audioLadderSpec.channels = channelLayout;
|
|
356
|
+
}
|
|
346
357
|
}
|
|
347
358
|
|
|
348
359
|
return JSON.stringify(conf, null, 2);
|
package/src/client/LiveStream.js
CHANGED
|
@@ -1118,7 +1118,7 @@ exports.LoadConf = async function({name}) {
|
|
|
1118
1118
|
* @return {Object} - The status response for the stream
|
|
1119
1119
|
*
|
|
1120
1120
|
*/
|
|
1121
|
-
exports.StreamConfig = async function({name}) {
|
|
1121
|
+
exports.StreamConfig = async function({name, customSettings}) {
|
|
1122
1122
|
let conf = await this.LoadConf({name});
|
|
1123
1123
|
let status = {name};
|
|
1124
1124
|
|
|
@@ -1191,10 +1191,15 @@ exports.StreamConfig = async function({name}) {
|
|
|
1191
1191
|
console.log("PROBE", probe);
|
|
1192
1192
|
probe.format.filename = streamUrl.href;
|
|
1193
1193
|
|
|
1194
|
-
// Create live
|
|
1194
|
+
// Create live recording config
|
|
1195
1195
|
let lc = new LiveConf(probe, node.id, endpoint, false, false, true);
|
|
1196
1196
|
|
|
1197
|
-
const liveRecordingConfigStr = lc.generateLiveConf(
|
|
1197
|
+
const liveRecordingConfigStr = lc.generateLiveConf({
|
|
1198
|
+
audioBitrate: customSettings.audioBitrate,
|
|
1199
|
+
audioIndex: customSettings.audioIndex,
|
|
1200
|
+
partTtl: customSettings.partTtl,
|
|
1201
|
+
channelLayout: customSettings.channelLayout
|
|
1202
|
+
});
|
|
1198
1203
|
let liveRecordingConfig = JSON.parse(liveRecordingConfigStr);
|
|
1199
1204
|
console.log("CONFIG", JSON.stringify(liveRecordingConfig.live_recording));
|
|
1200
1205
|
|
|
@@ -1213,6 +1218,14 @@ exports.StreamConfig = async function({name}) {
|
|
|
1213
1218
|
metadata: liveRecordingConfig.live_recording
|
|
1214
1219
|
});
|
|
1215
1220
|
|
|
1221
|
+
await this.ReplaceMetadata({
|
|
1222
|
+
libraryId,
|
|
1223
|
+
objectId: conf.objectId,
|
|
1224
|
+
writeToken,
|
|
1225
|
+
metadataSubtree: "probe",
|
|
1226
|
+
metadata: probe
|
|
1227
|
+
});
|
|
1228
|
+
|
|
1216
1229
|
status.fin = await this.FinalizeContentObject({
|
|
1217
1230
|
libraryId,
|
|
1218
1231
|
objectId: conf.objectId,
|
package/testScripts/Test.js
CHANGED
|
@@ -16,20 +16,6 @@ const Test = async () => {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
client.SetSigner({signer});
|
|
19
|
-
|
|
20
|
-
client.ToggleLogging(true);
|
|
21
|
-
const response = await client.CallContractMethod({
|
|
22
|
-
cacheContract: true,
|
|
23
|
-
contractAddress: "0xc4958836b7f883a02e9fedcc11f7ebbcc8c2d5bb",
|
|
24
|
-
formatAgruments: true,
|
|
25
|
-
methodArgs: [1],
|
|
26
|
-
methodName: "membersList",
|
|
27
|
-
overrideCachedContract: false,
|
|
28
|
-
overrides: {}
|
|
29
|
-
});
|
|
30
|
-
client.ToggleLogging(false);
|
|
31
|
-
|
|
32
|
-
console.log("response", response)
|
|
33
19
|
} catch(error) {
|
|
34
20
|
console.error(error);
|
|
35
21
|
console.error(JSON.stringify(error, null, 2));
|