mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-06 14:16:58 +00:00
fix(pip): disable pip when casting
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user