Community

Topic: Android SDK

Video mesh through custom data. (SOLVED)

George
Saturday, July 8, 2017

Hello support. Am using your sdk trial version on android. I want to create another video mesh and display this video but this has to be done when the marker is found and then i retreive the url to the video through the marker custom data. Please how can i do this.
Also when i supply a url to my video hosted on youtube the pikkart sample code does not play this video. It shows me a sign of downloading then it shows a x symbol like a "not downloaded" how can i solve this. Thanks

user profile image
Support Team  (expert)
Monday, July 10, 2017

Hi, I suppose you are using the augmented video tutorial.
After defining a VideoMesh in the ArRenderer class, the initMesh method is called, and it takes a video string url as the second parameter (movieUrl), in the case of the tutorial the video is local but the url can refer to a hosted video on your server, in this way the video will play when the marker is recognized. However, if you want the video to start after the marker has been recognized, you can make some changes to the tutorial classes.
First of all in the ArRenderer class you can define the videoMesh as follows:

VideoMesh = new VideoMesh ((Activity) context);

VideoMesh.InitMesh (context.getAssets (), "", "media / pikkart_keyframe.png", 0, false, null);

This will cause the video not to play back to the recognition, then in the VideoMesh class in the initMesh method, you can comment the lines

// boolean canFullscreen = true;

// if (mPikkartVideoPlayer! = Null) {
// if (mPikkartVideoPlayer.setupSurfaceTexture (mVideoTexture_GL_ID)) {
// canFullscreen = false;
//}
// //mPikkartVideoPlayer.load(mMovieUrl,canFullscreen,mAutostart,mSeekPosition);
//}

And define a public method with the removed part:

public void loadVideo (String videoUrl) {

boolean canFullscreen = true;
If (mPikkartVideoPlayer! = Null) {
If (mPikkartVideoPlayer.setupSurfaceTexture (mVideoTexture_GL_ID)) {
canFullscreen = false;
}
mPikkartVideoPlayer.load (videoUrl, canFullscreen, mAutostart, mSeekPosition);
}
}

Now in the ARRenderer class you can define the public method

public VideoMesh getVideoMesh () {

return videoMesh; // your mesh variable name
}

Then define the method in the ARView class

public ARRenderer getRenderer () {

return _renderer;
}

At this point in MainActivity in the markerFound (Marker marker) method you can load the url you entered in your marker's customData:

if (marker.getId ().equals ("your_marker_id")) {

m_arView.getRenderer (). getVideoMesh (). loadVideo (marker.getCustomData());
}

You can not play videos directly from youtube, the video must be directly linked.

Sign in to add a comment