Como usar o RajawaliVR ou o Rajawali para reproduzir um vídeo em 360 °
Estou tendo dificuldades para descobrir como usar o Rajawali para reproduzir um vídeo em 360 °. Para conseguir isso, tentei todas as soluções que pude encontrar na Internet, mas falhei.
Primeiro, usei o RajawaliCardboard e deixei a MainActivity estender-se deCardboardActivity
. Ao mesmo tempo, emMyRenderer
classe, deixo essa classe estender-se doRajawaliCardboardRenderer
classe. NoMyRenderer
classe, eu anulei oinitScene()
função:
protected void initScene() {
StreamingTexture mTexture = null;
if (externalMemoryAvailable())
{
mVideoPath = Environment.getExternalStorageDirectory().getAbsolutePath()+"/testVideo.mp4";
try{
mPlayer = new MediaPlayer();
mPlayer.setDataSource(mVideoPath);
}catch(IllegalArgumentException e){
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mPlayer.prepare();
} catch (IOException t) {
t.printStackTrace();
}
mTexture = new StreamingTexture("video", mPlayer);
}
Sphere sphere = createPhotoSphereWithTexture(mTexture);
getCurrentScene().addChild(sphere);
getCurrentCamera().setPosition(Vector3.ZERO);
getCurrentCamera().setFieldOfView(75);
}
private 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;
}
O programa pode ser executado sem nenhum erro, mas a tela é preta e sem imagem.
Quero perguntar o que devo fazer para melhorar meu programa e por que devo fazer para reproduzir um vídeo usando o Rajawali. Quem pode me ajudar?