@geekapps/silo-elements-nextjs 0.3.20 → 0.3.21
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/dist/VideoPlayer.js +23 -9
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2467,15 +2467,29 @@ function Video({
|
|
|
2467
2467
|
hls.on(Hls.Events.AUDIO_TRACKS_UPDATED, (_, data) => {
|
|
2468
2468
|
const tracks = data.audioTracks ?? [];
|
|
2469
2469
|
console.debug("[Silo/hls] AUDIO_TRACKS_UPDATED", tracks.length);
|
|
2470
|
-
if (tracks.length >
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
)
|
|
2470
|
+
if (tracks.length > 0) {
|
|
2471
|
+
const mapped = tracks.map((t, i) => {
|
|
2472
|
+
const codec = (t.attrs?.CODECS ?? t.codecSet ?? "").split(",")[0]?.trim() ?? "";
|
|
2473
|
+
const supported = deviceSupportsAudioCodec(codec);
|
|
2474
|
+
const label = friendlyAudioLabel(t.name, t.lang, codec, t.channels ?? t.attrs?.CHANNELS);
|
|
2475
|
+
return { id: i, label, supported };
|
|
2476
|
+
});
|
|
2477
|
+
const currentTrackIdx = hls.audioTrack ?? 0;
|
|
2478
|
+
if (mapped[currentTrackIdx] && !mapped[currentTrackIdx].supported) {
|
|
2479
|
+
const firstSupported = mapped.findIndex((t) => t.supported);
|
|
2480
|
+
if (firstSupported >= 0) {
|
|
2481
|
+
console.debug("[Silo/hls] current audio track unsupported \u2014 switching to track", firstSupported);
|
|
2482
|
+
hls.audioTrack = firstSupported;
|
|
2483
|
+
if (pinnedAudio === -1) setSelectedAudio(firstSupported);
|
|
2484
|
+
} else {
|
|
2485
|
+
console.warn("[Silo/hls] no supported audio track found \u2014 disabling separate audio");
|
|
2486
|
+
try {
|
|
2487
|
+
hls.audioTrack = -1;
|
|
2488
|
+
} catch {
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
if (mapped.length > 1) setAudioTracks(mapped);
|
|
2479
2493
|
}
|
|
2480
2494
|
if (pinnedAudio >= 0 && hls.audioTrack !== pinnedAudio) {
|
|
2481
2495
|
hls.audioTrack = pinnedAudio;
|