mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
chore: simplify/refactor to reuse existing method
This commit is contained in:
parent
b1e397c4bc
commit
a50fae3b7d
1 changed files with 3 additions and 17 deletions
|
@ -900,26 +900,12 @@ class PlaybackManager {
|
||||||
return streams.filter((stream) => self.trackHasSecondarySubtitleSupport(stream, player));
|
return streams.filter((stream) => self.trackHasSecondarySubtitleSupport(stream, player));
|
||||||
};
|
};
|
||||||
|
|
||||||
function getCurrentSubtitleStream(player) {
|
function getCurrentSubtitleStream(player, isSecondaryStream = false) {
|
||||||
if (!player) {
|
if (!player) {
|
||||||
throw new Error('player cannot be null');
|
throw new Error('player cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = getPlayerData(player).subtitleStreamIndex;
|
const index = isSecondaryStream ? getPlayerData(player).secondarySubtitleStreamIndex : getPlayerData(player).subtitleStreamIndex;
|
||||||
|
|
||||||
if (index == null || index === -1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.getSubtitleStream(player, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurrentSecondarySubtitleStream(player) {
|
|
||||||
if (!player) {
|
|
||||||
throw new Error('player cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
const index = getPlayerData(player).secondarySubtitleStreamIndex;
|
|
||||||
|
|
||||||
if (index == null || index === -1) {
|
if (index == null || index === -1) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1598,7 +1584,7 @@ class PlaybackManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentStream = getCurrentSecondarySubtitleStream(player);
|
const currentStream = getCurrentSubtitleStream(player, true);
|
||||||
|
|
||||||
const newStream = self.getSubtitleStream(player, index);
|
const newStream = self.getSubtitleStream(player, index);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue