@eluvio/elv-client-js 4.0.98 → 4.0.100

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.
@@ -472,6 +472,9 @@ var LiveConf = /*#__PURE__*/function () {
472
472
  if (customSettings.part_ttl) {
473
473
  conf.live_recording.recording_config.recording_params.part_ttl = customSettings.part_ttl;
474
474
  }
475
+ if (customSettings.connection_timeout) {
476
+ conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
477
+ }
475
478
 
476
479
  // Fill in specifics for protocol
477
480
  switch (this.probeKind()) {
@@ -136,7 +136,7 @@ var FormatNFTMetadata = function FormatNFTMetadata(walletClient, nft) {
136
136
  var mediaType = (media.media_type || "").toLowerCase();
137
137
  if (mediaType === "image") {
138
138
  return _objectSpread(_objectSpread({}, media), {}, {
139
- embed_url: media.media_file.url
139
+ embed_url: media.media_file && media.media_file.url
140
140
  });
141
141
  }
142
142
  var embedUrl = new URL("https://embed.v3.contentfabric.io");
@@ -149,7 +149,7 @@ var FormatNFTMetadata = function FormatNFTMetadata(walletClient, nft) {
149
149
  embedUrl.searchParams.set("vid", LinkTargetHash(media.media_link));
150
150
  embedUrl.searchParams.set("ct", "h");
151
151
  embedUrl.searchParams.set("ap", "");
152
- } else if (mediaType === "ebook") {
152
+ } else if (mediaType === "ebook" && media.media_file) {
153
153
  embedUrl.searchParams.set("type", "ebook");
154
154
  embedUrl.searchParams.set("vid", media.media_file["."].container);
155
155
  embedUrl.searchParams.set("murl", btoa(media.media_file.url));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.98",
3
+ "version": "4.0.100",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -1890,6 +1890,24 @@ const AbrProfileLiveDrm = {
1890
1890
  "protocol": {
1891
1891
  "type": "ProtoHls"
1892
1892
  }
1893
+ },
1894
+ "hls-widevine-cenc": {
1895
+ "drm": {
1896
+ "enc_scheme_name": "cenc",
1897
+ "type": "DrmWidevine"
1898
+ },
1899
+ "protocol": {
1900
+ "type": "ProtoHls"
1901
+ }
1902
+ },
1903
+ "hls-playready-cenc": {
1904
+ "drm": {
1905
+ "enc_scheme_name": "cenc",
1906
+ "type": "DrmPlayReady"
1907
+ },
1908
+ "protocol": {
1909
+ "type": "ProtoHls"
1910
+ }
1893
1911
  }
1894
1912
  },
1895
1913
  "segment_specs": {
@@ -1584,6 +1584,16 @@ exports.PlayoutOptions = async function({
1584
1584
  noAuth: true,
1585
1585
  queryParams
1586
1586
  }),
1587
+ globalPlayoutUrl:
1588
+ signedLink ?
1589
+ await this.GlobalUrl({versionHash, path: UrlJoin(linkPath, offering, playoutPath), queryParams}) :
1590
+ await this.GlobalUrl({
1591
+ libraryId: linkTarget.libraryId || libraryId,
1592
+ objectId: linkTarget.objectId || objectId,
1593
+ versionHash: linkTarget.versionHash || versionHash,
1594
+ path: UrlJoin("rep", handler, offering, playoutPath),
1595
+ queryParams
1596
+ }),
1587
1597
  drms: drm ? {[drm]: {licenseServers, cert}} : undefined
1588
1598
  }
1589
1599
  }
@@ -1790,6 +1800,107 @@ exports.BitmovinPlayoutOptions = async function({
1790
1800
  return config;
1791
1801
  };
1792
1802
 
1803
+ /**
1804
+ * Create a 'global' URL with the specified parameters
1805
+ *
1806
+ * A global URL is a URL that will resolve to a Fabric node close to the resolver. This is useful in cases where URLS are being passed to clients that may be in a different geographical location from where the URL was created.
1807
+ *
1808
+ * @methodGroup URL Generation
1809
+ * @namedParams
1810
+ * @param {string=} libraryId - ID of the library
1811
+ * @param {string=} objectId - ID of the object
1812
+ * @param {string=} versionHash - Version hash of the object
1813
+ * @param {string=} writeToken - Write token of an object draft
1814
+ * @param {string=} path - Path of the URL
1815
+ * @param {string=} authorizationToken - Authorization token for the URL. If not specified and `noAuth` is false, the client will generate the token automatically
1816
+ * @param {boolean=} noAuth=false - Set to true if the URL is for publicly accessible content
1817
+ * @param {boolean=} resolve=false - Whether links should resolve (if this URL is for metadata)
1818
+ * @param {Object=} queryParams={} - Additional URL query params
1819
+ *
1820
+ * @returns {Promise<string>} - The generated global URL
1821
+ */
1822
+ exports.GlobalUrl = async function({
1823
+ libraryId,
1824
+ objectId,
1825
+ writeToken,
1826
+ versionHash,
1827
+ path="/",
1828
+ authorizationToken,
1829
+ noAuth=false,
1830
+ resolve=true,
1831
+ queryParams={}
1832
+ }) {
1833
+ const network = this.NetworkInfo().name;
1834
+ let url = new URL(
1835
+ network === "main" ?
1836
+ "https://main.net955305.contentfabric.io" :
1837
+ "https://demov3.net955210.contentfabric.io"
1838
+ );
1839
+
1840
+ // Pull auth out of query params
1841
+ if(
1842
+ queryParams.authorization &&
1843
+ (
1844
+ typeof queryParams.authorization === "string" ||
1845
+ (Array.isArray(queryParams.authorization) && queryParams.authorization.length === 1)
1846
+ )
1847
+ ) {
1848
+ queryParams = {...queryParams};
1849
+ authorizationToken = typeof queryParams.authorization === "string" ?
1850
+ queryParams.authorization :
1851
+ queryParams.authorization[0];
1852
+ }
1853
+
1854
+ if(writeToken) {
1855
+ let fabricNodeUrl = this.HttpClient.draftURIs[writeToken];
1856
+
1857
+ if(fabricNodeUrl) {
1858
+ url = new URL(fabricNodeUrl);
1859
+ }
1860
+ }
1861
+
1862
+ let urlPath = UrlJoin("s", network);
1863
+ if(!noAuth || authorizationToken) {
1864
+ urlPath = UrlJoin(
1865
+ "t",
1866
+ authorizationToken || await this.authClient.AuthorizationToken({
1867
+ libraryId,
1868
+ objectId,
1869
+ versionHash,
1870
+ noAuth
1871
+ })
1872
+ );
1873
+ }
1874
+
1875
+ if(versionHash) {
1876
+ objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1877
+ } else {
1878
+ // Ensure library ID is loaded for this object
1879
+ libraryId = libraryId || await this.ContentObjectLibraryId({objectId});
1880
+ }
1881
+
1882
+ if(path.startsWith("/qfab")) {
1883
+ urlPath = UrlJoin(urlPath, path.replace(/^\/qfab/, "q"));
1884
+ } else if(versionHash) {
1885
+ urlPath = UrlJoin(urlPath, "q", writeToken || versionHash, path);
1886
+ } else {
1887
+ urlPath = UrlJoin(urlPath, "qlibs", libraryId, "q", writeToken || objectId, path);
1888
+ }
1889
+
1890
+ url.pathname = urlPath;
1891
+
1892
+ if(resolve) {
1893
+ url.searchParams.set("resolve", "true");
1894
+ }
1895
+
1896
+ Object.keys(queryParams).forEach(key =>
1897
+ url.searchParams.set(key, queryParams[key])
1898
+ );
1899
+
1900
+ return url.toString();
1901
+ };
1902
+
1903
+
1793
1904
  /**
1794
1905
  * Call the specified bitcode method on the specified object
1795
1906
  *
@@ -455,6 +455,10 @@ class LiveConf {
455
455
  conf.live_recording.recording_config.recording_params.part_ttl = customSettings.part_ttl;
456
456
  }
457
457
 
458
+ if(customSettings.connection_timeout) {
459
+ conf.live_recording.recording_config.recording_params.xc_params.connection_timeout = customSettings.connection_timeout;
460
+ }
461
+
458
462
  // Fill in specifics for protocol
459
463
  switch(this.probeKind()) {
460
464
  case "udp":
@@ -132,7 +132,7 @@ const FormatNFTMetadata = function(walletClient, nft) {
132
132
  if(mediaType === "image") {
133
133
  return {
134
134
  ...media,
135
- embed_url: media.media_file.url
135
+ embed_url: media.media_file && media.media_file.url
136
136
  };
137
137
  }
138
138
 
@@ -148,7 +148,7 @@ const FormatNFTMetadata = function(walletClient, nft) {
148
148
  embedUrl.searchParams.set("vid", LinkTargetHash(media.media_link));
149
149
  embedUrl.searchParams.set("ct", "h");
150
150
  embedUrl.searchParams.set("ap", "");
151
- } else if(mediaType === "ebook") {
151
+ } else if(mediaType === "ebook" && media.media_file) {
152
152
  embedUrl.searchParams.set("type", "ebook");
153
153
  embedUrl.searchParams.set("vid", media.media_file["."].container);
154
154
  embedUrl.searchParams.set("murl", btoa(media.media_file.url));