2010-12-01 47 views
2

即使預緊禁用,最簡單的<video>標籤<video>原因很多請求被點擊*

<video src="video.mp4" preload="none"></video> 

之前會引起請求到服務器*前被點擊

89.212.77.133 - - [01/Dec/2010:11:48:43 +0100] "GET /temp/html5-video-requests-test/one-noposter.html HTTP/1.1" 200 267 "-" "Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_0_2 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A400 Safari/6531.22.7" 
89.212.77.133 - - [01/Dec/2010:11:48:43 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:43 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 8621463 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:43 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 101783 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:44 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 8499743 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:44 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:44 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:44 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 8621463 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:44 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 101783 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:45 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 8505535 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 
89.212.77.133 - - [01/Dec/2010:11:48:44 +0100] "GET /temp/html5-video-requests-test/video.mp4 HTTP/1.1" 206 8519680 "-" "AppleCoreMedia/1.0.0.8A400 (iPhone Simulator; U; CPU OS 4_0_2 like Mac OS X; en_us)" 

設置海報會減少海報+約。 3個請求。

由於我在頁面上有很多視頻,因此我不希望瀏覽器發出任何請求,直到點擊視頻。

除了設置海報並禁用預加載之外,還可以做些什麼?

回答

0

也許嘗試:

<video preload="none"> 
    <source src="video.mp4" /> 
</video> 

我很新的HTML5,所以我不知道如果我的建議在這裏是你的代碼或多或少相同。

我對服務器端的東西一無所知。你在哪裏獲得有關這10個請求的數據?看起來你正在使用iPhone模擬器進行測試。這是來自控制檯日誌嗎?

找到了206狀態的參考:Notes on HTML5 Video and iPhone。警告說它已經過了一年了。