Log in or register to post comments

VideoPlayback sample, running the video's automatically

September 20, 2012 - 6:46am #1

I am exploring the sample app for VideoPlayback on android. How can I trigger the video play automatically instead of clicking on the video frame?

Also what all video/ animation formats are supported?

 

VideoPlayback sample, running the video's automatically

May 7, 2018 - 10:02am #8

sbeck27 wrote:

Did anyone figure out how to lose the play sign? The video starts automatically, but always shows the play sign.

You can remove that element from the Hierarchy in Unity to stop it from displaying.

Thanks,

Vuforia Support

VideoPlayback sample, running the video's automatically

May 7, 2018 - 9:20am #7

Did anyone figure out how to lose the play sign? The video starts automatically, but always shows the play sign.

VideoPlayback sample, running the video's automatically

December 12, 2013 - 2:18am #6

VideoPlayback sample, running the video's automatically

September 2, 2013 - 8:07pm #5

Hi,

I commented the code according to the last post and it works. However at the same begining when the target is catched the play button appears for a moment. How can I avoid that?

Thanks

VideoPlayback sample, running the video's automatically

September 24, 2012 - 7:43am #4

Was able to achieve the effect finally

In the VideoPlayBackRendere.java File, we already had a hint

   // 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.

So this worked

 

 for (int i = 0; i < VideoPlayback.NUM_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();
               //     }
               // }
            }
        }

VideoPlayback sample, running the video's automatically

September 23, 2012 - 11:17pm #3

Hi David, Thanks for the quick reply.

I am not able to make the autoplay work by removing mShouldPlayImmediately flag or stting by default true. I could see the flag was used only at

 

 public void onPrepared(MediaPlayer mediaplayer)
    {
        mCurrentState = MEDIA_STATE.READY;

        // If requested an immediate play
        //if (mShouldPlayImmediately)
            play(false, mSeekPosition);

        mSeekPosition = 0;
    }

 

I commented out the code for the checking of mShouldPlayImmediately flag, but still the video gets played only after tapping the screen.

 

 

 

VideoPlayback sample, running the video's automatically

September 21, 2012 - 3:43pm #2

The Auto Play behavior is defined using the mShouldPlayImmediately boolean in the VideoPlayerHelper , see line 57 for the default.

For maximum compatibility across platforms we recommend to use H.264 for video encoding, AAC for audio encoding
and that everything should be packaged on an MPEG-4-like wrapper.

We have found that ".m4v" works well on iOS, Android and Unity while
".MP4" for some reason needs to be re-encoded when imported on Unity.

Things that the developers should stay away from: H.263, AVI, WMV, MKV.

Log in or register to post comments