Skip to content

Commit

Permalink
[Fix]Screensharing track disappearing when shared second time (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis authored Jul 19, 2024
1 parent fdfec37 commit 0416c39
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/StreamVideo/CallState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public class CallState: ObservableObject {
@Published public internal(set) var screenSharingSession: ScreenSharingSession? = nil {
didSet {
let isCurrentUserSharing = screenSharingSession?.participant.id == sessionId
/// When screensharingSession is non-nil we need to ensure that the track is also enabled.
/// Otherwise, we can get in a situation where a track which was shared previously,
/// was disabled (due to PiP) and that will cause the track not showing on UI.
/// Forcing it here to be enabled, should mitigate this issue and ensure that the track is always
/// visible whenever screensharingSession is non-nil.
screenSharingSession?.track?.isEnabled = true
if isCurrentUserSharing != isCurrentUserScreensharing {
isCurrentUserScreensharing = isCurrentUserSharing
}
Expand Down

0 comments on commit 0416c39

Please sign in to comment.