Android Virtual Reality VideoView Tutorial

Virtual Reality is an immersive computer system that mimics the world we see around us. By using VR, we able to view 360 angles of the virtual environment through the screen. Mobile VR has now become more and more popular in the mobile phones. We use VR technology to implements in the games, videos, and maps in order to get a good experience. There have many big companies such as Google, Samsung and Facebook are investing much money in VR technology for the future. Google provides a library to let the Android developer easier to implement VR on the mobile devices. In this tutorial, I will guide you on how to implement android Virtual Reality VideoView in the project.

Creating a New Project

1. Open Android Studio IDE in your computer.
2. Create a new project and Edit the Application name to “VRVideoViewTutorial”.
(Optional) You can edit the company domain or select the suitable location for current project tutorial. Then click next button to proceed.
3. Select Minimum SDK (API 15:Android 4.0.3 (IceCreamSandwich). I choose the API 15 because many Android devices currently support more than API 15. Click Next button.
4. Choose “Empty Activity” and Click Next button
5. Lastly, press finish button.

Add new dependency

In the gradle, add VR dependency in order to add video view to your activity.

Edit main_activity.xml layout

Go to the main_activity.xml and add VRView widget and seekbar. Copy and paste the source code below into your file.

Add volume on and off button image

Go to res>drawable add two button image for volume on and off, you can find it online or download our source code.

Download VR video

Add your VR video in the app > assets, you can find it on //www.mettle.com/360vr-master-series-free-360-downloads-page

Edit MainActivity.java class

Go to MainActivity.java class and copy and paste the source code below. You need to change  videoWidgetView.loadVideoFromAsset(“congo.mp4”, options) in order to load your video.

Run Your Project

Lastly, you can now run this project and test the vr in your smart phone, if you have vr headset you can try to play around with it.

(Android Virtual Reality VideoView)

Source Code

(Visited 209 times, 1 visits today)
Advertisements

Kristofer Ng

A crazy android and web developer. Passion on developing android application and exploring new technology as a hobby.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

GET YOUR EBOOK FOR FREE

Unlock free ebook "Beginning Programming ALL-IN-ONE Desk Reference for DUMMIES" now!

We will send a copy to your email