2016-06-03 11 views
2

Zusammenfassung: Cache nicht möglich und das zwischengespeicherte Audio über einen Service Worker verwenden.Kann zwischengespeicherte Audiodaten von Service Worker nicht wiedergeben


Versuch an: Cache relativ kleine Audiodateien (2-3mb) mit Servicemitarbeitern und Cache-API. Diese werden über ein HTML-Audio-Element geladen/gespielt, das normalerweise einen "Bereich" -Header setzt.

Problem: Service Worker reagiert mit dem gesamten Inhalt und ignoriert den Bereichskopf, und das Audioelement ignoriert den Inhalt und wird nicht wiedergegeben.

Ohne Service Worker: Server gehorcht der Bereich Header, sendet teilweise Inhalt, Audio Element ist glücklich und spielt das Audio.

Ich bin mit Google Chrome 52

Hinweis: Lösung erscheint durch mnot "Serve range requests from a complete cache entry" bemerkt worden zu sein, aber jeder Browser diese umgesetzt hat? Oder gibt es eine Workaround?


Technische Informationen

Chrome Terminal Stderr: [1:1:0603/164806:ERROR:render_media_log.cc(23)] MediaEvent: PIPELINE_ERROR demuxer: could not open

Chromkonsole Fehler: Uncaught (in promise) DOMException: The element has no supported sources.

Chrome Header (mit SW, 2 Teile):

PART#1 

GENERAL 
Request URL:http://localhost:3333/audio.m4a 
Request Method:GET 
Status Code:200 OK (from ServiceWorker) 
Remote Address:127.0.0.1:3333 

RESPONSE 
accept-ranges:bytes 
connection:keep-alive 
content-length:2449048 
content-type:audio/x-m4a 
date:Fri, 03 Jun 2016 10:14:02 GMT 
etag:"56f8f953-255e98" 
last-modified:Mon, 28 Mar 2016 09:28:51 GMT 
server:nginx 
x-content-type-options:nosniff 
x-frame-options:SAMEORIGIN 
x-xss-protection:1; mode=block 

REQUEST 
Provisional headers are shown 
Accept-Encoding:identity;q=1, *;q=0 
Range:bytes=0- 
Referer:http://localhost:3333/ 
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.10 Safari/537.36 

PART #2 

GENERAL 
Request URL:http://localhost:3333/audio.m4a 
Request Method:GET 
Status Code:200 OK (from ServiceWorker) 
Remote Address:127.0.0.1:3333 

RESPONSE 
accept-ranges:bytes 
connection:keep-alive 
content-length:2449048 
content-type:audio/x-m4a 
date:Fri, 03 Jun 2016 10:14:02 GMT 
etag:"56f8f953-255e98" 
last-modified:Mon, 28 Mar 2016 09:28:51 GMT 
server:nginx 
x-content-type-options:nosniff 
x-frame-options:SAMEORIGIN 
x-xss-protection:1; mode=block 

REQUEST 
Provisional headers are shown 
Accept-Encoding:identity;q=1, *;q=0 
Range:bytes=2392064- 
Referer:http://localhost:3333/ 
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.10 Safari/537.36 

Chrome-Header (ohne SW, 3 Teile!):

PART #1 

GENERAL 
Request URL:http://localhost:3333/audio.m4a 
Request Method:GET 
Status Code:206 Partial Content 
Remote Address:127.0.0.1:3333 

RESPONSE 
Connection:keep-alive 
Content-Length:2449048 
Content-Range:bytes 0-2449047/2449048 
Content-Type:audio/x-m4a 
Date:Fri, 03 Jun 2016 10:24:32 GMT 
ETag:"56f8f953-255e98" 
Last-Modified:Mon, 28 Mar 2016 09:28:51 GMT 
Server:nginx 
X-Content-Type-Options:nosniff 
X-Frame-Options:SAMEORIGIN 
X-XSS-Protection:1; mode=block 

REQUEST 
Accept:*/* 
Accept-Encoding:identity;q=1, *;q=0 
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6 
Connection:keep-alive 
Host:localhost:3333 
Range:bytes=0- 
Referer:http://localhost:3333/ 
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.10 Safari/537.36 

PART #2 

GENERAL 
Request URL:http://localhost:3333/audio.m4a 
Request Method:GET 
Status Code:206 Partial Content 
Remote Address:127.0.0.1:3333 

RESPONSE 
Connection:keep-alive 
Content-Length:56984 
Content-Range:bytes 2392064-2449047/2449048 
Content-Type:audio/x-m4a 
Date:Fri, 03 Jun 2016 10:24:32 GMT 
ETag:"56f8f953-255e98" 
Last-Modified:Mon, 28 Mar 2016 09:28:51 GMT 
Server:nginx 
X-Content-Type-Options:nosniff 
X-Frame-Options:SAMEORIGIN 
X-XSS-Protection:1; mode=block 

REQUEST 
Accept:*/* 
Accept-Encoding:identity;q=1, *;q=0 
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6 
Connection:keep-alive 
Host:localhost:3333 
If-Range:"56f8f953-255e98" 
Range:bytes=2392064-2449047 
Referer:http://localhost:3333/ 
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.10 Safari/537.36 


PART #3 

GENERAL 
Request URL:http://localhost:3333/audio.m4a 
Request Method:GET 
Status Code:206 Partial Content 
Remote Address:127.0.0.1:3333 

RESPONSE 
Content-Length:2121368 
Content-Range:bytes 327680-2449047/2449048 
Content-Type:audio/x-m4a 
Date:Fri, 03 Jun 2016 10:24:32 GMT 
ETag:"56f8f953-255e98" 
Last-Modified:Mon, 28 Mar 2016 09:28:51 GMT 
Server:nginx 
X-Content-Type-Options:nosniff 
X-Frame-Options:SAMEORIGIN 
X-XSS-Protection:1; mode=block 

REQUEST 
Provisional headers are shown 
Accept-Encoding:identity;q=1, *;q=0 
Range:bytes=327680- 
Referer:http://localhost:3333/ 
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.10 Safari/537.36 

Antwort

Verwandte Themen