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




Patrick H. Lauke / JSDay / Verona / 17 Maggio 2012
<video>
Adobe Flash currently most common
 video/audio 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>
plug-in is a black box
<video src="video.webm"></video>




           originally proposed by Opera in 2007
     dev.opera.com/articles/view/labs-a-call-for-video-on-the-web
<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
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
people.opera.com/patrickl/experiments/webm/hover+transition
powerful (simple) API
<video> and JavaScript
var v = document.getElementById('player');

v.play()
v.pause()

v.volume = …
v.currentTime = …

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
HTML5 does not specify
how browser controls should look
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
people.opera.com/patrickl/experiments/webm/fancy-controls
people.opera.com/patrickl/experiments/webm/fancy-swap
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, 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
http://tools.google.com/dlpage/webmmf
Browsers vs codecs
                  Chome Firefox IE      Opera   Safari
  Ogg Theora      ✔        ✔            ✔
  WebM / VP8      ✔        ✔       ?    ✔
  MP4 / H.264     ✔                ✔            ✔

mobile and devices slightly better...
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>
understanding fallback
<video controls width="…" height="…">
   <source … type='video/mp4; codecs="avc1.42E01E,mp4a.40.2"'>
   <!-- fallback content →
   <p>Shown to browsers that don't support video element,
   and NOT just browsers that don't support MP4/H.264</p>
</video>
people.opera.com/patrickl/experiments/webm/wrongsource
feature-detection for codecs
v.canPlayType('video/webm;codecs="vp8,vorbis"')


     "probably" | "maybe" | "" < WAT?
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
video and Responsive Web Design
<source … media="(min-width:1000px)">
<source … media="(max-width:1000px)">
people.opera.com/patrickl/experiments/webm/mediaquery
people.opera.com/patrickl/experiments/webm/mediaquery
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/windchime
no need for <audio> or <video> in your DOM
   var s = document.createElement('audio');
       s.src = 'aaargh.oga'; s.play();
audio “sound sprites” to counter
     latency and overhead




    people.opera.com/~emoller/audio-demo
<canvas>
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
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, … ]
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 and audio - JSDay / Verona / 17 May 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
// Opera
navigator.getUserMedia({video:true},success,error);
[…]
video.src = stream;

// WebKit
navigator.webkitGetUserMedia("video",success,error);
[…]
video.src = window.webkitURL.createObjectURL(stream);


        gUM Shield: http://html5doctor.com/getusermedia/
www.opera.com/browser/next
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
neave.com/webcam/html5
shinydemos.com/qr-code
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
www.opera.com/developer
   patrick.lauke@opera.com

More Related Content

PDF
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
PDF
HTML5 multimedia - browser-native video and audio - DevUp HTML5 / Barcelona /...
PDF
audio, video and canvas in HTML5 - standards>next Manchester 29.09.2010
PDF
Taking HTML5 video a step further
PDF
State of Media Accessibility in HTML5
PDF
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
PPT
Html5 vs Flash video
PPTX
DoctypeHTML5 (Hyderabad) Presentation on Multimedia
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
HTML5 multimedia - browser-native video and audio - DevUp HTML5 / Barcelona /...
audio, video and canvas in HTML5 - standards>next Manchester 29.09.2010
Taking HTML5 video a step further
State of Media Accessibility in HTML5
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
Html5 vs Flash video
DoctypeHTML5 (Hyderabad) Presentation on Multimedia

What's hot (20)

PDF
Html5 Open Video Tutorial
PPTX
HTML5 Multimedia Support
PDF
HTML5 Multimedia: where we are, where we're going
PDF
HTML5 Multimedia Accessibility
PDF
Html5 - audio and video tags
PDF
Vkmdp cologne
PDF
HTML5 multimedia - where we are, where we're going
KEY
HTML5 Video Presentation
PDF
HTML5 APIs - The New Frontier - Jfokus 2011
PDF
HTML5 APIs - The New Frontier - ConFoo 2011
PDF
Pwned in Translation - from Subtitles to RCE
DOCX
Boceto de mi webquest
TXT
Widget radio sarkub (nusa radio)
PDF
Web Directions @media 2010
PDF
Oversight: Exposing spies on macOS
PDF
HTML5 Design
TXT
Ravi Singh / Campaign Guru Biography
PDF
JS Days Mobile Meow
PPTX
Got &lt;video>? Implementing HTML5 Video for Library Tutorials
PPTX
Getting Started With CFEngine - Updated Version
Html5 Open Video Tutorial
HTML5 Multimedia Support
HTML5 Multimedia: where we are, where we're going
HTML5 Multimedia Accessibility
Html5 - audio and video tags
Vkmdp cologne
HTML5 multimedia - where we are, where we're going
HTML5 Video Presentation
HTML5 APIs - The New Frontier - Jfokus 2011
HTML5 APIs - The New Frontier - ConFoo 2011
Pwned in Translation - from Subtitles to RCE
Boceto de mi webquest
Widget radio sarkub (nusa radio)
Web Directions @media 2010
Oversight: Exposing spies on macOS
HTML5 Design
Ravi Singh / Campaign Guru Biography
JS Days Mobile Meow
Got &lt;video>? Implementing HTML5 Video for Library Tutorials
Getting Started With CFEngine - Updated Version
Ad

Viewers also liked (8)

PPT
Tilted Plus @FFI
PDF
Program agenda 19
PPT
PPTX
Neuroscience in Advertising
PPT
Swine Influenza: Frequently Asked Questions
PPT
Pulmonary Tuberculosis
PDF
Demystifying the Media
PPT
SPIKE's BIOGRAPHY
Tilted Plus @FFI
Program agenda 19
Neuroscience in Advertising
Swine Influenza: Frequently Asked Questions
Pulmonary Tuberculosis
Demystifying the Media
SPIKE's BIOGRAPHY
Ad

Similar to HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012 (20)

PDF
Responsive Videos, mehr oder weniger
PDF
Mobile Web Video
KEY
Web Apps
PDF
Html5 intro
PDF
Speak The Web: The HTML5 Experiments
KEY
HTML5 Video for WordPress
KEY
Upgrade to HTML5 Video
PDF
HTML5 Audio & Video
PDF
HTML5 Multimedia
KEY
HTML5 Video Player - HTML5 Dev Conf 2012
PDF
Multimedia on the web - HTML5 video and audio
PDF
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
PDF
HTML5 e Css3 - 8 | WebMaster & WebDesigner
PDF
Brave new world of HTML5
PDF
webinale2011_Chris Mills_Brave new world of HTML5Html5
PDF
Craft 2019 - “The Upside Down” Of The Web - Video technologies
PDF
What you need to know bout html5
PDF
Building an HTML5 Video Player
PDF
Hero Video Performance
PDF
HTML5 and Accessibility sitting in a tree
Responsive Videos, mehr oder weniger
Mobile Web Video
Web Apps
Html5 intro
Speak The Web: The HTML5 Experiments
HTML5 Video for WordPress
Upgrade to HTML5 Video
HTML5 Audio & Video
HTML5 Multimedia
HTML5 Video Player - HTML5 Dev Conf 2012
Multimedia on the web - HTML5 video and audio
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
HTML5 e Css3 - 8 | WebMaster & WebDesigner
Brave new world of HTML5
webinale2011_Chris Mills_Brave new world of HTML5Html5
Craft 2019 - “The Upside Down” Of The Web - Video technologies
What you need to know bout html5
Building an HTML5 Video Player
Hero Video Performance
HTML5 and Accessibility sitting in a tree

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
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
August Patch Tuesday
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
A Presentation on Touch Screen Technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
A comparative study of natural language inference in Swahili using monolingua...
SOPHOS-XG Firewall Administrator PPT.pptx
August Patch Tuesday
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
A novel scalable deep ensemble learning framework for big data classification...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Zenith AI: Advanced Artificial Intelligence
Enhancing emotion recognition model for a student engagement use case through...
Assigned Numbers - 2025 - Bluetooth® Document
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
A Presentation on Touch Screen Technology
Unlocking AI with Model Context Protocol (MCP)
Web App vs Mobile App What Should You Build First.pdf
Heart disease approach using modified random forest and particle swarm optimi...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
1 - Historical Antecedents, Social Consideration.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
A comparative study of natural language inference in Swahili using monolingua...

HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012