AB1209 AB1209 - 5 months ago 96
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

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.

Edit

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.

http://pastebin.com/KwQvBWs1