2

I am trying to play an m4a file from the cache in safari. The error first occured on iOS (it is a Meteor Cordova app, therefore it uses Safari Webview), then I realized that it can also be reproduced in Safari on desktop. I am using the following code to try and play the audio:

LocalForage.getItem(track_id, (err, value)=>{
    if(err)
        throw err;
    //the loaded value is an arraybuffer of an m4a file
    let blob = new Blob([value]);
    let url = (window.URL || window.webkitURL || window || {}).createObjectURL(blob);
    let testAudio = new Audio(url);
    testAudio.play().then(()=>{console.log("play successful")}).catch((err)=>{console.error(err)});
});

The only error message I get is

DOMError: NotSupportedError (Message: "This operation is not supported")

If you are interested in the code used to download into the cache, it can be found in my other question, the fix for chrome provided there is implemented and working, but the testing code here is as simplified as possible.

Community
  • 1
  • 1
Taxel
  • 3,859
  • 1
  • 18
  • 40

1 Answers1

0

This is a normal behaviour. Localstorage is blocked by safari in private browsing mode.

Anis D
  • 761
  • 11
  • 25
  • 1
    Do you mean that webview on iOS always runs in private browsing mode? Also, if I test it on OSX, private browsing is not enabled and it does not work either. Do you have an idea how could I achieve offline caching differently? – Taxel Dec 12 '16 at 22:16
  • Could you add a some more information f.e. a link to the Safari documentation? – Phonolog Dec 18 '16 at 16:11