I am a new man in these area. I am trying to change a program in github to play video for cardboard now.
I modified the MyRenderer by using StreamingTexture.
public class MyRenderer extends RajawaliCardboardRenderer {
public MyRenderer(Context context) {
super(context);
}
private MediaPlayer mMediaPlayer;
private StreamingTexture streamingTexture;
@Override
protected void initScene() {
mMediaPlayer = MediaPlayer.create(this.getContext(), R.raw.test);
streamingTexture = new StreamingTexture("video", mMediaPlayer);
Sphere sphere = createPhotoSphereWithTexture(streamingTexture);
getCurrentScene().addChild(sphere);
getCurrentCamera().setPosition(Vector3.ZERO);
getCurrentCamera().setFieldOfView(75);
}
private static Sphere createPhotoSphereWithTexture(ATexture texture) {
Material material = new Material();
material.setColor(0);
try {
material.addTexture(texture);
} catch (ATexture.TextureException e) {
throw new RuntimeException(e);
}
Sphere sphere = new Sphere(50, 64, 32);
sphere.setScaleX(-1);
sphere.setMaterial(material);
return sphere;
}
}
I saved my short video as test.mp4 in the raw folder, however , after I start my app the two sides are blank, and the video's sound is actually playing.
I need some help. Thank you very much!
I got 360 video with head tracking in a carboard working like this.
Extend your class using RajawaliVRRenderer
next use the following initScene():
After initiating the scene you want to update the videoTexture on every render, so add:
And last but not least you want to update the camera for movement tracking for the cardboard like this:
Also, to pass some other listeners forward to the carboard sdk you will need these functions: