Log in or register to post comments

How to play video automatically when we target is found

April 15, 2013 - 3:39am #1

Hi Moderators,

 

Please help me , i need to play video automatically when target detects instead of touch.

 

 

// If you would like the video to start playing as soon as it starts
// tracking
// and pause as soon as tracking is lost you can do that here by
// commenting
// the for-loop above and instead checking whether the isTracking()
// value has
// changed since the last frame. Notice that you need to be careful not
// to
// trigger automatic playback for fullscreen since that will be
// inconvenient
// for your users.
 
Regards
Vineet Aggarwal

How to play video automatically when we target is found

December 20, 2017 - 12:39am #11

Can anyone help me how to play video every time from starting point like if i have two different markers with two different videos when first video play in the target but not completed and i start the second video from second marker after that when i view the first target again then video should start from starting point not from that point where it paused...

How to play video automatically when we target is found

March 19, 2016 - 3:56am #10

did you play video now?

How to play video automatically when we target is found

November 30, 2015 - 4:09am #9

hi

pleas learn me how fixe this problem by a video file

 

tnx

How to play video automatically when we target is found

November 24, 2015 - 5:10am #8

Good day,

 

This link: https://developer.vuforia.com/resources/sample-apps/video-playback-sample-app

Does not work any more - where can I find this now?

How to play video automatically when we target is found

November 20, 2015 - 8:59pm #7

Where is that code for android studio?

Play any video from asset when image target is found in android.

June 16, 2015 - 1:04am #6

Hi friends ,

I want to play a video when Image Target is found in android , currently the sample is working fine of rendering the Teapot on the image...
So please help me that how to play video (any video) from the assets folder.

Thank you

How to play video automatically when we target is found

May 21, 2014 - 12:29am #5

I'm trying to follow this guy but i don't know where to replace the code (that I want to play  video automatically in videoplayback. i got confused, anyone help me.

 

    

How to play video automatically when we target is found

April 16, 2013 - 3:29am #4

Great ! Glad to help (and thanks for sharing your solution).

 

How to play video automatically when we target is found

April 16, 2013 - 3:17am #3

Hi Alessandro,

 

The issue is resolved now.

Lot of thanks for your help.

 

Here is piece of code taht can help users who are facing this issue.

Videoplaybackrenderer.java

public void playVideo(final String text) {
		// We use a handler because this thread cannot change the UI
		mActivity.runOnUiThread(new Runnable() {
			@Override
			public void run() {

				// The following opens a pre-defined URL based on the name of
				// trackable detected
				for (int i = 0; i < VideoPlayback.VIDEO_TARGETS; i++) {
					if (mMovieName[i].startsWith(text)) {

						if (mVideoPlayerHelper[i] != null)
							mVideoPlayerHelper[i].play(false, -1);
					}
				}
			}
		});
	}

 

Videoplayback.cpp

 

  if (state.getNumTrackableResults() == 0)
        lastTrackableId = -1;
 
    // Did we find any trackables this frame?
    for(int tIdx = 0; tIdx < state.getNumTrackableResults(); tIdx++)
    {
        // Get the trackable:
        const QCAR::TrackableResult* trackableResult = state.getTrackableResult(tIdx);
 
        const QCAR::ImageTarget& imageTarget = (const QCAR::ImageTarget&) trackableResult->getTrackable();
 
        if (imageTarget.getId() != lastTrackableId)
        {
           jstring js= env->NewStringUTF(imageTarget.getName());
           jclass javaClass = env->GetObjectClass(obj);
           jmethodID method = env->GetMethodID(javaClass, "playVideo", "(Ljava/lang/String;)V");
           env->CallVoidMethod(obj, method, js);
           lastTrackableId = imageTarget.getId();
        }
...

How to play video automatically when we target is found

April 15, 2013 - 4:00am #2

Hi Vineet,

these are the best resources to read in order to achieve that:

https://developer.vuforia.com/resources/dev-guide/open-web-site-and-display-toast-target-detection

the link above explains how to perform some action in Java (such as displaying a Toast message) when the trackable is detected; you can adjust that to play the video instead of displaying a Toast message

And the following is the videoplayback sample app page, where you can find a sample code walk-through (see the "Sample Specific Notes" foldable item):

https://developer.vuforia.com/resources/sample-apps/video-playback-sample-app

 

Log in or register to post comments