Genvid Forum

Getting data and stream synced via web API


#1

Hey there! Sorry for the barrage of posts lately - everything has been working well on my end since the last few posts with one exception:

Using the web API, I’m having a hard time getting the data stream to sync with the current video frame; we’re using YouTube as our streaming service, and I have tried collecting the frame data both in the onStreamsReceived() and onDraw() callbacks -

When I use the onStreamsReceived() callback, it seems that the data is pretty consistently ahead of the video stream (I’d guess by a few milliseconds); when using the onDraw() callback, the data seems to be behind the video stream by approximately the same amount. Is there any sort of helper method to ensure that the stream data (in either method) matches the current frame of video? Or best practices/tricks that I might be able to use?

Right now, I am following the Unity web example, so I am collecting the stream frames in onStreamsReceived() and storing the JSON-parsed data within the frame object. I am then using that data within the onDraw() callback to display the data - which results in the delayed visuals mentioned above. (If I move the display code into the onStreamsReceived() callback, it is too fast)

Thanks!


#2

Hi Lucas,

The OnDraw call is the one that should get you the data in-sync. We probably need more information to know what’s going wrong. If you can sent us the zip file built with genvid-bugreport -c broadcast it will be very useful to better understand the cause of this offsync.


#3

Heya Fabien -

Sure thing! Here is the report zip: