Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlls position in a horizontal orientation with RESIZE_MODE_FILL #1120

Closed
1 task done
sid1605 opened this issue Feb 22, 2024 · 4 comments
Closed
1 task done

Controlls position in a horizontal orientation with RESIZE_MODE_FILL #1120

sid1605 opened this issue Feb 22, 2024 · 4 comments
Assignees

Comments

@sid1605
Copy link

sid1605 commented Feb 22, 2024

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

@oceanjules oceanjules self-assigned this Feb 22, 2024
@oceanjules oceanjules changed the title i'm facing an issue regarding the media3 exo player controlls position in a horizoantal tab Controlls position in a horizontal orientation with RESIZE_MODE_FILL Feb 22, 2024
@sid1605
Copy link
Author

sid1605 commented Feb 29, 2024

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
Copy link
Author

sid1605 commented Feb 29, 2024

@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
Copy link
Author

sid1605 commented Mar 28, 2024

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

@oceanjules
Copy link
Contributor

Potential duplicate of #1237. Investigation of Compose interaction with SurfaceView and AspectRatioFrameLayout.

@oceanjules oceanjules added duplicate and removed bug labels May 8, 2024
@androidx androidx locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants