media icon indicating copy to clipboard operation
media copied to clipboard

Controlls position in a horizontal orientation with RESIZE_MODE_FILL

Open sid1605 opened this issue 1 year ago • 2 comments

Version

Media3 1.2.1

More version details

media3 version 1.2.1 all other latest dependencies

Devices that reproduce the issue

tab

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

when click on controls

Expected result

controls should open inside the player

Actual result

controls opend outside of player

Media

i'm making a video player in jetpack compsoe using media3 exo player. thae problem i'm facing is that in a horizontal tab mode i give an aspect ration of 16/9f to my player and defined 60% of total screen width for the player so the default controlls should be visible inside the defined 60% width but they are visible in the end of screen or outside the defined area for the video player. i'm mentioning the screenshots for my problem

https://stackoverflow.com/questions/78031876/im-facing-an-issue-regarding-the-media3-exo-player-controlls-position-in-a-hori/78032193#78032193

Screenshot 2024-02-21 113358

Bug Report

  • [X] You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

sid1605 avatar Feb 22 '24 05:02 sid1605

it don't work as there isn't any property as Controlls position that i could set as RESIZE_MODE_FILL in horizontal orientation.

sid1605 avatar Feb 29 '24 06:02 sid1605

@Composable
fun XpPlayer() {
    val context = LocalContext.current
    fun buildCustomDrmSessionManager(): DrmSessionManager {
        val userAgent = "1"
        val dataSourceFactory = DefaultHttpDataSource.Factory().setUserAgent(userAgent)
            .setDefaultRequestProperties(mapOf("X-AxDRM-Message" to ""))
        val drmCallback: MediaDrmCallback = HttpMediaDrmCallback("", dataSourceFactory)
        val exoMediaDrmProvider: ExoMediaDrm.Provider = FrameworkMediaDrm.DEFAULT_PROVIDER
        return DefaultDrmSessionManager.Builder()
            .setUuidAndExoMediaDrmProvider(C.WIDEVINE_UUID, exoMediaDrmProvider).build(drmCallback)
    }

    fun buildDrmMediaItemWithDrmConfig(): MediaItem {
        return MediaItem.fromUri("https://travelxp.s.llnwi.net/watch1/61025c11781ce3c543f5abcd/manifest_v4.mpd")
    }

    val customDrmSessionManager = buildCustomDrmSessionManager()
    val mediaSourceFactory =
        DefaultMediaSourceFactory(context).setDrmSessionManagerProvider { customDrmSessionManager }

    val loadControl = DefaultLoadControl.Builder().setBufferDurationsMs(
        10000, 20000, 2000, 10000
    ).build()

    val exoPlayer = remember {
        ExoPlayer.Builder(context, mediaSourceFactory).setLoadControl(loadControl).build().also {
            it.playWhenReady = true
        }.apply {
            setMediaItem(buildDrmMediaItemWithDrmConfig())
            prepare()
        }
    }

    DisposableEffect(Unit) {
        onDispose {
            exoPlayer.release()
        }
    }

    AndroidView(modifier = Modifier
        .border(2.dp, Color.Red)
        .width(800.dp).aspectRatio(16/9f),
        factory = {
        PlayerView(context).apply {
            useController = true
            resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FILL
            player = exoPlayer
            setShowBuffering(PlayerView.SHOW_BUFFERING_WHEN_PLAYING)
            hideController()
            layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)
        }
    })
}

this is the code of my player. i put this code in my main activity. when i make player to be full screen then it is okay and then playback speed and audio selection dialog opens inside the player but when i make player with som height and width as in code then these dialogs(playback speed and audio selection) opens outside of the player. these are screen shotls related to this,

Screenshot_20240229_133508

sid1605 avatar Feb 29 '24 07:02 sid1605

when i added modifier = Modifier.width(700.dp).aspectRatio(16/9f)

 AndroidView(
            factory = { ctx ->
                PlayerView(ctx).apply {
                    player = exoPlayer
                    useController = true // Set to false if you want to hide the controller
                    resizeMode = RESIZE_MODE_FILL
                }
            },
        modifier = Modifier.width(700.dp).aspectRatio(16/9f)
        )

in the AndroidView modifier, then it it showing the error that can be seen in the image

image

the control dialog opens outside of the playerView

sid1605 avatar Mar 28 '24 13:03 sid1605

Potential duplicate of https://github.com/androidx/media/issues/1237. Investigation of Compose interaction with SurfaceView and AspectRatioFrameLayout.

oceanjules avatar May 08 '24 18:05 oceanjules