Skip to content

Instantly share code, notes, and snippets.

@booherbg
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save booherbg/e93ec212bf1255432717 to your computer and use it in GitHub Desktop.
Save booherbg/e93ec212bf1255432717 to your computer and use it in GitHub Desktop.
Google Chrome Pending network calls on html5 video -- fix

Google Chrome Pending video status

There's an outstanding bug in Google Chrome where video resources aren't properly closed after download, so the socket limit gets maxed and subsequent videos (and all ajax calls) hang. https://code.google.com/p/chromium/issues/detail?id=234779

I tried, with no success:

  • Removing the tag after unload (in an attempt to force the resource to be released)
  • All combinations of preload, auto, controls etc.
  • Manual remove() of the video player
  • Add a unique timestamp to the src= to force reloading

Nothing worked, except finally -- via a random stack overflow thread -- this seems to work:

if(window.stop !== undefined) {
    window.stop();
} else if(document.execCommand !== undefined) {
    document.execCommand("Stop", false);
}

But it only works if I put this in my "sync" function, which runs every 500ms. So it basically has to be run continuously. But it seems to clear it all out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment