SlideShare a Scribd company logo
HTML5 multimedia
BROWSER-NATIVE VIDEO, AUDIO AND CANVAS




Patrick H. Lauke / meet.js Summit / Poznań / 14 January 2011
Web Evangelist at Opera
making your site Fonzie compliant...
<video>
Adobe Flash currently most common
    video delivery mechanism
<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&f
s=1&" type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true"
width="425" height="344"></embed>
</object>
<video src="video.webm"></video>
<video src="video.webm"
  controls
  autoplay
  muted
  loop
  preload="none|metadata|auto"
  poster="poster.jpg"
  width="320" height="240">
    <a href="video.webm">Download movie</a>
</video>
video as native object
●
  behaves like any other HTML element
●
  keyboard accessibility out-of-the-box
people.opera.com/patrickl/experiments/webm/hover+transition
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / Poznan / 14 January 2012
powerful (simple) API
controlling <video> with JavaScript
var v = document.getElementById('player');

v.play();
v.pause();
v.volume = … ;
v.currentTime = … ;
…
events fired by <video>
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)
…
www.w3.org/2010/05/video/mediaevents.html
people.opera.com/patrickl/experiments/webm/basic-controls
people.opera.com/patrickl/experiments/webm/fancy-controls
people.opera.com/patrickl/experiments/webm/fancy-swap
HTML5 means all your
old dHTML is cool again!
video formats
 the big debate?
HTML5 does not specify
 video container/codec
   (same as with images in HTML 4.01)
MP4/H.264
    or
Ogg Theora
    or
WebM/VP8
MP4 / H.264




ubiquitous, patent encumbered, licensing/royalties
Ogg Theora




    free and open, no licensing fees
not many tools for it, not web optimised
WebM / VP8




  open and royalty-free, web-optimised
support by hardware and software vendors
providing multiple sources
<video controls width="…" height="…">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.webm" type="video/webm">
  <source src="movie.ogv" type="video/ogg">
  <!-- fallback content -->
</video>
specifying codecs
<video controls width="…" height="…">
   <source … type='video/mp4; codecs="avc1.42E01E,mp4a.40.2"'>
   <source … type='video/webm; codecs="vorbis,vp8"'>
   <source … type='video/ogg; codecs="theora,vorbis"'>
   <!-- fallback content -->
</video>
feature-detection for codecs
v.canPlayType('video/webm;codecs="vp8,vorbis"')


           "probably" | "maybe" | ""
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / Poznan / 14 January 2012
www.ffmpeg.org
www.mirovideoconverter.com
flash fallback for older browsers
 http://camendesign.com/code/video_for_everybody
<video controls width="…" height="…">
   <source src="movie.mp4" type="video/mp4" />
   <source src="movie.webm" type="video/webm" />
   <source src="movie.ogv" type="video/ogg" />

   <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>
audio...exactly the same as video
<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>

formats: MP3 vs Ogg Vorbis (vs WAV)
people.opera.com/patrickl/experiments/audio/wilhelm
people.opera.com/patrickl/experiments/audio/windchime
no need for <audio> in your document
var s = document.createElement('audio');
     s.src = 'aaargh.oga'; s.play();

       (same for video as well, if you're crazy...)
<canvas>
canvas = “scriptable images”
<canvas width="…" height="…"></canvas>
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);
…

www.w3.org/TR/2dcontext
people.opera.com/patrickl/experiments/canvas/particle/3
mariuswatz.com/works/abstract01js
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
www.splintered.co.uk/experiments/archives/paranoid_0.4
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, … ]
www.splintered.co.uk/experiments/archives/canvas-ambilight
desandro.com/resources/close-pixelate
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)
html5doctor.com/video-canvas-magic
media.chikuyonok.ru/ambilight
is it all safe to use, right now?
www.youtube.com/html5
don't do browser sniffing



      http://www.flickr.com/photos/timdorr/2096272747/
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / Poznan / 14 January 2012
feature-detection
progressive enhancement, graceful degradation
              diveintohtml5.info/everything.html
feature-detection for audio/video
if (!!document.createElement('video').canPlayType;) { … }

if (!!document.createElement('audio').canPlayType;) { … }
sublimevideo.net
www.jplayer.org
www.textfiles.com/underconstruction
dev.w3.org/2011/webrtc/editor/webrtc.html
dev.w3.org/2011/webrtc/editor/getusermedia.html
camera access
navigator.getUserMedia({video:true},success,error);
dev.opera.com/labs
people.opera.com/danield/html5/explode
neave.com/webcam/html5
HTML5 as Flashkiller?
not a question of
HTML5 replacing Flash...
giving developers a choice!
www.opera.com/developer
   patrick.lauke@opera.com

More Related Content

PDF
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
PDF
HTML5 multimedia - browser-native video and audio - DevUp HTML5 / Barcelona /...
PDF
audio, video and canvas in HTML5 - standards>next Manchester 29.09.2010
KEY
Video.js - How to build and HTML5 Video Player
PDF
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
PDF
Making the HTML5 Video element interactive
PDF
HTML5 APIs - The New Frontier 2011
PDF
How to-save-video-list
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
HTML5 multimedia - browser-native video and audio - DevUp HTML5 / Barcelona /...
audio, video and canvas in HTML5 - standards>next Manchester 29.09.2010
Video.js - How to build and HTML5 Video Player
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
Making the HTML5 Video element interactive
HTML5 APIs - The New Frontier 2011
How to-save-video-list

What's hot (20)

PDF
[convergese] Adaptive Images in Responsive Web Design
PDF
Mobile Web Video
KEY
HTML5와 모바일
PDF
HTML5 APIs - The New Frontier
PDF
[refreshaustin] Adaptive Images in Responsive Web Design
TXT
Video
PDF
HTML5 multimedia - where we are, where we're going
PDF
[cssdevconf] Adaptive Images in Responsive Web Design
PDF
Web Directions @media 2010
PDF
Responsive Videos, mehr oder weniger
PDF
High Performance Images
PDF
[rwdsummit2012] Adaptive Images in Responsive Web Design
PDF
[cssdevconf] Adaptive Images in RWD
TXT
Ravi Singh / Campaign Guru Biography
PDF
HTML5 Multimedia Accessibility
PDF
Object width
TXT
Document text nou
TXT
DOC
Jager
DOC
Vídeo.1
[convergese] Adaptive Images in Responsive Web Design
Mobile Web Video
HTML5와 모바일
HTML5 APIs - The New Frontier
[refreshaustin] Adaptive Images in Responsive Web Design
Video
HTML5 multimedia - where we are, where we're going
[cssdevconf] Adaptive Images in Responsive Web Design
Web Directions @media 2010
Responsive Videos, mehr oder weniger
High Performance Images
[rwdsummit2012] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in RWD
Ravi Singh / Campaign Guru Biography
HTML5 Multimedia Accessibility
Object width
Document text nou
Jager
Vídeo.1
Ad

Similar to HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / Poznan / 14 January 2012 (20)

PDF
Multimedia on the web - HTML5 video and audio
KEY
HTML5 Video Player - HTML5 Dev Conf 2012
PPTX
DoctypeHTML5 (Hyderabad) Presentation on Multimedia
PDF
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
PDF
HTML5 Multimedia: where we are, where we're going
KEY
Web Apps
PDF
Brave new world of HTML5
PDF
webinale2011_Chris Mills_Brave new world of HTML5Html5
PPTX
HTML5 Multimedia Streaming
PDF
Craft 2019 - “The Upside Down” Of The Web - Video technologies
PDF
Html5video
KEY
HTML5 Video Presentation
PPTX
HTML5 Multimedia Streaming
PDF
Html5 Open Video Tutorial
PDF
JS Days HTML5 Flash and the Battle for Faster Cat Videos
PDF
Mobile Meow at Mobilism
PDF
HTML5 APIs - The New Frontier - Jfokus 2011
PDF
HTML5 APIs - The New Frontier - ConFoo 2011
PDF
JS Days Mobile Meow
PDF
HTML5 Multimedia
Multimedia on the web - HTML5 video and audio
HTML5 Video Player - HTML5 Dev Conf 2012
DoctypeHTML5 (Hyderabad) Presentation on Multimedia
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 Multimedia: where we are, where we're going
Web Apps
Brave new world of HTML5
webinale2011_Chris Mills_Brave new world of HTML5Html5
HTML5 Multimedia Streaming
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Html5video
HTML5 Video Presentation
HTML5 Multimedia Streaming
Html5 Open Video Tutorial
JS Days HTML5 Flash and the Battle for Faster Cat Videos
Mobile Meow at Mobilism
HTML5 APIs - The New Frontier - Jfokus 2011
HTML5 APIs - The New Frontier - ConFoo 2011
JS Days Mobile Meow
HTML5 Multimedia
Ad

More from Patrick Lauke (20)

PDF
These (still) aren't the SCs you're looking for ... (mis)adventures in WCAG 2...
PDF
Pointer Events Working Group update / TPAC 2023 / Patrick H. Lauke
PDF
These aren't the SCs you're looking for ... (mis)adventures in WCAG 2.x inter...
PDF
These aren't the SCs you're looking for ... (mis)adventures in WCAG 2.x inter...
PDF
Too much accessibility - good intentions, badly implemented / Public Sector F...
PDF
Styling Your Web Pages with Cascading Style Sheets / EDU course / University ...
PDF
Evaluating web sites for accessibility with Firefox / Manchester Digital Acce...
PDF
Managing and educating content editors - experiences and ideas from the trenc...
PDF
Implementing Web Standards across the institution: trials and tribulations of...
PDF
Geolinking content - experiments in connecting virtual and physical places / ...
PDF
All change for WCAG 2.0 - what you need to know about the new accessibility g...
PDF
Web Accessibility - an introduction / Salford Business School briefing / Univ...
PDF
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
PDF
Web standards pragmatism - from validation to the real world / Web Developers...
PDF
Ian Lloyd/Patrick H. Lauke: Accessified - practical accessibility fixes any w...
PDF
The state of the web - www.salford.ac.uk / 2007
PDF
Keyboard accessibility - just because I don't use a mouse doesn't mean I'm se...
PDF
WAI-ARIA An introduction to Accessible Rich Internet Applications / JavaScrip...
PDF
WAI-ARIA An introduction to Accessible Rich Internet Applications / CSS Minsk...
PDF
WAI-ARIA An introduction to Accessible Rich Internet Applications / AccessU 2018
These (still) aren't the SCs you're looking for ... (mis)adventures in WCAG 2...
Pointer Events Working Group update / TPAC 2023 / Patrick H. Lauke
These aren't the SCs you're looking for ... (mis)adventures in WCAG 2.x inter...
These aren't the SCs you're looking for ... (mis)adventures in WCAG 2.x inter...
Too much accessibility - good intentions, badly implemented / Public Sector F...
Styling Your Web Pages with Cascading Style Sheets / EDU course / University ...
Evaluating web sites for accessibility with Firefox / Manchester Digital Acce...
Managing and educating content editors - experiences and ideas from the trenc...
Implementing Web Standards across the institution: trials and tribulations of...
Geolinking content - experiments in connecting virtual and physical places / ...
All change for WCAG 2.0 - what you need to know about the new accessibility g...
Web Accessibility - an introduction / Salford Business School briefing / Univ...
Doing it in style - creating beautiful sites, the web standards way / WebDD /...
Web standards pragmatism - from validation to the real world / Web Developers...
Ian Lloyd/Patrick H. Lauke: Accessified - practical accessibility fixes any w...
The state of the web - www.salford.ac.uk / 2007
Keyboard accessibility - just because I don't use a mouse doesn't mean I'm se...
WAI-ARIA An introduction to Accessible Rich Internet Applications / JavaScrip...
WAI-ARIA An introduction to Accessible Rich Internet Applications / CSS Minsk...
WAI-ARIA An introduction to Accessible Rich Internet Applications / AccessU 2018

Recently uploaded (20)

PPTX
Tartificialntelligence_presentation.pptx
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PPT
What is a Computer? Input Devices /output devices
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
Getting Started with Data Integration: FME Form 101
PPTX
The various Industrial Revolutions .pptx
PDF
project resource management chapter-09.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
STKI Israel Market Study 2025 version august
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Tartificialntelligence_presentation.pptx
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Web App vs Mobile App What Should You Build First.pdf
What is a Computer? Input Devices /output devices
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Assigned Numbers - 2025 - Bluetooth® Document
O2C Customer Invoices to Receipt V15A.pptx
Getting Started with Data Integration: FME Form 101
The various Industrial Revolutions .pptx
project resource management chapter-09.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Developing a website for English-speaking practice to English as a foreign la...
Hindi spoken digit analysis for native and non-native speakers
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
STKI Israel Market Study 2025 version august
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Univ-Connecticut-ChatGPT-Presentaion.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...

HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / Poznan / 14 January 2012