Log in or register to post comments

Video playback Unity 2017.2

October 5, 2017 - 4:23am #1

Hi!

I'm testing unity with Vuforia but I am not able to get the video to load after the image marker is found.

It loads 3D models without any problems, but does not play video.

I've been looking through a bunch of (now old) tutorials without being able to figure this thing out.

Do I need to add something to the Default Trackable Event Handler?



Anyone have a solution to this?



Thanks!

Video playback Unity 2017.2

April 17, 2019 - 11:25am #17

You should create, on the quad that is shown when the target is found, a VideoPlayer.

 

At the ImageTarget, you should edit the DefaultTrackableEventHandler script.

 

Add a public UnityEngine.Video.VideoPlayer videoPlayer;

 

On the method OnTrackingFound, you just put videoPlayer.Play();

Video playback Unity 2017.2

April 17, 2019 - 11:15am #16

Hi,

 

I'm still having the same issue with the white screen, 

 

Could anyone please help me with that matter ??

 

Thank you 

Video playback Unity 2017.2

April 8, 2018 - 4:15pm #15

Shengen, have you found a way to fix the "white screen"? 

Does anyone else have a solution to this?  I have the same issue when unchecking the "play on awake" box.  Other wise my audio is playing, as well as the video for that matter, even if the target is never scanned (when the image is detected it's already well into the clip).  Again, if "play on awake" box is unchecked, just a white box with no audio or video.

Here's my controller code

 

[RequireComponent(typeof(VideoPlayer))]

[RequireComponent(typeof(AudioSource))]

public class VideoAudioController : MonoBehaviour,

ITrackableEventHandler

{

private TrackableBehaviour mTrackableBehaviour;

private AudioSource sound;

private VideoPlayer videoPlayer;

void Start()

{

  videoPlayer = GetComponent<VideoPlayer>();

  sound = GetComponent<AudioSource> ();

  mTrackableBehaviour = GetComponent<TrackableBehaviour>();

  if (mTrackableBehaviour)

  {

   mTrackableBehaviour.RegisterTrackableEventHandler(this);

  }

  videoPlayer.playOnAwake = false;

  sound.playOnAwake = false;



}

public void OnTrackableStateChanged(

  TrackableBehaviour.Status previousStatus,

  TrackableBehaviour.Status newStatus)

{

  if (newStatus == TrackableBehaviour.Status.DETECTED ||

   newStatus == TrackableBehaviour.Status.TRACKED ||

   newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED

  )

  {

   // Play audio when target is found

   videoPlayer.Play ();

   sound.Play ();

  }

  else

  {

   // Stop audio when target is lost

   videoPlayer.Stop ();

   sound.Stop ();

  }



}

Thanks to anyone in advance for your help.  Just want to know how to play both video and audio, ONLY when tracking image is detected.

Video playback Unity 2017.2

March 30, 2018 - 11:01am #14

Hey guys,

 

New to Vuforia/ Unity world, so , bear with me. 

 

We have a Quad in our ImageTarget, that is pulling in an MP4. When we check 'Play On Awake' we hear the audio before image target is detected. When we turn off 'Play on Awake' we see a white box as our Image Target, instead of our media (MP4).

 

Not sure if this has been answered or not (is the VIdeo Controller Script an external script that is needed? If so, where is that available?)

 

Thanks guys!

 

James

Video playback Unity 2017.2

January 23, 2018 - 2:25am #13

LAGroup wrote:

Hi Gal,

When you want to display a video on tracking of an Image Target, the plane (or whatever primitive or mesh you want the video on) should have these components:

- Video Player component (Unity component)

- VIdeo Controller Script

while the Image Target responsible for the tracking should have Video Trackable Event Handler.

Oh, also UNCHECK "Play on awake", you don't need that thing.

 

Try that, it works for me.

Cheers!

Eugenio

 

 

Hi Eugenio,

I followed your advice but i couldn't get it to play now. all i'm getting now is a white box instead..

 

 

Video playback Unity 2017.2

November 23, 2017 - 12:46am #12

Hi Gal,

When you want to display a video on tracking of an Image Target, the plane (or whatever primitive or mesh you want the video on) should have these components:

- Video Player component (Unity component)

- VIdeo Controller Script

while the Image Target responsible for the tracking should have Video Trackable Event Handler.

Oh, also UNCHECK "Play on awake", you don't need that thing.

 

Try that, it works for me.

Cheers!

Eugenio

Video playback Unity 2017.2

October 25, 2017 - 12:04am #11

How can I play a video and sound automatically when a target is found?

I'm using the video player from the "ImageTarget_Fissure". 

If "play on away" is checked the video will be played when the target is found but the sound starts playing from the moment the scene is opened.

I could not find any references for this for unity 2017.2.

I would extremely appreciate your help with this,

Gal

 

 

Video playback Unity 2017.2

October 25, 2017 - 12:03am #10

How can I play a video and sound automatically when a target is found?

I'm using the video player from the "ImageTarget_Fissure". 

If "play on away" is checked the video will be played when the target is found but the sound starts playing from the moment the scene is opened.

I could not find any references for this for unity 2017.2.

I would extremely appreciate your help with this,

Gal

 

 

Video playback Unity 2017.2

October 18, 2017 - 6:58am #9

marthetra, I am having the very same issue. What did you do to get this working?

Thanks,

 

BFreese

Video playback Unity 2017.2

October 13, 2017 - 4:44am #8

Finally made it work!

However, the video is displayed upside down and sticking to the screen rather than tracking on the image.

Any idea what is causing this?

Video playback Unity 2017.2

October 10, 2017 - 11:19pm #7

Thanks, but as I say in my previous post, I did that.

 

 

Video playback Unity 2017.2

October 10, 2017 - 11:35am #6

Hi Marthe,

This issue "Please Add Vuforia to the list of included SDKs in the XR Player Settings.........UnityEngine.Debug:LogWarning(Object)" indicates that you haven't activated Vuforia in the Player Settings in Unity. To get here, go to Edit->Project Settings->Player and then navigate to the platform you are building for and expand the XR Settings. Within here, check the "Vuforia Augmented Reality Support" box.

Thanks,

-Vuforia Support

 

Video playback Unity 2017.2

October 10, 2017 - 5:21am #5

Hi!

Thanks for your reply.

I downloaded and imported the Core Samples. When running it (in Unity with webcam) I don't get any response at all.

The console does not register tracked images and the player does not play video nor display 3D models.

When importing the package I get:

Fixing reference to the runtime script in scene file!

Shader warning in 'Standard: Output value 'o' is not completely initialized at UnityStandardShadow.cginc(128) (on d3d11)

I open the image target scene, hit play and get these messages:

Please Add Vuforia to the list of included SDKs in the XR Player Settings.........UnityEngine.Debug:LogWarning(Object)

Vuforia is not compatible with Android FAT.........

I add the SDK and change the Device Filter to ARMv7 and press play. 

No error messages. Everything seems to be running fine, though it does not find the image targets, i.e. the console does not output anything when I point the camera to the images, as it does in my own test project.

Any suggestion to a solution is greatly appriciated. :)

Thanks,

Marthe

Video playback Unity 2017.2

October 6, 2017 - 11:56am #4

Hello Marthe,

Have you looked at our Core Samples that are available on the Unity Asset Store? If you download that sample project and open up the Image Target scene you will see an example of playing a video clip on an Image Target. The object called "ImageTarget_Fissure" has a Unity Video Player component attached to one of its children and it plays a video clip that is stored in "Assets/SampleResources/ImageTargets/Videos"

Thanks,

-Vuforia Support

Video playback Unity 2017.2

October 6, 2017 - 3:48am #3

I've only tried testing with the webcam so far, and I do not know how to configure the video player correctly, or if to use it at all. 

I am brand new to both unity and vuforia - without too much programming experience, so the learning curve is incredibly steep.

Without proper documentation it is very difficult to achieve what I want. I cannot understand how it can be so easy to trigger a 3D model when a simple short video is close to impossible... 

My video is located in the "materials" folder. When I try to move it to the StreamingAssets folder the icon goes blank and I can no longer view my video in the texture panel. I tried creating a "materials" folder in the StreamingAssets, but it did not make any difference. Maybe you can ellaborrate on how you got your video to work through the streaming assets folder? It might be that the video is encoded incorrectly, it is a medium bitrate mp4. I tried converting to .ogg, but all I got were an audio file.

Is it perhaps easier to get the video to work using URL instead of VideoClip?

Thanks,

Marthe

 

Video playback Unity 2017.2

October 6, 2017 - 3:20am #2

Hi,

I'm trying to accomplish the same thing, and so far it seems to play a video sith "Handheld.PlayFullScreenMovie", but I need some custom interface ontop of it.

Handheld.PlayFullScreenMovie ("waterfallVideo.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);

The video (in my case waterfallVideo.mp4) shoulod be placed under the StreamingAssets folder.

Did you find any other solution?

 

Thanks,

 

Fabio

Log in or register to post comments