mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
looks simpler and more self-explaining
fix suggested on https://github.com/TeamPiped/Piped/pull/2937#discussion_r1325072807
This commit is contained in:
parent
0d41d3f7d8
commit
8ccef3b110
1 changed files with 7 additions and 9 deletions
|
@ -595,17 +595,15 @@ export default {
|
|||
const autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false);
|
||||
this.$player.setTextTrackVisibility(autoDisplayCaptions);
|
||||
|
||||
(() => {
|
||||
const prefSubtitles = this.getPreferenceString("subtitles", "");
|
||||
if (prefSubtitles === "") return;
|
||||
|
||||
if (prefSubtitles !== "") {
|
||||
const textTracks = this.$player.getTextTracks();
|
||||
const subtitleIdx = textTracks.findIndex(textTrack => textTrack.language == prefSubtitles);
|
||||
if (subtitleIdx == -1) return;
|
||||
|
||||
if (subtitleIdx != -1) {
|
||||
this.$player.setTextTrackVisibility(true);
|
||||
this.$player.selectTextTrack(textTracks[subtitleIdx]);
|
||||
})();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue