Search Unity

onProgress doesn't work when content encoding headers are set

Discussion in 'Web' started by CrazyGamesCom, Oct 14, 2019.

  1. CrazyGamesCom

    CrazyGamesCom

    Joined:
    Nov 11, 2016
    Posts:
    16
    When you set content encoding headers to let browser do the decompression (e.g. for Brotli), the onProgress stops working.

    Observed behavior:
    progress jumps to a fixed % and stays there until finished

    Expected behavior:
    progress comes in gradually while files are downloaded

    Does anyone know what causes this / how to solve this?
     
    Twyker likes this.
  2. hsallander

    hsallander

    Joined:
    Dec 19, 2013
    Posts:
    46
    Did you find a solution to this? We're having issues with this as well. Maybe @alexsuvorov has some input?
     
  3. CrazyGamesCom

    CrazyGamesCom

    Joined:
    Nov 11, 2016
    Posts:
    16
    We didn't find a solution to this.
     
  4. Twyker

    Twyker

    Joined:
    Nov 10, 2016
    Posts:
    12
    This is still happening when using a compression on WebGL builds on 2020.1+

    Is there any fix to this? Why would onProgress not be called anymore? @alexsuvorov @Marco-Trivellato any ideas maybe? :/
     
  5. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    It looks like this is a browser thing: when one does an XHR that is compressed, the progress events do not come through: https://bugs.chromium.org/p/chromium/issues/detail?id=463622.

    I believe there will be no other resolution to migrate to using fetch() API. I made a TODO note for the team to look into that in the future. Unity uses XMLHttpRequest for compatibility purposes, so migrating to fetch() will limit the browser compatibility somewhat, but looking at https://caniuse.com/fetch it does not look too bad.
     
  6. mld-cmwolke

    mld-cmwolke

    Joined:
    Aug 30, 2021
    Posts:
    2
    Hey!

    Is there any outline on when this change might be done?