How to integrate video to image target in Unity 2022 version?

55 Views Asked by At

I am using Unity version 2022.3.16f With the Vuforia package, I need to integrate a video on a real image within the scope of Augmented Reality. For this, I create a plane on the image target in Hierarchy and assign a video to the inspector window. However, when I test, the video does not move on the plane, only a white image appears. Briefly, how can I integrate video on image target. can you explain in detail?

  1. Tried older versions (unity 2020,2021)
  2. I tried playing video by assigning render texture or quad instead of plane.
  3. I tried to do it using different videos. I am also sure that it is MP4 extension.
1

There are 1 best solutions below

0
thesbyro On

Your video might not be playing because there is no trigger to start it. If you see the Vuforia's Core Samples, there's an Image Target with a video playing when the image is detected. I would grab that GameObject with its children and replace the video in the Video Player component's Video Clip field. Their sample even has a play and pause controller script that you can use. Image Target Core Samples from Vuforia showing the Unity setup of a playing a video when an Image Target is detected

Otherwise, I would:

  1. Make a plane GameObject as a child of the Image Target,
  2. Disable its Mesh Renderer,
  3. Add the Video Player component,
  4. Add the path to my video in the Video Clip field,
  5. Disable the Play On Awake,
  6. Add an item to the OnTargetFound() in the DefaultObserverEventHandler component and drag the Plane GameObject into the Object field.
  7. Then select VideoPlayer.Play() in the Function dropdown menu. Simple Image Target setup for playing a video when the target is found