mirror of
https://github.com/owncast/owncast.git
synced 2024-11-22 04:40:37 +03:00
ADD: Save volume settings in localstorage
This commit is contained in:
parent
8aa5c33999
commit
84b81e440d
1 changed files with 7 additions and 0 deletions
|
@ -47,6 +47,7 @@ class OwncastPlayer {
|
|||
this.startPlayer = this.startPlayer.bind(this);
|
||||
this.handleReady = this.handleReady.bind(this);
|
||||
this.handlePlaying = this.handlePlaying.bind(this);
|
||||
this.handleVolume = this.handleVolume.bind(this);
|
||||
this.handleEnded = this.handleEnded.bind(this);
|
||||
this.handleError = this.handleError.bind(this);
|
||||
}
|
||||
|
@ -76,6 +77,7 @@ class OwncastPlayer {
|
|||
startPlayer() {
|
||||
this.log('Start playing');
|
||||
const source = { ...VIDEO_SRC }
|
||||
this.vjsPlayer.volume(localStorage.getItem('owncastVolume'));
|
||||
this.vjsPlayer.src(source);
|
||||
// this.vjsPlayer.play();
|
||||
};
|
||||
|
@ -84,6 +86,7 @@ class OwncastPlayer {
|
|||
this.log('on Ready');
|
||||
this.vjsPlayer.on('error', this.handleError);
|
||||
this.vjsPlayer.on('playing', this.handlePlaying);
|
||||
this.vjsPlayer.on('volumechange', this.handleVolume);
|
||||
this.vjsPlayer.on('ended', this.handleEnded);
|
||||
|
||||
if (this.appPlayerReadyCallback) {
|
||||
|
@ -92,6 +95,10 @@ class OwncastPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
handleVolume(e) {
|
||||
localStorage.setItem('owncastVolume', this.vjsPlayer.volume());
|
||||
}
|
||||
|
||||
handlePlaying() {
|
||||
this.log('on Playing');
|
||||
if (this.appPlayerPlayingCallback) {
|
||||
|
|
Loading…
Reference in a new issue