Search Unity

Audio Audio and Video issues with AR App - Audio won't stop on target drop

Discussion in 'Audio & Video' started by dizzbee, Mar 18, 2019.

  1. dizzbee

    dizzbee

    Joined:
    Mar 18, 2019
    Posts:
    4
    Hello all,

    Im building an AR app that uses 6 different target images to trigger 6 different videos - it's for an arts project. It all seems to work well apart from the audio. When I set the audio to Play on Awake all 6 videos start up - if I take it off the video stops running, I get a grey floating square. Also the audio continues to play even when I lose the target. I need the video and audio to stop when target image is dropped so that users can scan different images. I have made the app without using code - I am hoping for an easy fix as I don't code..... hoping for a check box solution?

    Really appreciate any help

    Dizz
     
    shadoworld69 and thirdpurple like this.
  2. thirdpurple

    thirdpurple

    Joined:
    Mar 21, 2019
    Posts:
    4
    Same problem here.
     
  3. dizzbee

    dizzbee

    Joined:
    Mar 18, 2019
    Posts:
    4
    Well if you figure it out will you let me know and I will do the same lol!
     
  4. thirdpurple

    thirdpurple

    Joined:
    Mar 21, 2019
    Posts:
    4
    Hi,
    I have figured mine out, but it does require a little bit of copying and pasting code.
    I am on OSX
    Unity 2018.3.9f1
    Vuforia 8.1.7
    Xcode 10.1

    I have an ARCamera, an ImageTarget with a Quad Child and my video with embedded audio attached to a video component within that Quad.
    If PLAY ON AWAKE was checked, the audio could be be heard as soon as the app fired up and before the image was tracked, the video had also started, although I couldnt see it until it tracked the image then it would start from whereever it was in that video, so was in sync with the audio.
    If tracking was lost the audio carried on, and the video would also have carried on, although not visible, and then would be visable once tracking started again, but would be further along the video an be in sync with audio.

    If PLAY ON AWAKE was unchecked, the quad would just remain grey when tracking was found, no audio or video would play.

    I added a bit of code to the defaultTrackableEventhandler script in the ImageTarget inspector.
    It does not reference any specific file names, so if you replace your script with the one attached it should work?
    I would do a backup version of your original project first just in case, I am new to this!

    Hope this helps.
     

    Attached Files:

    ppaulick and dizzbee like this.
  5. dizzbee

    dizzbee

    Joined:
    Mar 18, 2019
    Posts:
    4
    Thanks! That works - just need to get it to build now.
     
    thirdpurple likes this.
  6. ppaulick

    ppaulick

    Joined:
    Aug 6, 2018
    Posts:
    1
    You're awesome. I've been struggling with this for a while now, and this got me over the hump. Much obliged!
     
    thirdpurple likes this.
  7. philspitlerSF

    philspitlerSF

    Joined:
    Oct 10, 2018
    Posts:
    37
    Hi, I am having the same issue, I tried the script and it's not working as expected. I still just get a blank quad displayed once the target is detected.

    Any ideas?

    Thanks

    Phil
     
  8. savgrec

    savgrec

    Joined:
    Jan 19, 2021
    Posts:
    1
    Me too I was struggling like mad to pause the vid and to play it when it is in actual detection. Thanks!!!
     
  9. coolshakeeb

    coolshakeeb

    Joined:
    Jul 8, 2021
    Posts:
    2
    when i use that file, it wont compile/build, and i get the following error message. Library\PackageCache\com.ptc.vuforia.engine@efa13d4486\Vuforia\Scripts\DefaultTrackableEventHandler.cs(15,60): error CS0246: The type or namespace name 'ITrackableEventHandler' could not be found (are you missing a using directive or an assembly reference?)