Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Video playback: target lost - start from beginning

Discussion in 'Vuforia' started by nlsangria, Feb 19, 2018.

  1. nlsangria

    nlsangria

    Joined:
    Dec 2, 2017
    Posts:
    2
    Hi there,

    I'm using the built in Video Player to play a video clip when a target is found. However, the video pauses when the target is lost. I'd like to change that so that the video starts again from the beginning every time the target is lost then found again.

    How to do this ?

    Thanks,
    Vince
     
  2. henriqueranj

    henriqueranj

    Joined:
    Feb 18, 2016
    Posts:
    177
    Hi @nlsangria , you can start by looking into the Vuforia's DefaultTrackableEventHandler script (that is added by default in any Vuforia image target that you add to your scene) and create your own or modify it. If you create a new one, remember to remove the DefaultTrackableEventHandler component from the image target and add your own.

    You can implement in code the behaviour you need inside the virtual methods from ITrackableEventHandler: OnTrackingFound and OnTrackingLost.
     
    ROBYER1 and Vuforia-Strasza like this.
  3. nlsangria

    nlsangria

    Joined:
    Dec 2, 2017
    Posts:
    2
    Hi Henrique,

    Thanks for your answer. Through trials and errors I was finally able to load the video from the start every time a target is found with the help of this post. Now the problem I have is that the video doesn't load as fast as without the player.stop()

    Without it, the video play instantaneously, there are no delays. With a player.stop() in OnTrackingLost (or anywhere else), there is a small delay which is noticeable by the display of a white screen right before the video starts.

    As shown in these videos.

    Any way to avoid this ?

    Thanks in advance and have a nice day !
    Vincent
     
  4. vitopastorini

    vitopastorini

    Joined:
    Dec 20, 2013
    Posts:
    1
    Hi nlsangria, did you solve the issue? im wondering where do I have to put the player.stop(), Im using voidAR and it seem that only uses the "video play behavior" and not the "video player" either way there is no much code in it.

    thanks in advance