Augmented Reality Tutorial No. 38: Augmented Reality and Scaling Video Playback using Vuforia

Augmented Reality Video Playback

In this Augmented Reality Video Playback tutorial video scales up when you get further away from the image target and scales down to original size, when you get close to the image target.

Download 5.2.4 version  Unity3D 32bit is available from here

Download # Download and Import Vuforia Advanced from Advanced Topic section for Unity3D (*.unitypackage file)

You can download it also from here.

Download # Print Euforia of Beauty Logo for Scene Augmentation and Create the Tracker (*.jpg file)

Download # You Can Use Already Created Tracker Based on Euforia of Beauty Logo (*.unitypackage file)

Download # Print Chips and Stones Targets for Scene Augmentation (*.pdf file)

Download # Archived App Content (*.m4v file video , C# scaling code, etc.) (*.rar file)

Download # Download Whole Augmented Reality VideoPlayback Tutorial Project Files (the result to test it) (*.rar file)

Download # Download app for Android device (*.apk file)

Tags: , ,

49 Responses

  1. Video with a new marker can not be played. The video with the marker provided can be played. Do I need to upgrade to Unity Pro to play the video? Thanks in advance. 🙂

    • No need for Unity3D Pro license, really, it’s possible to make it on your own target just some attention is needed. Did you follow my steps?

  2. I did everything step by step but my videos wont play.
    It shows up but it gives me the x image and when i click on it it gives me the loading image forever.
    How do i get my video to actuall play?

  3. For any one reading the comments

    THE VIDEO WON’T PLAY IN THE EDITOR YOU HAVE TO EXPORT IT OR IT WONT’ WORK

  4. Hey i downloaded ur APK for testing it and when i click on the video, it loads for ever, any idea of what im doing wrong or anything?

  5. hello sir, this tutorial is very nice..
    but i want ask the c# code in appcontent..
    did you has update the new c# code in appcontent

    • Hi Kiran,
      Did you find out how to play video continuously when target is moved out of camera’s focus? We would like ideally to use Vuforia to only trigger video player, so it comes out of the image and turning/moving towards the screen finally getting into the place. Once it’s in the place we can touch play button for video to play in the full screen mode. Also would be nice to close finished video and return to the targeting mode to trigger another video from different image. Any help would be greatly appreciated. TIA.

      • Only video preview in full screen mode would not depend on the tracking state.
        About other needs – there is no easy description how to do so, you just need to code, but I don’t think you’ll be able to have some additional buttons (from your side) when the video is in full screen.

  6. Hi, I followed your tutorial and worked perfect! than you so much for providing this kind of knowledge, I really appreciate it.

    What I would like to ask you, is how can I get the resulted .apk being as light as possible? Could you give me some tips on that?

  7. hi, i followed your tutorial, and i couldn’t find AppManger.cs and SceneViewManager.cs in /Asset of Unity.
    could you tell me how and where can i find it.

  8. Hey please can you tell be how can i put my own video instead of the video in appcontent file. Or how do you convert the video to its meta files.

      • So basically you mean i just have to put my video in the appcontent folder instead of your augmented_reality_technology?
        By doing this can my video play instead of the video provided by you?

  9. I tried it but when i play it through mobile the moment i click on the screen to play the screen goes black…any specific mistake that i am doing ? can you please tell me?

  10. thank you for your tuorial, it’s very helpful
    i followed your tutorial, but i i’ve an error like this :
    Error attempting to SetHeadsetPresent
    UnityEngine.Debug:LogError(Object)
    Vuforia.VuforiaAbstractBehaviour:SetHeadsetPresent(String)
    Vuforia.VuforiaAbstractBehaviour:Start()

    how to fix it ?

  11. Hello Edgaras,
    thank you very much for your tutorials.
    I tried this with my own video and it works perfectly.
    I also changed the orientation of the video by Selecting VIDEO in Hierarchy and changing the X Scale value from 0.1 to -0.1

    I have a problem when I pause the video and play it again: the music start from beginning but the video remain blocked.
    Where is the problem? Maybe because I stream an MP4 video instead of M4V?

    Thank you very much
    Marco

  12. when i import videoplayback package, i got these error:

    Assets/Common/MenuOptions.cs(10,19): error CS0234: The type or namespace name `UI’ does not exist in the namespace `UnityEngine’. Are you missing an assembly reference?
    Assets/Common/SplashAbout/AsyncSceneLoader.cs(7,19): error CS0234: The type or namespace name `UI’ does not exist in the namespace `UnityEngine’. Are you missing an assembly reference?
    Assets/Common/SplashAbout/LoadingScreen.cs(10,19): error CS0234: The type or namespace name `UI’ does not exist in the namespace `UnityEngine’. Are you missing an assembly reference?

    how to solve it?

  13. I have the same problem as:
    ” I did everything step by step but my videos wont play. It shows up but it gives me the x image and when i click on it it gives me the loading image forever” also I can’t find this file “AppManger.cs”. Any idea I use the latest unity and Vuforia plugins

  14. I noticed there were questions on the videos being inverted upon tests. Mine is doing the same. I have tried all suggested. Can any help regarding where the proper axis change is made?

    Current setting for ImageTarget is: X -0.1 Y 0.1 Z 0.1

    Thanks in advance.

  15. I ‘ve tried to make video playback like this. but the unity said that “IsampleAppUIEventHandler” cannot be found. it’s because I dont have that file in my project. so where I can get that file ???

  16. why my appmanager.cs got error

    #region PUBLIC_MEMBER_VARIABLES
    public string TitleForAboutPage = “About”;
    public ISampleAppUIEventHandler m_UIEventHandler; (The type or namespace name ‘ISampleAppUIEventHandler’ could not be found)
    #endregion PUBLIC_MEMBER_VARIABLES

    #region PROTECTED_MEMBER_VARIABLES
    public static ViewType mActiveViewType;
    public enum ViewType { SPLASHVIEW, ABOUTVIEW, UIVIEW, ARCAMERAVIEW };

    #endregion PROTECTED_MEMBER_VARIABLES

    #region PRIVATE_MEMBER_VARIABLES
    private SplashScreenView mSplashView;
    private AboutScreenView mAboutView;
    private float mSecondsVisible = 4.0f;
    #endregion PRIVATE_MEMBER_VARIABLES

    //This gets called from SceneManager’s Start()
    public virtual void InitManager()
    {
    mSplashView = new SplashScreenView();
    mAboutView = new AboutScreenView();
    mAboutView.SetTitle(TitleForAboutPage);
    mAboutView.OnStartButtonTapped += OnAboutStartButtonTapped;
    m_UIEventHandler.CloseView += OnTappedOnCloseButton;
    m_UIEventHandler.GoToAboutPage += OnTappedOnGoToAboutPage;
    InputController.SingleTapped += OnSingleTapped;
    InputController.DoubleTapped += OnDoubleTapped;
    InputController.BackButtonTapped += OnBackButtonTapped;

    mSplashView.LoadView();
    StartCoroutine(LoadAboutPageForFirstTime());
    mActiveViewType = ViewType.SPLASHVIEW;
    }

    public virtual void DeInitManager()
    {
    // mSplashView.UnLoadView();
    // mAboutView.UnLoadView();
    // m_UIEventHandler.CloseView -= OnAboutStartButtonTapped;
    // m_UIEventHandler.GoToAboutPage -= OnTappedOnGoToAboutPage;
    InputController.SingleTapped -= OnSingleTapped;
    InputController.DoubleTapped -= OnDoubleTapped;
    InputController.BackButtonTapped -= OnBackButtonTapped;

    m_UIEventHandler.UnBind();
    }

    public virtual void UpdateManager()
    {
    //Does nothing but anyone extending AppManager can run their update calls here
    }

    public virtual void Draw()
    {
    m_UIEventHandler.UpdateView(false);
    switch (mActiveViewType)
    {
    case ViewType.SPLASHVIEW:
    // mSplashView.UpdateUI(true);
    break;

    case ViewType.ABOUTVIEW:
    mAboutView.UpdateUI(true);
    break;

    case ViewType.UIVIEW:
    m_UIEventHandler.UpdateView(true);
    break;

    case ViewType.ARCAMERAVIEW:
    break;
    }
    }

    #region UNITY_MONOBEHAVIOUR_METHODS

    #endregion UNITY_MONOBEHAVIOUR_METHODS

    #region PRIVATE_METHODS

    private void OnSingleTapped()
    {
    if (mActiveViewType == ViewType.ARCAMERAVIEW)
    {
    // trigger focus once
    m_UIEventHandler.TriggerAutoFocus();
    }
    }

    private void OnDoubleTapped()
    {
    if (mActiveViewType == ViewType.ARCAMERAVIEW)
    {
    mActiveViewType = ViewType.UIVIEW;
    }
    }

    private void OnTappedOnGoToAboutPage()
    {
    mActiveViewType = ViewType.ABOUTVIEW;
    }

    private void OnBackButtonTapped()
    {
    if (mActiveViewType == ViewType.ABOUTVIEW)
    {
    Application.Quit();
    }
    else if (mActiveViewType == ViewType.UIVIEW) //Hide UIMenu and Show ARCameraView
    {
    mActiveViewType = ViewType.ARCAMERAVIEW;
    }
    else if (mActiveViewType == ViewType.ARCAMERAVIEW) //if it’s in ARCameraView
    {
    mActiveViewType = ViewType.ABOUTVIEW;
    }

    }

    private void OnTappedOnCloseButton()
    {
    mActiveViewType = ViewType.ARCAMERAVIEW;
    }

    private void OnAboutStartButtonTapped()
    {
    mActiveViewType = ViewType.ARCAMERAVIEW;
    }

    private IEnumerator LoadAboutPageForFirstTime()
    {
    yield return new WaitForSeconds(mSecondsVisible);
    mSplashView.UnLoadView();
    mAboutView.LoadView();
    mActiveViewType = ViewType.ABOUTVIEW;
    m_UIEventHandler.Bind();
    yield return null;
    }
    #endregion PRIVATE_METHODS

    someone help me

  17. Hey Guys, i have used your tutorial to make the simple video playback app, and its working great, i just want to know, how we can change size of video appearing after tracking the image target ?
    Please i need help

Leave a Reply