diff --git a/src/app/channel/media/queue.js b/src/app/channel/media/queue.js index 83690a8..9e69fb0 100644 --- a/src/app/channel/media/queue.js +++ b/src/app/channel/media/queue.js @@ -53,6 +53,7 @@ module.exports = class{ } defineListeners(socket){ + //Queueing Functions socket.on("queue", (data) => {this.queueURL(socket, data)}); socket.on("stop", (data) => {this.stopMedia(socket)}); //needs perms socket.on("delete", (data) => {this.deleteMedia(socket, data)}); @@ -279,18 +280,17 @@ module.exports = class{ //Grab the next item const nextItem = this.getNextItem(); - //If we have no next item - if(nextItem == null){ - //Get current item - const currentItem = this.getItemAtEpoch() + //Get current item + const currentItem = this.getItemAtEpoch() - //If we have a current item and it isn't currently playing - if(currentItem != null && (this.nowPlaying == null || currentItem.uuid != this.nowPlaying.uuid)){ - //Start the found item at w/ a pre-calculated time stamp to reflect the given start time - this.start(currentItem, Math.round((new Date().getTime() - currentItem.startTime) / 1000) + currentItem.startTimeStamp, volatile); - } - //otherwise if we have an item - }else{ + //If we have a current item and it isn't currently playing + if(currentItem != null && (this.nowPlaying == null || currentItem.uuid != this.nowPlaying.uuid)){ + //Start the found item at w/ a pre-calculated time stamp to reflect the given start time + this.start(currentItem, Math.round((new Date().getTime() - currentItem.startTime) / 1000) + currentItem.startTimeStamp, volatile); + } + + //If we have a next item + if(nextItem != null){ //Calculate the amount of time in ms that the next item will start in const startsIn = nextItem.startTime - new Date().getTime();