googlevr / cardboard

Open source Cardboard SDK and samples
Other
1.48k stars 253 forks source link

Playback video and images with Android MediaPlayer #24

Open azizi436 opened 4 years ago

azizi436 commented 4 years ago

Hi I want to playback video and image with Android MediaPlayer like below

` String Url="https://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4";

          MediaPlayer mp=new MediaPlayer();

          mp.setDataSource(Url);

          mp.prepare();`

but i don't know how to use MediaPlayer in this project and where can i use it ,Could you help me?

jballoffet commented 4 years ago

Cardboard SDK currently doesn’t have a Java API, you will have to write one yourself. Please star issue #19 if you are interested in us providing a Java API.

Regarding the MediaPlayer question, in order to be able to render it with Cardboard SDK, you need to get an OpenGL ES texture using Android's SurfaceTexture. Then you will be able to render it normally using OpenGL ES.

Consti10 commented 4 years ago

Hello, here is a simple wrapper around OpenGL SurfaceTexture and android lifecycle that uses MediaPlayer for decoding: XVideoPlayerSurfaceTexture.