@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/VideoPlayer.js
CHANGED
|
@@ -937,15 +937,29 @@ function Video({
|
|
|
937
937
|
hls.on(Hls.Events.AUDIO_TRACKS_UPDATED, (_, data) => {
|
|
938
938
|
const tracks = data.audioTracks ?? [];
|
|
939
939
|
console.debug("[Silo/hls] AUDIO_TRACKS_UPDATED", tracks.length);
|
|
940
|
-
if (tracks.length >
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
)
|
|
940
|
+
if (tracks.length > 0) {
|
|
941
|
+
const mapped = tracks.map((t, i) => {
|
|
942
|
+
const codec = (t.attrs?.CODECS ?? t.codecSet ?? "").split(",")[0]?.trim() ?? "";
|
|
943
|
+
const supported = deviceSupportsAudioCodec(codec);
|
|
944
|
+
const label = friendlyAudioLabel(t.name, t.lang, codec, t.channels ?? t.attrs?.CHANNELS);
|
|
945
|
+
return { id: i, label, supported };
|
|
946
|
+
});
|
|
947
|
+
const currentTrackIdx = hls.audioTrack ?? 0;
|
|
948
|
+
if (mapped[currentTrackIdx] && !mapped[currentTrackIdx].supported) {
|
|
949
|
+
const firstSupported = mapped.findIndex((t) => t.supported);
|
|
950
|
+
if (firstSupported >= 0) {
|
|
951
|
+
console.debug("[Silo/hls] current audio track unsupported \u2014 switching to track", firstSupported);
|
|
952
|
+
hls.audioTrack = firstSupported;
|
|
953
|
+
if (pinnedAudio === -1) setSelectedAudio(firstSupported);
|
|
954
|
+
} else {
|
|
955
|
+
console.warn("[Silo/hls] no supported audio track found \u2014 disabling separate audio");
|
|
956
|
+
try {
|
|
957
|
+
hls.audioTrack = -1;
|
|
958
|
+
} catch {
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (mapped.length > 1) setAudioTracks(mapped);
|
|
949
963
|
}
|
|
950
964
|
if (pinnedAudio >= 0 && hls.audioTrack !== pinnedAudio) {
|
|
951
965
|
hls.audioTrack = pinnedAudio;
|