So the browser can at will delete the saved playlist and cache streams at will if the application uses too much data or the device storage is full.
This is still happening to my phone very fequently, even though not a lot of data is used.
I tried to fix that by typical means, e.g. bookmark it and add it to the homescreen, to no avail.
Turns out I overlooked a significant limitation when caching the thumbnail images.
The thumbnails are fetched directly from youtubes servers and then cached. Due to CORS policy, the image data of this is protected, inaccessible by a userscript. When cached, this means the response type is 'opaque'. So while individual thumbnails only make up for around 4kB, Chrome policy dictates that all opaque cached items (in other words, those fetched from other origins) make up at least 7MB in quota usage.
For my test case, just saving a playlist of a thousand videos would add 7GB to the storage quota, even though it is actually only 4MB of data. This resulted in the browser deleting the data very quickly.
There are two possible solutions to this:
Don't cache the thumbnails at all. Since they are so small this would be sad because they add quite a lot to the offline experience. The masses of requests when loading up a 1000-video playlist is also not healthy if not cached.
Route them though the cors server, just like the cached audio stream, to circumvent cors policy. This would only be added for explicitly cached thumbnails, e.g. those of cached playlists, and not other thumbnails. Other thumbnails would not be cached at all anymore. The effect on the cors server would be pretty big. Also I would have to ease the request limit once more to allow users to cache a 1000-video playlist at once.
I'd want to go for 2., but for the short term, I'll probably do 1. until I have the time to adress this properly.
So the browser can at will delete the saved playlist and cache streams at will if the application uses too much data or the device storage is full. This is still happening to my phone very fequently, even though not a lot of data is used.
I tried to fix that by typical means, e.g. bookmark it and add it to the homescreen, to no avail.
Turns out I overlooked a significant limitation when caching the thumbnail images. The thumbnails are fetched directly from youtubes servers and then cached. Due to CORS policy, the image data of this is protected, inaccessible by a userscript. When cached, this means the response type is 'opaque'. So while individual thumbnails only make up for around 4kB, Chrome policy dictates that all opaque cached items (in other words, those fetched from other origins) make up at least 7MB in quota usage. For my test case, just saving a playlist of a thousand videos would add 7GB to the storage quota, even though it is actually only 4MB of data. This resulted in the browser deleting the data very quickly.
There are two possible solutions to this:
I'd want to go for 2., but for the short term, I'll probably do 1. until I have the time to adress this properly.