At first I have a voice call in a vLine session, I hear the audio by getting the audio tag calling createAudioElement()
on the media stream and appending it to the $(body)
Then on when the remote user opens his video, I send this piece of info to the other user using an x-msg
, after received I get the video stream by calling createVideoElement()
on the media stream.
After that I find a lag between the audio and the video, the audio always reaching faster than the video, how can I synchronize the audio with the video in this case?
When you call
createVideoElement
on the stream it will create a<video>
element, which plays both audio and video, so at that point there is no need for the<audio>
element that you created withcreateAudioElement
.The browser handles synchronizing the audio and video in a single
MediaStream
, so if they are consistently out of sync, you may need to file a WebRTC bug.