Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to flip(mirror effect) a video in a VideoView?

I know there are ways using TextureViews and some other ways, but can we do a video flip in a VideoView, I tried using the method scaleType of X axis to -1, but just getting a black screen. Is there no way to do a simple video flip for a video being played in a videoview? Am I forced to use a TextureView or other methods?

like image 276
king_below_my_lord Avatar asked Apr 18 '16 07:04

king_below_my_lord


1 Answers

As you said, the best option is to use TextureView... Android's VideoView can only play videos straight and not mirrored.

If you want your app to play a video mirrored (for instance if the video was recorded using a front camera), you will need to use a TextureView, which can be easily mirrored by specifying android:scaleX=-1 in the XML file, or textureView.setScaleX(-1) in the code. (source)

like image 108
Alvaro Avatar answered Sep 28 '22 15:09

Alvaro