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.setPlayerAttrs(player, videoEl, dash, shaka);
this.setPlayerAttrs(this.player, videoEl, dash, shaka);
});
else this.setPlayerAttrs(this.player, videoEl, dash, this.shaka);
@ -85,17 +85,15 @@ export default {
player.load("data:application/dash+xml;charset=utf-8;base64," + btoa(dash)).then(() => {
this.video.subtitles.map(subtitle => {
player.addTextTrack(subtitle.url, "eng", "SUBTITLE", subtitle.mimeType, null, "English");
player.setTextTrackVisibility(true);
});
if (localStorage) videoEl.volume = localStorage.getItem("volume") || 1;
const ui =
this.ui ||
(this.ui = new shaka.ui.Overlay(
if (!this.ui) {
this.ui = new shaka.ui.Overlay(
player,
document.querySelector("div[data-shaka-player-container]"),
videoEl,
));
);
const config = {
overflowMenuButtons: ["quality", "captions", "playback_rate"],
@ -106,7 +104,8 @@ export default {
},
};
ui.configure(config);
this.ui.configure(config);
}
});
},
},