Log in or register to post comments

Vuforia Video Playback to play automatically.

October 8, 2012 - 3:33am #1

The code given in the Trackable Event Handler with the example of Vuforia video Playback to play the video automatically(given below) was not working.    

How can we make the video to play automatically once when the image is captured....

Please HELP....

 

// Optionally play the video automatically when the target is found

        

        VideoPlaybackBehaviour video = GetComponentInChildren<VideoPlaybackBehaviour>();

Debug.Log("Video is : " +video);

        if (video != null)

        {

            if (video.VideoPlayer.IsPlayableOnTexture())

            {

Debug.Log("Status -" +video.VideoPlayer.GetStatus());

                VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus();

                if (state == VideoPlayerHelper.MediaState.PAUSED ||

                    state == VideoPlayerHelper.MediaState.READY ||

                    state == VideoPlayerHelper.MediaState.STOPPED)

                {

                    // Pause other videos before playing this one

                    PauseOtherVideos(video);

                    // Play this video on texture where it left off

                    video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition());

                }

                else if (state == VideoPlayerHelper.MediaState.REACHED_END)

                {

                    // Pause other videos before playing this one

                    PauseOtherVideos(video);

                    // Play this video from the beginning

                    video.VideoPlayer.Play(false, 0);

                }

            }

        }

 

Thanks.

Vuforia Video Playback to play automatically.

November 20, 2012 - 4:42am #4

Glad to hear it's working :)

N

Vuforia Video Playback to play automatically.

November 20, 2012 - 4:06am #3

Sorry NalinS.

Mistake is mine. I was using lower version(Android 3.2) and that is the problem.

It is working like a charm..

Thank you.

Vuforia Video Playback to play automatically.

October 9, 2012 - 4:04am #2

Hmmm, I just tried this with the VP sample and it works fine on an iPhone.

All I did was uncomment the lines in TrackableEventHandler.cs as shown below and it worked first time :)

Have you tried it with the sample or is it your own?

Also, have you tried debugging it to see how far it gets? or checked any of the logs to find out what the problem is?

Also, what platform are you using?

N

 

        VideoPlaybackBehaviour video = GetComponentInChildren<VideoPlaybackBehaviour>();

        if (video != null)

        {

            if (video.VideoPlayer.IsPlayableOnTexture())

            {

                VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus();

                if (state == VideoPlayerHelper.MediaState.PAUSED ||

                    state == VideoPlayerHelper.MediaState.READY ||

                    state == VideoPlayerHelper.MediaState.STOPPED)

                {

                    // Pause other videos before playing this one

                    PauseOtherVideos(video);

 

                    // Play this video on texture where it left off

                    video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition());

                }

                else if (state == VideoPlayerHelper.MediaState.REACHED_END)

                {

                    // Pause other videos before playing this one

                    PauseOtherVideos(video);

 

                    // Play this video from the beginning

                    video.VideoPlayer.Play(false, 0);

                }

            }

        }

 
Log in or register to post comments