You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a bit torn on this – at least in its current state.
The problem is that e.g. setMicrophoneEnabled will only consider the CaptureOptions and TrackPublishOptions passed to it the first time it actually results in publishing a track. Subsequent calls only mute/unmute.
That's why it seems reasonable to log an info about the options being ignored.
However this might get a bit noisy in cases where the same (initial) options get passed each time.
A couple of ideas that would make it better than the current proposal:
deep compare of options (for capture options this will get a bit more tricky as we'll have to unwrap the constraints passed to the track itself) and only log when they're not the same as the ones set on the track
store captureOptions also on the track and do the same shallow compare that we do for TrackPublishOptions in this PR
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
I am definitely not an expert on this code path, but assuming the api interface must stay the same, initially the two approaches that come to mind are:
Do a shallow reference check / warn like you are doing now, maybe with a note like "to get rid of this warning, pass the same reference in each time"
Send some sort of update to the active track telling it that its options should change - ideally it is done in such a way where all the option "leaves" as they make their way through the abstraction layers are individually reference-equality checked, which ends up implicitly implementing a "deep equals" type of mechanism.
I don't particularly like the explicit deep equality check option IMO, because if larger / non easily equality checked things like class instances eventually end up in the options, at best it could get a lot slower, and at worst it would silently break because somebody wasn't aware of this behavior.
Maybe this is something to add to the client 3.0 doc though - IMO it seems like it would be ideal if there were two methods instead - one that initialized the track and one that mutes / unmutes, with assertions to ensure they are used in the right way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm a bit torn on this – at least in its current state.
The problem is that e.g.
setMicrophoneEnabledwill only consider the CaptureOptions and TrackPublishOptions passed to it the first time it actually results in publishing a track. Subsequent calls only mute/unmute.That's why it seems reasonable to log an info about the options being ignored.
However this might get a bit noisy in cases where the same (initial) options get passed each time.
A couple of ideas that would make it better than the current proposal: