@@ -218,7 +218,12 @@ export default createPlugin<
218218
219219 switch ( event . type ) {
220220 case 'ADD_SONGS' : {
221- if ( conn && this . permission === 'host-only' ) return ;
221+ if ( conn && this . permission === 'host-only' ) {
222+ await this . connection ?. broadcast ( 'SYNC_QUEUE' , {
223+ videoList : this . queue ?. videoList ?? [ ] ,
224+ } ) ;
225+ return ;
226+ }
222227
223228 const videoList : VideoData [ ] = event . payload . videoList . map (
224229 ( it ) => ( {
@@ -232,10 +237,18 @@ export default createPlugin<
232237 ...event . payload ,
233238 videoList,
234239 } ) ;
240+ await this . connection ?. broadcast ( 'SYNC_QUEUE' , {
241+ videoList,
242+ } ) ;
235243 break ;
236244 }
237245 case 'REMOVE_SONG' : {
238- if ( conn && this . permission === 'host-only' ) return ;
246+ if ( conn && this . permission === 'host-only' ) {
247+ await this . connection ?. broadcast ( 'SYNC_QUEUE' , {
248+ videoList : this . queue ?. videoList ?? [ ] ,
249+ } ) ;
250+ return ;
251+ }
239252
240253 this . queue ?. removeVideo ( event . payload . index ) ;
241254 await this . connection ?. broadcast ( 'REMOVE_SONG' , event . payload ) ;
@@ -385,7 +398,6 @@ export default createPlugin<
385398 ownerId : it . ownerId ?? this . connection ! . id ,
386399 } ) ) ,
387400 } ) ;
388- await this . connection ?. broadcast ( 'SYNC_QUEUE' , undefined ) ;
389401 break ;
390402 }
391403 case 'REMOVE_SONG' : {
@@ -394,7 +406,6 @@ export default createPlugin<
394406 }
395407 case 'MOVE_SONG' : {
396408 await this . connection ?. broadcast ( 'MOVE_SONG' , event . payload ) ;
397- await this . connection ?. broadcast ( 'SYNC_QUEUE' , undefined ) ;
398409 break ;
399410 }
400411 case 'SYNC_PROGRESS' : {
0 commit comments