Live audio delayed when autoplay enabled and no user gesture performed in Chrome
dumbmoron opened this issue · 1 comments
dumbmoron commented
Describe the bug
When streaming live video+audio to the browser via a WebSocket connection, the audio is delayed unless a user clicked on some element before the stream started playing. This is an issue that also affects the original phoboslab/jsmpeg script.
To Reproduce
Steps to reproduce the behavior:
- Stream video+audio stream over WebSocket (I can provide example code that generates this stream if needed)
- Set autoplay to
true
, load page in browser, but don't click on anything - Wait ~5 seconds, then click on some element
- Audio starts playing, but is delayed
I was also able to reproduce this with just streaming audio separately.
Expected behavior
The audio should be in sync with the video.
Desktop (please complete the following information):
- OS: macOS Ventura
- Browser: Google Chrome
- Version: latest (114)
Additional context
Warning message in console logs:
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
nguyenduy2392 commented
+1