On Beauty of the Web, there is a purple/blue swoosh at the beginning, if you are in IE9 or Chrome. How is that done? What is that? How come it only displays in IE9 and Chrome?
+4
A:
This is a video placed with html5. Look for id="streak". Here is the video if you care :)
http://az6680.vo.msecnd.net/botwcontent/assets/videos/layout/streak.mp4
Edit: The html that actually does this
<div id="streak">
<video id="vid" src="http://az6680.vo.msecnd.net/botwcontent/assets/videos/layout/streak.mp4">
</video>
<canvas id="streak_canvas" width="1920" height="256"></canvas>
</div>
Amir Raminfar
2010-10-27 23:22:09
And it probably only works in IE9 and Chrome because those browsers support the video tag.
Amir Raminfar
2010-10-27 23:22:52
Those are the only browsers it works in because they support the `<video>` tag *and* H.264. Firefox supports `<video>`, but not H.264.
Chuck
2010-10-27 23:31:45
@Amir: Firefox also supports the video tag, just not the H.264 codec which the site uses. Pre-4.0, Firefox supports only Theora, which in the end, lost the HTML5 video race.
Ashley Williams
2010-10-27 23:33:11
+1
A:
It's an MP4 file http://az6680.vo.msecnd.net/botwcontent/assets/videos/layout/streak.mp4
The reason it only works in Chrome and IE9 is because it's in a <video>
tag, which is only in HTML5.
Jimmy
2010-10-27 23:24:05
+1
A:
home.video.streak.js is the JS that is controlling the video.
var homeVideo;
var homeVideoTimer;
var homeVideoCanvas;
var homeVideoCanvasCtx;
function beginBackgroundVideo() {
try {
homeVideo = document.getElementById("vid");
homeVideoCanvas = document.getElementById('streak_canvas');
homeVideoCanvasCtx = homeVideoCanvas.getContext('2d');
homeVideoCanvas.style["display"] = "block";
homeVideoTimer = setInterval(drawBackgroundVideo, 16);
} catch (e) { //sometimes, modernizr canvas detection fails
}
}
function drawBackgroundVideo() {
if (!isNaN(homeVideo.duration)) {
if (homeVideo.ended === true) {
homeVideoCanvas.style["display"] = "none";
clearInterval(homeVideoTimer);
return;
} else {
homeVideo.play();
}
// Draw the video
try {
homeVideoCanvasCtx.drawImage(homeVideo, 0, 0, homeVideoCanvas.width, 250);
} catch (e) {
}
}
} /* paste in your code and press Beautify button */
if ('this_is' == /an_example/) {
do_something();
} else {
var a = b ? (c % d) : e[f];
}
and on the page its here:
<div id="streak">
<video id="vid" src="http://az6680.vo.msecnd.net/botwcontent/assets/videos/layout/streak.mp4">
</video>
<canvas id="streak_canvas" width="1920" height="256" style="display: inline; "></canvas>
</div>
looks like its doing via canvas.
etoxin
2010-10-28 02:05:17