Skip to content

Commit 2c66ef7

Browse files
committed
Go to inline when backgrounding the player from fullscreen
1 parent 5c7de30 commit 2c66ef7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ios/THEOplayerRCTView+AppState.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// THEOplayerRCTView+AppState.swift
22

33
import Foundation
4+
import THEOplayerSDK
45
import MediaPlayer
56

67
extension THEOplayerRCTView {
@@ -32,6 +33,14 @@ extension THEOplayerRCTView {
3233
}
3334

3435
@objc private func applicationDidEnterBackground() {
36+
// When player was fullscreen, it will have go to PiP before applicationDidEnterBackground is called,
37+
// because PiP always starts from fullscreen (startsAutomaticallyFromInline pipConfig only applies to inline setup)
38+
// In any other case we push the player back to inline to prevent view index issues on app termination.
39+
if self.presentationModeManager.presentationMode == .fullscreen {
40+
if DEBUG_APPSTATE { PrintUtils.printLog(logText: "[NATIVE] presentationMode is fullscreen while backgrounding => back to inline.") }
41+
self.setPresentationMode(newPresentationMode: PresentationMode.inline)
42+
}
43+
3544
self.isApplicationInBackground = true
3645
}
3746

0 commit comments

Comments
 (0)