Multimedia and HTML5
There is a wealth of new functionality coming to browsers under the umbrella term of HTML5, but certainly the most talked-about is the inclusion of native media playback and the visual possibilities offered by the new canvas element. In this session we'll cover the basics of audio, video and canvas in HTML5 - mixing context and theory with simple live demos and examples that showcase the power of these new tools for developers.
http://thinkvitamin.com/online-conferences/html5-nov/
Links to demos used in the presentation:
http://people.opera.com/patrickl/experiments/video/basic/
http://people.opera.com/patrickl/experiments/flash-overlap/
http://people.opera.com/patrickl/experiments/flash-overlap/fixed.html
http://people.opera.com/patrickl/experiments/video/hover+transition/
http://www.youtube.com/html5
http://camendesign.com/code/video_for_everybody
http://camendesign.com/code/video_for_everybody/test.html
http://people.opera.com/patrickl/experiments/webm/basic-controls/
http://people.opera.com/patrickl/experiments/webm/fancy-controls/
http://people.opera.com/patrickl/experiments/webm/fancy-swap/
http://people.opera.com/patrickl/experiments/audio/wilhelm/controls.html
http://people.opera.com/patrickl/experiments/audio/wilhelm/
http://people.opera.com/patrickl/experiments/canvas/particle/2/
http://mariuswatz.com/works/abstract01js/index.html
http://www.splintered.co.uk/experiments/archives/paranoid_0.2/
http://alteredqualia.com/canvasmol/
http://www.splintered.co.uk/experiments/archives/canvas-ambilight/
http://people.opera.com/patrickl/experiments/canvas/image-edit/
http://github.com/mezzoblue/PaintbrushJS
http://html5doctor.com/video-canvas-magic/
http://media.chikuyonok.ru/ambilight/
http://diveintohtml5.org/everything.html
http://www.modernizr.com/
http://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
http://sublimevideo.net/
http://videojs.com/
http://www.happyworm.com/jquery/jplayer/
4. “...extending the language to better
support Web applications [...] This puts
HTML in direct competition with other
technologies[...] , in particular Flash and
Silverlight.”
Ian Hickson, Editor of HTML5
http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
28. canvas has standard API methods for drawing
ctx = canvas.getContext("2d");
ctx.fillRect(x, y, width, height);
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x, y);
ctx.bezierCurveTo(x1, y1, x2, y2, c1, c2);
29. canvas drawing ready-made images
ctx = canvas.getContext("2d");
var logo = new Image();
logo.src = 'logo.png';
ctx.drawImage(logo,x1,y1,w1,h1,x2,y2,w2,h2);
or call in an existing image already on the page
30. canvas access to image data array
ctx = canvas.getContext("2d");
canvasData = ctx.getImageData(x,y,w,h);
[R,G,B,A,R,G,B,A,R,G,B,A,R,G,B,A, … ]
34. canvas also works with video
ctx = canvas.getContext("2d");
v = document.getElementById('player');
ctx.drawImage(v,x1,y1,w1,h2,x2,y2,w2,h2);
grab currently displayed frame (update as appropriate)
35. video, audio and canvas on any device
without plugins
(Java / Flash / Silverlight not ubiquitous)
42. feature-detection for audio/video
if (!!document.createElement('video').canPlayType;) { … }
if (!!document.createElement('audio').canPlayType;) { … }
43. feature-detection for audio/video codecs
var v = document.createElement('video');
if (!!(v.canPlayType)&&
((v.canPlayType('video/webm;codecs="vp8,vorbis"') == 'probably')
||
(v.canPlayType('video/webm;codecs="vp8, vorbis"') == 'maybe')))
{ … }