Chrome ServiceWorker Bug - Partially Loaded Videos

It seems that video (all media?) files that are already partially loaded by a normal page load cannot load more parts through a ServiceWorker.

Similarly, video files that have already been partially loaded through a ServiceWorker cannot load more parts when the ServiceWorker is unregistered.

Tested in Chrome 78.0.3904.108 / Windows, reported as Bug #1026867

ServiceWorker source code for this test case: sw.js

The Buttons™

To Reproduce

For each scenario, start with a fresh Incognito-Window as to not have anything cached. Check the JS-Console for debug output.

✅ Scenario 1: Video uncached, ServiceWorker inactive

  1. Start with a fresh incognito window
  2. Click the Add Video Element Button
  3. Observe that the video plays and that you can jump to any time in the video
  4. Observe in the Dev-Tools network tab that the browser makes the appropriate range requests to the server

✅ Scenario 2: Video uncached, ServiceWorker active

  1. Start with a fresh incognito window
  2. Click the Register Service Worker Button
  3. Reload the page
  4. Click the Add Video Element Button
  5. Observe that the video plays and that you can jump to any time in the video
  6. Observe in the Dev-Tools network tab that the range requests will be intercepted by the ServiceWorker and the range limited to 1MB per request

❌ Scenario 3: Video partially cached through page load, ServiceWorker active

  1. Start with a fresh incognito window
  2. Click the Add Video Element Button
  3. Observe that the video plays and that you can jump to any time in the video
  4. Pause the video
  5. Click the Register Service Worker Button
  6. Reload the page
  7. Click the Add Video Element Button
  8. Observe that the video fails to play or stops after a few seconds
  9. Observe in the Dev-Tools network tab that a range requests has been made to the server (through the SW) and returned from the ServiceWorker. The response from the ServiceWorker seems to be ignored.
  10. Observe PIPELINE_ERROR_READ in chrome://media-internals/

❌ Scenario 4: Video partially cached through ServiceWorker, ServiceWorker inactive

  1. Start with a fresh incognito window
  2. Click the Register Service Worker Button
  3. Reload the page
  4. Click the Add Video Element Button
  5. Observe that the video plays and that you can jump to any time in the video
  6. Pause the video
  7. Click the Un-Register Service Worker Button
  8. Reload the page
  9. Click the Add Video Element Button
  10. Observe that the video fails to play or stops after a few seconds
  11. Observe in the Dev-Tools network tab that a request has been made to the server but no more than ~300 bytes are loaded
  12. Observe in chrome://media-internals/ that the browser seems to have made no attempt to load the video