fix(pip): disable pip when casting

This commit is contained in:
2026-07-27 00:29:05 +02:00
parent 6ab5743f94
commit 12be950ea0
2 changed files with 9 additions and 2 deletions
@@ -124,6 +124,9 @@ class OmniPlayer(
override val castStatus: CastStatus
get() = runOnMainThreadSync { computeCastStatus() }
val isCasting: Boolean
get() = castContext?.sessionManager?.currentCastSession?.isConnected == true
private fun computeCastStatus(): CastStatus {
val cc = castContext ?: return CastStatus.UNSUPPORTED
return when (cc.castState) {
@@ -185,7 +185,10 @@ class OmniView(val context: ThemedReactContext) :
return
}
if (boundPlayer == null || boundPlayer?.localPlayer?.isPlaying != true) {
if (boundPlayer == null ||
boundPlayer?.localPlayer?.isPlaying != true ||
boundPlayer?.isCasting == true
) {
return
}
@@ -219,7 +222,8 @@ class OmniView(val context: ThemedReactContext) :
val autoEnterEnabled =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
autoPip == true &&
boundPlayer?.localPlayer?.isPlaying == true
boundPlayer?.localPlayer?.isPlaying == true &&
boundPlayer?.isCasting != true
activity.setPictureInPictureParams(buildPipParams(autoEnterEnabled))
}