Handling HTML5 Video for iOS and Safari clients

info+varnish at shee.org info+varnish at shee.org
Thu Sep 7 15:10:07 UTC 2017


Hi, a bit latency caused by vacation. 


Am 21.07.2017 um 09:53 schrieb Guillaume Quintard <guillaume at varnish-software.com>:
> 
> Don't pipe. ever. Unless your are using websockets.


Okay, I tried just to delete "req.http.cookie" or return(pass) both do not help here.




> do_stream is set by default, you can remove it.

Okay, thanks to clarify it. 



> Are we talking aboud VoD or Live? if the latter, remember to set grace to 0, other you'll have outdated manifest problems.

VoD - plain mp4 files. 


> What isn't working on Safari? Does the problem goes away if you connect straight to the origin? (ie. no varnish)


Test scenario: just GET the mp4 file and play it in the browser (HTML5).



Connecting straight to the backend (via SSH tunnel):

File size 7081786 test.mp4 


$ curl -s -I localhost:8080/test.mp4 
HTTP/1.1 200 OK
Date: Thu, 07 Sep 2017 14:48:14 GMT
Server: Apache
ETag: "6c0f3a-55899f81639c0"
Accept-Ranges: bytes
Content-Length: 7081786
Cache-Control: max-age=28800
Expires: Thu, 07 Sep 2017 22:48:14 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: video/mp4



Safari loads the file (progress bar shows up) and autoplays it directly:

Webserver log:

- - - [07/Sep/2017:16:08:09 +0200] "GET /test.mp4 HTTP/1.1" 200 7081786 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
- - - [07/Sep/2017:16:08:11 +0200] "GET /test.mp4 HTTP/1.1" 206 2 "http://localhost:8080/test.mp4" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
- - - [07/Sep/2017:16:08:11 +0200] "GET /test.mp4 HTTP/1.1" 206 7081786 "http://localhost:8080/test.mp4" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
- - - [07/Sep/2017:16:08:13 +0200] "GET /test.mp4 HTTP/1.1" 206 6669784 "http://localhost:8080/test.mp4" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"







Connecting through varnish with return(pass):

curl -s  -I https://www.DOMAIN.org/test.mp4  | grep -v -E "key-pins|access-control|strict"
HTTP/2 200 
date: Thu, 07 Sep 2017 14:48:59 GMT
etag: "6c0f3a-55899f81639c0"
accept-ranges: bytes
content-length: 7081786
cache-control: max-age=28800
expires: Thu, 07 Sep 2017 22:48:59 GMT
x-frame-options: SAMEORIGIN
content-type: video/mp4
x-varnish: 10
age: 0
via: 1.1 Cache


Safari starts to loading the file, progressbar does not shows any progress and video does not get autoplayed:


Varnish log:

IP - - [07/Sep/2017:16:12:04 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 2 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:12:04 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 3076986 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:12:07 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 3142462 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:12 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 65536 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:12:03 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 200 7081786 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:58 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 3207941 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:11 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 3989392 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:14:13 +0200] "GET http://www.DOMAIN.org/test.mp4 HTTP/2.0" 206 65536 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"




Webserver log:

IP - - [07/Sep/2017:16:12:03 +0200] "GET /test.mp4 HTTP/1.1" 200 7081786 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:12:04 +0200] "GET /test.mp4 HTTP/1.1" 206 2 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:12:04 +0200] "GET /test.mp4 HTTP/1.1" 206 7081786 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:12:07 +0200] "GET /test.mp4 HTTP/1.1" 206 7049018 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:11 +0200] "GET /test.mp4 HTTP/1.1" 206 6983482 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:12 +0200] "GET /test.mp4 HTTP/1.1" 206 65536 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:57 +0200] "GET /test.mp4 HTTP/1.1" 206 6819642 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:13:58 +0200] "GET /test.mp4 HTTP/1.1" 206 6754106 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
IP - - [07/Sep/2017:16:14:13 +0200] "GET /test.mp4 HTTP/1.1" 206 65536 "https://www.DOMAIN.org/test," "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"



Even pressing play manually, does not shows the video fluent. Instead a part is loaded and played (e.g. 2 seconds of the video) and then the playback stops again.

Sometimes I see a lot of sequent 64k-requests "GET /test.mp4 HTTP/1.1" 206 65536" while video is played partly. This happens only after a couple of time (more then 30 sec.) after the initial request.




> What do the developer tools tell you? Have you looked at varnishlog?


Developer tools of Safari does not tell something useful because media stuff is handled over to Quicktime ...



Are there more infos catchable that I am not aware of (tools of varnish etc.)?


--
Thank you,
Leon







More information about the varnish-misc mailing list