Senior Program Manager Developer Experience and Evangelism at Microsoft
Jan. 12, 2011•0 likes•4,327 views
1 of 85
Multimedia on the web - HTML5 video and audio
Jan. 12, 2011•0 likes•4,327 views
Download to read offline
Report
Education
A lecture given at MIT in Boston about the benefits and technicalities of open web standards for Video and Audio. Lots of examples how to manipulate live video using CSS3 and Canvas.
3. What we will cover:
★ Quick history of Multimedia on the web
★ Annoyances with Flash
★ HTML5 audio and video
★ Painful stuff – codecs and conversion
★ Embedding
★ Controlling
★ Transforming
★ Realtime changes
★ Awesome audio stuff
11. And many others...
★ Quicktime / Quicktime VR
★ Microsoft Media Player
★ Shockwave
★ Acrobat had some image
editing features.
★ iPix / VRML and many other
forgotten ones...
12. They all had the same
issues.
★ End users must install a
plugin.
★ You need to upgrade the
plugin constantly.
★ There is limited interaction
with the rest of the page.
13. Another big issue is and
was security – plugins
are one of main attack
vectors for malware.
14. In the end, one
plugin prevailed
over all the
others: Flash.
22. Therefore it is also an
accessibility problem.
★ Other browsers than IE don’t allow you
to access Flash with a keyboard.
★ You are at the mercy of the developers
to make their movies keyboard
accessible.
★ Which is bad, as audio and video can
help a lot of people to understand
things.
27. HTML5 audio and video
make things much
simpler:
★ Betteraccessibility
★ Doing one thing well
★ Much simpler API
★ Allows for styling and overlays
★ View-source “hackable”
43. Embedding audio and
video in an HTML5
document is easy:
<audio src=”foo.ogg”>
If your browser didn’t suck, you’d have audio here.
</audio>
<video src=”foo.ogv”>
If your browser didn’t suck, you’d have video here.
</video>
44. That doesn’t do
anything yet
<video src=”foo.ogv” controls>
If your browser didn’t suck, you’d have video here.
</video>
★ Controls appear on mouse
hover or tabbing
★ Keyboard enabled
controls
★ Video can be styled in any
way.
46. So to give it to all
browsers...
<video controls>
<source src="http://www.archive.org/{...}_512kb.mp4"
type="video/mp4"></source>
<source src="http://www.archive.org/{...}nsters.ogv"
type="video/ogg"></source>
<p>Your browser doesn't like HTML5 video,
watch the movie on
<a href="http://www.archive.org/{...}_monsters">
archive.org</a>.
</p>
</video>
47. Things to consider:
★ Use MP4 always as the first
option to support iOS devices
(iPads, iPhone and so on...)
★ If you omit the type attribute,
the browser loads the meta
data of each source!
48. Media queries can save
bandwidth:
<video controls>
<source src="http://www.archive.org/{...}_512kb.mp4"
type="video/mp4"
media="(min-device-width:800px)"></source>
<source src="http://www.archive.org/{...}_low.mp4"
type="video/mp4"></source>
<source src="http://www.archive.org/{...}nsters.ogv"
type="video/ogg"></source>
<p>watch the movie on <a href="{...}_monsters">
archive.org</a>.</p>
</video>
49. Other attributes:
★ poster – define a picture to
show before loading.
★ height/width – oh, well...
★ loop – automatically restart
★ preload (auto/none/
metadata)
52. HTML5’s Media API
gives you control:
★ load() – load a new media.
★ canPlayType(type) – returns probably,
maybe and “” (really!)
★ play() – play the movie
★ pause() – pause the movie.
★ addTrack(label,kind,language) -for
subtitles
54. Writing a play button is
simple:
var audio = document.getElementsByTagName('audio')[0];
var play = document.getElementsByClassName('play')[0];
play.addEventListener('click',function(e){
var t = e.target;
if(audio.paused){
audio.play();
t.innerHTML = 'pause';
} else {
audio.pause();
t.innerHTML = 'play';
}
e.preventDefault();
});
68. I am a film buff and I like to find easter eggs in
movies. Every pixar movie for example has A113
in it – the room in the uni a lot of pixar employees
had their animation lectures in. To find things like
that I sometimes zoom the screen and scan
around.
I thought this should be possible in HTML5.