AB1209 AB1209 - 1 year ago 234
Android Question

How to perform zoom in/out on VideoView in android?

I am using VideoView & running videos from resources.

I want to know, is there any way by which I can perform zoom in/out functionality on running video?

Answer Source

OK I had this issue and solved it by removing the VideoView and replaced it with a TextureView. You can then apply a Matrix transformation which includes lots of options including zooming.

The method for the Matrix I would use is the postScale() method. You can apply multiple effects pre and post, which you can view in the documentation.


Here is a custom VideoView from a running project that we used. You can decalre it in XML Layouts and it has a function called setMatrix() which takes a Matrix argument. The original code was written by Alex Ross, we then modified it to deal with the Matrix functionality.