Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent PCTransportManager.subscriber from reusing previous remote-track/transceiver? #1034

Open
patstar123 opened this issue Feb 18, 2024 · 3 comments

Comments

@patstar123
Copy link

Describe the bug

issue description

  1. Everything works fine on Chrome browser and native Android WebView.
  2. But encountered oddities with Tencent X5 WebView on android:
    • Client A publishes audio, and client B subscribes the audio track. When A exits the room or stops publishing the audio track, B successfully unsubscribes from A's audio.
    • However, in Tencent's X5 WebView, additional events occur: B's MediaStreamTrack (RemoteTrack) triggers the onended callback, i.e., track.readyState is set to ended.
    • Therefore, when A rejoins the room and publishes audio again, B attempts to subscribe to that track.
    • Due to PCTransportManager.subscriber reusing the previous MediaStreamTrack, which has already ended, the subscription fails, resulting in the error message: "unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()."

my request

Regarding this strange phenomenon, I have come up with two solutions:

  1. Figure out why onended is triggered on Tencent's X5 WebView and prevent it from happening again.
  2. Prevent PCTransportManager.subscriber from reusing the previous MediaStreamTrack.
    For solution 1, I have tried for a long time but without any progress. X5 is like a black box to me and i am unable to use the native WebView to replace the X5 WebView with some reasons.

So, I can only seek solution 2.

Reproduction

RT

Logs

No response

System Info

client-sdk-js: 1.15.2
x5: 46279, 20231225193004
x5 sdk: 44286

Severity

annoyance

Additional Information

No response

@davidzhao
Copy link
Member

@AllenTu21CN, nice digging here.

It's disappointing to hear that X5 WebView isn't implementing the spec correctly.

Path 2 is an option, you can add some code to disable transceiver re-use for that particular device. It'll need to be added to the clientconfiguration package, and used in Participant.SupportsTransceiverReuse.

Do you want to open a PR with the above changes?

@patstar123
Copy link
Author

@davidzhao
Thanks for your response. I will try to modify the code locally and test it. Once validated, I'll initiate a PR.

@AnnaGromova-FD
Copy link

AnnaGromova-FD commented Mar 18, 2024

Hello. We have a very similar problem with turning on the camera after re-entering room.
My technology: React + Electron.js.
After a participant leaves the room with the camera on and returns back to the room, the other participants can no longer see his video.
issue description:

  1. 2 participants enter the room, turn on their cameras. Both participants get all the information they need about the video tracks.
  2. One participant leaves the room and re-enters the same room a short time later. Turns on the camera. The second participant gets the error could not find published track {participantSid: 'PA_STthhL3q452h', participantId: '01HCEQA5ZR2MVYTY0G5Q5QYMDVXD', trackSid: 'TR_VCK2ZbmiJiiMM3'}.
    I was able to track that the trackSid value is not updated in this case. LiveKit is trying to retrieve publication by trackSid from a past room login.
    Further in the RemoteTrackPublication object the new track data appears, trackSid, trekInfo data is populated, but the track object is still undefined. As a result remote participants see a black screen.
    So, how can I get an updated track information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants