forked from mirrors/linphone-iphone
Hide/show PIP window on active speaker call view appear/disappear
This commit is contained in:
parent
e01989c9c9
commit
93abf64da6
2 changed files with 15 additions and 4 deletions
|
|
@ -908,6 +908,17 @@ struct CallView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if coreContext.pipViewModel.pipController?.isPictureInPictureActive ?? false {
|
||||
coreContext.pipViewModel.pipController?.stopPictureInPicture()
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
if !callViewModel.isPaused && TelecomManager.shared.callInProgress
|
||||
&& !(coreContext.pipViewModel.pipController?.isPictureInPictureActive ?? false) {
|
||||
coreContext.pipViewModel.pipController?.startPictureInPicture()
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(
|
||||
width: fullscreenVideo && !telecomManager.isPausedByRemote ? geometry.size.width - (isLandscapeMode ? 160 : 0) : geometry.size.width - 8 - (isLandscapeMode ? 160 : 0),
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ class PIPViewModel: NSObject, AVPictureInPictureControllerDelegate {
|
|||
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
if let call = core.currentCall {
|
||||
self.callStateChangedDelegate = CallDelegateStub(onStateChanged: { (_: Call, cstate: Call.State, _: String) in
|
||||
if cstate != .StreamsRunning && CoreContext.shared.pipViewModel.pipController?.isPictureInPictureActive ?? false {
|
||||
Log.info("\(PIPViewModel.TAG) onCallStateChanged detected, stop picture in picture")
|
||||
CoreContext.shared.pipViewModel.pipController?.stopPictureInPicture()
|
||||
self.callStateChangedDelegate = CallDelegateStub(onStateChanged: { (call: Call, cstate: Call.State, _: String) in
|
||||
if CoreContext.shared.pipViewModel.pipController?.isPictureInPictureActive ?? false {
|
||||
if cstate == .End || cstate == .Error {
|
||||
Log.info("\(PIPViewModel.TAG) call state 'End' or 'Error' detected, stopping picture in picture")
|
||||
CoreContext.shared.pipViewModel.pipController?.stopPictureInPicture()
|
||||
self.callStateChangedDelegate = nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue