Android - Displaying ExoPlayer in a circle

Viewed 1545

I am trying to display a ExoPlayerView inside a circle, overlaying another ExoPlayer (picture in picture): enter image description here

I have tried putting the 2nd player inside a frame with rounded corners (both this answer and this one) but the player will always escape the parent frame and draw the video's full rectangle.

I found this solution which uses a GLSurfaceView, however this solution uses the classic MediaPlayer and not ExoPlayer.

2 Answers

For the one that's supposed to have rounded corners, you can set in the layout XML file this about it:

app:surface_type="texture_view"

Found this solution here.

The drawback of using this is mainly performance and battery usage (written here) :

Should I use SurfaceView or TextureView? SurfaceView has a number of benefits over TextureView for video playback:

Significantly lower power consumption on many devices. More accurate frame timing, resulting in smoother video playback. Support for secure output when playing DRM protected content. SurfaceView should therefore be preferred over TextureView where possible. TextureView should be used only if SurfaceView does not meet your needs. One example is where smooth animations or scrolling of the video surface is required prior to Android N (see How do I get smooth animation/scrolling of video?). For this case, it’s preferable to use TextureView only when SDK_INT is less than 24 (Android N) and SurfaceView otherwise.

Related