fix(player): unable to play media without subtitles

This commit is contained in:
Prayag Prajapati committed 2024-03-27 14:25:38 +05:30
1 parent 37096a5c9e
commit 3efe4a4473
3 files changed
+8 -3

No files matched your search

+6 -3
View File
@@ -234,8 +234,11 @@ const PlayButton = ({
const subtitles = result?.Items[0].MediaSources[0].MediaStreams?.filter(
(value) => value.Type === "Subtitle",
);
if (!currentSubTrack) {
let enableSubtitles = true;
if (!currentSubTrack && subtitles?.length > 0) {
selectedSubtitleTrack = subtitles[0].Index;
} else {
enableSubtitles = false;
}
playItem(
@@ -245,7 +248,7 @@ const PlayButton = ({
currentAudioTrack,
selectedSubtitleTrack,
result.Items[0].Container,
true,
enableSubtitles,
`${api.basePath}/Videos/${result.Items[0].Id}/stream.${result.Items[0].Container}?Static=true&mediaSourceId=${result.Items[0].Id}&deviceId=${api.deviceInfo.id}&api_key=${api.accessToken}&Tag=${result.Items[0].MediaSources[0].ETag}&videoStreamIndex=${currentVideoTrack}&audioStreamIndex=${currentAudioTrack}`,
userId,
result?.Items[0].UserData?.PlaybackPositionTicks,
@@ -254,7 +257,7 @@ const PlayButton = ({
queue,
0,
subtitles,
result?.Items[0].MediaSources[0].Id
result?.Items[0].MediaSources[0].Id,
);
navigate("/player");
}
+1
View File
@@ -284,6 +284,7 @@ $cardWidth: 22%;
&-cast {
max-height: 50vh;
overflow-y: auto;
overflow-x: hidden;
mask-image: linear-gradient(to top, transparent, black 1.2em);
-webkit-mask-image: linear-gradient(to top, transparent, black 1.2em);
&-title {
+1
View File
@@ -102,6 +102,7 @@ $cardWidth: 18%;
&-cast {
max-height: 50vh;
overflow-y: auto;
overflow-x: hidden;
mask-image: linear-gradient(to top, transparent, black 1.2em);
-webkit-mask-image: linear-gradient(to top, transparent, black 1.2em);
&-title {