File tree Expand file tree Collapse file tree 3 files changed +35
-9
lines changed Expand file tree Collapse file tree 3 files changed +35
-9
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,36 @@ function playNext(roomnum) {
137
137
socket . emit ( 'play next' , { } , function ( data ) {
138
138
var videoId = data . videoId
139
139
140
- // Change the video
141
- socket . emit ( 'change video' , {
142
- room : roomnum ,
143
- videoId : videoId ,
144
- time : 0
145
- } ) ;
146
- } ) ;
140
+ // IF queue is empty do not try to change
141
+ if ( videoId !== "QUEUE IS EMPTY" ) {
142
+ // Change the video
143
+ socket . emit ( 'change video' , {
144
+ room : roomnum ,
145
+ videoId : videoId ,
146
+ time : 0
147
+ } )
148
+ }
149
+ else {
150
+ // Notify alert
151
+ $ . notify ( {
152
+ title : '<strong>Queue</strong>' ,
153
+ icon : 'fas fa-list-alt' ,
154
+ message : " is empty!"
155
+ } , {
156
+ type : 'warning' ,
157
+ delay : 400 ,
158
+ animate : {
159
+ enter : 'animated fadeInUp' ,
160
+ exit : 'animated fadeOutRight'
161
+ } ,
162
+ placement : {
163
+ from : "bottom" ,
164
+ align : "right"
165
+ } ,
166
+ offset : 20 ,
167
+ spacing : 10 ,
168
+ z_index : 1031 ,
169
+ } ) ;
170
+ }
171
+ } )
147
172
}
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ function disconnected() {
70
70
icon : 'fas fa-users' ,
71
71
message : " You are now out of sync of the host"
72
72
} , {
73
- type : 'warning ' ,
73
+ type : 'danger ' ,
74
74
delay : 400 ,
75
75
animate : {
76
76
enter : 'animated fadeInUp' ,
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ io.sockets.on('connection', function(socket) {
101
101
} ) ;
102
102
103
103
socket . on ( 'play next' , function ( data , callback ) {
104
- var videoId = ""
104
+ var videoId = "QUEUE IS EMPTY "
105
105
106
106
switch ( io . sockets . adapter . rooms [ 'room-' + socket . roomnum ] . currPlayer ) {
107
107
case 0 :
@@ -123,6 +123,7 @@ io.sockets.on('connection', function(socket) {
123
123
default :
124
124
console . log ( "Error invalid player id" )
125
125
}
126
+ // console.log(videoId)
126
127
// Remove video from the front end
127
128
updateQueueVideos ( )
128
129
callback ( {
You can’t perform that action at this time.
0 commit comments