mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
fix(pip): disable pip when casting
This commit is contained in:
@@ -124,6 +124,9 @@ class OmniPlayer(
|
|||||||
override val castStatus: CastStatus
|
override val castStatus: CastStatus
|
||||||
get() = runOnMainThreadSync { computeCastStatus() }
|
get() = runOnMainThreadSync { computeCastStatus() }
|
||||||
|
|
||||||
|
val isCasting: Boolean
|
||||||
|
get() = castContext?.sessionManager?.currentCastSession?.isConnected == true
|
||||||
|
|
||||||
private fun computeCastStatus(): CastStatus {
|
private fun computeCastStatus(): CastStatus {
|
||||||
val cc = castContext ?: return CastStatus.UNSUPPORTED
|
val cc = castContext ?: return CastStatus.UNSUPPORTED
|
||||||
return when (cc.castState) {
|
return when (cc.castState) {
|
||||||
|
|||||||
@@ -185,7 +185,10 @@ class OmniView(val context: ThemedReactContext) :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boundPlayer == null || boundPlayer?.localPlayer?.isPlaying != true) {
|
if (boundPlayer == null ||
|
||||||
|
boundPlayer?.localPlayer?.isPlaying != true ||
|
||||||
|
boundPlayer?.isCasting == true
|
||||||
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +222,8 @@ class OmniView(val context: ThemedReactContext) :
|
|||||||
val autoEnterEnabled =
|
val autoEnterEnabled =
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
|
||||||
autoPip == true &&
|
autoPip == true &&
|
||||||
boundPlayer?.localPlayer?.isPlaying == true
|
boundPlayer?.localPlayer?.isPlaying == true &&
|
||||||
|
boundPlayer?.isCasting != true
|
||||||
activity.setPictureInPictureParams(buildPipParams(autoEnterEnabled))
|
activity.setPictureInPictureParams(buildPipParams(autoEnterEnabled))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user