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

Question Why doesn't my video play in the android smartphone but plays in the Unity Editor

Discussion in 'Audio & Video' started by Chethan007, May 26, 2022.

  1. Chethan007

    Chethan007

    Joined:
    Dec 3, 2020
    Posts:
    56
    I want to play a vertical video or a portrait video in Unity. I followed this tutorial and was successfully able to implement .As per the video you create a raw image in the UI canvas. In the hierarcy you add an empty video player gameobject. Then in the project window you right click and create a render texture. You drag the render texture to the Target texture field in the Video player and the texture field in the raw image.

    But the problem is create a I am able to play in my game view of Unity Editor but when I build on smartphone , it is not playing.

    As per some suggestion I changed Codec of the video in the inspector from Auto to VP8 but there was no change at all.

    I saw this answer, but I have not written any code as such. What I have done is as per that video.
     
    ArunPrakasam likes this.
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
  3. Chethan007

    Chethan007

    Joined:
    Dec 3, 2020
    Posts:
    56
    My Unity editor version is 2021.2.5f1 personal. Phone is Poco F1 ,Android version is 8.1 .

    I get this warning as such but no error

    Code (CSharp):
    1. WindowsVideoMedia error unhandled Color Standard: 0  falling back to default this may result in rendering issues
    You can see the Screenshot here
     

    Attached Files:

  4. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    You said your issue was only in the build. Can you check with Logcat on your phone if you get an error? WindowsVideoMedia error unhandled Color Standard only impacts the image color, but it doesn't work in your case.
     
  5. Chethan007

    Chethan007

    Joined:
    Dec 3, 2020
    Posts:
    56
    Oh, sorry. I am getting something like this in the Android Logcat

    Code (CSharp):
    1. 2022-05-27 23:07:19.049 8454 8487 Error Unity RenderTexture.Create failed: depth/stencil format unsupported - D32 SFloat S8 UInt (94). There is no compatible format on this platform or this fallback to a compatible format is disabled in the import inspector.
    Here is the screenshot

    upload_2022-5-27_23-9-37.png

    and If u scroll to the right horizontally

    upload_2022-5-27_23-10-8.png

    I am actually playing the video in the Home screen itself of my game
     
  6. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    lelaksi likes this.
  7. Chethan007

    Chethan007

    Joined:
    Dec 3, 2020
    Posts:
    56
    harpiagamesstudio likes this.
  8. kasym_

    kasym_

    Joined:
    Oct 18, 2022
    Posts:
    9
    Hi, I am using Unity 2022.3.4f1, Android and I have the same issue. I want to load video from storage and play it, however it works fine in editor but not in build.
    I do this to play the video

    videoPlayer.source = VideoSource.Url;
    videoPlayer.url = videoLocation;
    Debug.Log("Preparing videoPlayer");
    videoPlayer.Prepare();

    and I subscribe to event like so:

    videoPlayer.prepareCompleted += source =>
    {
    Debug.Log("Playing videoPlayer");
    source.Play();
    };

    However I see nothing, neither I have any message in logs.

    Interesting to note that if I use

    Handheld.PlayFullScreenMovie(videoLocation);

    to play my video, it works in build but not in editor

    Any ideas?
     
  9. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    You should probably check with Logcat your log. Your log will tell what is the issue.
     
  10. drazuerg

    drazuerg

    Joined:
    Jan 31, 2014
    Posts:
    62
    Hello there!

    I have a similar issue with my game on Android. I picked up all these errors from Game Analytics :
    RenderTexture.Create failed: depth/stencil format unsupported - D32 SFloat S8 UInt (94). There is no compatible format on this platform or this fallback to a compatible format is disabled in the import inspector.

    I could get the top 10 devices that would generate this error (lots of Samsung devices it seams)

    stencilDevices.png

    • CLT-L09
    • LX3KFONWI
    • SM-A015M
    • SM-A115M
    • SM-G955F
    • SM-G965U
    • SM-N950U
    • SM-N960U
    • SM-N960U1
    • STK-LX3

    Luckily I have an old device where I could reproduce the issue (Redmi 7A).
    The video I'm trying to render is just a black screen. It wouldn't play.

    I changed the Depth Stencil Format to D32_SFLOAT and it seems it did the trick for this specific device, but the video lags terribly ... (still better than a black screen I guess).

    stencilOptions.png

    I couldn't find documentation on the various options, and I'm really not familiar with rendering theory.
    Should I just put "None" in there ?
    Would that change performances anyhow ?

    Thanks for you feedback @The_Island !
     
    afonsooliveira likes this.