Upload
patrick-lauke
View
2.893
Download
8
Tags:
Embed Size (px)
Citation preview
Schöne neue Welt von HTML5
Patrick H. Lauke / MultimediaTreff 28 / Köln / 3 Dezember 2011
NEUE TECHNOLOGIEN IM KONTEXT
"there is already a lot of excitement for HTML5, but it’s a little too early to deploy it because we’re running into interoperability issues."
Philippe Le Hegaret, W3C interaction domain leader
blogs.techrepublic.com.com/hiner/?p=6369
http://www.flickr.com/photos/24374884@N08/4603715307/
2004 W3C Fokus auf XHTML 2.0…die Zukunft ist XML!
http://www.flickr.com/photos/craiga/17071467/
“...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 HTML5http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
HTML5 Spezifikation fürBrowserhersteller
(wie interpretieren Browser Markup/Code – kein “reverse engineering”)
für Autoren: HTML5 differences from HTML4http://www.w3.org/TR/html5-diff/
software.hixie.ch/utilities/js/live-dom-viewer/
Top 20 class names1. footer 11. button
2. menu 12. main
3. style1 13. style3
4. msonormal 14. small
5. text 15. nav
6. content 16. clear
7. title 17. search
8. style2 18. style4
9. header 19. logo
10. copyright 20. body
http://devfiles.myopera.com/articles/572/classlist-url.htm
Top 20 id names1. footer 11. search
2. content 12. nav
3. header 13. wrapper
4. logo 14. top
5. container 15. table2
6. main 16. layer2
7. table1 17. sidebar
8. menu 18. image1
9. layer1 19. banner
10. autonumber1 20. navigation
http://devfiles.myopera.com/articles/572/idlist-url.htm
neue und alte Browser “unterstützen” die Elemente(obwohl einige etwas Hilfe brauchen)
header, footer, … { display: block; }
Internet Explorer <9 braucht Stützräderdocument.createElement('header');document.createElement('footer');…
http://html5doctor.com/how-to-get-html5-working-in-ie-and-firefox-2
rich form elements – ganz ohne JavaScript
<input type=”date”><input type=”time”><input type=”month”><input type=”week”><input type=”datetime” … ><input type=”range”><input type=”number”>
<input type=”file” multiple>
<input … autofocus><input … autocomplete>
Typen und Attribute miteingebauter Validierung<input … required><input type=”tel”><input type=”email”><input type=”url”><input … pattern="[a-z]{3}[0-9]{3}">
people.opera.com/patrickl/experiments/forms/newtypes.html
people.opera.com/patrickl/experiments/forms/validation.html
<object width="425" height="344"><param name="movie"
value="http://www.youtube.com/v/9sEI1AUFJKw&hl=en&fs=1&"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/9sEI1AUFJKw&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
<video src="video.webm" controls autoplay loop preload poster="poster.jpg" width="320" height="240"> <a href="video.webm">Download movie</a></video>
Video als natives object
● verhält sich wie jedes andere HTML Element● keyboard accessibility von Haus aus
people.opera.com/patrickl/experiments/video/hover+transition
<video> per JavaScript ansteuern
var v = document.getElementById('player');
v.play();v.pause();v.volume = … ;v.currentTime = … ;…
events vom <video> abfangen
var v = document.getElementById('player');
v.addEventListener('loadeddata', function() { … }, true)v.addEventListener('play', function() { … }, true)v.addEventListener('pause', function() { … }, true)v.addEventListener('timeupdate', function() { … }, true)v.addEventListener('ended', function() { … }, true)…
people.opera.com/patrickl/experiments/webm/basic-controls
people.opera.com/patrickl/experiments/webm/fancy-controls
people.opera.com/patrickl/experiments/webm/fancy-swap
WebM
von Google, aber “open and royalty-free”Web-optimiert
Support von Software- und Hardware-Herstellern
Video mit multiple sources<video controls autoplay poster="…" width="…" height="…">
<source src="movie.webm" type="video/webm" /><source src="movie.mp4" type="video/mp4" /><!-- fallback content -->
</video>
Flash fallback für ältere browsershttp://camendesign.com/code/video_for_everybody
<video controls autoplay poster="…" width="…" height="…"><source src="movie.webm" type="video/webm" /><source src="movie.mp4" type="video/mp4" />
<object width="…" height="…" type="application/x-shockwave-flash" data="player.swf">
<param name="movie" value="player.swf" /><param name="flashvars" value=" … file=movie.mp4" /><!-- fallback content -->
</object>
</video>
Audio...genau das gleiche
<audio src=”music.mp3” controls autoplay … ></audio>
<audio controls autoplay><source src="music.mp3" type="audio/mpeg" /><source src="music.oga" type="audio/ogg" /><!-- fallback content -->
</audio>
Formate: MP3 vs Ogg Vorbis (vs WAV)
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);ctx.drawImage(…);
people.opera.com/patrickl/experiments/canvas/particle/3
canvas und externe Bildformate
ctx = canvas.getContext("2d");
var logo = new Image();logo.src = 'logo.png';
ctx.drawImage(logo,x1,y1,w1,h1,x2,y2,w2,h2);
www.splintered.co.uk/experiments/archives/paranoid_0.3
canvas zugriff auf Bilddaten
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, … ]
www.splintered.co.uk/experiments/archives/canvas-ambilight
canvas und video
ctx = canvas.getContext("2d");v = document.getElementById('player');
ctx.drawImage(v,x1,y1,w1,h2,x2,y2,w2,h2);
video, audio und canvas auch auf Devicesohne “Steck-eins” (plugins)
(nicht jeder hat Java / Flash / Silverlight)
vorsicht: browser sniffing
http://www.flickr.com/photos/timdorr/2096272747/
feature-detectionprogressive enhancement, graceful degradation – or use shims
http://diveintohtml5.org/everything.html
alten Browser patchengithub.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills