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

Question Video not playing on iOS in WebGL

Discussion in 'Audio & Video' started by ryansizemore, Sep 7, 2021.

  1. ryansizemore

    ryansizemore

    Joined:
    Jan 25, 2014
    Posts:
    8
    I'm having issues playing videos on WebGL using iOS Safari.

    This is the error it is getting.

    NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
    play@[native code]
    _JS_Video_Play

    I have an interactive button that starts playback, a workaround I put when autoplay was causing issues on Chrome. Not sure why it is throwing this issue. I am preparing the video while the button is displayed, could that be causing the issue? It's not an issue on other browsers.

    I have several videos in the streaming assets folder that I'm calling with videoPlayer.url = Path.Combine(Application.streamingAssetsPath, URL[index]); This works on PC/Mac web browsers and Android Chrome. It also works on iOS Chrome. Safari on iOS seems to be the only issue.

    I read some forum posts saying to use UnityWebRequest but I couldn't find examples that lined up with what I wanted and the "Path.Combine(Application.streamingAssetsPath" seems to be working without it. Unsure what to do to troubleshoot. I've looked in the forums but haven't found a solution.

    Similarly, Firefox on Android will play the audio of the videos but won't display the video.
     
  2. ryansizemore

    ryansizemore

    Joined:
    Jan 25, 2014
    Posts:
    8
  3. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    The issue tracker says that the fix landed in 2020.3.16
     
  4. nullgamestudio

    nullgamestudio

    Joined:
    Nov 6, 2016
    Posts:
    10
    Hello everyone, I hope that this is the right place to ask.
    I have the same problem of black screen on iOS devices, meanwhile on android and pc it just works.

    I am using unity 2021.3.2f

    This is the test site: https://www.interactivelab.it/Work/WebTest/index.html

    I setup a simple scene with a button and a video player that load a video hosted on Digital Ocean. The video works well everywhere but it doesn't load on iOS, i see only a black screen.

    I read through the internet that can also be a CORS problem (which i setup on DO). Do you have any idea of what is wrong?
    Here the CORS settings.
    Thank you in advance.

     
  5. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    is not fixed at all
    Still not work on ios
     
    CyborgGames likes this.
  6. CyborgGames

    CyborgGames

    Joined:
    Mar 2, 2017
    Posts:
    13
    2021.3.16f1
    Still not work on ios
     
  7. QasimJUD

    QasimJUD

    Joined:
    Apr 18, 2022
    Posts:
    3
    Hi,
    I work on playing videos in unity with unity video player using video urls link. Urls must be with the video type (ex. https/xyz.mp4) it worked fine on Crome, Mac, IOS, firefox etc. the issue that I have 12 IPADS, iPhones, and android devices on which I test the webGL build with same link which I upload on firbase local host and its working on (3 IPADS and 4 iPhones) but at the same time its not working on only (1 iPhone and 1 IPAD). I face the request is not allowed by the user agent in the current context or the permission denied error. I use unity video player
    build link is https://host557.web.app/
     
  8. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    still on 2023 we are unable to play video on Iphone or Ipads? :(
     
  9. QasimJUD

    QasimJUD

    Joined:
    Apr 18, 2022
    Posts:
    3
    Did you play my webGL build host557.web.app on your any IPAD or iPhone device?
     
  10. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    Yes, and works on my device.
    But I have the same problem as you, on some device it works and with some others don't
    But I cannot give an app with this kind of behaviour to a client...

    Your solution anyway works on my device and mine not...
    Can I ask you what did?
    .
    Did you something about the CORS problem?
     
    Last edited: Jan 18, 2023
  11. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    281
    Can I ask you what Unity version did you used to create your demo?