我想使用Vuforia Android Native API从URL播放视频。
我更改了VideoPlayback示例中的代码,如下所示:
VideoPlayback.java
Video from Url
mMovieName[STONES] = "..Youtube Video link..";
mMovieName[CHIPS] = "..Youtube Video link..";
mMovieName[celebVM_LOGO] = "..Youtube Video link..";
我从VideoPlayerHelper.java中删除了一些代码,如下所示:
for Video from Url, in Load method
AssetFileDescriptor afd = mParentActivity.getAssets().openFd(filename);
mMediaPlayer.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());
afd.close();
补充:
mMediaPlayer.setDataSource(filename);
删除代码
try {
AssetFileDescriptor afd = mParentActivity.getAssets().openFd(filename);
afd.close();
} catch (Exception e) {
Log.d(LOGTAG, "File does not exist");
mCurrentState = MEDIA_STATE.ERROR;
mMediaPlayerLock.unlock();
mSurfaceTextureLock.unlock();
return false;
}
它没有用,有人可以提出原因吗?有关更多信息,请参阅此链接: https://developer.vuforia.com/forum/android/how-work-video-url-videoplayback
答案 0 :(得分:0)
我相信它只适用于实际视频的链接,例如this one。
答案 1 :(得分:0)
mMediaPlayer.setDataSource("../video.mp4"); //or any video type