Skip to content

Commit ad7660e

Browse files
committed
Queue Quick Fix For DM/Vimeo (#86)
Queue was refactored for dm/vimeo. It now works to an extent, it is still in beta. Disabled the visual queue for now.
1 parent 54088cc commit ad7660e

File tree

6 files changed

+53
-43
lines changed

6 files changed

+53
-43
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Vynchronize
22
[Access the application here!](https://vynchronize.herokuapp.com/)
33

4+
![Vynchronize Screenshot](https://raw.githubusercontent.com/kyle8998/Vynchronize/master/img/screenshot2.PNG)
5+
46
Vynchronize is a online video synchronization platform where you can watch videos online with friends in real time!
57

68
Vynchronize currently supports YouTube, Daily Motion, and Vimeo!

img/screenshot1.PNG

1.15 MB
Loading

img/screenshot2.PNG

671 KB
Loading

index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ <h2><span id="hostlabel" class="label label-default"><i class="fas fa-user"></i>
171171
</div>
172172

173173
<!-- Playlist shit -->
174-
<div class="vid-list-container">
174+
<div id="visual-queue" class="vid-list-container">
175175
<ul class="vid-list" id="vidlist">
176176
<li class="vid-item">
177177
<!-- <div class="thumb">
@@ -184,14 +184,16 @@ <h2><span id="hostlabel" class="label label-default"><i class="fas fa-user"></i>
184184
</li>
185185
</ul>
186186
</div>
187-
<div class="arrows">
187+
<div id="queue-arrows" class="arrows">
188188
<div class="arrow-left">
189189
<i class="fa fa-chevron-left fa-lg"></i>
190190
</div>
191191
<div class="arrow-right">
192192
<i class="fa fa-chevron-right fa-lg"></i>
193193
</div>
194194
</div>
195+
<br/>
196+
<p style="display: none" id="beta-message" class="lead">Queue is currently in beta for DailyMotion/Vimeo</p>
195197

196198

197199

js/player.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ socket.on('createYoutube', function(data) {
8181
you.style.display = 'block';
8282
currPlayer = 0
8383

84-
console.log("Player state: "+playerStatus)
84+
// The visual queue
85+
document.getElementById('visual-queue').style.display = 'block'
86+
document.getElementById('queue-arrows').style.display = 'block'
87+
document.getElementById('beta-message').style.display = 'none'
88+
89+
console.log("Player state: " + playerStatus)
8590
// If it is -1, there was an error and needs to resync to host
8691
if (playerStatus == -1) {
8792
socket.emit('get video', function(id) {
@@ -114,6 +119,11 @@ socket.on('createDaily', function(data) {
114119
daily.style.display = 'block';
115120
currPlayer = 1
116121

122+
// disable for dm/vimeo
123+
document.getElementById('visual-queue').style.display = 'none'
124+
document.getElementById('queue-arrows').style.display = 'none'
125+
document.getElementById('beta-message').style.display = 'block'
126+
117127
// Special call to pause youtube player
118128
// Only have to do on youtube player as it is the default player that autoplays
119129
player.pauseVideo();
@@ -137,6 +147,11 @@ socket.on('createVimeo', function(data) {
137147
vimeo.style.display = 'block';
138148
currPlayer = 2
139149

150+
// disable for dm/vimeo
151+
document.getElementById('visual-queue').style.display = 'none'
152+
document.getElementById('queue-arrows').style.display = 'none'
153+
document.getElementById('beta-message').style.display = 'block'
154+
140155
// Special call to pause youtube player
141156
// Only have to do on youtube player as it is the default player that autoplays
142157
player.pauseVideo();

server.js

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -151,50 +151,41 @@ io.sockets.on('connection', function(socket) {
151151
// Gets title then calls back
152152
socket.on('enqueue video', function(data) {
153153
var user = data.user
154-
// callback
155-
// See yt.js file
156-
socket.emit('get title', {
157-
videoId: data.videoId,
158-
user: user
159-
}, function(data) {
160-
// Data contains videoId and title
161-
var videoId = data.videoId
162-
var title = data.title
163-
switch (io.sockets.adapter.rooms['room-' + socket.roomnum].currPlayer) {
164-
case 0:
154+
var videoId = data.videoId
155+
var title = ""
156+
switch (io.sockets.adapter.rooms['room-' + socket.roomnum].currPlayer) {
157+
case 0:
158+
// See yt.js file
159+
socket.emit('get title', {
160+
videoId: videoId,
161+
user: user
162+
}, function(data) {
163+
videoId = data.videoId
164+
title = data.title
165165
io.sockets.adapter.rooms['room-' + socket.roomnum].queue.yt.push({
166166
videoId: videoId,
167167
title: title
168168
})
169-
break;
170-
case 1:
171-
io.sockets.adapter.rooms['room-' + socket.roomnum].queue.dm.push({
172-
videoId: videoId,
173-
title: title
174-
})
175-
break;
176-
case 2:
177-
io.sockets.adapter.rooms['room-' + socket.roomnum].queue.vimeo.push({
178-
videoId: videoId,
179-
title: title
180-
})
181-
break;
182-
default:
183-
console.log("Error invalid player id")
184-
}
185-
console.log(io.sockets.adapter.rooms['room-' + socket.roomnum].queue.yt)
186-
187-
// Call notify
188-
// DEPRECATED - NOW THE SOCKET ITSELF CALLS 'notify alerts' from within the get title function
189-
// io.sockets.in("room-"+socket.roomnum).emit('enqueueNotify', {
190-
// videoId: videoId,
191-
// title: title,
192-
// user: user
193-
// })
194-
195-
// Update front end
196-
updateQueueVideos()
197-
})
169+
console.log(io.sockets.adapter.rooms['room-' + socket.roomnum].queue.yt)
170+
// Update front end
171+
updateQueueVideos()
172+
})
173+
break;
174+
case 1:
175+
io.sockets.adapter.rooms['room-' + socket.roomnum].queue.dm.push({
176+
videoId: videoId,
177+
title: title
178+
})
179+
break;
180+
case 2:
181+
io.sockets.adapter.rooms['room-' + socket.roomnum].queue.vimeo.push({
182+
videoId: videoId,
183+
title: title
184+
})
185+
break;
186+
default:
187+
console.log("Error invalid player id")
188+
}
198189
})
199190

200191
// Empty the queue

0 commit comments

Comments
 (0)