wetfish / sync

Synchronize audio and video between friends! Supports HTML5 video, YouTube, and Vimeo
27 stars 8 forks source link

adding m3u support via command args. #54

Closed Meleeman01 closed 3 years ago

Meleeman01 commented 4 years ago

https://github.com/wetfish/sync/issues/24 this is a better implementation of m3u support from a maintainment perspective, a user will pass in the argument --m3u when running node server.js. a command called playlist is there for conveniance. so the code can be run in m3u playlist mode. so far it converts the file to json as a list of objects containing, name duration, and filename. still need to implement extention checking which could be done in the contructor, but i think it would be better to use the existing architecture on this one.

here is an example playlist test_playlist.m3u.zip

mozai commented 3 years ago

meleeman and I are testing today (Oct 12) and found something odd while testing on fishhost:

#EXTM3U
#EXTINF:33,vapourwave
http://[redacted]/temp/vapourwave.mp4
#EXTINF:58,PepeSilvia
/media/Pepe_Silvia.mp4
#EXTINF:25,ABC Monday Night Movie
https://[redacted]/tumblr_qhavdc9szN1ute1ez.mp4

If a client connects during the "PepeSilva" they get the proper url "https://fishhost/media/Pepe_Silvia.mp4" but if they join during "vapourwave" and the timer ticks down, over the websocket the client is told to go to "http://localhost:3000/media/Pepe_Silvia.mp4"

WORKAROUND: always use absolute URLs, not relative paths, even for locally-hosted files.

Meleeman01 commented 3 years ago

meleeman and I are testing today (Oct 12) and found something odd while testing on fishhost:

#EXTM3U
#EXTINF:33,vapourwave
http://[redacted]/temp/vapourwave.mp4
#EXTINF:58,PepeSilvia
/media/Pepe_Silvia.mp4
#EXTINF:25,ABC Monday Night Movie
https://[redacted]/tumblr_qhavdc9szN1ute1ez.mp4

If a client connects during the "PepeSilva" they get the proper url "https://fishhost/media/Pepe_Silvia.mp4" but if they join during "vapourwave" and the timer ticks down, over the websocket the client is told to go to "http://localhost:3000/media/Pepe_Silvia.mp4"

WORKAROUND: always use absolute URLs, not relative paths, even for locally-hosted files.

so whats happening is that the m3u file is specified too long for the content in some cases mainly #EXTINF:12,Faec https://va.media.tumblr.com/tumblr_qi3r87aTGJ1tfmrz4.mp4 and because of that it will pause the media, and when the newMedia event happens, the current implementation will keep it paused and it while socket.io sets the flag for vueapp.js it doesn't actually make it to vueapp.js. so the solution here is to properly time your files slightly under, and fix the way files are handled when newMedia Event happens on pause, so the new file should play all the time when in m3u mode i think unless the user has explictly pressed the pause button. alternatively, i could just reflect this in the UI so a user will intinctively press it and it will play the media as I've observed.

itsrachelfish commented 3 years ago

I suppose we can merge this now since we are already using this code on production