-
Notifications
You must be signed in to change notification settings - Fork 172
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
fix video track lost for migration on safari #419
Conversation
🦋 Changeset detectedLatest commit: 73c9630 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 |
@@ -129,6 +129,9 @@ export default class RemoteTrackPublication extends TrackPublication { | |||
setTrack(track?: RemoteTrack) { | |||
const prevStatus = this.subscriptionStatus; | |||
const prevTrack = this.track; | |||
if (!!prevTrack === !!track) { |
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.
the commit message sounds like you'd want to know if track
and prevTrack
are the same, but this check here would return always if track
and prevTrack
are either both set or both undefined.
I'm wondering if there's any part where we'd expect setTrack
to work even if a previous (different) track had been set.
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.
There is a case that old track not cleared and new track fired, then prevTrack and track are both set. That cause prevTrack detached and new track not attached, that's why safari lost video tracks on UI.
If !!prevTrack === !!track
means they are either both set or both undefined, does the below code will subscribed not fired if they are both set.
if (!!track !== !!prevTrack) {
// when undefined status changes, there's a subscription changed event
if (track) {
this.emit(TrackEvent.Subscribed, track);
} else if (prevTrack) {
this.emit(TrackEvent.Unsubscribed, prevTrack);
}
}
I see @davidzhao add this code, any suggesstions about this?
* don't detach track when same mediatrack received * changeset * attempt Co-authored-by: David Zhao <dz@livekit.io>
In case of session migration, safari have chance not fire the
stream.onremovetrack
event, so the RemoteTrack are not cleared, will be set again by the same remote track then cause the track detach and not attached, then some video tracks are disappeared in ui