Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Video Video not rendering Android 9

Discussion in 'Audio & Video' started by dcamod, Mar 30, 2020.

  1. dcamod

    dcamod

    Joined:
    Oct 29, 2019
    Posts:
    19
    Hello, I am having an issue with Android 9 video playback from a URL. The video format is .mp4. The audio plays but the video does not. This works for Android 10 and I have not tested it on any other versions. Is it a permissions issue or is it a render issue? I do not have the logcat because the Android 9 phone it was tested on was not my own.
     
  2. michaelberg

    michaelberg

    Unity Technologies

    Joined:
    Jan 11, 2017
    Posts:
    21
    This doesn't match your description perfectly since you are saying this works on Android 10, but this sounds a lot like a recent bug with the following resolution:

    When targeting Android API Level 28 or higher, you have to start adding an application attribute to Android to be able to use HTTP. If you add this line to your Android manifest, then HTTP will work:
    <application android:usesCleartextTraffic="true">

    Instructions for manually adding things to your Android manifest in your Unity project can be found here:
    https://docs.unity3d.com/Manual/android-manifest.html

    Alternatively, if you don't want to enable all HTTP traffic, you can enable HTTP to certain domains. This can be done via the Android security config file.
     
    dcamod likes this.
  3. dcamod

    dcamod

    Joined:
    Oct 29, 2019
    Posts:
    19
    Thanks for the reply I have had someone else test it for me on their phone again after updating the manifest and still no video. I am working on downloading Android 9 for Android studio to see if it works there. Is there anything else it could possibly be? I am using Unity 2019.2.12f1. Minimum Android version is 7.1 and Target is API 28.
     
    Last edited: Mar 30, 2020
  4. michaelberg

    michaelberg

    Unity Technologies

    Joined:
    Jan 11, 2017
    Posts:
    21
    If that's not it, then we probably need to look at the video clip itself to try to figure out what's wrong. Can you file a bug report and create a simple test project that tries to play this clip?
     
    dcamod likes this.
  5. dcamod

    dcamod

    Joined:
    Oct 29, 2019
    Posts:
    19
    Sure. Should I attach the project file to this message board and the report?

    Quick edit. While copying my exact project settings I realized I had it set to highest installed API which for me is API 29.

    Edit: I solved the issue. I was rendering a texture over the top of the video player render texture. I had a texture with it's Z depth set to render below the video as a background but it was a child of the render texture for the video player. In Android 10 and Windows this did not create an issue, but in Android 9 it did. That may be the only relevant information for you guys at Unity to glean from this interaction. Silly, I know. Thanks for all of the help and just for future people Googling this same issue. Changing the manifest file DOES work. You guys at Unity are awesome and thanks for this wonderful software as well as the help you willingly provide. I am humbly grateful for your responses. Maybe you could look into why this is a problem with Android 9 and not with 10 but if people simply do not set a texture as a child object of a render texture they will not have to worry about this issue. I did it so that when I went to Fullscreen the child texture would scale and rotate also without me having to use any GetComponent calls. Turns out it is better to just use the GetComponent calls.

    I should have known better and isolated the issue in a separate project. I have done it many times before. So, let that be a tip to beginners also. If you have an issue don't be like me. Be smart and create a new project with the issue isolated. :)

    Cheers all and good luck to the beginners like me!

    My issue is solved but it seems I discovered a new one (the way Android 9 and Android 10 handled the change in Z depth). Should I mark this topic solved and submit a bug report about that or is there a reason that is known for this?
     
    Last edited: Mar 31, 2020