By vinny82
on Wed, 04/10/2013 - 09:58
Hi , I was look to start video automatically as soon the target is detected. I was successful by applying below code. But now i'm not able to pause video on single tap. I confirmed issue is due to change in code in VideoRenderer.java to play video automatically when target is detected. please help. Single tap and onPause functions are working but this code is not allowing to pause the video. I need both the functionalities automatic palying of video when target is detected and pausing video on single tap. for (int i = 0; i < VideoPlayback.VIDEO_TARGETS; i++) { // Ask whether the target is currently being tracked and if so react // to it if (isTracking(i)) { // If it is tracking reset the timestamp for lost tracking // mLostTrackingSince[i] = -1; if (mVideoPlayerHelper[i] != null) mVideoPlayerHelper[i].play(false, -1); } else { // If it isn't tracking // check whether it just lost it or if it's been a while // if (mLostTrackingSince[i] < 0) // mLostTrackingSince[i] = SystemClock.uptimeMillis(); // else { // // If it's been more than 2 seconds then pause the player // if ((SystemClock.uptimeMillis() - mLostTrackingSince[i]) > // 2000) { if (mVideoPlayerHelper[i] != null) mVideoPlayerHelper[i].pause(); // } // } } }
Video not pause due to automatic playing
Thank you for your code. it save my time :D
Video not pause due to automatic playing
Video not pause due to automatic playing
Hi Moderators,
Please help me out. Its critical for me.
Video not pause due to automatic playing
Hi, when (from which function) are you executing the code below (the one that you pasted) ?
Video not pause due to automatic playing
Hi , This code exists in draw Frame . This is called after following lines
Video not pause due to automatic playing
Ok, then the issue is that at every single frame you are telling the video to play (in your code) as it is tracked (isTracking is true)
Video not pause due to automatic playing
i think its necessary because i want to play video automatically as soon it detects target.
how should i detect it's first time?
Video not pause due to automatic playing
Just tried with boolean flag and my video gets black.
if( is(Tracking(i) and VIDEO_PLAY ==false)
Video not pause due to automatic playing
The issue is resolved.
solution posted here
https://developer.vuforia.com/forum/android/how-play-video-automatically-when-we-target-found
Video not pause due to automatic playing
Great !