See this first post for example code
Video latency - Using the context event you can get the
hlsLatencyBroadcaster
which gives you how many seconds theviewer
is behind the live stream. Using this latency you can pad your receive buffer so that your extension messages are in sync with the video. In my case each second of data includes a set of 10 data samples that have a 100 ms duration each. So I’m enforcing that the receive buffer always has (10 data samples for every second of latency).