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. Dismiss Notice

Question Unity & Android - 360 Video Player is clipping (opengl native plug-in error: gl_invalid_enum)

Discussion in 'Scripting' started by pawelbabiuch, Sep 21, 2022.

  1. pawelbabiuch

    pawelbabiuch

    Joined:
    Sep 21, 2022
    Posts:
    4
    Hello,
    I've built simple 360 Video Player in Unity (2021.3.4f1) for Android (Samsung Galaxy Tab A7 Lite). Video is build in project.
    Problem: Video (audio & graphics) is clipping.

    Other facts:

    • This same app on my old phone works fine.
    • This video play fine when I play them from tablet (no from app).


    What I've tried:

    • Factory Reset
    • Play just sound (no render texture)
    • Load video from URL
    • Disable multithreading


    When app starts play video then Unity throw an error:

    Code (CSharp):
    1. opengl native plug-in error: gl_invalid_enum: enum argument out of range
    Any ideas how can I fix it ;)?
    Regards.
     
  2. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,058
    The VideoPlayer component on Android has always been a bit of a hassle to work with. Either it does it well, or it doesn't.
    Bugs, stutters, no audio, no video, a complete garbled mess, direct audio that doesn't work on one device but does on the other etc.
    Many times there's a problem with the VideoPlayer, I've reported them many times and they mostly got fixed but there's always a new Android device on the market that will just not work with it.
    It ain't VLC player that plays anything you throw at it sadly.

    Since the video is built into the project, I could assume that the encoding should be fine. Unity converts it to a usable format.
    If by clipping you mean that your 360° sphere isn't fully covered by the texture, you could try setting the RenderTexture's Wrap Mode to Repeat.

    Try using the latest Unity LTS build as it contains the most fixes.
    Try another video, something simple.
    Try a lower resolution. Often the GPU ain't even good enough to render at high resolution. Whilst a phone can do it easily, Android tablets are often way behind.
    Try OpenGLES 3 or Vulkan. I often found Vulkan to be a buggy mess with the Video Player.

    At some point on giving up, you'd be best to just fill in a bug report and hope they'll fix it within a reasonable time. Do mention the exact device you're testing on.
     
  3. pawelbabiuch

    pawelbabiuch

    Joined:
    Sep 21, 2022
    Posts:
    4

    Thanks for answer.

    Yea, I've tried a few Unity version (2019, 2020, 2021 - all LTS, 2022). I tried switch to Vulkan (video not render). That what I found is: set video to lower resolution (from 4k to 2k) and set lower bitrate twice.

    Thats a 'solution', but now video has really ugly quality. When I set resolution to 2500x1250px i get an error - "VideoPlayer cannot play url".

    Probably this cause problems: resolution. I tried with many resolutions and bitrates and I have only one conclusion simmilar to yours but I know then resolution cause errors.

    So, I'm still waiting for any ideas :)
     
  4. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,058
    Yeah if a lower resolution works, the GPU just can't handle much higher.
    Usually 4096x2048 is already too demanding. Where 2048x1024 is too low resolution.
    You're likely limited by what the GPU can render. In this case, not much higher than 2k.
    There's no way to work around this as it is a hardware limitation.
    The recording resolution is also FHD 1920x1080. This is usually close to the max resolution for playback as well.
    Phones usually have a good camera and are able to record 4k. They can playback 4k as well. Android tablets are less well equipped.

    Most iPads would probably have no problem with 4k though. Which is why the company I worked at, usually suggested an iPad more often than an Android tablet.
     
    pawelbabiuch likes this.
  5. pawelbabiuch

    pawelbabiuch

    Joined:
    Sep 21, 2022
    Posts:
    4
    Thank you for your explanations. My fears have been confirmed.
    Regards ;)