Has anyone had success putting `AVPlayer`/`AVPlaye...
# compose-ios
a
Has anyone had success putting `AVPlayer`/`AVPlayerViewController` inside a
HorizontalPager
? 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?
FYI, this is the AVPlayer code I've got on the iOS side for my
SimplePlayer
Copy code
@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 = { _ -> },
    )
}
a
Have you tried the latest dev build? I believe it was fixed (or at least improved) here
a
Oh thank you! I'll give it a try
e
It almost certainly has been fixed and then further improved. Don’t hesitate to report any issues you have, or share your proposals 🙂
a
Yeah I actually tried the latest 1.7.0 dev and it worked great! Can't wait for 1.7 release!
❤️ 3