videos: save last volume

This commit is contained in:
FireMasterK 2021-01-07 11:04:21 +05:30
parent f57647d24e
commit 43569748ae
No known key found for this signature in database
GPG Key ID: 8DFF5DD33E93DB58
1 changed files with 11 additions and 1 deletions

View File

@ -161,8 +161,13 @@ export default {
const noPrevPlayer = !this.player;
if (noPrevPlayer)
if (noPrevPlayer) {
this.player = videojs(this.$refs.player, options);
if (localStorage)
this.player.volume(
localStorage.getItem("volume") || 1
);
}
this.player.hotkeys({
volumeStep: 0.1,
@ -264,6 +269,11 @@ export default {
this.player.on("volumechange", () => {
this.audioplayer.volume = this.player.volume();
if (localStorage)
localStorage.setItem(
"volume",
this.player.volume()
);
});
this.player.on("ended", () => {