brianwernick / ExoMedia

An Android ExoPlayer wrapper to simplify Audio and Video implementations
Apache License 2.0
2.14k stars 380 forks source link

`setVideoRotation` Not Rotating Video #764

Closed brianwernick closed 2 years ago

brianwernick commented 2 years ago
Include the following:

Reproduction Steps

  1. Update the VideoPlayerActivity to set the video rotation to 135 in the init
  2. Play a video, e.g. Caminandes 2

Expected

The video plays with the picture rotated by 135 degrees

Actual

The video plays with the picture clipped by a rectangle rotated by 135 degrees ExoMedia Video Rotation

brianwernick commented 2 years ago

When trying the same setup with app:useTextureViewBacking="true" the picture is correctly rotated

brianwernick commented 2 years ago

It's been a while since we initially implemented the functionality to rotate so I need to do some research to refresh my memory. Unfortunately the SurfaceView handling of rotation only rotates the cutout and doesn't actually rotate the content, this is due to how the SurfaceView works. This is the same reason that the ExoPlayer itself doesn't handle video rotation for the SurfaceView (see Issue #3385).

However, the TextureView does rotate both the frame and the media so if you need to specify the media rotation manually you will need to use the TextureView backing instead (by adding app:useTextureViewBacking="true" to you VideoView definition in XML).

I will update the documentation for the setVideoRotation function to include this information to help those in the future.