开发者

Force download mp3 for mobile site on iPhone

开发者 https://www.devze.com 2023-02-04 23:21 出处:网络
I\'m working on a little mobile site for a music开发者_如何学Pythonian and they want to be able to let users download a song for free on their mobile device. The problem I\'m running into is that in S

I'm working on a little mobile site for a music开发者_如何学Pythonian and they want to be able to let users download a song for free on their mobile device. The problem I'm running into is that in Safari for iPhone the song plays in the browser no matter what and does not get added to the music library.

On Android I've been able to force a download which the user can then add to their music application of choice. I was hoping there was some way to get the song into the iPhone music library with out requiring some additional application or going through iTunes.

Any help would be greatly appreciated. Thanks!


It is not possible to have Mobile Safari download a media file from your site to a device's library. That and many other parts of the iOS filesystem are protected from external access.


Safari on iOS 13 and up finally supports file downloads, just like Android and Chrome.


According to a senior level Apple Support Rep, Apple has coded their OS to specifically prevent any audio file that does not have DRM protection, to be downloaded. This means Apple products will force a file to stream as opposed to downloading the entire file. Finding an official statement from Apple is difficult so the closest I could get was talking to a senior rep. You can, of course, call apple for free support with ANY apple product (including I-tunes on windows lol) by calling 1-800 My Apple. Most likely you can get additional confirmation there.

I actually created a site where if you click on a link with a windows or android device, it forces the download. This doesn't work on Apple devices, it still will only stream. The only real fix for this is to offer the file as a compressed file. (ie. zip) then they could download the compressed file but then they would have to open the .zip up and extract the audio.

Ironically, I'm currently looking into how I can use PHP to "zip" a file up on the server side per client request and then deliver them the file in the compressed format. I stumbled across this post because I was attempting to see if there was a way to fool a system into believing a file was in fact protected when it was not.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消