client-sdk-js
client-sdk-js copied to clipboard
Audio tracks don't stop playback when detached after a screen share audio is attached
Describe the bug
Overview
Microphone audio tracks continue playing back after calling RemoteTrack.detach() in some circumstances. Only calling RemoteTrack.stop() actually makes us stop hearing audio from other participants being played back.
Reproduction
- start a call with 3 participants
- participant 1 and 2 have their mic on (no cam)
- participant 2 is sharing a chrome tab including audio (obviously not the meeting tab)
- participant 3 simply consumes the shared mics and screen sharing audio and video (all in separate audio / video elements)
Now for participant 3:
call detach() on the participant 1 mic track
call detach() on participant 2 mic track
--> expectation: you don’t here any mics anymore
--> actual result: you still hear the audio from the mics
3. call detach on the screen share audio track
--> suddenly the mics aren’t played back anymore
Logs
No response
System Info
- Mac OS 13.1 / Windows 11
- Chrome 110 / 111, also reproducible on Edge
Severity
serious, but I can work around it
Additional Information
If I do the same steps as for the reproduction but call track.attachedElements[0].pause() instead of detach they stop playing back one by one as I pause them.
Also if stop() is called after the track is detached the playback also stops. Be aware that you need to call start() again before attach()ing it again.
thanks for the report!
I tried to reproduce this but having trouble doing so.
Could you check whether audioElement.srcObject is still set to a mediaStreamTrack when you hear participants after detaching? it should be null / undefined.
And log track.attachedElements as well just to have an idea of what that looks like (after detach).