Andrew Watson
07/22/2024, 11:30 PMHorizontalPager
? I'm putting a simple AVPlayer in one page of a pager I've got, and it displays fine, but I lose the ability to swipe away from that tab once the AVPlayer tab is showing. You can see it in this video, I swipe back and forth between some image pages and then I swipe to the AVPlayer tab and I can't leave it. That's why the video just sits there once it's showing; I'm trying to swipe away but it won't let me.
Is AVPlayer overriding gestures? I tried some code to disable gesturerecognizers, to no avail. Any tips?Andrew Watson
07/22/2024, 11:36 PMSimplePlayer
Andrew Watson
07/22/2024, 11:36 PM@Composable
actual fun SimplePlayer(
modifier: Modifier,
mediaUrl: String,
) {
val avPlayer = remember { AVPlayer(uRL = NSURL.URLWithString(mediaUrl)!!) }
val avPlayerViewController = remember {
AVPlayerViewController()
.also { it.updatesNowPlayingInfoCenter = false }
}
UIKitView(
modifier = modifier,
factory = {
avPlayerViewController.player = avPlayer
avPlayerViewController.showsPlaybackControls = false
val playerContainer = UIView()
playerContainer.apply {
addSubview(avPlayerViewController.view)
}
playerContainer
},
onRelease = { },
onResize = { view: UIView, rect: CValue<CGRect> ->
CATransaction.begin()
CATransaction.setValue(true, kCATransactionDisableActions)
view.layer.setFrame(rect)
avPlayerViewController.view.layer.frame = rect
CATransaction.commit()
},
update = { _ -> },
)
}
Alexander Zhirkevich
07/23/2024, 6:12 AMAndrew Watson
07/23/2024, 4:30 PMElijah Semyonov
07/24/2024, 1:22 PMAndrew Watson
07/24/2024, 4:36 PM