@eluvio/elv-client-js 4.0.87 → 4.0.89

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.
Files changed (43) hide show
  1. package/dist/ElvClient-min.js +10 -10
  2. package/dist/ElvClient-node-min.js +11 -11
  3. package/dist/ElvFrameClient-min.js +7 -7
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +11 -11
  6. package/dist/ElvWalletClient-node-min.js +11 -11
  7. package/dist/src/ContentObjectAudit.js +163 -0
  8. package/dist/src/ElvClient.js +422 -444
  9. package/dist/src/FrameClient.js +1 -1
  10. package/dist/src/HttpClient.js +70 -9
  11. package/dist/src/RemoteSigner.js +162 -57
  12. package/dist/src/Validation.js +6 -2
  13. package/dist/src/abr_profiles/abr_profile_live_to_vod.js +7 -0
  14. package/dist/src/client/ContentAccess.js +834 -770
  15. package/dist/src/client/ContentManagement.js +55 -3
  16. package/dist/src/client/Files.js +9 -6
  17. package/dist/src/client/LiveConf.js +144 -35
  18. package/dist/src/client/LiveStream.js +1104 -531
  19. package/dist/src/walletClient/index.js +366 -279
  20. package/package.json +1 -1
  21. package/src/ElvClient.js +1 -1
  22. package/src/Validation.js +5 -2
  23. package/src/client/ContentAccess.js +22 -13
  24. package/src/client/Files.js +7 -5
  25. package/src/client/LiveConf.js +0 -2
  26. package/src/client/LiveStream.js +3 -1
  27. package/testScripts/OfferingEnsureStrongDrm.js +2 -2
  28. package/testScripts/Test.js +3 -0
  29. package/testScripts/abr_profile_4k_both.json +18 -0
  30. package/testScripts/abr_profile_4k_drm.json +9 -0
  31. package/testScripts/abr_profile_4k_drm_public_access.json +18 -0
  32. package/testScripts/abr_profile_both.json +18 -0
  33. package/testScripts/abr_profile_drm.json +9 -0
  34. package/testScripts/abr_profile_drm_public_access.json +18 -0
  35. package/utilities/example_files/abr_profile_4k_both.json +18 -0
  36. package/utilities/example_files/abr_profile_4k_drm.json +9 -0
  37. package/utilities/example_files/abr_profile_4k_drm_public_access.json +18 -0
  38. package/utilities/example_files/abr_profile_4k_drm_strict.json +9 -0
  39. package/utilities/example_files/abr_profile_both.json +18 -0
  40. package/utilities/example_files/abr_profile_drm.json +9 -0
  41. package/utilities/example_files/abr_profile_drm_hls_only.json +9 -0
  42. package/utilities/example_files/abr_profile_drm_public_access.json +18 -0
  43. package/utilities/example_files/simple_ingest_library_metadata.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.87",
3
+ "version": "4.0.89",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
package/src/ElvClient.js CHANGED
@@ -283,7 +283,7 @@ class ElvClient {
283
283
  * @return {Object} - An object using network names as keys and configuration URLs as values.
284
284
  */
285
285
  static Networks() {
286
- return networks;
286
+ return Object.assign({}, networks);
287
287
  }
288
288
 
289
289
  /**
package/src/Validation.js CHANGED
@@ -52,8 +52,11 @@ exports.ValidatePartHash = (partHash) => {
52
52
  }
53
53
  };
54
54
 
55
- exports.ValidateParameters = ({libraryId, objectId, versionHash}) => {
56
- if(versionHash) {
55
+ exports.ValidateParameters = ({libraryId, objectId, versionHash, writeToken}) => {
56
+ if(writeToken) {
57
+ if(versionHash) throw Error(`Cannot specify writeToken and versionHash at same time (token:${writeToken}, hash:${versionHash})`);
58
+ exports.ValidateWriteToken(writeToken);
59
+ } else if(versionHash) {
57
60
  exports.ValidateVersion(versionHash);
58
61
  } else {
59
62
  exports.ValidateLibrary(libraryId);
@@ -1210,20 +1210,29 @@ exports.AvailableDRMs = async function() {
1210
1210
  return availableDRMs;
1211
1211
  }
1212
1212
 
1213
- try {
1214
- const config = [{
1215
- initDataTypes: ["cenc"],
1216
- audioCapabilities: [{
1217
- contentType: "audio/mp4;codecs=\"mp4a.40.2\""
1218
- }],
1219
- videoCapabilities: [{
1220
- contentType: "video/mp4;codecs=\"avc1.42E01E\""
1221
- }]
1222
- }];
1213
+ const config = [{
1214
+ initDataTypes: ["cenc"],
1215
+ audioCapabilities: [{
1216
+ contentType: "audio/mp4;codecs=\"mp4a.40.2\""
1217
+ }],
1218
+ videoCapabilities: [{
1219
+ contentType: "video/mp4;codecs=\"avc1.42E01E\""
1220
+ }]
1221
+ }];
1223
1222
 
1223
+ try {
1224
1224
  await navigator.requestMediaKeySystemAccess("com.widevine.alpha", config);
1225
-
1226
1225
  availableDRMs.push("widevine");
1226
+ // console.log("widevine detected");
1227
+ // eslint-disable-next-line no-empty
1228
+ } catch(e) {}
1229
+
1230
+ try {
1231
+ // unused parameters:
1232
+ // robustness: "2000" // 150, 2000, or 3000 if we know the secruity level
1233
+ await navigator.requestMediaKeySystemAccess("com.microsoft.playready", config);
1234
+ availableDRMs.push("playready");
1235
+ // console.log("playready detected");
1227
1236
  // eslint-disable-next-line no-empty
1228
1237
  } catch(e) {}
1229
1238
 
@@ -1407,7 +1416,7 @@ exports.AvailableOfferings = async function({
1407
1416
  * @param {string=} linkPath - If playing from a link, the path to the link
1408
1417
  * @param {boolean=} signedLink - Specify if linkPath is referring to a signed link
1409
1418
  * @param {Array<string>} protocols=["dash","hls"]] - Acceptable playout protocols ("dash", "hls")
1410
- * @param {Array<string>} drms - Acceptable DRM formats ("clear", "aes-128", "widevine")
1419
+ * @param {Array<string>} drms - Acceptable DRM formats ("aes-128", "clear", "fairplay", "playready", "sample-aes", "widevine")
1411
1420
  * @param {string=} handler=playout - The handler to use for playout (not used with links)
1412
1421
  * @param {string=} offering=default - The offering to play
1413
1422
  * @param {string=} playoutType - The type of playout
@@ -1675,7 +1684,7 @@ exports.PlayoutOptions = async function({
1675
1684
  * @param {string=} linkPath - If playing from a link, the path to the link
1676
1685
  * @param {boolean=} signedLink - Specify if linkPath is referring to a signed link
1677
1686
  * @param {Array<string>} protocols=["dash","hls"]] - Acceptable playout protocols ("dash", "hls")
1678
- * @param {Array<string>} drms - Acceptable DRM formats ("clear", "aes-128", "sample-aes", "widevine")
1687
+ * @param {Array<string>} drms - Acceptable DRM formats ("aes-128", "clear", "fairplay", "playready", "sample-aes", "widevine")
1679
1688
  * @param {string=} handler=playout - The handler to use for playout
1680
1689
  * @param {string=} offering=default - The offering to play
1681
1690
  * @param {string=} playoutType - The type of playout
@@ -34,20 +34,22 @@ const {
34
34
  * @namedParams
35
35
  * @param {string=} libraryId - ID of the library
36
36
  * @param {string=} objectId - ID of the object
37
+ * @param {string=} path - ID of the object
37
38
  * @param {string=} versionHash - Hash of the object version - if not specified, most recent version will be used
39
+ * @param {string=} writeToken - Write token of a draft (incompatible with versionHash)
38
40
  */
39
- exports.ListFiles = async function({libraryId, objectId, versionHash}) {
40
- ValidateParameters({libraryId, objectId, versionHash});
41
+ exports.ListFiles = async function({libraryId, objectId, path = "", versionHash, writeToken}) {
42
+ ValidateParameters({libraryId, objectId, versionHash, writeToken});
41
43
 
42
44
  if(versionHash) { objectId = this.utils.DecodeVersionHash(versionHash).objectId; }
43
45
 
44
- let path = UrlJoin("q", versionHash || objectId, "meta", "files");
46
+ let urlPath = UrlJoin("q", writeToken || versionHash || objectId, "files_list", path);
45
47
 
46
48
  return this.utils.ResponseToJson(
47
49
  this.HttpClient.Request({
48
50
  headers: await this.authClient.AuthorizationHeader({libraryId, objectId, versionHash}),
49
51
  method: "GET",
50
- path: path,
52
+ path: urlPath,
51
53
  })
52
54
  );
53
55
  };
@@ -554,7 +556,7 @@ exports.UploadFileData = async function({libraryId, objectId, writeToken, encryp
554
556
  const jobStatus = await this.UploadJobStatus({libraryId, objectId, writeToken, uploadId, jobId});
555
557
 
556
558
  // Find the status of this file
557
- let fileStatus = jobStatus.files.find(item => item.path == filePath);
559
+ let fileStatus = jobStatus.files.find(item => item.path === filePath);
558
560
  if(encryption && encryption !== "none") {
559
561
  fileStatus = fileStatus.encrypted;
560
562
  }
@@ -301,7 +301,6 @@ class LiveConf {
301
301
  break;
302
302
  default:
303
303
  throw "unsupported frame rate for MPEGTS - " + frameRate;
304
- break;
305
304
  }
306
305
  return seg;
307
306
  }
@@ -362,7 +361,6 @@ class LiveConf {
362
361
  break;
363
362
  default:
364
363
  throw "unsupported frame rate for RTMP - " + frameRate;
365
- break;
366
364
  }
367
365
  return seg;
368
366
  }
@@ -498,6 +498,9 @@ exports.StreamStatus = async function({name, stopLro=false, showParams=false}) {
498
498
  state = lroStatus.state;
499
499
  status.warnings = lroStatus.custom && lroStatus.custom.warnings;
500
500
  status.quality = lroStatus.custom && lroStatus.custom.quality;
501
+ if(lroStatus.custom && lroStatus.custom.status) {
502
+ status.recording_status = lroStatus.custom.status;
503
+ }
501
504
  } catch(error) {
502
505
  console.log("LRO Status (failed): ", error.response.statusCode);
503
506
  status.state = "stopped";
@@ -1954,7 +1957,6 @@ exports.StreamAddWatermark = async function({
1954
1957
  exports.AuditStream = async function({objectId, versionHash, salt, samples}) {
1955
1958
  return await ContentObjectAudit.AuditContentObject({
1956
1959
  client: this,
1957
- libraryId,
1958
1960
  objectId,
1959
1961
  versionHash,
1960
1962
  salt,
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
 
3
- // Ensures that an existing offering has only strong DRM playout options (Widevine and Fairplay)
3
+ // Ensures that an existing offering has only strong DRM playout options (FairPlay, PlayReady, and Widevine)
4
4
 
5
5
  const ScriptOffering = require("./parentClasses/ScriptOffering");
6
6
 
@@ -49,7 +49,7 @@ class OfferingEnsureStrongDrm extends ScriptOffering {
49
49
  for(let i = 0; i < originalFormatCount; i++) {
50
50
  const key = playoutFormatKeys[i];
51
51
  const drm = metadata.offerings[offeringKey].playout.playout_formats[key].drm;
52
- if(!drm || !["DrmWidevine", "DrmFairplay"].includes(drm.type)) {
52
+ if(!drm || !["DrmWidevine", "DrmFairplay", "DrmPlayReady"].includes(drm.type)) {
53
53
  console.log("Deleting playout format '" + key + "'...");
54
54
  delete metadata.offerings[offeringKey].playout.playout_formats[key];
55
55
  changesMade = true;
@@ -9,6 +9,9 @@ const Test = async () => {
9
9
  const client = await ElvClient.FromNetworkName({
10
10
  networkName: "demo"
11
11
  });
12
+ // const client = await ElvClient.FromConfigurationUrl({
13
+ // configUrl: "http://localhost:8008/config?qspace=demov3&self"
14
+ // });
12
15
 
13
16
  const wallet = client.GenerateWallet();
14
17
  const signer = wallet.AddAccount({
@@ -126,6 +126,24 @@
126
126
  "protocol": {
127
127
  "type": "ProtoHls"
128
128
  }
129
+ },
130
+ "hls-fairplay": {
131
+ "drm": {
132
+ "enc_scheme_name": "cbcs",
133
+ "type": "DrmFairplay"
134
+ },
135
+ "protocol": {
136
+ "type": "ProtoHls"
137
+ }
138
+ },
139
+ "hls-playready-cenc": {
140
+ "drm": {
141
+ "enc_scheme_name": "cenc",
142
+ "type": "DrmPlayReady"
143
+ },
144
+ "protocol": {
145
+ "type": "ProtoHls"
146
+ }
129
147
  }
130
148
  },
131
149
  "segment_specs": {
@@ -123,6 +123,15 @@
123
123
  "protocol": {
124
124
  "type": "ProtoHls"
125
125
  }
126
+ },
127
+ "hls-playready-cenc": {
128
+ "drm": {
129
+ "enc_scheme_name": "cenc",
130
+ "type": "DrmPlayReady"
131
+ },
132
+ "protocol": {
133
+ "type": "ProtoHls"
134
+ }
126
135
  }
127
136
  },
128
137
  "segment_specs": {
@@ -113,6 +113,24 @@
113
113
  "protocol": {
114
114
  "type": "ProtoHls"
115
115
  }
116
+ },
117
+ "hls-fairplay": {
118
+ "drm": {
119
+ "enc_scheme_name": "cbcs",
120
+ "type": "DrmFairplay"
121
+ },
122
+ "protocol": {
123
+ "type": "ProtoHls"
124
+ }
125
+ },
126
+ "hls-playready-cenc": {
127
+ "drm": {
128
+ "enc_scheme_name": "cenc",
129
+ "type": "DrmPlayReady"
130
+ },
131
+ "protocol": {
132
+ "type": "ProtoHls"
133
+ }
116
134
  }
117
135
  },
118
136
  "segment_specs": {
@@ -1960,6 +1960,24 @@
1960
1960
  "protocol": {
1961
1961
  "type": "ProtoHls"
1962
1962
  }
1963
+ },
1964
+ "hls-fairplay": {
1965
+ "drm": {
1966
+ "enc_scheme_name": "cbcs",
1967
+ "type": "DrmFairplay"
1968
+ },
1969
+ "protocol": {
1970
+ "type": "ProtoHls"
1971
+ }
1972
+ },
1973
+ "hls-playready-cenc": {
1974
+ "drm": {
1975
+ "enc_scheme_name": "cenc",
1976
+ "type": "DrmPlayReady"
1977
+ },
1978
+ "protocol": {
1979
+ "type": "ProtoHls"
1980
+ }
1963
1981
  }
1964
1982
  },
1965
1983
  "segment_specs": {
@@ -1957,6 +1957,15 @@
1957
1957
  "protocol": {
1958
1958
  "type": "ProtoHls"
1959
1959
  }
1960
+ },
1961
+ "hls-playready-cenc": {
1962
+ "drm": {
1963
+ "enc_scheme_name": "cenc",
1964
+ "type": "DrmPlayReady"
1965
+ },
1966
+ "protocol": {
1967
+ "type": "ProtoHls"
1968
+ }
1960
1969
  }
1961
1970
  },
1962
1971
  "segment_specs": {
@@ -1947,6 +1947,24 @@
1947
1947
  "protocol": {
1948
1948
  "type": "ProtoHls"
1949
1949
  }
1950
+ },
1951
+ "hls-fairplay": {
1952
+ "drm": {
1953
+ "enc_scheme_name": "cbcs",
1954
+ "type": "DrmFairplay"
1955
+ },
1956
+ "protocol": {
1957
+ "type": "ProtoHls"
1958
+ }
1959
+ },
1960
+ "hls-playready-cenc": {
1961
+ "drm": {
1962
+ "enc_scheme_name": "cenc",
1963
+ "type": "DrmPlayReady"
1964
+ },
1965
+ "protocol": {
1966
+ "type": "ProtoHls"
1967
+ }
1950
1968
  }
1951
1969
  },
1952
1970
  "segment_specs": {
@@ -126,6 +126,24 @@
126
126
  "protocol": {
127
127
  "type": "ProtoHls"
128
128
  }
129
+ },
130
+ "hls-fairplay": {
131
+ "drm": {
132
+ "enc_scheme_name": "cbcs",
133
+ "type": "DrmFairplay"
134
+ },
135
+ "protocol": {
136
+ "type": "ProtoHls"
137
+ }
138
+ },
139
+ "hls-playready-cenc": {
140
+ "drm": {
141
+ "enc_scheme_name": "cenc",
142
+ "type": "DrmPlayReady"
143
+ },
144
+ "protocol": {
145
+ "type": "ProtoHls"
146
+ }
129
147
  }
130
148
  },
131
149
  "segment_specs": {
@@ -123,6 +123,15 @@
123
123
  "protocol": {
124
124
  "type": "ProtoHls"
125
125
  }
126
+ },
127
+ "hls-playready-cenc": {
128
+ "drm": {
129
+ "enc_scheme_name": "cenc",
130
+ "type": "DrmPlayReady"
131
+ },
132
+ "protocol": {
133
+ "type": "ProtoHls"
134
+ }
126
135
  }
127
136
  },
128
137
  "segment_specs": {
@@ -113,6 +113,24 @@
113
113
  "protocol": {
114
114
  "type": "ProtoHls"
115
115
  }
116
+ },
117
+ "hls-fairplay": {
118
+ "drm": {
119
+ "enc_scheme_name": "cbcs",
120
+ "type": "DrmFairplay"
121
+ },
122
+ "protocol": {
123
+ "type": "ProtoHls"
124
+ }
125
+ },
126
+ "hls-playready-cenc": {
127
+ "drm": {
128
+ "enc_scheme_name": "cenc",
129
+ "type": "DrmPlayReady"
130
+ },
131
+ "protocol": {
132
+ "type": "ProtoHls"
133
+ }
116
134
  }
117
135
  },
118
136
  "segment_specs": {
@@ -105,6 +105,15 @@
105
105
  "protocol": {
106
106
  "type": "ProtoHls"
107
107
  }
108
+ },
109
+ "hls-playready-cenc": {
110
+ "drm": {
111
+ "enc_scheme_name": "cenc",
112
+ "type": "DrmPlayReady"
113
+ },
114
+ "protocol": {
115
+ "type": "ProtoHls"
116
+ }
108
117
  }
109
118
  },
110
119
  "segment_specs": {
@@ -1914,6 +1914,24 @@
1914
1914
  "protocol": {
1915
1915
  "type": "ProtoHls"
1916
1916
  }
1917
+ },
1918
+ "hls-fairplay": {
1919
+ "drm": {
1920
+ "enc_scheme_name": "cbcs",
1921
+ "type": "DrmFairplay"
1922
+ },
1923
+ "protocol": {
1924
+ "type": "ProtoHls"
1925
+ }
1926
+ },
1927
+ "hls-playready-cenc": {
1928
+ "drm": {
1929
+ "enc_scheme_name": "cenc",
1930
+ "type": "DrmPlayReady"
1931
+ },
1932
+ "protocol": {
1933
+ "type": "ProtoHls"
1934
+ }
1917
1935
  }
1918
1936
  },
1919
1937
  "segment_specs": {
@@ -1911,6 +1911,15 @@
1911
1911
  "protocol": {
1912
1912
  "type": "ProtoHls"
1913
1913
  }
1914
+ },
1915
+ "hls-playready-cenc": {
1916
+ "drm": {
1917
+ "enc_scheme_name": "cenc",
1918
+ "type": "DrmPlayReady"
1919
+ },
1920
+ "protocol": {
1921
+ "type": "ProtoHls"
1922
+ }
1914
1923
  }
1915
1924
  },
1916
1925
  "segment_specs": {
@@ -1899,6 +1899,15 @@
1899
1899
  "protocol": {
1900
1900
  "type": "ProtoHls"
1901
1901
  }
1902
+ },
1903
+ "hls-playready-cenc": {
1904
+ "drm": {
1905
+ "enc_scheme_name": "cenc",
1906
+ "type": "DrmPlayReady"
1907
+ },
1908
+ "protocol": {
1909
+ "type": "ProtoHls"
1910
+ }
1902
1911
  }
1903
1912
  },
1904
1913
  "segment_specs": {
@@ -1901,6 +1901,24 @@
1901
1901
  "protocol": {
1902
1902
  "type": "ProtoHls"
1903
1903
  }
1904
+ },
1905
+ "hls-fairplay": {
1906
+ "drm": {
1907
+ "enc_scheme_name": "cbcs",
1908
+ "type": "DrmFairplay"
1909
+ },
1910
+ "protocol": {
1911
+ "type": "ProtoHls"
1912
+ }
1913
+ },
1914
+ "hls-playready-cenc": {
1915
+ "drm": {
1916
+ "enc_scheme_name": "cenc",
1917
+ "type": "DrmPlayReady"
1918
+ },
1919
+ "protocol": {
1920
+ "type": "ProtoHls"
1921
+ }
1904
1922
  }
1905
1923
  },
1906
1924
  "segment_specs": {
@@ -154,6 +154,15 @@
154
154
  "protocol": {
155
155
  "type": "ProtoHls"
156
156
  }
157
+ },
158
+ "hls-playready-cenc": {
159
+ "drm": {
160
+ "enc_scheme_name": "cenc",
161
+ "type": "DrmPlayReady"
162
+ },
163
+ "protocol": {
164
+ "type": "ProtoHls"
165
+ }
157
166
  }
158
167
  },
159
168
  "segment_specs": {