HTML5 Multimedia

28
HTML5 Multimedia Siddharta Govindaraj [email protected]

description

My presentation on using svg, canvas and video. Given at Doctype HTML5 - http://www.doctypehtml5.in

Transcript of HTML5 Multimedia

Page 1: HTML5 Multimedia

HTML5MultimediaSiddharta Govindaraj

[email protected]

Page 2: HTML5 Multimedia

Siddharta Govindaraj

FounderSilver Stripe Software

Page 3: HTML5 Multimedia

Agenda

SVG

Canvas

Video

Page 4: HTML5 Multimedia

Agenda

SVGCanvas

Video

Page 5: HTML5 Multimedia

SVG

Scalable Vector Graphics

Page 6: HTML5 Multimedia
Page 7: HTML5 Multimedia
Page 8: HTML5 Multimedia

<svg width="100%" height="100%" version="1.1"xmlns="http://www.w3.org/2000/svg">

<circle cx="100" cy="50" r="40" stroke="black"stroke-width="2" fill="red"/>

</svg>

Page 9: HTML5 Multimedia

SVG

Circles, rectangles, polygons

Paths, Groups

Fills, Gradients, Patterns, Filters

User interaction, Javascript & CSS

Synchronized Multimedia Integration Language

Page 10: HTML5 Multimedia

Workflow

1. Create diagram in a vector graphics tool

2. Save as SVG

3. Display SVG in page

Inkscape: http://www.inkscape.org/

Page 11: HTML5 Multimedia

Internet Explorer 7 & 8!!!

Either use browser detection and serve an image

OR use a plugin for IE (Adobe SVG Viewer)

OR use SVGWeb

SVGWeb: http://code.google.com/p/svgweb/

Page 12: HTML5 Multimedia

Use it today!

Replace graphs and charts

Replace illustrations

Generate scalable images

Page 13: HTML5 Multimedia

Agenda

SVG

CanvasVideo

Page 14: HTML5 Multimedia

Canvas

Allows you to interact directly with the screen

Page 15: HTML5 Multimedia

<canvas id=“draw“ width=“300“ height=“300“></canvas>

var canvas_el = document.getElementById(“draw“);var context = canvas_el.getContext(“2d“);context.fillRect(50, 25, 150, 100);

Page 16: HTML5 Multimedia

Canvas

Draw arbitrary pictures onscreen

Display images

User interaction model

Page 17: HTML5 Multimedia

Internet Explorer 7 & 8!!!

Use excanvas: Simulates canvas through VML

Excanvas: http://code.google.com/p/explorercanvas/

Page 18: HTML5 Multimedia

Use it today!

Dynamic charting

In-browser Games

Complex rendering

jQuery flot: http://code.google.com/p/flot/

Page 19: HTML5 Multimedia

Agenda

SVG

Canvas

Video

Page 20: HTML5 Multimedia

Video

Containers: MP4, Ogg, WebM

Video: H.264, Theora, VP8

Audio: MP3, AAC, Vorbis

Page 21: HTML5 Multimedia

CompatibilityTheora +Vorbis +Ogg

H.264 +AAC +MP4

VP8 +Vorbis +WebM

IE 9 9Firefox 3.5 4.0Safari plugin 3.0 pluginChrome 5.0 5.0 6.0Opera 10.5 10.6iPhone 3.0Android 2.0

Page 22: HTML5 Multimedia

<video src=“file.ogv“ width=“640“ height=“480“ controls=“controls“ preload=“preload“ autoplay=“autoplay“></video>

Page 23: HTML5 Multimedia

<video src=“file.ogv“ width=“640“ height=“480“ controls=“controls“ preload=“preload“ autoplay=“autoplay“></video>

<video width=“640“ height=“480“>

<source src=“file.mp4“ type='video/mp4; codecs=“avc1.42E01E, mp4a.40.2“'/>

<source src=“file.webm“ type='video/webm; codecs=“vp8, vorbis“/>

<source src=“file.ogv“ type=“video/ogg; codecs=“theora, vorbis“/>

</video>

Page 24: HTML5 Multimedia

Workflow

1. Record & edit video and audio tracks

2. Encode into appropriate formats

3. Insert into page

Firefogg: http://firefogg.org/

Handbrake: http://handbrake.fr/

Page 25: HTML5 Multimedia

Internet Explorer 7 & 8!!!

Use Flash fallback

<video width=“640“ height=“480“> <source .../> <object width=“640“ height=“480“ type=“application/x-shockwave-flash“> ... </object></video>

Page 26: HTML5 Multimedia

Use it today!

Play video directly through the browser

Page 27: HTML5 Multimedia

Questions

Siddharta Govindaraj

[email protected]

http://siddhi.blogspot.com

http://toolsforagile.com

Page 28: HTML5 Multimedia

Image Credits

http://www.sxc.hu/photo/1314784http://www.sxc.hu/photo/1033164http://www.sxc.hu/photo/949448http://www.sxc.hu/photo/1238789