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 displays black frame only on Android

Discussion in 'Vuforia' started by marthetra, Oct 19, 2017.

  1. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    When testing my app on an Android phone, the video only displays a black rectangle.

    My source video needs to be, and is, a video retreived from URL so using the transcoding override for Android is not an option. It is currently a standard H264 mp4 with high bitrate.

    I tried disabling the Auto Graphics API, leaving OpenGLES2, 3 and Vulkan. This did not make any difference.

    Does anyone know what the problem is? Is it the encoding of the video or some setting/component that is missing?

    Thanks!
     
  2. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    If I'm understanding correctly, you are wanting the camera to be this external feed from the URL and not the Android camera correct? If so, this is not supported by Vuforia, you'll need to use the device camera.
     
  3. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    Oh, my apologies for the unclear question.
    I have made a simple app where a triggered image displays a video tracked to the image.
    The problem is that the video does not play when built to Android, it only shows a black rectangle on top of the image target.
     
  4. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    What are you using to play your video? Our core samples have a demonstration of using Unity's Video Player component with an included video. I've attached a screenshot of a modification to it that plays a video using a web url. I deployed this to an Samsung Galaxy 8+ and it worked fine. If you're using a different method than this, or if this is what is causing your issues, I would recommend maybe checking out a different Unity subforum as this is outside the scope of Vuforia features.

    Thanks.
     

    Attached Files:

  5. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    I am trying to apply the same setttings, but I am having some difficulties.
    I created a plane with a mesh collider, mesh renderer that contains a material that is the same as the image target.
    I then have the video player and lastly a video controller script. (see attached picture)
    Now, when I have Play On Awake active, the video plays in Unity play mode, but when unchecking this option, it only displays the material from the mesh renderer.
    So, maybe first things first.. How do you set up the mesh renderer so that when play on awake in deactivated it still will play the video and not simply display the material?
    And, how do I add audio from the video when the video is online?
     

    Attached Files:

  6. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Comparing what you have in your screenshot and what I see in the samples, the core difference is that the samples is using a Mesh Renderer attached to the same object as the Video Player and yours is attached to the parent. Perhaps the parent Renderer is being covered or not displaying? I'm not certain this is the issue, but it is the only difference I can see with the picture presented.
    In terms of sound, you'll need to define and object as your Audio Source on your Video Player component for the sound to play.
     
  7. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    I tried building the image target samples to my phone, and the video played perfectly. I tried switching the source to url then added the url displayed in your screenshot. The video is no longer showing up. It is the same problem as I experience in my project. I only see the material assigned to the renderer, not the video. It plays perfectly in the Unity player, but does not show up on Android. When I close the app, I see a small symbol showing that audio is being played, however I cannot hear anythng. So it does play, but it's not visible or audible.
     
  8. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Do you see any errors in ADB Logcat when running on Android?
     
  9. marthetra

    marthetra

    Joined:
    Sep 21, 2017
    Posts:
    7
    No, not really.
    I tested on a different phone. Samsung G920F. And I got both the smple project and mine to work on the Samsung phone. There is a playback issue with my videos however. It was updating the video every other second or so, making it a very choppy playback. The reason it is displaying a black frame only on the other phone, Huawei P8 lite, might be because of the video encoding. I will do some further testing...