Hosting audio files on Amazon AWS: unable to play

With SAB 4.7 on a Mac (don’t want to upgrade to 5.0 quite yet, although was the same with 4.5 as well) I’ve not been able to configure the app to properly download audio files from Amazon AWS whereas from another location, there’s no issues (downloads fine and plays fine). In the brief download dialog, the download dialog indicates a negative number as opposed to counting through 1->100%.

As you can below, there’s no difference in the server response via wget (both 200 and both indicate the proper file size). Moreover, the actual MP3 files are all exactly the same and play fine upon downloading or listening to via browser (no corruption).

wget https://s3-ap-northeast-1.amazonaws.com/hkbible/mp3/B03___12_Luke__________Cantonese.mp3
–2019-01-14 14:55:18-- https://s3-ap-northeast-1.amazonaws.com/hkbible/mp3/B03___12_Luke__________Cantonese.mp3
Resolving s3-ap-northeast-1.amazonaws.com (s3-ap-northeast-1.amazonaws.com)… 52.219.0.166
Connecting to s3-ap-northeast-1.amazonaws.com (s3-ap-northeast-1.amazonaws.com)|52.219.0.166|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1250663 (1.2M) [audio/mpeg]
Saving to: ‘B03___12_Luke__________Cantonese.mp3’

B03___12_Luke__________Cantonese.mp3.2 100%[===============================================================================>] 1.19M 577KB/s in 2.1s

2019-01-14 14:55:21 (577 KB/s) - ‘B03___12_Luke__________Cantonese.mp3.2’ saved [1250663/1250663]

$ wget https://www.tulbox.com/hkbible/B03___12_Luke__________Cantonese.mp3
–2019-01-14 12:04:07-- https://www.tulbox.com/hkbible/B03___12_Luke__________Cantonese.mp3
Resolving www.tulbox.com (www.tulbox.com)… 104.31.70.141, 104.31.71.141, 2606:4700:30::681f:468d, …
Connecting to www.tulbox.com (www.tulbox.com)|104.31.70.141|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1250663 (1.2M) [audio/mpeg]
Saving to: ‘B03___12_Luke__________Cantonese.mp3’

B03___12_Luke__________Cantonese.mp3.1 100%[===============================================================================>] 1.19M 7.77MB/s in 0.2s

2019-01-14 12:04:07 (7.77 MB/s) - ‘B03___12_Luke__________Cantonese.mp3.1’ saved [1250663/1250663]

Additionally, analyzing some response header information when testing via Paw, it all lines up well enough:

Other Web Server through Cloudflare
HTTP/1.1 200 OK
Date: Mon, 14 Jan 2019 23:03:29 GMT
Content-Type: audio/mpeg
Content-Length: 1250663
Connection: close
Cache-Control: max-age=2592000
Last-Modified: Mon, 06 Aug 2018 18:36:40 GMT
Accept-Ranges: bytes
ETag: “0ec376ab42dd41:0”
X-Powered-By: ASP.NET
X-UA-Compatible: IE=Edge
Expect-CT: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
Server: cloudflare
CF-RAY: 4993bc7a2837bce0-SEA

Amazon S3
HTTP/1.1 200 OK
x-amz-id-2: xvJ+OG4fDm/3mjjbZjL/KrlWiTpFMDbxTUdCKFA4joHRYyrYt/NMRooxc/FtKyESUykNhojMBG8=
x-amz-request-id: BA9C323D60FD782F
Date: Mon, 14 Jan 2019 23:01:45 GMT
Last-Modified: Mon, 14 Jan 2019 21:17:10 GMT
ETag: “ab7ad7278edb94a9be6cbd4ec65d64cd”
Accept-Ranges: bytes
Content-Type: audio/mpeg
Content-Length: 1250663
Server: AmazonS3
Connection: close

Originally Amazon S3 was serving it up with audio/mp3 mime type, but adjusted that, and still have the same issue only from within the Scripture App. I’d really like to offload the files to S3, but unless I can resolve this problem, doesn’t look like I can.

When I try to download using wget I get a certificate error.
When I put the URL in Chrome, it brings up an audio player but does not download by default.

I am thinking it is your AWS server setup.

-----wget error ----
Connecting to s3-ap-northeast-1.amazonaws.com|52.219.0.48|:443… connected.
ERROR: Certificate verification error for s3-ap-northeast-1.amazonaws.com: unabl
e to get local issuer certificate
ERROR: certificate common name *.s3-ap-northeast-1.amazonaws.com' doesn't match requested host names3-ap-northeast-1.amazonaws.com’.
To connect to s3-ap-northeast-1.amazonaws.com insecurely, use `–no-check-certif
icate’.
Unable to establish SSL connection.

wget with http:// instead of https:// downloaded successfully.

Have you tried that?

@mcquayi thanks for the very quick response.

If indeed the issue was with invalid certs, that would explain it. However, in all my tests (and confirmed again now), there are no issues with the certs (which I’d be shocked with since there’s no way Amazon S3 would have cert issues without that being a very big deal). Their Digicert cert is configured just fine. See https://www.sslshopper.com/ssl-checker.html#hostname=s3-ap-northeast-1.amazonaws.com. No problems. Verified also in my wget calls, by API test calls, and browser tests.

Likewise with the complete chain:

### s3-ap-northeast-1.amazonaws.com resolves to 52.219.68.40
### Server Type: AmazonS3
### The certificate should be trusted by all major web browsers (all the correct intermediate certificates are installed).
###

The certificate was issued by DigiCert. Write review of DigiCert|
||###

The certificate will expire in 295 days. Remind me|
||### The hostname (s3-ap-northeast-1.amazonaws.com) is correctly listed in the certificate.|

\ 128x128 Common name: *.s3-ap-northeast-1.amazonaws.com
SANs: s3-ap-northeast-1.amazonaws.com, *.s3-ap-northeast-1.amazonaws.com, s3.ap-northeast-1.amazonaws.com, *.s3.ap-northeast-1.amazonaws.com, s3.dualstack.ap-northeast-1.amazonaws.com, *.s3.dualstack.ap-northeast-1.amazonaws.com, *.s3.amazonaws.com, *.s3-control.ap-northeast-1.amazonaws.com, s3-control.ap-northeast-1.amazonaws.com, *.s3-control.dualstack.ap-northeast-1.amazonaws.com, s3-control.dualstack.ap-northeast-1.amazonaws.com
Organization: Amazon.com Inc.
Location: Seattle, Washington, US
Valid from November 7, 2018 to November 6, 2019
Serial Number: 0bbdc22909029061a515d094530e8042
Signature Algorithm: sha256WithRSAEncryption
Issuer: DigiCert Baltimore CA-2 G2
\ 48x48
\ 128x128 Common name: DigiCert Baltimore CA-2 G2
Organization: DigiCert Inc Org. Unit: www.digicert.com
Location: US
Valid from December 8, 2015 to May 10, 2025
Serial Number: 0182f8098ea2e626b91a3b27841fb9af
Signature Algorithm: sha256WithRSAEncryption
Issuer: Baltimore CyberTrust Root

All that to say, I don’t think that’s the issue (and note that it’s not even AWS per se, just S3). My guess is you have a proxy or the like that is kicking up your particular issue (I’d like to see what the cert actually is that your request is picking up).

Having said that, it would explain the problematic behaviour so I spun up the app and configured it to pull from non-encrypted (non-HTTPS) and encountered the same issue: no problem with another encrypted https://sample.com/*.mp3 while both https://s3-ap-northeast-1.amazonaws.com/hkbible/mp3/ and http://s3-ap-northeast-1.amazonaws.com/hkbible/mp3/ fail (only in the app - fine everywhere else).

And pointing out again, no problems via wget:

Both locally as well as third-party verification.

And Chrome will always do that with mp3/mpeg.

Anyone else using S3 to host audio files with SAB?

I’m having the exact same issue here as well. Want the mp3s on AWS as that is where they are hosted for the website etc, fail every time. On any other web server I’ve tried it worked as expected. I’ve made the AWS folder fully public, still nothing. Will open in browser, but will fail in the app (currently only testing Android).

Teddy - Any chance you solved this?

@teddy & @James_B,

I just tested this with World English Bible text and audio from ebible.org. I uploaded the gospels (e.g. B04___01_John________ENGWEBN2DA.mp3) to https://sil-stg-aps-resources.s3.amazonaws.com/web.

I set the File Source to be Download files from internet using the above https url.
I built Android (tested on device) and iOS (tested on Simulator) apps using SAB 6.0.2 and both were able to download and play audio from S3. I didn’t change the default Content-Type assigned by AWS when uploaded through the web interface (which is audio/mp3).

This is what I get when downloading it via wget:

$ wget https://sil-stg-aps-resources.s3.amazonaws.com/web/B01___01_Matthew_____ENGWEBN2DA.mp3
--2019-10-31 09:40:50--  https://sil-stg-aps-resources.s3.amazonaws.com/web/B01___01_Matthew_____ENGWEBN2DA.mp3
Resolving sil-stg-aps-resources.s3.amazonaws.com (sil-stg-aps-resources.s3.amazonaws.com)... 52.216.0.240
Connecting to sil-stg-aps-resources.s3.amazonaws.com (sil-stg-aps-resources.s3.amazonaws.com)|52.216.0.240|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1825367 (1.7M) [audio/mp3]
Saving to: ‘B01___01_Matthew_____ENGWEBN2DA.mp3’

B01___01_Matthew___ 100%[===================>]   1.74M  6.61MB/s    in 0.3s

2019-10-31 09:40:51 (6.61 MB/s) - ‘B01___01_Matthew_____ENGWEBN2DA.mp3’ saved [1825367/1825367]

Have you tried a more recent SAB?
Did you make sure the FILES are public? S3 doesn’t really have folders, just bucket and keys (they pretend to have folders through the Web UI to allow users to put files in certain key paths). Make sure the individual files are public. You can select all the files and from the Action menu, select “make public”. You also need to make sure the bucket is public as well.

Chris

I’m on a Mac, was on SAB v6.0.1 but I upped it to v6.0.2 at your suggestion. I also ran the same wget test…

$ wget https://womansaudiobible-herbible.s3.us-east-2.amazonaws.com/Full/NT-26-Jude-01.mp3 --2019-10-31 12:17:49-- https://womansaudiobible-herbible.s3.us-east-2.amazonaws.com/Full/NT-26-Jude-01.mp3 Resolving womansaudiobible-herbible.s3.us-east-2.amazonaws.com (womansaudiobible-herbible.s3.us-east-2.amazonaws.com)... 52.219.96.232 Connecting to womansaudiobible-herbible.s3.us-east-2.amazonaws.com (womansaudiobible-herbible.s3.us-east-2.amazonaws.com)|52.219.96.232|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3646482 (3.5M) [audio/mp3] Saving to: ‘NT-26-Jude-01.mp3’ NT-26-Jude-01.mp3 100%[===================>] 3.48M 4.16MB/s in 0.8s 2019-10-31 12:17:50 (4.16 MB/s) - ‘NT-26-Jude-01.mp3’ saved [3646482/3646482]

In AWS I’ve set the entirety of the bucket and all subfolders and files to public…

I’ve been testing on Android only thus far, with these settings etc it still gives me a “Download Error” in the app. Thoughts?

Thanks for your help…

@James_B: I sent you a private message asking for your project…

@James_B, I was able to work-around the issue in your project by removing the trailing slash from your url in the File Source setting.
It was:
https://womansaudiobible-herbible.s3.us-east-2.amazonaws.com/Full/
I changed it to:
https://womansaudiobible-herbible.s3.us-east-2.amazonaws.com/Full
And it worked.

I will fix the code so that it works with either. Sorry about that…

Chris

Just tried it myself and yep - it works now. I could have sworn I tried that but I’ll take it either way! Thanks Chris.

@teddy, can you see if this fixes your problem? Does the url that you have specified in the File Source end with a slash? Can you remove it and see if that fixes your issue?

FYI, in the next release, it will still work with a slash at the end.

I’ll have to find the time to upgrade to the latest, configure a bucket again, and then test. I’m quite sure I would have tested with and without a trailing slash, but it’s possible I didn’t. However, thanks for getting to what seems to be the bottom of the issue!

I’ll note here for anyone who comes along later with a related issue but with a different cause: audio files downloaded from an external server must be downloaded over HTTPS on Android. See Audio files must be served via HTTPS on Android.

I also had the same issue when I tried downloading audio from an S3 bucket.

This is a sample file - https://sab-tmp.s3.ap-south-1.amazonaws.com/16/Malayalam/Mathew_01.mp3

Folder - https://sab-tmp.s3.ap-south-1.amazonaws.com/16/Malayalam

Going to try this.
https://aws.amazon.com/premiumsupport/knowledge-center/read-access-objects-s3-bucket/

Will update you all if I am able to fix the issue with my project.

This fixed my issue.

I found that I have given the URL in File Source setting with trailing slash.
https://sab-tmp.s3.ap-south-1.amazonaws.com/16/Malayalam/

I changed it to https://sab-tmp.s3.ap-south-1.amazonaws.com/16/Malayalam and it is working.