javascript - Scheduling and/or Synchronizing HTML5 Video Playback Across Machines -
i'm running 3 different videos identical durations on 3 separate machines , synchronizing them using websocket server. can pretty accurate time sync between machines, changing currenttime
attribute of of videos results in significant , unpredictable delay.
in past webaudio, i've been able schedule playback of audio source using start()
, video.play()
doesn't have functionality. , makes impossible "play part of video @ point in time".
is not option html5 video? there out-of-the-box solution should trying (e.g. media streams, canvas). i'm using chrome, use browser.
unfortunately there exist no method video sync sources way.
the problem setting currenttime
is asynchronous operation. when time set there no guarantee video play time instantly. browser check cache, possibly load net , decode before video before it's played time (and when reports through seeked
event).
as long miss form of cue method in web audio api (which require data reside in memory) limited in options.
we maybe hackish solution work @ moment using 2 video elements "double buffer" time/positions, when scheduled time due, start , swap in second element (which may or may not work depending on system, browser, network, cache, server response time etc.).
depending on size , length of videos pre-load image frames instead of video. allow instant sync @ cost of initial load time , memory.
i believe more stable solution sync streams on server side using dedicated solutions , use browser passive client. videolan or obs may trick, or commercial specialized software/hardware related broadcasting able handle sync reference signals.
just 2 cents.