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
Start with a fresh incognito window
Click the Add Video Element Button
Observe that the video plays and that you can jump to any time in the video
Observe in the Dev-Tools network tab that the browser makes the
appropriate range requests to the server
✅ Scenario 2: Video uncached, ServiceWorker active
Start with a fresh incognito window
Click the Register Service Worker Button
Reload the page
Click the Add Video Element Button
Observe that the video plays and that you can jump to any time in the video
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
Start with a fresh incognito window
Click the Add Video Element Button
Observe that the video plays and that you can jump to any time in the video
Pause the video
Click the Register Service Worker Button
Reload the page
Click the Add Video Element Button
Observe that the video fails to play or stops after a few seconds
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.
Observe PIPELINE_ERROR_READ in
chrome://media-internals/
❌ Scenario 4: Video partially cached through ServiceWorker, ServiceWorker inactive
Start with a fresh incognito window
Click the Register Service Worker Button
Reload the page
Click the Add Video Element Button
Observe that the video plays and that you can jump to any time in the video
Pause the video
Click the Un-Register Service Worker Button
Reload the page
Click the Add Video Element Button
Observe that the video fails to play or stops after a few seconds
Observe in the Dev-Tools network tab that a request has been made to
the server but no more than ~300 bytes are loaded
Observe in chrome://media-internals/ that the browser seems to
have made no attempt to load the video