Search Unity

WebGL VideoPlayer Apple Memory Issue

Discussion in 'Web' started by JoRangers, Aug 28, 2020.

  1. JoRangers

    JoRangers

    Joined:
    Nov 7, 2017
    Posts:
    26
    Hi everyone,

    I have an issue with the video player and the memory, especially on Apple’s devices.

    I tested with :
    - Unity 2019.4.3f1 - 2019.4.9f1
    - WebGL 2.0 & 1.0
    - Safari 13.1.2
    - Chrome version 85
    - Video mp4 h264 720p (2mb - 20mb)

    My app is for WebGL and I have several videos.
    So I set the VideoPlayer.url (I load the video from the StreamingAssets Path),
    Then VideoPlayer.Play()
    When I change a video, I do Video player.Close() and then the step as said above (with a new url of course)

    Inside the browser and their dev tool all the memory seems to be correct for my app.
    Snapshot around 50-120Mb.

    I also use this plugins found on GitHub.
    Thanks to https://github.com/kongregate/Unity-WebGL-Utilities
    I get these value on average : WebGL Memory - Total: 64MB, Used: 32MB, Free: 31MB

    But my problem is about the memory that I can see on the task manager for windows and activity monitor on MacOS.

    I focus my test on MacOs with Safari and the Activity Monitor.
    The app starts around 500-600mb.
    Then after 5-10 video changes, I got > 1Gb.
    I don’t know why but sometimes, it stays around 1.5Gb, other time the memory can go up to 3Gb and drop to 1Gb

    On MacOS with chrome, the memory stays at 500-600mb.

    My big problem is with my iPad Air 2019.
    With Safari or Chrome, after a few (20) video changes :
    - on Safari, the page restarts
    - on Chrome, I got the "Aw, Snap!" page crashes and other page loading errors.

    As I have a strange value in memory on the Mac, I guess the issue on the mobile device is related to memory.

    I am not an expert on Memory Management so I hope you can help me to resolve my issue.

    In attachment, you can find one screenshot of the web inspector from Safari MacOS.
    In the archive, I export 2 timelines in .json so you can import them inside your web inspector.

    Thank you for the help !
     

    Attached Files: