Hi,
Firstly thank you for developing this module, it is really useful.

We have a site in Drupal Commerce that uses commerce file,
we sell mp3's or m4v's for music teaching downloads and this works fine on desktop computers,
but the files attempt to stream on iOs,
My question is ,
Is there a way to force download on these mobile devices? I know we can use idownloader or similar, but it would be better if they didn't even attempt to stream.

many thanks

Brodie

Comments

bojanz’s picture

See if this issue is the one that broke it: #2101017: Use of 'Content-Type: force-download' breaks downloading on Android
Try changing the headers that are outputted in commerce_file_download_page(), if force-download fixes it, then the issue above needs to be reopened.
Or clone commerce_file via git and revert this commit: http://drupalcode.org/project/commerce_file.git/commitdiff/ef65370

brodiebrodie’s picture

Hello , thanks for that
I tried changing the headers by using ,

$headers = array(
'Content-Type' => 'force-download'

instead of

$headers = array(
'Content-Type' => mime_header_encode($file->filemime),

in file_entity.pages.inc

but this didn't seem to do the job, on iPad the file still streams .

Is that the sort of thing that you were suggesting?

bojanz’s picture

Yes. I have no other ideas unfortunately. It's come combination of headers for sure.

brodiebrodie’s picture

Thankyou,

I will keep looking, meanwhile I think we will just have to zip the files

torgospizza’s picture

This is an iOS limitation: because mp4 format is associated with the browser, iOS plays the file in Safari even if you have set headers to force-download. (We sell media on our site as well, so we've had this question many times.) Essentially this is Apple's way of "sandboxing" apps with file types; they want you to create an app for your site and then associate files with that app, which would (in theory) trigger a download.

Your best option, IMO, is to host a streaming player for your mp4 files that iOS users can use to play back their content.

There are some other solutions discussed in this person's blog post, but I would use them at your own risk.

(This issue could probably be closed, because the issue lies with iOS, not Commerce File.)

brodiebrodie’s picture

Status: Active » Closed (works as designed)

Thanks, I'll close it for the reasons in #5