mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
cleaning code
This commit is contained in:
parent
c3fbe0164c
commit
0d41d3f7d8
1 changed files with 9 additions and 5 deletions
|
@ -595,13 +595,17 @@ export default {
|
|||
const autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false);
|
||||
this.$player.setTextTrackVisibility(autoDisplayCaptions);
|
||||
|
||||
const prefSubtitles = this.getPreferenceString("subtitles", null);
|
||||
const textTracks = this.$player.getTextTracks();
|
||||
const subtitleIdx = textTracks.findIndex(textTrack => textTrack.language == prefSubtitles);
|
||||
if (subtitleIdx >= 0) {
|
||||
(() => {
|
||||
const prefSubtitles = this.getPreferenceString("subtitles", "");
|
||||
if (prefSubtitles === "") return;
|
||||
|
||||
const textTracks = this.$player.getTextTracks();
|
||||
const subtitleIdx = textTracks.findIndex(textTrack => textTrack.language == prefSubtitles);
|
||||
if (subtitleIdx == -1) return;
|
||||
|
||||
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