@vindral/web-sdk 3.2.2 → 3.2.4
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 +2 -0
- package/index.mjs +32 -15
- package/index.umd.js +4 -4
- package/package.json +1 -1
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 = {}) {
|
|
@@ -1379,6 +1380,19 @@ class Qg extends iA {
|
|
|
1379
1380
|
t(this, "isClosed", () => this.mediaSource.readyState === "closed");
|
|
1380
1381
|
t(this, "isEnded", () => this.mediaSource.readyState === "ended");
|
|
1381
1382
|
t(this, "createObjectURL", () => URL.createObjectURL(this.mediaSource));
|
|
1383
|
+
t(this, "attach", (e) => {
|
|
1384
|
+
const g = e;
|
|
1385
|
+
if ("srcObject" in g)
|
|
1386
|
+
try {
|
|
1387
|
+
g.srcObject = this.mediaSource;
|
|
1388
|
+
} catch (s) {
|
|
1389
|
+
if (s instanceof Error && s.name !== "TypeError")
|
|
1390
|
+
throw s;
|
|
1391
|
+
g.src = this.createObjectURL();
|
|
1392
|
+
}
|
|
1393
|
+
else
|
|
1394
|
+
e.src = this.createObjectURL();
|
|
1395
|
+
});
|
|
1382
1396
|
t(this, "addSourceBuffer", (e) => {
|
|
1383
1397
|
const g = this.mediaSource.addSourceBuffer(e);
|
|
1384
1398
|
return new hI(g);
|
|
@@ -4156,7 +4170,7 @@ const re = class re {
|
|
|
4156
4170
|
const s = !this.mediaElement.paused, I = [];
|
|
4157
4171
|
this.trackContexts.forEach((B, n) => {
|
|
4158
4172
|
B.state === "initialized" && I.push({ type: n, mimeType: B.mimeType });
|
|
4159
|
-
}), this.sourceOpenStartTime = Date.now(), this.pendingTracksToAddSourceBuffers = I, this.mediaElement.src = "", this.setTrackContexts(this.trackContexts), this.
|
|
4173
|
+
}), this.sourceOpenStartTime = Date.now(), this.pendingTracksToAddSourceBuffers = I, this.mediaElement.src = "", this.setTrackContexts(this.trackContexts), this.mediaSource.attach(this.mediaElement), s && this.mediaElement.play();
|
|
4160
4174
|
}
|
|
4161
4175
|
}
|
|
4162
4176
|
this.logger.debug("source ended");
|
|
@@ -4166,7 +4180,7 @@ const re = class re {
|
|
|
4166
4180
|
};
|
|
4167
4181
|
t(re, "create", (A, e, g) => {
|
|
4168
4182
|
const s = new re(A, e, g);
|
|
4169
|
-
return s.setTrackContexts(), s.mediaSource.on("source ended", s.onSourceEnded), s.mediaSource.on("source open", s.onSourceOpen),
|
|
4183
|
+
return s.setTrackContexts(), s.mediaSource.on("source ended", s.onSourceEnded), s.mediaSource.on("source open", s.onSourceOpen), s.mediaSource.attach(g), s;
|
|
4170
4184
|
});
|
|
4171
4185
|
let rt = re;
|
|
4172
4186
|
const ti = (i, A) => {
|
|
@@ -5363,23 +5377,26 @@ const bB = (i) => {
|
|
|
5363
5377
|
});
|
|
5364
5378
|
t(this, "filterRenditions", (e) => m(this, null, function* () {
|
|
5365
5379
|
const g = yield Promise.all(
|
|
5366
|
-
e.map((
|
|
5367
|
-
var
|
|
5368
|
-
if (FA(
|
|
5380
|
+
e.map((n) => m(this, null, function* () {
|
|
5381
|
+
var Q, a, E;
|
|
5382
|
+
if (FA(n))
|
|
5369
5383
|
return !0;
|
|
5370
|
-
if (!this.isSupportedVideoCodecProfile(
|
|
5384
|
+
if (!this.isSupportedVideoCodecProfile(n.codec, n.codecString))
|
|
5371
5385
|
return !1;
|
|
5372
5386
|
if (!this.willUseMediaSource()) {
|
|
5373
|
-
const
|
|
5374
|
-
return
|
|
5387
|
+
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;
|
|
5388
|
+
return n.bitRate <= l && n.width <= f && n.height <= w;
|
|
5375
5389
|
}
|
|
5376
|
-
|
|
5390
|
+
const o = yield tB(n);
|
|
5391
|
+
if (!o.supported || n.codec == "av1" && !o.smooth && !o.powerEfficient)
|
|
5377
5392
|
return !1;
|
|
5378
|
-
const
|
|
5379
|
-
return
|
|
5393
|
+
const C = this.options.getOverride("maxVideoBitRate", this.channelId);
|
|
5394
|
+
return C ? C >= n.bitRate : !0;
|
|
5380
5395
|
}))
|
|
5381
5396
|
);
|
|
5382
|
-
|
|
5397
|
+
let s = e.filter((n, o) => g[o]);
|
|
5398
|
+
const I = s.findLast((n) => n.codec === "h264"), B = s.findLast((n) => n.codec === "av1");
|
|
5399
|
+
return I && B && I.width > B.width && I.height > B.height && (s = s.filter((n) => n.codec !== "av1")), s;
|
|
5383
5400
|
}));
|
|
5384
5401
|
/**
|
|
5385
5402
|
* Patch the subscription with properties from the channel that isn't known until connection
|
|
@@ -5396,7 +5413,7 @@ const bB = (i) => {
|
|
|
5396
5413
|
j.INITIAL_MAX_BIT_RATE,
|
|
5397
5414
|
g,
|
|
5398
5415
|
this.targetSubscription.audio.bitRate
|
|
5399
|
-
), B = this.options.get("media") === "audio" ? [] :
|
|
5416
|
+
), 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
5417
|
if (this.logger.debug("supported and selected codecs", { audioCodecs: n, videoCodecs: B, audioCodec: Q, videoCodec: a }), a) {
|
|
5401
5418
|
const l = this.options.get("maxSize");
|
|
5402
5419
|
this.modules.subscription.setVideoConstraint(h({
|
|
@@ -5533,7 +5550,7 @@ const bB = (i) => {
|
|
|
5533
5550
|
const e = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
|
|
5534
5551
|
return h({
|
|
5535
5552
|
uptime: Date.now() - this.createdAt,
|
|
5536
|
-
version: "3.2.
|
|
5553
|
+
version: "3.2.4",
|
|
5537
5554
|
clientId: this.clientId,
|
|
5538
5555
|
sessionId: this.sessionId,
|
|
5539
5556
|
channelId: this.channelId,
|