livekit / client-sdk-js

LiveKit browser client SDK (javascript)
https://livekit.io
Apache License 2.0
334 stars 143 forks source link

Unstopped Tracks on Room Disconnect #1146

Closed Tanney-102 closed 3 months ago

Tanney-102 commented 3 months ago

Describe the bug

Sometimes tracks do not stop properly upon disconnect. If the room disconnects after the camera or audio has been turned on but before the getUserMedia request is resolved, the tracks of the resolved stream remain active and do not stop.

Reproduction

  1. call LocalParticipant.setCameraEnabled(true)
  2. call Room.disconnect before getUesrMedia is resolved
  3. RoomEvent.Disconnected is fired before getUesrMedia is resolved

Logs

No response

System Info

System:
    OS: macOS 14.3.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 359.20 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 4.0.0 - ~/.nvm/versions/node/v18.17.0/bin/yarn
    npm: 10.4.0 - ~/.nvm/versions/node/v18.17.0/bin/npm
  Browsers:
    Chrome: 125.0.6422.61
    Firefox: 125.0.3
    Safari: 17.3.1

Severity

serious, but I can work around it

Additional Information

No response

lukasIO commented 3 months ago

Can you reproduce this with the latest version? This should have been addressed by https://github.com/livekit/client-sdk-js/pull/1131. It might still happen that RoomEvent.Disconnected gets fired before the tracks stop, but the tracks should definitely stop with that change.

Tanney-102 commented 3 months ago

@lukasIO Oh, I confirmed that the issue is resolved in the latest version! Thank you so much.