Forum

This forum is now read-only. Support is provided at https://wordpress.org/support/plugin/sermon-browser/

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Downloading MP3s on Android Phones
29 August, 2013
3:15 pm
Jedidiah Smith
Enthusiast
Members
Forum Posts: 37
Member Since:
10 July, 2013
sp_UserOfflineSmall Offline

I'm able to download mp3 sermons on my computer without any issue, but when I use the download link on my Android phone, rather than download the file, it downloads "downloadfile-2.bin" and does not open. Someone else with an Android phone told met they couldn't open downloaded sermons on their phone, and I found that I have the same problem. Have you seen this before?

Thanks.

29 August, 2013
6:44 pm
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

I'm pretty sure the problem is related to the issue discussed on this page.

In sermon.php, function sb_hijack, you can see the HTTP headers that are associated with the download links.  You can see these on lines 92-96 (for local file attachments) and on lines 132-143 (for URL attachments).  Basically, the headers sent are:

Content-Type: application/force-download
Content-Type: application/octet-stream
Content-Type: application/download
Content-Disposition: attachment; filename="your-filename.mp3"
Content-Transfer-Encoding: binary

Reading that article makes me think that Android has a problem with some of these headers.  However, I don't have an Android device to test, so I won't really be able to work on this much.

If anyone has an Android phone and wants to try some things out, I'd be interested to hear the results.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

29 August, 2013
6:54 pm
Jedidiah Smith
Enthusiast
Members
Forum Posts: 37
Member Since:
10 July, 2013
sp_UserOfflineSmall Offline

I'm happy to help out any way possible. I did try it with multiple browsers. Let me know if there is something I can do on my end.

 

Thanks.

 

29 August, 2013
6:59 pm
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

Well, that's the thing, Jedidiah, I don't know exactly what needs to be done.  But if you read that article, it gives some ideas for what the headers need to be to allow downloading on Android.  If you wanted to play with it, you could remove or edit some of those lines I mentioned in sermon.php until it works, and let me know what you find out.

If you aren't comfortable making those changes, I understand.  (I certainly wouldn't recommend doing it on a live church site.)  But since I can't do it, we'll have to wait for someone with the expertise and the equipment to provide us a solution.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

29 August, 2013
7:26 pm
Jedidiah Smith
Enthusiast
Members
Forum Posts: 37
Member Since:
10 July, 2013
sp_UserOfflineSmall Offline

I found those lines, but I really don't understand what it it suggesting.

In case this is helpful, I am able to rename the files to .mp3 on my phone and play it.

 

Also, I tried this on my Android tablet. On my tablet, it keeps the original filename, but when I try to open it says, "Cannot open file." This is what happened with my friend's Android yesterday as well.

8 September, 2013
4:23 am
colinw
Enthusiast
Members
Forum Posts: 12
Member Since:
18 August, 2013
sp_UserOfflineSmall Offline

I am having the same problem, I am happy to test if you have any specific suggestions about what lines of code to change.

8 September, 2013
4:38 am
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

Jedidiah and colinw,

I guess the first thing I would try would be to go into the sections of sermon.php at lines 92-96 and lines 132-143 and remove the lines containing the following:

Content-Type: application/force-download
Content-Type: application/download

Keep the lines containing this:

Content-Type: application/octet-stream

Try that out and see if it makes a difference in Android.  If that doesn't work, you can play around with the "Content-Disposition: attachment" line, using the article I linked to as a guide.

If you get it working in Android, you then need to test out your code in various computer browsers, making sure that the download link still works in all of those.

 

Please let us know if your research turn up anything interesting.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

12 September, 2013
3:28 am
colinw
Enthusiast
Members
Forum Posts: 12
Member Since:
18 August, 2013
sp_UserOfflineSmall Offline

Removing the lines you suggested did not make a difference so I left them in.

Based on the article you referred to I changed line 95 from:

header('Content-Disposition: attachment; filename="'.$file_name.'";');

to:

header('Content-Disposition: attachment; filename="'.$file_name.'"');

Android download seems to work now, but probably needs some further testing to be sure.

Line 142 may need a similar change, but I am not using any external URL's so have not tested.

 

This is from the article you referred to:

 

Please also make sure that there are no trailing semicolons behind any of these headers. Otherwise especially Content-Disposition will not be parsed properly by the Android stock browser (up to and including Android 4,Ice Cream Sandwich). Example:

Content-Disposition: attachment; filename="MyFileName.ZIP";

…will not work correctly because of the semicolon at the end. Such trailing semicolons are reportedly generated by some eCommerce packages that provide download links. With such a header the download will still happen, but the desired filename will be lost.

12 September, 2013
4:35 am
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

colinw,

That makes a lot of sense.  Thanks for looking into this.  I'll do some testing to see if removing that trailing semicolon will work for other browsers, and hopefully get this into a future version.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

12 September, 2013
3:20 pm
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

I've made this correction (removing the trailing semicolon from the Content-Disposition header) to both lines 95 and 142 in sermon.php.  A quick Google search shows me that the semicolon doesn't belong there.  And it still works with every browser I've tried.

This will be in the next version (hopefully out within the next day or two).  Thanks colinw and Jedidiah.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

12 September, 2013
4:39 pm
Jedidiah Smith
Enthusiast
Members
Forum Posts: 37
Member Since:
10 July, 2013
sp_UserOfflineSmall Offline

Thanks, guys. I made the change on our site, and I'm still having issues, though things are better.

 

When I download on my phone now, it doesn't rename the file like it did before, but I still cannot download directly from the downloads area. When I open the file up in a file explorer, I can open the mp3.  With mp3s from other sites, I can open them directly from the downloads area.

 

Are you able to do this colinw?

 

Thanks for your work on this.

 

13 September, 2013
2:47 am
colinw
Enthusiast
Members
Forum Posts: 12
Member Since:
18 August, 2013
sp_UserOfflineSmall Offline

Jedidiah - I know what you mean - after download the file will not open from the Android Download Manager, an error shows "cannot open file".  But the file can be played from the Android Music Player.

Ben - not sure if this will fix the problem but may be worth trying, this article suggests that the Content-Disposition filename extension be in UPPERCASE.  Just a thought.

http://stackoverflow.com/quest.....on-android

 

13 September, 2013
5:12 am
Ben Miller
Appleton, WI, USA
Moderator
Members

Moderators
Forum Posts: 1628
Member Since:
18 June, 2009
sp_UserOfflineSmall Offline

Removing the trailing semicolon is a good idea anyway; as far as I can tell, it never should have been there.  However, I don't want to send out capital letter extensions for everyone, especially since capital letter extensions have been known to cause problems in certain circumstances.  Let's try sending out capital letter extensions in the header for just Android.

Try these change in sermon.php and let me know how Android reacts:

Around line 95, find this line:

http://pastebin.com/RHbZEGr6

Change it to these lines:

http://pastebin.com/pBtfFNnX

 

Then around line 149 (line number after you add those other lines), find these lines:

http://pastebin.com/b4xceLVQ

Change it to these lines:

http://pastebin.com/Jbcn8LaS

 

Let me know if you have any questions.

Ben Miller, Pathways Church, Appleton, Wisconsin, USA
Read the new FAQ, last updated 11/21/2013
Announcing version 0.45.12

13 September, 2013
7:43 am
colinw
Enthusiast
Members
Forum Posts: 12
Member Since:
18 August, 2013
sp_UserOfflineSmall Offline

Hi Ben - that did not make a difference with my Android, that is not to say it won't help users with different versions.

For the time being I have reverted to the code without the uppercase fix.

I had been testing with Android Chrome browser and the removal of the semicolon and it fixed the download.bin problem.  I have now checked on the stock Android browser and even after the removal of the semicolon it attempts and fails completely to download the file.  I have a Samsung Galaxy S3 & Android 4.1.2.  There could be something else going on with my device, I just don't know what.

Checked on my wifes Galaxy S2 & Andorid 4.1.2 & the download was successful!  Still had the problem of opening the file from the Android Download Manager.

So would be interested to know which browser Jedidiah tested with, and if he can test the uppercase code.

Ben - could you have a look at this article which may have an alternate solution. Not completely sure it is relevant.

http://stackoverflow.com/quest.....s-htm-file

Forum Timezone: Europe/London

Most Users Ever Online: 381

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Rich Brown: 358

Matt Schlueter: 93

Mindy: 72

Don Johnson: 65

anointed: 57

0be1: 55

Member Stats:

Guest Posters: 7

Members: 3188

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 2

Topics: 1713

Posts: 7499

Newest Members:

marktest, deatles50, ValeriaGoodriz, dapedPup, oapedPup, Margarettoimb

Moderators: Ben Miller: 1628

Administrators: Mark Barnes: 435