client-sdk-js icon indicating copy to clipboard operation
client-sdk-js copied to clipboard

Fixes calling start() on a remote track multiple times

Open wcarle opened this issue 2 years ago • 3 comments

Prevent multiple redundant monitors from being started if start is called multiple times on a RemoteTrack

Fixes issue: https://github.com/livekit/client-sdk-js/issues/392

wcarle avatar Aug 11 '22 19:08 wcarle

🦋 Changeset detected

Latest commit: 515fb7799d250ec5c0700d38fbb4968a5cf1fec1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 11 '22 19:08 changeset-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 11 '22 19:08 CLAassistant

hi @wcarle, thanks for the PR! Looking at the code (not particularly your changes), I'm thinking it might make sense to base the monitor on an interval, rather than timeouts. Then a reference to the interval could be used to track if monitoring has been started already and it wouldn't need the extra variable to track if monitoring has been started.

lukasIO avatar Aug 12 '22 07:08 lukasIO

@lukasIO Yeah that's a good call, it's much cleaner that way. Just pushed that change

wcarle avatar Aug 17 '22 20:08 wcarle

great, thank you! I think there's only one thing left to do, which is clearing the interval at the top of the stop function on the RemoteTrack

lukasIO avatar Aug 18 '22 12:08 lukasIO

@lukasIO Done!

wcarle avatar Aug 19 '22 18:08 wcarle