Getting intermittent 416 status code for mp4/mp3 audio playback mediaelementjs

0

Setup: I am using medialementjs (v4.2) via npm and the setup is done as part of a React component as mentioned in the docs. It is running on KAIOS 2.5 which I think should behave as Firefox 48.0. I am facing an issue where I see quite a few calls failing out with HTTP status code 416. On digging into the failing calls I see that the calls have byte ranges greater than the content length (as determined from previous http requests) of the audio file. I can't find any reason why this should happen.

Adding the request/response details for a 416 scenario, host and file name are replaced with dummies :

GET /473/abc.mp4 HTTP/1.1
Host    abc.def.com
User-Agent  Mozilla/5.0 (Mobile; LYF/F271i/LYF_F271i-000-02-05-050319_i; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5
Accept  audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5
Accept-Language en-US,en;q=0.5
Range   bytes=0-
Connection  keep-alive

HTTP/1.1 206 Partial Content
Content-Type    audio/mp4
**Content-Length  1638597**
Connection  keep-alive
Last-Modified   Tue, 05 Nov 2019 01:05:43 GMT
Accept-Ranges   bytes
Server  AmazonS3
Date    Fri, 03 Jan 2020 04:01:26 GMT
ETag    "078ee816a6a21c3764601e034781abd-1"
Content-Range   bytes 0-1638596/1638597
X-Cache Hit from cloudfront
Via 1.1 57a7a97927e18893c09f2a95e57175ae.cloudfront.net (CloudFront)
X-Amz-Cf-Pop    BOM51-C2
X-Amz-Cf-Id OYbRuU55Cp5BGaMw2yNzmQNvf6gZJF0RsS24j8aDPmwkuxJbjqcy1w==
Age 57772

GET /473/abc.mp4 HTTP/1.1
Host    abc.def.com
User-Agent  Mozilla/5.0 (Mobile; LYF/F271i/LYF_F271i-000-02-05-050319_i; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5
Accept  audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5
Accept-Language en-US,en;q=0.5
Range   bytes=160728-
Connection  keep-alive

HTTP/1.1 206 Partial Content
Content-Type    audio/mp4
Content-Length  1477869
Connection  keep-alive
Last-Modified   Tue, 05 Nov 2019 01:05:43 GMT
Accept-Ranges   bytes
Server  AmazonS3
Date    Fri, 03 Jan 2020 04:01:26 GMT
ETag    "078ee816a6a21c3764601e034781abd-1"
Content-Range   bytes 160728-1638596/1638597
X-Cache Hit from cloudfront
Via 1.1 2606bc577d5e46e4fb5a12cdb996e3f0.cloudfront.net (CloudFront)
X-Amz-Cf-Pop    BOM51-C2
X-Amz-Cf-Id BWUJe9Dn-cFC2ugRSwaWNw-3qAYlO2g7fPe6FocxBxKpwl-ly0Z8rg==
Age 57773
FAILING REQUEST, check the byte range:

GET /473/abc.mp4 HTTP/1.1
Host    abc.def.com
User-Agent  Mozilla/5.0 (Mobile; LYF/F271i/LYF_F271i-000-02-05-050319_i; Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5
Accept  audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5
Accept-Language en-US,en;q=0.5
**Range   bytes=1638597-**
Connection  keep-alive

HTTP/1.1 416 Requested Range Not Satisfiable
Content-Type    text/html
Content-Length  49
Connection  keep-alive
Server  CloudFront
Date    Fri, 03 Jan 2020 20:07:16 GMT
Expires Fri, 03 Jan 2020 20:07:16 GMT
X-Cache Error from cloudfront
Via 1.1 80770456312ba85426e0f3af4e996bbd.cloudfront.net (CloudFront)
X-Amz-Cf-Pop    BOM51-C2
X-Amz-Cf-Id BMvpfJQMZ0lG8R8_bLhonFSPwu5e79cpzFhuROPdB-RsBwn4gsHDgg
Adding info (running afinfo) about the file being played:

File type ID:   mp4f 
Num Tracks:     1
----
Data format:     2 ch,  22050 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
no channel layout.
estimated duration: 256.677959 sec
audio bytes: 1557304
audio packets: 5529
bit rate: 48520 bits per second
packet size upper bound: 728
maximum packet size: 728
audio data file offset: 22939
optimized
audio 5659749 valid frames + 1024 priming + 923 remainder = 5661696
format list:
[ 0] format:      2 ch,  22050 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Stereo (L R)
----

The code to play a url:

mediaelementJsInstance.setSrc(src);
//mediaelementJsInstance.load(); // I have tried both with and without load and it does not have an effect. 
mediaelementJsInstance.play();

My question is:

a) Is there anything wrong with the how I am playing the src or mediaelement setup

b) should I look at the CDN, using the same CDN I don't face the same problem for other clients (android/ios)

javascript
http
mediaelement.js
mediaelement
firefox-os
asked on Stack Overflow Jan 8, 2020 by tinus91 • edited Jan 12, 2020 by SE_net4 the downvoter

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0