android - 如何在exoplayer android中检测视频是纵向(垂直)还是横向(水平)拍摄
问题描述
我正在使用 exoplayer 播放我的视频。一切正常。我不想拉伸我的视频,如果它是横向模式,我可以使用它来实现它,AspectRatioFrameLayout,现在使用 AspectRatioFrameLayout,使我的横向视频完美,但在 potrait 模式下,它会在左侧和右侧留下黑色空间。下面是示例
肖像模式
横向模式这很好
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/videoFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/player_view_story"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent"
app:use_controller="false" />
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
当我尝试使用下面的代码时,我的肖像模式是完美的,但风景会被拉伸。需要知道是否有一种方法可以同时进行。
player_view_story.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
解决方案
推荐阅读
- octave - 在 Octave 中使用稀疏矩阵广播乘法/除法
- python-3.x - 明白这段代码的含义了吗?
- python - 在 django 视图函数中使用 pandas 从 csv 加载数据
- ios - IOS App crash GAIThread-谷歌标签管理器实现
- javascript - Javascript:我能做些什么来阻止 403 的发生吗?
- sql-server - 哪些版本的 PowerShell、SqlCmlet 和 SQL 数据库引擎兼容?
- python - 为文本文件中的所有时间戳添加 5 秒
- shell - 我试图在我的主目录和我的所有子目录中找到前 10 个更大的文件
- python - 没有名为 pandas 的模块?
- python - Keras时间序列,如何预测下一个时间段