Added persistant volume.

This commit is contained in:
rainbow napkin 2025-05-04 17:17:20 -04:00
parent b253f817f4
commit 2d5afc23d7
2 changed files with 4 additions and 5 deletions

View file

@ -30,9 +30,6 @@ class mediaHandler{
//Set last received timestamp to 0 //Set last received timestamp to 0
this.lastTimestamp = 0; this.lastTimestamp = 0;
//Set volume
this.volume = 1;
//Ingest media object from server //Ingest media object from server
this.startMedia(media); this.startMedia(media);
} }
@ -149,6 +146,7 @@ class rawFileBase extends mediaHandler{
defineListeners(){ defineListeners(){
//Resize to aspect on metadata load //Resize to aspect on metadata load
this.video.addEventListener('loadedmetadata', this.onMetadataLoad.bind(this)); this.video.addEventListener('loadedmetadata', this.onMetadataLoad.bind(this));
this.video.addEventListener('volumechange', this.onVolumeChange.bind(this));
} }
buildPlayer(){ buildPlayer(){
@ -211,7 +209,7 @@ class rawFileBase extends mediaHandler{
onVolumeChange(event){ onVolumeChange(event){
//Pull volume from video //Pull volume from video
this.volume = this.video.volume; this.player.volume = this.video.volume;
} }
} }
@ -270,7 +268,7 @@ class rawFileHandler extends rawFileBase{
this.video.src = this.nowPlaying.id; this.video.src = this.nowPlaying.id;
//Set video volume //Set video volume
this.video.volume = this.volume; this.video.volume = this.player.volume;
//Set video title //Set video title
this.setVideoTitle(this.nowPlaying.title); this.setVideoTitle(this.nowPlaying.title);

View file

@ -43,6 +43,7 @@ class player{
//Numbers //Numbers
this.syncTolerance = 0.4; this.syncTolerance = 0.4;
this.syncDelta = 6; this.syncDelta = 6;
this.volume = 1;
//run setup functions //run setup functions
this.setupInput(); this.setupInput();