我按照 Mog 在帖子中的建议进行操作:
如何使用 Google Cardboard SDK for Unity 创建 VR 视频播放器 https://stackoverflow.com/questions/30277895/how-to-create-vr-video-player-using-google-cardboard-sdk-for-unity/30405578#30405578
这是我的代码片段
1.
在 MainActivity 中onSurfaceCreated()
方法中,我初始化一个纹理并将其绑定到 GL,并创建一个与它们关联的表面和媒体播放器。
- in the
onNewFrame()
方法,我按照莫格在帖子中所说的更新纹理
我将我的短视频保存为small.mp4在raw文件夹中,但是,在我启动我的应用程序后,两侧都是空白的,并且视频的声音实际上正在播放。
我面临着类似的问题,为了完成这个任务,我使用了很棒的RajawaliVR 图书馆 https://github.com/Rajawali/RajawaliVR/.
我使用的代码:
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);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)