Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

ADD: Save volume settings in localstorage

Edgardo Ramírez6411f26d6fcf
diff --git a/webroot/js/components/player.js b/webroot/js/components/player.js
index ca33bffb53..309c154db3 100644
--- a/webroot/js/components/player.js
+++ b/webroot/js/components/player.js
@@ -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) {