Fix double ui.

This commit is contained in:
FireMasterK 2021-04-14 12:17:19 +05:30
parent 9b659ad3b8
commit 5e6b41f8bf
No known key found for this signature in database
GPG key ID: 8DFF5DD33E93DB58

View file

@ -47,7 +47,7 @@ export default {
this.player = player; this.player = player;
this.setPlayerAttrs(player, videoEl, dash, shaka); this.setPlayerAttrs(this.player, videoEl, dash, shaka);
}); });
else this.setPlayerAttrs(this.player, videoEl, dash, this.shaka); else this.setPlayerAttrs(this.player, videoEl, dash, this.shaka);
@ -85,28 +85,27 @@ export default {
player.load("data:application/dash+xml;charset=utf-8;base64," + btoa(dash)).then(() => { player.load("data:application/dash+xml;charset=utf-8;base64," + btoa(dash)).then(() => {
this.video.subtitles.map(subtitle => { this.video.subtitles.map(subtitle => {
player.addTextTrack(subtitle.url, "eng", "SUBTITLE", subtitle.mimeType, null, "English"); player.addTextTrack(subtitle.url, "eng", "SUBTITLE", subtitle.mimeType, null, "English");
player.setTextTrackVisibility(true);
}); });
if (localStorage) videoEl.volume = localStorage.getItem("volume") || 1; if (localStorage) videoEl.volume = localStorage.getItem("volume") || 1;
const ui = if (!this.ui) {
this.ui || this.ui = new shaka.ui.Overlay(
(this.ui = new shaka.ui.Overlay(
player, player,
document.querySelector("div[data-shaka-player-container]"), document.querySelector("div[data-shaka-player-container]"),
videoEl, videoEl,
)); );
const config = { const config = {
overflowMenuButtons: ["quality", "captions", "playback_rate"], overflowMenuButtons: ["quality", "captions", "playback_rate"],
seekBarColors: { seekBarColors: {
base: "rgba(255, 255, 255, 0.3)", base: "rgba(255, 255, 255, 0.3)",
buffered: "rgba(255, 255, 255, 0.54)", buffered: "rgba(255, 255, 255, 0.54)",
played: "rgb(255, 0, 0)", played: "rgb(255, 0, 0)",
}, },
}; };
ui.configure(config); this.ui.configure(config);
}
}); });
}, },
}, },