Skip to content

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Feb 27, 2024

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.

Copy link

changeset-bot bot commented Feb 27, 2024

🦋 Changeset detected

Latest commit: 968e6b7

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 February 27, 2024 09:19
Copy link
Contributor

github-actions bot commented Feb 27, 2024

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 81.51 KB (+0.06% 🔺)
dist/livekit-client.umd.js 87.2 KB (+0.06% 🔺)

Copy link
Contributor

@boks1971 boks1971 left a 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

@@ -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) {
Copy link
Contributor Author

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?

Copy link
Contributor

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.

@lukasIO lukasIO merged commit 81bde6d into main Feb 27, 2024
@lukasIO lukasIO deleted the lukas/skip-unnecessary-restarts branch February 27, 2024 16:57
@github-actions github-actions bot mentioned this pull request Feb 27, 2024
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.

3 participants