-
Notifications
You must be signed in to change notification settings - Fork 166
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 perform mute/unmute actions if necessary #1048
Conversation
🦋 Changeset detectedLatest commit: 968e6b7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just drive by review
…client-sdk-js into lukas/skip-unnecessary-restarts
@@ -133,6 +138,11 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> { | |||
async unmute(): Promise<typeof this> { | |||
const unlock = await this.muteLock.lock(); | |||
try { | |||
if (!this.isMuted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could add a check here for mediaStreamTrack.readyState === 'live'
just to make sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine to leave it out. If it not live, it is ended and the following action is probably not user perceptible any way. Want to avoid checks which probably increases the surface area of browser weirdness affecting functionality in unexpected ways.
restarting tracks seemingly takes a lot longer on new Safari versions (>=17.3.1).
This tries to minimise that impact by avoiding unnecessary restarts to tracks.
Previously calling
unmute
repeatedly would have led to multiple track restarts even if the track is unmuted already.