ExoPlayer在Kotlin Compose中视频宽度拉伸问题求助
ExoPlayer在Kotlin Compose中视频拉伸问题
我正在开发一款Android应用,需使用AspectRatioFrameLayout.RESIZE_MODE_ZOOM让视频铺满屏幕,但在Pixel 7a(Android 14)真机和模拟器上,视频宽度出现拉伸。切换至RESIZE_MODE_FIXED_HEIGHT后问题仍存在。
- 应用退至后台再从最近应用打开时,视频显示恢复正常
- 使用Android View系统而非Kotlin Compose时无此Bug
相关代码
ExoplayerscalingproblemTheme { // A surface container using the 'background' color from the theme Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { BoxWithConstraints(modifier = Modifier.fillMaxSize()) { AndroidView( modifier = Modifier.fillMaxSize(), factory = { PlayerView(it).apply { layoutParams = ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, ) this.useController = false setKeepContentOnPlayerReset(true) this.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM } }, update = { it.player = exoPlayer } ) } } }
问题截图
当前异常显示:
期望正常显示:
已创建仓库用于复现该问题,另有使用Android View而非Compose的分支。
恳请各位提供技术帮助,感谢!
内容的提问来源于stack exchange,提问作者H.Taras
相关产品推荐
相关产品推荐

