sor*_*ife 5 java sdk android augmented-reality vuforia
我正在尝试 Vuforia 增强现实 SDK 及其示例。我成功编译了 videopayback 示例并在我的平板电脑上运行它。然后我尝试从 url 而不是从设备加载视频。按照示例代码中的注释,在VideoPlayerHelper.java中我注释掉了这部分:
// This example shows how to load the movie from the
// assets folder of the app
// However, if you would like to load the movie from the
// sdcard or from a network location
// simply comment the three lines below
AssetFileDescriptor afd = mParentActivity.getAssets()
.openFd(filename);
mMediaPlayer.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());
afd.close();
Run Code Online (Sandbox Code Playgroud)
并评论了这部分并添加了在线视频文件的网址:
mMediaPlayer.setDataSource("http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4");
Run Code Online (Sandbox Code Playgroud)
我仍然可以编译它而不会出现错误,但是当我将相机指向触发图像时,我要么看到上面有一个十字,要么看到一个沙漏,这似乎意味着它正在加载视频。但什么也没发生。知道我还应该做什么来解决这个问题吗?我在 vuforia 论坛上四处查看。大多数解决方案都说要正确选择视频(那里建议了我正在使用的视频),并且基本上我已经在做的更改如下:
Uri videolink = Uri.parse("http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4");
mMediaPlayer.setDataSource(mParentActivity,videolink);
Run Code Online (Sandbox Code Playgroud)
在进行了您问题中提到的这些更改后,我遇到了同样的问题。但是,在VideoPlayerHelper.java中,我只是注释了 AssetFileDescriptor 代码(3行)
//AssetFileDescriptor afd = mParentActivity.getAssets().openFd(filename);
//mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),afd.getLength());
//afd.close();
Run Code Online (Sandbox Code Playgroud)
并取消注释/更改以下行 mMediaPlayer.setDataSource(" http://giftsoninternet.com/android/EngageApp/VuforiaSizzleReel_1.m4v ");
我通过注释VideoPlayback.java文件中的一行来纠正此问题,其中视频播放器尝试从asset/VideoPlayback文件夹访问视频。
// mMovieName[STONES] = "VideoPlayback/VuforiaSizzleReel_1.mp4";
Run Code Online (Sandbox Code Playgroud)
PS -我只评论了这一行,因为我只使用STONES.jpg目标图像进行 Vuforia 渲染。如果您使用CHIPS,则可以注释该行。