Wowza Community

Webrtc recording/compositing- issue in adding audio track at correct position

We are using wowza webrtc and able to implement it in live.
But on wowza server, seperate streams are getting recorded for every user. As per documentation, compositing on wowza server is not supported. we have to merge streams at client side and republish it.

we compositing all streams via the canvas element and able to add all video track to canvas stream whenever new user joins .
But there is issue, when trying to add new audio track to existing peer connection that is when new user joins video chat its audio track should get added at correct time .

we are trying below methods:
1.When we want to add new audio track to our existing canvas stream peer connection, we are using below code.


peerConnections[localUser].addEventListener(“negotiationneeded”, ev => {

peerConnections[localUser].createOffer(gotLocalDescription, errorHandler);

}, false);

But in gotLocalDescription function, below code is written to send offer-
wsConnection.send(’{“direction”:“publish”, “command”:“sendOffer”, “streamInfo”:’ + JSON.stringify(streamInfo) + ‘, “sdp”:’ + JSON.stringify(description) + ‘, “userData”:’ + JSON.stringify({}) + ‘}’);

But it is giving error that stream name is already in use.

  1. So tried another method.
    When we want to add new audio track to our existing canvas stream peer connection, we closed existing peer connection and created new one. added audio track to canvas_stream and sending new composite stream to peer connection. But in this method, we are facing audio-video sync that is audio got attached from start and not in the middle in recorded video file.

Does anyone know how to solve this problem?

1 Like

I got the same problem…

Any update on this issue?

Hello @Prashant_Apte, this is a bit of a complicated process- seems like you must grab the track, and then associate with the correct stream.

Likely you are missing negotiation:

Mixing them together and not just adding them will be a task you may need some assistance with and I don’t have nay documentation on that. You might have to submit a ticket and get an engineer in Wowza tech support to try and help.