@eluvio/elv-client-js 4.0.61 → 4.0.62
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/package.json +1 -1
- package/src/Utils.js +28 -17
- package/src/client/LiveConf.js +3 -10
- package/src/walletClient/index.js +33 -14
package/package.json
CHANGED
package/src/Utils.js
CHANGED
|
@@ -743,36 +743,47 @@ const Utils = {
|
|
|
743
743
|
}
|
|
744
744
|
},
|
|
745
745
|
|
|
746
|
-
|
|
746
|
+
HLSJSSettings({profile="default"}={}) {
|
|
747
747
|
const isSafari =
|
|
748
748
|
typeof window !== "undefined" &&
|
|
749
749
|
typeof window.navigator !== "undefined" &&
|
|
750
750
|
/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
const defaultSettings = {
|
|
753
|
+
"maxBufferHole": 2.2,
|
|
754
|
+
"nudgeOffset": 0.2,
|
|
755
|
+
"nudgeMaxRetry": 12,
|
|
756
|
+
"highBufferWatchdogPeriod": 1
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
if(!isSafari && ["ull", "ultraLowLatency"].includes(profile)) {
|
|
753
760
|
return {
|
|
754
|
-
"capLevelToPlayerSize": false,
|
|
755
|
-
"enableWorker": true,
|
|
756
761
|
"lowLatencyMode": true,
|
|
757
|
-
"maxBufferLength": 8,
|
|
758
|
-
"backBufferLength": 4,
|
|
759
762
|
"liveSyncDuration": 4,
|
|
760
763
|
"liveMaxLatencyDuration": 5,
|
|
761
764
|
"liveDurationInfinity": false,
|
|
762
|
-
"
|
|
765
|
+
"maxBufferLength": 8,
|
|
766
|
+
"backBufferLength": 4,
|
|
767
|
+
...defaultSettings
|
|
768
|
+
};
|
|
769
|
+
} else if(["ll", "lowLatency", "ull", "ultraLowLatency"].includes(profile)) {
|
|
770
|
+
return {
|
|
771
|
+
"lowLatencyMode": true,
|
|
772
|
+
"liveSyncDuration": 5,
|
|
773
|
+
"liveMaxLatencyDuration": isSafari ? 15 : 10,
|
|
774
|
+
"liveDurationInfinity": false,
|
|
775
|
+
"maxBufferLength": 5,
|
|
776
|
+
"backBufferLength": 5,
|
|
777
|
+
...defaultSettings
|
|
763
778
|
};
|
|
779
|
+
} else {
|
|
780
|
+
return defaultSettings;
|
|
764
781
|
}
|
|
782
|
+
},
|
|
765
783
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
"maxBufferLength": 5,
|
|
770
|
-
"backBufferLength": 5,
|
|
771
|
-
"liveSyncDuration": 5,
|
|
772
|
-
"liveMaxLatencyDuration": !lowLatency || isSafari ? 15 : 10,
|
|
773
|
-
"liveDurationInfinity": false,
|
|
774
|
-
"highBufferWatchdogPeriod": 1
|
|
775
|
-
};
|
|
784
|
+
// Alias for HLSJSSettings
|
|
785
|
+
LiveHLSJSSettings({lowLatency=false, ultraLowLatency=false}) {
|
|
786
|
+
return Utils.HLSJSSettings({profile: ultraLowLatency ? "ull" : lowLatency ? "ll" : "default"});
|
|
776
787
|
}
|
|
777
788
|
};
|
|
778
789
|
|
package/src/client/LiveConf.js
CHANGED
|
@@ -161,57 +161,50 @@ class LiveConf {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
calcSegDuration({sourceTimescale}) {
|
|
164
|
-
|
|
165
164
|
let videoStream = this.getStreamDataForCodecType("video");
|
|
166
165
|
let frameRate = videoStream.frame_rate;
|
|
167
166
|
|
|
168
|
-
let seg ={};
|
|
167
|
+
let seg = {};
|
|
168
|
+
seg.audio = 29.76 * 48000;
|
|
169
|
+
|
|
169
170
|
switch(frameRate) {
|
|
170
171
|
case "24":
|
|
171
172
|
seg.video = 30 * sourceTimescale;
|
|
172
|
-
seg.audio = 30 * 48000;
|
|
173
173
|
seg.keyint = 48;
|
|
174
174
|
seg.duration = "30";
|
|
175
175
|
break;
|
|
176
176
|
case "25":
|
|
177
177
|
seg.video = 30 * sourceTimescale;
|
|
178
|
-
seg.audio = 30 * 48000;
|
|
179
178
|
seg.keyint = 50;
|
|
180
179
|
seg.duration = "30";
|
|
181
180
|
break;
|
|
182
181
|
case "30":
|
|
183
182
|
seg.video = 30 * sourceTimescale;
|
|
184
|
-
seg.audio = 30 * 48000;
|
|
185
183
|
seg.keyint = 60;
|
|
186
184
|
seg.duration = "30";
|
|
187
185
|
break;
|
|
188
186
|
case "30000/1001":
|
|
189
187
|
seg.video = 30.03 * sourceTimescale;
|
|
190
|
-
seg.audio = 29.76 * 48000;
|
|
191
188
|
seg.keyint = 60;
|
|
192
189
|
seg.duration = "30.03";
|
|
193
190
|
break;
|
|
194
191
|
case "48":
|
|
195
192
|
seg.video = 30 * sourceTimescale;
|
|
196
|
-
seg.audio = 30 * 48000;
|
|
197
193
|
seg.keyint = 96;
|
|
198
194
|
seg.duration = "30";
|
|
199
195
|
break;
|
|
200
196
|
case "50":
|
|
201
197
|
seg.video = 30 * sourceTimescale;
|
|
202
|
-
seg.audio = 30 * 48000;
|
|
203
198
|
seg.keyint = 100;
|
|
204
199
|
seg.duration = "30";
|
|
205
200
|
break;
|
|
206
201
|
case "60":
|
|
207
202
|
seg.video = 30 * sourceTimescale;
|
|
208
|
-
seg.audio = 30 * 48000;
|
|
209
203
|
seg.keyint = 120;
|
|
210
204
|
seg.duration = "30";
|
|
211
205
|
break;
|
|
212
206
|
case "60000/1001":
|
|
213
207
|
seg.video = 30.03 * sourceTimescale;
|
|
214
|
-
seg.audio = 29.76 * 48000;
|
|
215
208
|
seg.keyint = 120;
|
|
216
209
|
seg.duration = "30.03";
|
|
217
210
|
break;
|
|
@@ -861,8 +861,8 @@ class ElvWalletClient {
|
|
|
861
861
|
async LatestMarketplaceHash({marketplaceParams}) {
|
|
862
862
|
const marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
|
|
863
863
|
|
|
864
|
-
if(this.previewMarketplaceId && this.previewMarketplaceId
|
|
865
|
-
return this.
|
|
864
|
+
if(this.previewMarketplaceId && Utils.EqualHash(this.previewMarketplaceId, marketplaceInfo.marketplaceId)) {
|
|
865
|
+
return this.previewMarketplaceHash;
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
const marketplaceLink = await this.client.ContentObjectMetadata({
|
|
@@ -887,18 +887,37 @@ class ElvWalletClient {
|
|
|
887
887
|
}
|
|
888
888
|
|
|
889
889
|
if(!this.cachedMarketplaces[marketplaceId]) {
|
|
890
|
-
let marketplace
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
890
|
+
let marketplace;
|
|
891
|
+
if(this.previewMarketplaceId && Utils.EqualHash(marketplaceId, this.previewMarketplaceId)) {
|
|
892
|
+
// Load preview marketplace
|
|
893
|
+
marketplace = await this.client.ContentObjectMetadata({
|
|
894
|
+
versionHash: this.previewMarketplaceHash,
|
|
895
|
+
metadataSubtree: "/public/asset_metadata/info",
|
|
896
|
+
localizationSubtree: this.localization ? UrlJoin("public", "asset_metadata", "localizations", this.localization, "info") : undefined,
|
|
897
|
+
linkDepthLimit: 1,
|
|
898
|
+
resolveLinks: true,
|
|
899
|
+
resolveIgnoreErrors: true,
|
|
900
|
+
resolveIncludeSource: true,
|
|
901
|
+
produceLinkUrls: true,
|
|
902
|
+
authorizationToken: this.publicStaticToken
|
|
903
|
+
});
|
|
904
|
+
} else {
|
|
905
|
+
// Load marketplace from main site tree
|
|
906
|
+
marketplace = await this.client.ContentObjectMetadata({
|
|
907
|
+
libraryId: this.mainSiteLibraryId,
|
|
908
|
+
objectId: this.mainSiteId,
|
|
909
|
+
metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "marketplaces", marketplaceInfo.marketplaceSlug, "info"),
|
|
910
|
+
localizationSubtree: this.localization ?
|
|
911
|
+
UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "marketplaces", marketplaceInfo.marketplaceSlug, "localizations", this.localization, "info") :
|
|
912
|
+
undefined,
|
|
913
|
+
linkDepthLimit: 1,
|
|
914
|
+
resolveLinks: true,
|
|
915
|
+
resolveIgnoreErrors: true,
|
|
916
|
+
resolveIncludeSource: true,
|
|
917
|
+
produceLinkUrls: true,
|
|
918
|
+
authorizationToken: this.publicStaticToken
|
|
919
|
+
});
|
|
920
|
+
}
|
|
902
921
|
|
|
903
922
|
if(marketplace.branding.use_tenant_styling) {
|
|
904
923
|
marketplace.tenantBranding = (await this.client.ContentObjectMetadata({
|