Log in or register to post comments

Vuforia Video Playback - video automatically plays in unity activity when resumed from an android Activity

January 19, 2018 - 1:20am #1

Hi team,

I am using Vuforia in my app and i have configured both Android studio and Unity 3d in my app. I have sent the values from android app to unity like

UnityPlayer.UnitySendMessage("GameObject", "setGender", student.getGender());

And from unity 

 

My scenario is, 

1. My vuforia screen has a button overlayed in it.

2. On clicking the button,  An android activity opens. Upon closing the activity, Unity activity has to be resumed.

3. When a video is playing in Vuforia, and when the button to the Android activity is clicked, Android activity is opened. And when I come back to Unity from Android activity, Video is not playing until the image target is focused. This functional flow is perfect!

But when the video is playing and now I take off the focus from Image target, the video stops playing and now when I click on the button to go to Android Activity,  Android activity opens and upon closing Android activity, Without focusing image target also the Video's Audio getting resumed to Play.

 

How to rectify this error. I can't find any instance of video playing too. Video player is logged to be null upon resuming. 

 

Kindly help !

 

 

Vuforia Video Playback - video automatically plays in unity activity when resumed from an android Activity

February 9, 2018 - 3:52am #2

 

I solved my problem using the below code

video = GetComponentInChildren<VideoPlaybackBehaviour>();

        Debug.Log("onTracking video state in TrackableEventHandler called" + video.CurrentState);

        if (mLostTracking == true && mHasBeenFound == false && video!=null && video.CurrentState == VideoPlayerHelper.MediaState.PLAYING)

        {

            video.VideoPlayer.Pause();

        }



Add the above code in onUpdate()  method of your TrackableEventHandler.cs script.  That's it!

Log in or register to post comments