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

View file

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