vuforia AR SDK – Unable to play video via URL
I’m experimenting with the Vuforia Augmented Reality SDK and its examples. I successfully compiled the videopayback example and ran it on my tablet. Then I tried loading the video from the url instead of from the device.
Following the comments in the sample code, I commented out this part in 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();
And commented on this section and added a url: of a video file online
mMediaPlayer.setDataSource("http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4");
I
can still compile it without errors, but when I point the camera at the trigger image, I either see a cross on it or an hourglass, which seems to mean that it’s loading video. But nothing happened. Any idea what else I should do to fix this? I looked around on the vuforia forum. Most of the solutions say to choose the video correctly (the one I was using there suggested to me) and basically the changes I’m already working on, like doing this:
Uri videolink = Uri.parse("http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4");
mMediaPlayer.setDataSource(mParentActivity,videolink);
Solution
I had the same issue after finishing those changes mentioned in your question. However, in the VideoPlayerHelper .java, I just commented out the AssetFileDescriptor code (3 lines).
//AssetFileDescriptor afd = mParentActivity.getAssets().openFd(filename);
mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),afd.getLength());
afd.close();
and uncomment/change the following line mMediaPlayer.setDataSource(“ http://giftsoninternet.com/android/EngageApp/VuforiaSizzleReel_1.m4v “);
I corrected this by commenting a line in the VideoPlayback.java file where the video player is trying to access the video from the assets/VideoPlayback folder.
// mMovieName[STONES] = "VideoPlayback/VuforiaSizzleReel_1.mp4";
P.S. – I only commented on this line because I only use STONES.jpg target images for Vuforia rendering. If you are using CHIPS, you can comment the line instead.