相关疑难解决方法(0)

How to have similar mechanism of center-crop on ExoPlayer's PlayerView , but not on the center?

Background

We record a video of the user's face, and usually the face is located at the upper half of the video.

Later we wish to view the video, but the aspect ratio of the PlayerView might be different than the one of the video, so there needs to be some scaling and cropping.

The problem

我发现缩放PlayerView它的唯一方法是将它显示在它所拥有的整个空间中,但保持纵横比(当然需要在需要时进行裁剪),是通过使用app:resize_mode="zoom".以下是中心裁剪的示例:http://s000.tinyupload.com/?file_id = 00574047057406286563.显示内容的视图具有相似的宽高比越多,所需的裁剪越少.

但这仅适用于中心,这意味着它需要0.5x0.5的视频点,并从那一点开始进行缩放.这导致许多丢失视频重要内容的情况.

例如,如果我们有一个以纵向拍摄的视频,并且我们有一个方形的PlayerView并想要显示顶部区域,那么这将是可见的部分:

PlayerView

当然,如果内容本身是正方形,并且视图也是正方形,则应该显示整个内容,而不进行裁剪.

我试过的

我试过通过Internet,StackOverflow(这里)和Github搜索,但我找不到怎么做.我发现的唯一线索是关于AspectRatioFrameLayout和AspectRatioTextureView,但我没有找到如何将它们用于此任务,如果它甚至可能的话.

我被告知(这里)我应该使用普通TextureView,并直接提供它 …

android crop scale exoplayer

19
推荐指数
1
解决办法
1134
查看次数

标签 统计

android ×1

crop ×1

exoplayer ×1

scale ×1