android - Vuforia Video playback - How to play only one video at a time


Keywords:android 


Question: 

I am working on a basic Vuforia app following their documentation and i am new to Unity 3D.

I am working on to play videos in vuforia when the image target is detected. I got the videos playing but when it comes to multiple target, multiple videos are played as per the vuforia's behaviour.

But i want to play only one video at a time even multiple image targets are focused. Looking forward for some help to learn.

I am just using the vuforia's video playback script to play the videos.


2 Answers: 

This is fairly simple in unity. You have append those videos to their respective Image Target. I hope you have done so. You can get the video inside OnTrackableStateChanged by following:

vidPlay = mTrackableBehaviour.GetComponentInChildren<VideoPlayer>();

where vidplay is a VideoPlayer component declared inside DefaultTrackableEventHandler class. now play it once the target image is detected. like this: vidPlay.Play(); or vidPlay.Pause();. I hope this helps! Thank You.

 

You can see a option called as 'Max Simultaneous Image Targets' in Unity Inspector under Vuforia Configuration. Just mention how many targets you need to track simulataneously at a time and Vuforia will take care of other stuffs.

I set the count as '1' and one image target is tracked at a time.