Search Unity

[BUG] Video Does Not Load, White Box With AR Camera : Unity

Discussion in 'AR' started by arkedrem, Oct 13, 2018.

  1. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20

    Bug with Unity/Vuforia for AR.

    Scanned image using Samsung Galaxy Note 9 back camera, gives white box.

    MP4 file does not play, this includes the audio not playing.

    Please refer to attached image url for more information.

    Note: Scanning an image and replacing it with a secondary image works fine.

    Edit:
    If you run the app with "Video Player->Play on Awake" checked, audio will automatically play when the app is opened.

    The same scenario also occurs within Unity Editor.

    If you scan the image, so it registers the image correctly, but a white box will appear, .

    However, no video will appear on the screen.
     

    Attached Files:

    Last edited: Oct 16, 2018
  2. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    First of all, make sure to transcode your video file to all platforms. In other words, make sure that the video will play on all types of devices, and I think that is likely to be the solution in your case. Just go to your video file import settings, and you will be able to see if you have a warning there that the video file might not play on all devices. If that is not the case, tell us how you're playing your video? Are you using a render texture?
     
  3. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    Step 1: Transcoded the video

    I transcoded the whole video with "Override Android" and rebuilt the whole project.

    Did absolutely nothing, it's exactly as the image above.

    Step 2: Changed Render Mode
    Under "Video Player -> Render Mode", I was using a "Material Override" instead of "Render Texture". Changed to "Render Texture", rebuilt.

    Ran into some other Android APK build issue. Will get back after solving it.
     
    Last edited: Oct 15, 2018
  4. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    Continued dyuldashev

    Nope, still a white screen.

    Both suggestions don't work.
     
  5. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    Is it working in the Editor? It the video playing fine in the Editor? In those cases, transcoding might help.
     
  6. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    The video is in .mp4 format.

    The video works fine in the tiny box in the right hand corner, transcoding does absolutely nothing as mentioned above.

    However, I think the issue lies with the Unity Editor.

    When I add the video as a resource, then link it in the Video Player component, the Quad that I am using still remains white.

    However, with "Play on Wake" checked in the Video Player component, the video will play audio when I run the app.

    In the Unity Editor, the Quad has to show a preview of the video and I think I won't have this error.
     
  7. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    Please, just refer to a tutorial. Playing videos is really easy. Here's an official tutorial:

    If you want load them using C# scripts, here's another tutorial:

    Hope that helps...
     
  8. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    dyuldashev
    It's not a tutorial issue as you can see the app trying to load the video.

    If you're unsure of what the issue is, maybe someone from Unity could help.

    The video is meant to be from a tutorial.

    The bug is occurring as part of Unity.

    The white screen of death is actually very common in Unity.

    Like the thread below.
    https://developer.vuforia.com/forum...ical-discussion/vuforia-42-unity-501-ui-issue
     
  9. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    Without seeing how you're actually trying to play the video, you cannot get help. I have developed around 10-15 apps in Unity where videos play on top of targets. I even download and play at runtime. Done it with both Vuforia and Easy AR multiple times. If you cannot resolve this, just post a simple version of that part of your project here. Maybe, someone can take a look...Either way, good luck...
     
  10. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    I can send you the apk with the image.

    How about that?
     
  11. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    It's not really possible to see what's going on from your APK as I already understand that the video is not playing. The APK is of no help.
     
  12. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    Do you want the whole project?

    I can send it to you.
     
  13. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    Can you just post your code here where you play the video?
     
  14. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    How about I send you the whole file?

    You can see every file and every line of code.

    Then I don't do it piece meal.
     
  15. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    This forum is not meant to be a one on one help session. First, others will not be able to see what's wrong when they find this forum after having similar issues. Second, looking at a random project is too time consuming. Opening, loading, deducing the code. If you have something specific, post it here. Otherwise, I cannot help, sorry...
     
  16. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    I'll send the whole project to you.

    You have full permission to find and copy the error and paste it here.
     
  17. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    I apologize, but you should work on your project yourself. Paste your code, and I will take a look. Cannot help with your whole project...
     
  18. arkedrem

    arkedrem

    Joined:
    Oct 13, 2018
    Posts:
    20
    There is no code.

    It's drag and drop.
     
  19. fashour

    fashour

    Joined:
    Dec 10, 2017
    Posts:
    2
    Did you solved the issue ? I'm having the same problem
     
  20. chirag_unity

    chirag_unity

    Joined:
    May 3, 2019
    Posts:
    1
    I had the same issue. This is not a bug in Unity. The issue is that when you uncheck the play Play on Awake, you now need to tell your App when to play the video (or how). This video explains how to do this when the image is detected:
    . You need to edit the DefaultTrackableEventHandler.cs file to add commands to tell it when the video should play.
    for example, when the Tracked target is found, run videoPlayer.Play();. When the video is not tracked, videoPlayer.Stop();

    A simple Google search found the video pretty quickly.
    Hope that helps someone else
     
  21. Gecika

    Gecika

    Joined:
    Apr 9, 2019
    Posts:
    2
    Thank you for the video tutorial. While this was helpful, it only fixed half of my problem. I am trying to play 4 different videos using the AR tracker. It loads all 4 in the editor, but only 3 on my android device. It chooses the 3 to work randomly, while the 4th video is loaded as a white plane. Any suggestions on how I can get all 4 videos to play consistently?

    Thanks bunches!

    Solution Found:
    I ended up having to redo all of my videos so that their resolution was lower and the file size was under 10MB each. I used Handbreak for the conversion. After doing this, I kept the "Play on Awake" active, but paused the videos when they are not being tracked using the code in the tutorial above. I also transcoded all the videos and set it to "auto" in the codec drop down and made sure they were a max resolution of 1920 x 1080. Anything higher seemed to break android's rendering. This is probably a duh moment! Ha ha. Hope this helps anyone else having the white plane problem!
     
    Last edited: May 5, 2019
    Psyco92 likes this.
  22. florayner1111

    florayner1111

    Joined:
    Mar 23, 2019
    Posts:
    1
    Hi,

    I have tried everything but can't seem to get rid of this white box (which only seems to happen when I build to Android ((it works perfectly when I play on Unity).

    I have tried to follow the vid above editing the DefaultTrackableEventHandler.cs file but keep getting stuck on an error saying 'member modifier protected must precede..' ??

    If anyone knows why this is happening, I would be too eternally* grateful as I am trying to include this as part of my degree show and I don't have a lot of time left.

    Thank you!!!
     
    Last edited: May 11, 2019
  23. OurStLouisHiSTORY

    OurStLouisHiSTORY

    Joined:
    Nov 11, 2019
    Posts:
    1
    I am having the same problem :(
    I cannot use the UnityEngine code because I dont have any of the UnityEngine properties