calzoneman / sync

Node.JS Server and JavaScript/HTML Client for synchronizing online media
Other
1.45k stars 235 forks source link

Synchronization not working for HLS VOD content #977

Open forbjok opened 9 months ago

forbjok commented 9 months ago

Please fill out the templates below to the best of your ability, based on whether your problem is with using the website or with running your own server.

Website Problem

Please confirm whether you've tried the following debugging steps:

Description of the Problem

Using a HLS-encoded VOD video (.m3u8 manifest pointing to either fragmented mp4 segments or single file w/ byte ranges), the stream does not synchronize between users. Pausing/unpausing or seeking as leader does not cause other users' state/position to be updated, and refreshing will always cause the video to restart from the beginning instead of synchronizing to the leader's position.

I would expect this to synchronize like any other video file. I know for a fact that this is possible, as I have implemented the same functionality myself in a personal project using the same player component (video.js) as cytube uses.

Here's an example video that reproduces this issue: https://junk.forbstuff.net/t3mp/cytube-hlsvod-repro/master.m3u8

I suspect a possible cause is that cytube is coded to always consider HLS links as a livestream (It says "Currently Playing: Livestream" over the video), which would not be controllable, however if this is the case, it's not a sound assumption, as HLS can also be used for non-live pre-encoded, fully seekable video (VOD), as is the case here.

System Information

OS: Windows 11 Web Browsers tested: Chrome, Brave, Firefox, Edge

There are no relevant error messages, and nothing new shows up in the console when pausing/unpausing or seeking on either the leader or the viewer browsers.

calzoneman commented 9 months ago

All directly added m3u8s are treated as livestreams and are therefore not synced.

See https://github.com/calzoneman/sync/issues/767 -- someone contributed support for HLS VODs via the custom-media target (therefore relying on the JSON manifest to specify whether it is live or not), but it was not implemented for directly adding m3u8s (see https://github.com/calzoneman/sync/issues/767#issuecomment-417888889 for why -- it's difficult to programmatically decide whether a given m3u8 link represents a livestream or a VOD because the format itself is designed for livestreaming).