owt-client-javascript icon indicating copy to clipboard operation
owt-client-javascript copied to clipboard

Check for the transport id

Open philipgiuliani opened this issue 3 years ago • 3 comments

Subscriptions is a map and not an array, because of that checking on subscription._audioTrackId|_videoTrackId will actually not work.

For some reason, _audioTrackId and _videoTrackId is actually undefined. I am not sure if this is a good fix. The issue was caused with this commit: https://github.com/open-webrtc-toolkit/owt-client-javascript/commit/7d316778cea6363abc586ad9b0e4e20fdc9ba5fc

For more information, see discussion in https://github.com/open-webrtc-toolkit/owt-server/issues/1037

Closes #513

philipgiuliani avatar Jul 23 '21 12:07 philipgiuliani

Thanks for your PR. Perhaps we need to correctly set _audioTrackId and _videoTrackId instead of using transportId since transportId is for transport. Multiple publications, subscriptions can share the same the same transport channel. Sometimes, transportId is the same as stream ID, but it's not guaranteed by design.

jianjunz avatar Jul 26 '21 01:07 jianjunz

Hi, that definitely makes sense. I couldn't find out where the _audioTrackId/_videoTrackId should have been set in the first place.

philipgiuliani avatar Jul 26 '21 08:07 philipgiuliani

It could be set after a Subscription is created. And the initial audio track ID and initial video track ID are mediaOptions.audio.from and mediaOptions.video.from in subscribe method. You may store it in a map and read it when a subscription is created. Track IDs might be updated when user updates its source.

jianjunz avatar Jul 27 '21 03:07 jianjunz