简体   繁体   中英

Media control buttons in 360 Video player made using google cardboard and rajawali

I have created a VR video player using Google Cardboard Android SDK and Rajawali VR.
I want to add control buttons like play, pause, stream like a normal video player.
How can I implement this?

  1. Create a button UI inside the Sphere where your 360 video is textured. Try this code:

     Material playBtnM = new Material(); playBtnM.setColorInfluence(0); try { //place the button picture in "res/drawable-nodpi/" playBtnM.addTexture(new Texture("playBtn", R.drawable.play)); } catch(TextureException e) { e.printStackTrace(); } Plane playBtn; playBtn = new Plane(1, 1, 8, 8); playBtn.setScale(-1); playBtn.setMaterial(playBtnMaterial); playBtn.setPosition(0, 0, -2); playBtn.setAlpha(0); this.getCurrentScene().addChild(playBtn); 

You can use Cube or other primitves rather than Plane in Rajawali to map your texture to.

  1. Create your own way to trigger the button. For example, using a focus point at the center. If the focus point is inside the button, then the button is triggered.

  2. Notify the video player. Call start(), pause() or stop() method of MediaPlayer to control playback when the button is triggered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM