Implemented back-end for basic time-based queueing system.
This commit is contained in:
parent
f38eae170d
commit
4f6b3318a0
11 changed files with 329 additions and 140 deletions
|
|
@ -41,13 +41,12 @@ class player{
|
|||
this.reloadIcon = document.querySelector("#media-panel-reload-icon");
|
||||
|
||||
//Numbers
|
||||
this.syncTolerance = 1;
|
||||
this.syncTolerance = 0.4;
|
||||
this.syncDelta = 6;
|
||||
|
||||
//run setup functions
|
||||
this.setupInput();
|
||||
this.defineListeners();
|
||||
this.lockSync();
|
||||
}
|
||||
|
||||
setupInput(){
|
||||
|
|
@ -97,6 +96,9 @@ class player{
|
|||
}
|
||||
}
|
||||
|
||||
//Lock synchronization since everyone starts at 0, and update the UI
|
||||
this.lockSync();
|
||||
|
||||
//Re-size to aspect since video may now be a different size
|
||||
this.client.chatBox.resizeAspect();
|
||||
}
|
||||
|
|
@ -133,27 +135,32 @@ class player{
|
|||
|
||||
//Replace it with a null handler
|
||||
this.mediaHandler = new nullHandler(client, this);
|
||||
|
||||
//Re-lock sync since we're probably gonna start new media soon anywho, and we need to update the UI anywho
|
||||
this.lockSync();
|
||||
}
|
||||
|
||||
lockSync(){
|
||||
//Light up the sync icon to show that we're actively synchronized
|
||||
this.syncIcon.classList.add('positive');
|
||||
|
||||
//Enable syncing
|
||||
this.syncLock = true;
|
||||
|
||||
//If we have a media handler
|
||||
if(this.mediaHandler != null){
|
||||
if(this.mediaHandler != null && this.mediaHandler.type != null){
|
||||
//Light up the sync icon to show that we're actively synchronized
|
||||
this.syncIcon.classList.add('positive');
|
||||
|
||||
//Sync to last timestamp
|
||||
this.mediaHandler.sync();
|
||||
|
||||
//Play
|
||||
this.mediaHandler.play();
|
||||
}else{
|
||||
//Unlight the sync icon since there is nothing to sync
|
||||
this.syncIcon.classList.remove('positive');
|
||||
}
|
||||
}
|
||||
|
||||
unlockSync(){
|
||||
//Unlight the sync icon
|
||||
//Unlight the sync icon since we're no longer actively synced
|
||||
this.syncIcon.classList.remove('positive');
|
||||
|
||||
//Disable syncing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue