@vindral/web-sdk 3.2.2 → 3.2.3

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/index.d.ts CHANGED
@@ -1296,6 +1296,7 @@ export interface Options {
1296
1296
  */
1297
1297
  advanced?: AdvancedOptions;
1298
1298
  media?: Media;
1299
+ videoCodecs?: VideoCodec[];
1299
1300
  }
1300
1301
  /**
1301
1302
  * Contextual information about the language switch
@@ -1443,6 +1444,7 @@ declare const defaultOptions: {
1443
1444
  advanced: {
1444
1445
  wasmDecodingConstraint: Partial<VideoConstraint>;
1445
1446
  };
1447
+ videoCodecs: VideoCodec[];
1446
1448
  };
1447
1449
  /**
1448
1450
  * Available options when initializing the Player. Used for enabling/disabling features
package/index.mjs CHANGED
@@ -691,7 +691,8 @@ const Yg = {
691
691
  width: 1280,
692
692
  height: 1280
693
693
  }
694
- }
694
+ },
695
+ videoCodecs: ["av1", "h264"]
695
696
  }, xg = "connection_failed", Wg = "connection_failed_will_not_attempt_again", Vg = "authentication_error", Zg = "authentication_expired", Og = "channel_not_found", Xg = "no_incoming_data_error", zg = "connection_inactivity", jg = "missing_init_segment", _g = "no_track_context", $g = "invalid_track_context_state", As = "disconnected_by_edge", es = "decoder_error", ts = "audio_player_error", is = "media_source_error", gs = "webgl_context_lost_error", ss = "access_forbidden";
696
697
  class F extends Error {
697
698
  constructor(e, g, s = {}) {
@@ -5363,23 +5364,26 @@ const bB = (i) => {
5363
5364
  });
5364
5365
  t(this, "filterRenditions", (e) => m(this, null, function* () {
5365
5366
  const g = yield Promise.all(
5366
- e.map((s) => m(this, null, function* () {
5367
- var n, o, C;
5368
- if (FA(s))
5367
+ e.map((n) => m(this, null, function* () {
5368
+ var Q, a, E;
5369
+ if (FA(n))
5369
5370
  return !0;
5370
- if (!this.isSupportedVideoCodecProfile(s.codec, s.codecString))
5371
+ if (!this.isSupportedVideoCodecProfile(n.codec, n.codecString))
5371
5372
  return !1;
5372
5373
  if (!this.willUseMediaSource()) {
5373
- const Q = this.options.get("advanced"), a = (n = Q.wasmDecodingConstraint.bitRate) != null ? n : Number.MAX_SAFE_INTEGER, E = (o = Q.wasmDecodingConstraint.width) != null ? o : Number.MAX_SAFE_INTEGER, c = (C = Q.wasmDecodingConstraint.height) != null ? C : Number.MAX_SAFE_INTEGER;
5374
- return s.bitRate <= a && s.width <= E && s.height <= c;
5374
+ const c = this.options.get("advanced"), l = (Q = c.wasmDecodingConstraint.bitRate) != null ? Q : Number.MAX_SAFE_INTEGER, f = (a = c.wasmDecodingConstraint.width) != null ? a : Number.MAX_SAFE_INTEGER, w = (E = c.wasmDecodingConstraint.height) != null ? E : Number.MAX_SAFE_INTEGER;
5375
+ return n.bitRate <= l && n.width <= f && n.height <= w;
5375
5376
  }
5376
- if (!(yield tB(s)).supported)
5377
+ const o = yield tB(n);
5378
+ if (!o.supported || n.codec == "av1" && !o.smooth && !o.powerEfficient)
5377
5379
  return !1;
5378
- const B = this.options.getOverride("maxVideoBitRate", this.channelId);
5379
- return B ? B >= s.bitRate : !0;
5380
+ const C = this.options.getOverride("maxVideoBitRate", this.channelId);
5381
+ return C ? C >= n.bitRate : !0;
5380
5382
  }))
5381
5383
  );
5382
- return e.filter((s, I) => g[I]);
5384
+ let s = e.filter((n, o) => g[o]);
5385
+ const I = s.findLast((n) => n.codec === "h264"), B = s.findLast((n) => n.codec === "av1");
5386
+ return I && B && I.width > B.width && I.height > B.height && (s = s.filter((n) => n.codec !== "av1")), s;
5383
5387
  }));
5384
5388
  /**
5385
5389
  * Patch the subscription with properties from the channel that isn't known until connection
@@ -5396,7 +5400,7 @@ const bB = (i) => {
5396
5400
  j.INITIAL_MAX_BIT_RATE,
5397
5401
  g,
5398
5402
  this.targetSubscription.audio.bitRate
5399
- ), B = this.options.get("media") === "audio" ? [] : ["av1", "h264"], n = this.supportedAudioCodecs(), o = e.renditions.filter(FA), C = e.renditions.filter(qA), Q = n.find((l) => o.find((f) => f.codec === l) !== void 0), a = B.find((l) => C.find((f) => f.codec === l) !== void 0), E = o.map((l) => l.language);
5403
+ ), B = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs"), n = this.supportedAudioCodecs(), o = e.renditions.filter(FA), C = e.renditions.filter(qA), Q = n.find((l) => o.find((f) => f.codec === l) !== void 0), a = B.find((l) => C.find((f) => f.codec === l) !== void 0), E = o.map((l) => l.language);
5400
5404
  if (this.logger.debug("supported and selected codecs", { audioCodecs: n, videoCodecs: B, audioCodec: Q, videoCodec: a }), a) {
5401
5405
  const l = this.options.get("maxSize");
5402
5406
  this.modules.subscription.setVideoConstraint(h({
@@ -5533,7 +5537,7 @@ const bB = (i) => {
5533
5537
  const e = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
5534
5538
  return h({
5535
5539
  uptime: Date.now() - this.createdAt,
5536
- version: "3.2.2",
5540
+ version: "3.2.3",
5537
5541
  clientId: this.clientId,
5538
5542
  sessionId: this.sessionId,
5539
5543
  channelId: this.channelId,