diff --git a/js/yt.js b/js/yt.js index 5d174d7..8a1143d 100644 --- a/js/yt.js +++ b/js/yt.js @@ -133,10 +133,12 @@ socket.on('get playlist videos', function(data) { key: data.api_key }, function(data) { - // Iterate through all of the playlist videos - for (let video of data.items) { - enqueueVideo(roomnum, video.contentDetails.videoId) - } + // Iterate through all of the playlist videos, sorted by position + for (let video of data.items.sort((a, b) => { + a.position < b.position; + })) { + enqueueVideo(roomnum, video.contentDetails.videoId); + } } ) })