Controlls position in a horizontal orientation with RESIZE_MODE_FILL
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
Bug Report
- [X] You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
it don't work as there isn't any property as Controlls position that i could set as RESIZE_MODE_FILL in horizontal orientation.
@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,
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
the control dialog opens outside of the playerView
Potential duplicate of https://github.com/androidx/media/issues/1237. Investigation of Compose interaction with SurfaceView and AspectRatioFrameLayout.