diff --git a/www/js/channel/mediaHandler.js b/www/js/channel/mediaHandler.js index 595055c..1483d08 100644 --- a/www/js/channel/mediaHandler.js +++ b/www/js/channel/mediaHandler.js @@ -14,7 +14,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .*/ -class mediaHandler{ +//This is little more than a interface class +class mediaHandler{ constructor(client, player, media, type){ //Get parents this.client = client; @@ -29,6 +30,9 @@ class mediaHandler{ //Set last received timestamp to 0 this.lastTimestamp = 0; + //Set volume + this.volume = 1; + //Ingest media object from server this.startMedia(media); } @@ -45,17 +49,11 @@ class mediaHandler{ } buildPlayer(){ - //Create player - this.video = document.createElement('video'); - //Append it to page - this.player.videoContainer.appendChild(this.video); //Reset player lock this.lock = false; } destroyPlayer(){ - //Remove player from page - this.video.remove(); //Null out video property this.video = null; } @@ -72,11 +70,6 @@ class mediaHandler{ } sync(timestamp = this.lastTimestamp){ - //Skip sync calls that won't seek so we don't pointlessly throw selfAct - if(timestamp != this.video.currentTime){ - //Set self act flag - this.selfAct = true; - } } reload(){ @@ -85,15 +78,6 @@ class mediaHandler{ //Throw self act flag to make sure we don't un-sync the player this.selfAct = true; - - //Load video from source - this.video.load(); - - //Set it back to the proper time - this.video.currentTime = timestamp; - - //Play the video - this.video.play(); } end(){ @@ -114,22 +98,11 @@ class mediaHandler{ } setPlayerLock(lock){ - //toggle controls - this.video.controls = !lock; - //Only toggle mute if we're locking, or if we're unlocking after being locked - //If this is ran twice without locking we don't want to surprise unmute on the user - if(lock || this.lock){ - //toggle mute - this.video.muted = lock; - } - //toggle looping - this.video.loop = lock; //set lock property this.lock = lock; } getRatio(){ - return this.video.videoWidth / this.video.videoHeight; } getTimestamp(){ @@ -153,6 +126,9 @@ class mediaHandler{ this.selfAct = false; } + onVolumeChange(event){ + } + onSeek(event){ //If the video was seeked out-side of code if(!this.selfAct){ @@ -164,7 +140,83 @@ class mediaHandler{ } } -class nullHandler extends mediaHandler{ +//Basic building blocks for anything that touches a