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

Only restart tracks if they are internally managed by the SDK #279

Merged
merged 5 commits into from
Jun 24, 2022

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Jun 23, 2022

Not very happy about the naming with managed and isTrackManaged because it's quite ambiguous. Could mean both "externally managed" and "internally managed".

@changeset-bot
Copy link

changeset-bot bot commented Jun 23, 2022

🦋 Changeset detected

Latest commit: 83a9c0a

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

@lukasIO lukasIO requested a review from davidzhao June 23, 2022 09:41
@@ -19,16 +19,20 @@ export default class LocalTrack extends Track {

protected reacquireTrack: boolean;

protected managedTrack: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe acquiredExternally or userProvidedTrack to indicate a user has acquired the track?

@lukasIO
Copy link
Contributor Author

lukasIO commented Jun 24, 2022

@davidzhao one thing where I could argue for both cases is after a call to track.replaceTrack.
Right now calling this function does not mark the track as userProvided but maybe it should.

Reason to argue it should: User is in fact providing a raw MediaStreamTrack. We have no control over it directly. So we should assume it's managed externally.

But: If a user has our APIs previously for creating tracks then it might be that they expect us to manage them also after they called replaceTrack. So maybe the right option is to not change the userProvided state and just default to however the original LocalTrack has been created.

@davidzhao
Copy link
Member

@davidzhao one thing where I could argue for both cases is after a call to track.replaceTrack. Right now calling this function does not mark the track as userProvided but maybe it should.

Reason to argue it should: User is in fact providing a raw MediaStreamTrack. We have no control over it directly. So we should assume it's managed externally.

But: If a user has our APIs previously for creating tracks then it might be that they expect us to manage them also after they called replaceTrack. So maybe the right option is to not change the userProvided state and just default to however the original LocalTrack has been created.

Ah good point.. makes sense if they have replaced the Track with something else, then we shouldn't try to reacquire it. I think for users that are doing things that are a bit more advanced, we can let them write a bit more code to handle these corner cases :)

@lukasIO lukasIO merged commit 301ccc0 into main Jun 24, 2022
@lukasIO lukasIO deleted the lukas/track-track-managed-state branch June 24, 2022 07:12
@github-actions github-actions bot mentioned this pull request Jun 24, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants