mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fea0949bd | ||
|
|
9945f2b339 |
@@ -227,13 +227,15 @@ class OmniPlayer(
|
||||
.build()
|
||||
}
|
||||
|
||||
fun setVideoView(surfaceView: android.view.SurfaceView?) {
|
||||
fun setVideoView(surfaceView: android.view.SurfaceView) {
|
||||
runOnMainThread {
|
||||
if (surfaceView == null) {
|
||||
localPlayer.clearVideoSurface()
|
||||
} else {
|
||||
localPlayer.setVideoSurfaceView(surfaceView)
|
||||
}
|
||||
localPlayer.setVideoSurfaceView(surfaceView)
|
||||
}
|
||||
}
|
||||
|
||||
fun clearVideoView(surfaceView: android.view.SurfaceView) {
|
||||
runOnMainThread {
|
||||
localPlayer.clearVideoSurfaceView(surfaceView)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +300,7 @@ class OmniPlayer(
|
||||
override val renditions by mainThreadProperty {
|
||||
val group =
|
||||
player.currentTracks.groups.firstOrNull { it.isSelected && it.type == C.TRACK_TYPE_VIDEO }
|
||||
?: return emptyArray()
|
||||
?: return@mainThreadProperty emptyArray<Rendition>()
|
||||
|
||||
val currentIndex = when {
|
||||
isAutoQuality -> {
|
||||
@@ -326,7 +328,7 @@ class OmniPlayer(
|
||||
)
|
||||
)
|
||||
}
|
||||
return result.toTypedArray()
|
||||
return@mainThreadProperty result.toTypedArray()
|
||||
}
|
||||
|
||||
override var isAutoQuality by mainThreadProperty {
|
||||
@@ -478,9 +480,6 @@ class OmniPlayer(
|
||||
return tracks.associateBy { it.id }
|
||||
}
|
||||
|
||||
private fun getRenditions(): Array<Rendition> {
|
||||
}
|
||||
|
||||
override fun selectRendition(rendition: Rendition?) {
|
||||
runOnMainThreadSync {
|
||||
if (rendition == null) {
|
||||
|
||||
@@ -154,15 +154,11 @@ class OmniView(val context: ThemedReactContext) :
|
||||
val curPip = activeView.get()
|
||||
when {
|
||||
autoPip == true && curPip == this -> {}
|
||||
autoPip == true && curPip == null -> {
|
||||
autoPip == true -> {
|
||||
activeView = WeakReference(this)
|
||||
updatePictureInPictureParams()
|
||||
}
|
||||
|
||||
autoPip == true -> {
|
||||
throw Error("Only one OmniView can have `autoPip` set at a time.")
|
||||
}
|
||||
|
||||
autoPip == false && curPip == this -> {
|
||||
activeView = WeakReference(null)
|
||||
clearPictureInPictureParams()
|
||||
@@ -180,7 +176,7 @@ class OmniView(val context: ThemedReactContext) :
|
||||
}
|
||||
|
||||
boundPlayer?.localPlayer?.removeListener(this)
|
||||
boundPlayer?.setVideoView(null)
|
||||
boundPlayer?.clearVideoView(surfaceView)
|
||||
boundPlayer = omniPlayer
|
||||
omniPlayer.localPlayer.addListener(this)
|
||||
|
||||
@@ -206,7 +202,7 @@ class OmniView(val context: ThemedReactContext) :
|
||||
|
||||
val omniPlayer = player as? OmniPlayer ?: return
|
||||
boundPlayer?.localPlayer?.removeListener(this)
|
||||
omniPlayer.setVideoView(null)
|
||||
omniPlayer.clearVideoView(surfaceView)
|
||||
boundPlayer = null
|
||||
}
|
||||
|
||||
@@ -414,6 +410,6 @@ class OmniView(val context: ThemedReactContext) :
|
||||
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
||||
surfaceReady = false
|
||||
surfaceView.removeCallbacks(rebuildRunnable)
|
||||
boundPlayer?.setVideoView(null)
|
||||
boundPlayer?.clearVideoView(surfaceView)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,6 +894,7 @@ class VlcPlayer(ctx: Context) :
|
||||
}
|
||||
|
||||
override fun clearVideoSurfaceView(surfaceView: SurfaceView?) {
|
||||
if (surfaceView != null && boundSurfaceView !== surfaceView) return
|
||||
clearVideoSurface()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user