如何通过Google CardBoard Android SDK制作简单的VR视频播放器 [英] How to make a simple VR video player by Google CardBoard Android SDK
本文介绍了如何通过Google CardBoard Android SDK制作简单的VR视频播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是Mog在帖子中的建议:
Im following as what Mog suggest in the post:
如何使用Google Cardboard SDK for Unity创建VR视频播放器
这是我的代码段
1.
在MainActivity的onSurfaceCreated()
方法中,我初始化一个纹理并将其绑定到GL,并创建一个曲面和与其关联的媒体播放器.
1.
In the MainActivity's onSurfaceCreated()
method , I initialise a texture and bind it to GL, and create a surface and a mediaplayer associated to them.
- 在
onNewFrame()
方法中,我按照Mog在帖子中所说的那样更新了纹理
- in the
onNewFrame()
method, I update the texture as what Mog said in the post
我将我的短视频保存为raw.mp4在原始文件夹中,但是,启动我的应用程序后,两边都是空白,并且视频的声音实际上正在播放.
I saved my short video as small.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 was facing a similar problem in order to get this done I've used the great RajawaliVR library.
我使用的代码:
streamingTexture = new StreamingTexture("video", mediaPlayer);
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);
getCurrentScene().addChild(sphere);
这篇关于如何通过Google CardBoard Android SDK制作简单的VR视频播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文