As far as I know you cannot store blobs in IndexedDB on iOS. It would be nice to have this feature. One good thing about blobs is that they store their mime type with them, and require fewer steps from database to use after being stored.
Do you have a test page that reproduces this issue? What sort of error are you getting?
Here is the live test page: https://lastmjs.github.io/safari-blob-indexed-db-test
The code is found here: https://github.com/lastmjs/safari-blob-indexed-db-test
All the test page does is fetch an mp3 file and try to store the blob in IndexedDB. I've set a console.log and an alert for the error. All the alert says is "null". I'm not sure how to see what the console.log says. I have limited access to iOS devices.
Sorry, the test page fetches the audio file, tries to store the blob in IndexedDB, then tries to retrieve the file and set the src of the audio element to the object url created from window.URL.createObjectURL. If the example is successful, you should be able to click play on the audio element and hear Alexander Graham Bell's voice.
It looks like the iOS device I was testing on is on iOS version 12.0.1. I tested it on another phone with version 12.2, and the test page works. I'll do some more testing and report back. It would be nice if someone could independently reproduce my results.
The bug does not reproduce for me on iOS 12.4 beta. This likely has been fixed already?
Seems likely, I've tested it on two 12.2 devices now and it works.
I've done some more testing:
12.2 works fine
12.3 works fine
12.3.1 does not work with an explicit error: DataCloneError: Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.
The behavior seems inconsistent across versions, and Chris you say it's working on 12.4 beta? Is there any way to get a confirmation that it is indeed fixed in 12.4 and will continue to be supported thereafter, officially?
I have just confirmed that the test page (https://lastmjs.github.io/safari-blob-indexed-db-test) works as expected on iOS 13 beta 1.
Thanks for everything!
So I'm not so sure this is fixed. I went to an Apple store to test downloads on https://podcrypt.app, and I started getting the same exact error again. This was yesterday. I tested on multiple devices and all were on iOS 12.4 (16G77), and all failed with the "DataCloneError: Failed to store record in an IDBObjectStore: BlobURLs are not yet supported."
I have access to another device at home with iOS 12.4 (16G77), and the error does not throw. What's going on here? I'm not confident iOS 13 has this fixed since some versions seem to work, some don't, and even the same version on different devices are not consistent in their behavior.
I think I know my issue...the devices at the Apple store are set to private mode by default, and private mode does not have support for IndexedDB blobs. So, non-private mode definitely works in 12.4