title: Play video on Canvas When Image target found. Vuforia - Unity3d
body: <p>I'm trying to Play a video on canvas using the script play video on canvas in an AR app using Vuforia.  </p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  using UnityEngine.Video;
  public class StreamVideo : MonoBehaviour
  {
      public RawImage rawImage;
      public VideoPlayer videoPlayer;
      public AudioSource audioSource;
      // Use this for initialization
      void Start()
      {
          StartCoroutine(PlayVideo());
      }
      IEnumerator PlayVideo()
      {
          videoPlayer.Prepare();
          WaitForSeconds waitForSeconds = new WaitForSeconds(1);
          while (!videoPlayer.isPrepared)
          {
              yield return waitForSeconds;
              break;
          }
          rawImage.texture = videoPlayer.texture;
          videoPlayer.Play();
          audioSource.Play();
      }
  }
  </code></pre>
  
  <p>and this plays video when the play button is pressed. Now I hooked this game object to Default trackable event handler so when tracking is found <code>rawimage.gameobject.setactive(true);</code> and (false) when tracking is lost. The main problem here is when I show the camera in front of image target, only a Raw image is being shown and its child <strong>Videoplayer</strong> is not starting. Which results in Video Not being played. Any fix for this?</p>