contact@zeanex.com
+92 (317) 4843 022
Get a Quote
  • Home
  • Company
  • Products
  • Services
    • Marker based AR
    • Cloud based AR
  • Help & Support
    • Contact Us
    • FAQ
  • Blog

No products in the cart.

  • Home
  • Company
  • Products
  • Services
    • Marker based AR
    • Cloud based AR
  • Help & Support
    • Contact Us
    • FAQ
  • Blog

No products in the cart.

  • Home
  • Company
  • Products
  • Services
    • Marker based AR
    • Cloud based AR
  • Help & Support
    • Contact Us
    • FAQ
  • Blog

No products in the cart.

  • Home
  • Company
  • Products
  • Services
    • Marker based AR
    • Cloud based AR
  • Help & Support
    • Contact Us
    • FAQ
  • Blog
Blog
Home Tutorials display YOUTUBE Video on an image target using vuforia
Tutorials

display YOUTUBE Video on an image target using vuforia

CEO October 20, 2019 0 Comments

Augmented Reality has minimizes the distances of imaginary and real world. In this tutorial you will learn to Display YouTube Video on an image target. The video below will help you for better understanding of this blog.

For better understanding make sure to read the previous blogs i.e. DISPLAY 3D MODEL ON IMAGE TARGET USING VUFORIA IN UNITY3D and DISPLAY VIDEO ON AN IMAGE TARGET USING VUFORIA IN UNITY 3D.

Create a new unity project:

In augmented reality creating a new unity project requires some of the things to be done. For creating a new unity project you need to write project name and then click on create project.

create a new unity project

Adding new image:

For adding a new image target you need to go to vuforia engine. After going to vuforia engine click on image and re position it. Now go to vuforia portal. For opening vuforia developer portal make sure that you are sign in. Click on develop and after that go to click on target manager. For adding the target click on single image. Now choose the image by clicking on the browse button, then add certain width and rename it. Then click on add.

Adding target

Scene Setting:

Now we have to set scene for augmented reality. For that you have to delete main camera and add AR camera and image. As you can see this warning sign, go to build settings then go to player settings. Go to the bottom click on XR settings and check the vuforia augmented reality.

Warning sign during scene setting

Downloading the database:

Now download that data base. Click on unity editor then click on download. When it is downloaded drag it to the unity timeline put it in assets. Make sure that all the items are selected and click on import. Go to image target and select your database. Now you can see your image has loaded.

Downloading Database

YouTube video plugin:

Now what we have to do is to display YouTube video on an image target. For that we need a YouTube video plugin. The link of YouTube video plugin is available here. You can buy YouTube video plugin from it.

Importing the YouTube video plugin:

Drag the YouTube video plugin in unity and import it. Now click on console and click on clear. You can see an error here and double click on it.

error

Change the “LOW” word into “STANDARD”. Now press Ctrl S to save. We need to go back to unity. Now in Assets. Click on the plugin folder “Light Shaft” and go to resources.

changing LOW word into STANDARDS

In the resources go to prefabs and then click on YouTube player. Now crop it in image target.

Settings positions and rotations:

We need to set its positions and rotations. All x,y and z axis are set as 0 in the rotations and positions. Now click in YouTube player and then click on Video Render Area and make the positions x,y and z axis as 0.

YouTube video Render Area
settings positions and rotations

Go to Canvas and make the rotations x,y and z axis as 0. We need to set the positions of Y axis as 0.01 in YouTube player.

positioning y axis as 0.01

Now we need to rotate it also. Set the y axis of rotation as 180. You can set it according to your choice as well. Now paste a YouTube URL that you want to display on an image target in the YouTube player URL.

Scanning the image target:

Now the thing is when we will scan the image target video will start playing but when the target is lost video will not stop. Video will continue playing in the background. Thus, we will continue listening to the sounds of the video. So, in order to avoid that we need to code few lines. So, go to create and click on C# script and name it as track able event handler. Open this file by double clicking on it.

Coding of track able event handler:

The code of this track able event handler file is totally same as to the default track able event handler file that is attached to our image target. We will open this file. We only have to do few minor changing in code. Press Ctrl A and then Ctrl C and paste it to the track able event handler file.

Now in the track able event handler file delete the default placed code and press Ctrl V to paste the default track able event handler code in this file. Coding of track able event handler:heck the name of the file which is track able event handler file and give the same name to the class.

Adding unity engine event:

So, basically what we have to change in this file is that we are going to add unity engine event. So, we will be using codes as:

using Unity Engine. Events;

Declaring public variables:

We need to declare two public variables onTrack and onLost.

public UnityEvent onTrack;

public UnityEvent onLost;

Unity events
Declaring unity events

The event onTrack needs to be called when tracking is found. So, here we will write

onTrack.Invoke();

The second unity event onLost needs to be called when tracker is lost. So, here we will write

onLost.Invoke();

Adding track able event handler:

Now in image target we have to declare this delete this default track able event handler and add the track able event handler . Now in these events click on + in onTrack () and drop in the youtube player here. Click on + in on Lost in the YouTube player here.

Selecting functions:

Select YouTube player from the drop down and select play () function. Select YouTube player from the drop down and select pause() or stop() function according to your choice.

YouTube player

Export Application:

From top menu click on file, then click on build settings. Check the platform is android if not switch it. And then click on add open scenes. Now click on player settings. Go to other settings. Change the package name according to your choice. Unchecked x86 and Android TV compatibility. Change the stripping level to low. Click on XR settings and make sure vuforia augmented reality is selected. And then you can insert the icon of your app. That’s all for settings now connect your android mobile with your computer and click on build and run. Now name it and save it.

combination cycles with drostanole
Augmented reality displaying youtube video on an image target unity3d vuforia
1
1262 Views
AboutSundas Fatima
display text on an image target using vuforia in unity 3dPrevdisplay text on an image target using vuforia in unity 3dOctober 12, 2019
Display image slideshow on an image target using vuforiaOctober 29, 2019Display image slideshow on an image target using vuforiaNext

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts
  • Augmented Reality in Ecommerce and Retail
  • Create AR for the travel and tourism industry
  • Create augmented reality experience for restaurants
  • How to install Location Based ar APP With admin panel
  • Vuforia web services api: how to add target in vuforia cloud database?
Recent Comments
  • Valéria Gomes on MarkerLess Web AR with Admin Panel
  • Greg K on Vuforia Cloud Recognition App with Web Panel
  • Mohammad on Vuforia Cloud Recognition App with Web Panel
  • Ali Hamza on Vuforia Cloud Recognition App with Web Panel
  • Ahmet on Vuforia Cloud Recognition App with Web Panel
Archives
  • September 2022
  • January 2021
  • April 2020
  • March 2020
  • February 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
Categories
  • AR Creato
Meta
  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Categories
  • AR Creato 3
Recent Posts
No posts were found for display
Tags
AR AR Creato arcreato AR Creator AR Editor areditor Augmented reality augmented reality in ecommerce augmented reality in restaurants Augmented Reality in Retail menu AR tourism AR travel AR

We are here to transform your ideas into reality. We can build AR applications for business, artists, education etc with custom requirements.
Services
Marker Based AR
Cloud Based AR
Contacts
Email:
contact@zeanex.com
Phone:
+92 (317) 4843 022

Newsletter

Terms of use | Privacy Policy

Copyright © 2020 Zeanex Techonologies (SMC-PVT) Limited. All Rights Reserved.