SlideShare una empresa de Scribd logo
1 de 64
Descargar para leer sin conexión
HTML5 multimedia
Where we are, where we're going
Bruce Lawson
Anne van Kesteren annevk at opera.com
Wed Feb 28 05:47:56 PST 2007

Hi,
Opera has some internal expiremental builds with an implementation of a <video> element. The element
exposes a simple API (for the moment) much like the Audio() object:
  play()
  pause()
  Stop()

The idea is that it works like <object> except that it has special <video> semantics much like <img> has
image semantics. In markup you could prolly use it as follows:

 <figure>
  <video src=news-snippet.ogg>
   ...
  </video>
  <legend>HTML5 in BBC News</legend>
 </figure>

I attached a proposal for the element and as you can see there are still some open issues. The element and
its API are of course open for debate. We're not enforcing this upon the world ;-)

Cheers,
          http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-February/009702.html
<object width="425" height="344">
  <param name="movie"
value="http://www.example.com/v/9sEI1AUFJKw&hl=en
&fs=1&"></param>
  <param name="allowFullScreen"
value="true"></param>
  <param name="allowscriptaccess"
value="always"></param>
  <embed
src="http://www.example.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=pudding.webm
  controls
  autoplay
  poster=poster.jpg
  width=320 height=240>
    <a href=video.webm>Download movie</a>
</video>
<audio src=bieber.ogg
  controls
  autoplay>
     <a href=bieber.ogg>Download horrid pap</a>
</audio>
<video src=pudding.webm loop>
<audio   src=bieber.ogg   preload>
<audio   src=bieber.ogg   preload=auto>
<audio   src=bieber.ogg   preload=none>
<audio   src=bieber.ogg   preload=metadata>
powerful (simple) API
www.w3.org/TR/html5/video.html#media-elements
controlling <video> with JavaScript
var v = document.getElementByTagName('video')
[0];

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)
…
video as native object...why is it important?

●
    keyboard accessibility built-in
●
    “play nice” with rest of the page
●
    Simple API for controls
"In addition to giving video an HTML
element, we must also agree on a baseline
video format that will be universally
supported, just like the GIF, JPEG and PNG
image format are universally supported. It's
important that the video format we choose
can be supported by a wide range of devices
and that it's royalty-free (RF). RF is a well-
established principle for W3C standards."
   http://people.opera.com/howcome/2007/video/
Ogg Theora




“free and open”, no licensing/royalties
not many tools for it, not web optimised
MP4 / H.264




ubiquitous, patent encumbered, licensing/royalties,
               hardware accelerated
WebM




"open and royalty-free", web optimised,
   hardware acceleration on its way
video formats

               webM            Ogg/ Theora    mp4/ h264

Opera            yes               yes

Chrome           yes               yes           Nope
                                             (Chrome.soon)
Firefox      Yes (FF4)             yes

Safari                                            yes

IE9       Yes (if installed)                      yes
The politics of codecs
audio formats

          mp3       Ogg/ Vobis   wav

Opera                  yes       yes

Chrome     yes         yes       yes

Firefox                yes       yes

Safari     yes                   yes

IE9       yes
Giving everybody video

<video controls autoplay poster=… width=… height=…>
  <source src=pudding.mp4 type=video/mp4>
  <source src=pudding.webm type=video/webm>
  <source src=pudding.ogv type=video/ogg>
  <!-- fallback content -->
</video>
<video controls poster="…" 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>




       still include fallback for old browsers
            http://camendesign.com/code/video_for_everybody
Help
●
    archive.org converts and hosts creative-commons
    licensed media
●   vid.ly has a free conversion/ hosting service (max 1GB
    source file) see vid.ly/5u4h3e
●   Miro video converter is a drag and drop GUI skin on
    FFMPEG
video media queries

<video controls>
<source src=hi-res.ogv media="(min-device-width:800px)">
<source src=lo-res.ogv>
</video>


http://dev.w3.org/html5/spec/video.html#the-source-element
Full-screen video
●
  Currently, WebkitEnterFullscreen();
●
  May 11, WebKit announced it's implementing Gecko API
  https://wiki.mozilla.org/Gecko:FullScreenAPI
●
  Opera likes this approach, too
<video> accessibility
WebM release does not support subtitles




WHATWG / W3C RFC will release guidance on subtitles and other
overlays in HTML5 <video> in the near future. WebM intends to follow
that guidance.




 http://code.google.com/p/webm/issues/detail?id=11
 Egg image Kacper "Kangel" Aniołek http://commons.wikimedia.org/wiki/File:Egg.jpg
<track> element

<video controls poster=… width=… height=…>
    <source src=movie.webm type=video/webm>
    <track src=subtitles-en.vtt kind=subtitles srclang=en>
    <track src=subtitles-de.vtt kind=subtitles srclang=de>
    <!-- fallback content -->
</video>


http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-track-element
WebVTT or TTML ?
webVTT

WEBVTT FILE

1
01:23:45,678 --> 01:23:46,789
Hello world!

2
01:23:48,910 --> 01:23:49,101
Mój poduszkowiec jest pełen węgorzy
WebVTT formatting

   Supports positioning of text
     Supports <b> and <i>
  Colouring individual speakers
      Support vertical text
          Supports RTL
   Supports ruby annotations
Validator: http://quuz.org/webvtt/
subtitling polyfills
playr
http://www.delphiki.com/html5/playr/
LeanBack Player
http://leanbackplayer.com/
MediaElement.js
http://mediaelementjs.com/
Synchronising media elements
Synchronising media elements
Each media element can have a MediaController. A MediaController is an object
that coordinates the playback of multiple media elements, for instance so that a
sign-language interpreter track can be overlaid on a video track, with the two
being kept in sync....
Media elements with a MediaController are said to be slaved to their controller. The
MediaController modifies the playback rate and the playback volume of each of the
media elements slaved to it, and ensures that when any of its slaved media
elements unexpectedly stall, the others are stopped at the same time.
When a media element is slaved to a MediaController, its playback rate is fixed to
that of the other tracks in the same MediaController, and any looping is disabled.
  http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#synchronising-
                                multiple-media-elements
             http://www.w3.org/WAI/PF/HTML/wiki/Media_Multitrack_Media_API
How mature is all this?
                               Looping latency
               people.opera.com/patrickl/experiments/audio/hacky-looper/

 HTML5 video issues on the iPad and how to solve them
blog.millermedeiros.com/2011/03/html5-video-issues-on-the-ipad-and-how-to-solve-them/

               Unsolved HTML5 video issues on iOS
      http://blog.millermedeiros.com/2011/04/unsolved-html5-video-issues-on-ios/

                  Audio Sprites (and fixes for iOS)
                      remysharp.com/2010/12/23/audio-sprites/
“...extending the language to better support Web
applications … This puts HTML in direct competition
with other technologies intended for applications deployed
over the Web, in particular Flash and Silverlight.”


Ian Hickson, Editor of HTML5
http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
Image © Jackdrawsanything.com "I will draw anything you like to raise funds for the Sick Kids"
DISCLAIMER:

This is my personal perspective and does not reflect the
opinion of Opera.
Or my wife, children or hamster. Or anyone else who might
be embarrassed by association with me (which is mostly
everyone, to be honest).
As this is a conference, in the land of Żubrówka, I'll probably
get drunk and try to chat you up, so let's make this
disclaimer run until Saturday, OK?
DRM on HTML5 without changes

                  Henri Sivonen
lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-
                  July/027051.html
getUserMedia API
(previously known as "HTML5 <device>")
<video autoplay></video>
<script>
var video = document.querySelector(video);


If (navigator.getUserMedia)
{navigator.getUserMedia('video',successCallback,
errorCallback);


function successCallback(stream) {
       video.src = stream;
   }
</script>


Tutorial:
http://dev.opera.com/articles/view/playing-with-html5-video-and-getusermedia-support/
my.opera.com/core/blog/2011/03/23/webcam-orientation-preview
WebRTC is a free, open project that enables web browsers
   with Real-Time Communications (RTC) capabilities via
simple Javascript APIs. The WebRTC components have been
           optimized to best serve this purpose.

  The WebRTC initiative is a project supported by Google,
                   Mozilla and Opera.

                       http://sites.google.com/site/webrtc/
http://www.whatwg.org/specs/web-apps/current-work/complete/video-conferencing-
                     and-peer-to-peer-communication.html
"We expect to see WebRTC support in Firefox, Opera, and
                   Chrome soon!"

                http://www.webrtc.org/
Case study
http://www.rathergood.com/buffy
<div>
<button>Q</button>
<button>W</button>
...
</div>


<div>
<button>A</button>
<button>S</button>
...
</div>
<video loop>
<source src=hixie.mp4 type=video/mp4>
<source src=hixie.webm type=video/webm>
</video>
//grab all the buttons
    buttons = document.querySelectorAll('button'),

      //loop through all the <button> elements, and create
corresponding
      //audio elements

     buildAudio = (function(){
       for (var i = 0, l = buttons.length; i < l; i++) {
         var key = buttons[i].textContent.toLowerCase();

         //using the fancy new Audio() constructor here

     document.body.appendChild(new Audio(key + '.ogg'));

       };
     })()
document.addEventListener('ended', function(e){

 if (e.target.nodeName == "AUDIO") {
   // pause the video since the audio
   //has stopped

     vid.pause();
 }

}, true)
<button data-text="<q> element">Q</button>
<button data-text="Web Workers">W</button>
text = document.getElementById('thinger')

                        …

text.textContent = el.dataset ? el.dataset.text :
          el.getAttribute('data-text');
#thinger {position:absolute; left:40px;
top:200px;

  text-align: center;

  font-family: 'hixie', cursive, monospace; font-
size:3em; color:red;

  transform: matrix(0.98,-0.17,-0.17,0.98,0,0);}

        AEZ Segar font, made into fontface kit with
     http://www.fontsquirrel.com/fontface/generator
Thanks

 Mike Taylor @miketaylr for JS help, and Patrick Lauke
@patrick_h_lauke for the Hixie voice. (What does that "H"
         stand for?) to me slowly and patiently
All rights reserved corner

Thanks Takara Tomy for permission to use Gigapudding
               video. Buy the pudding.
Thanks Jack Henderson for permission to his scary DRM
                picture. Buy his book.
 HTML5 nazi-killing Bruce on unicorn picture by Marina
            Lawson. Buy her Dad's book.


      All others by me or (I believe) public domain.
www.opera.com/developer
   bruce.lawson@opera.com
   www.brucelawson.co.uk
       twitter.com/brucel

Más contenido relacionado

La actualidad más candente

HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
Patrick Lauke
 
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
Patrick Lauke
 
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
Patrick Lauke
 

La actualidad más candente (20)

Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web apps
 
HTML5 Video Player - HTML5 Dev Conf 2012
HTML5 Video Player - HTML5 Dev Conf 2012HTML5 Video Player - HTML5 Dev Conf 2012
HTML5 Video Player - HTML5 Dev Conf 2012
 
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
 
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
S314011 - Developing Composite Applications for the Cloud with Apache TuscanyS314011 - Developing Composite Applications for the Cloud with Apache Tuscany
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
 
Video.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video PlayerVideo.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video Player
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and Connectivity
 
Developing web applications in 2010
Developing web applications in 2010Developing web applications in 2010
Developing web applications in 2010
 
Html5 browser api_support
Html5 browser api_supportHtml5 browser api_support
Html5 browser api_support
 
HTML5 Design
HTML5 DesignHTML5 Design
HTML5 Design
 
The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)
 
[edUiconf] HTML5 does all that… and i can haz cheeseburger? You bet!
[edUiconf] HTML5 does all that… and i can haz cheeseburger? You bet![edUiconf] HTML5 does all that… and i can haz cheeseburger? You bet!
[edUiconf] HTML5 does all that… and i can haz cheeseburger? You bet!
 
High Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slowHigh Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slow
 
Plone for python programmers
Plone for python programmersPlone for python programmers
Plone for python programmers
 
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
 
Build Python CMS The Plone Way
Build Python CMS The Plone WayBuild Python CMS The Plone Way
Build Python CMS The Plone Way
 
Collective.amberjack ploneconf2010
Collective.amberjack ploneconf2010Collective.amberjack ploneconf2010
Collective.amberjack ploneconf2010
 
Building an HTML5 Video Player
Building an HTML5 Video PlayerBuilding an HTML5 Video Player
Building an HTML5 Video Player
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
Managing windows with Puppet and Chocolatey
Managing windows with Puppet and ChocolateyManaging windows with Puppet and Chocolatey
Managing windows with Puppet and Chocolatey
 
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
 

Similar a HTML5 multimedia - where we are, where we're going

Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
Greg Schechter
 
(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...
(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...
(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...
Web::Strategija
 
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
Patrick Lauke
 
Web Directions @media 2010
Web Directions @media 2010Web Directions @media 2010
Web Directions @media 2010
Patrick Lauke
 
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Patrick Lauke
 

Similar a HTML5 multimedia - where we are, where we're going (20)

HTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're goingHTML5 Multimedia: where we are, where we're going
HTML5 Multimedia: where we are, where we're going
 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
 
Web DU Mobile Meow
Web DU Mobile MeowWeb DU Mobile Meow
Web DU Mobile Meow
 
Responsive Videos, mehr oder weniger
Responsive Videos, mehr oder wenigerResponsive Videos, mehr oder weniger
Responsive Videos, mehr oder weniger
 
Html5video
Html5videoHtml5video
Html5video
 
HTML 5
HTML 5HTML 5
HTML 5
 
The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5The Rich Standard: Getting Familiar with HTML5
The Rich Standard: Getting Familiar with HTML5
 
Html5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentationHtml5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentation
 
HTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a treeHTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a tree
 
Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
 
GDD HTML5, Flash, and the Battle for Faster Cat Videos
GDD HTML5, Flash, and the Battle for Faster Cat VideosGDD HTML5, Flash, and the Battle for Faster Cat Videos
GDD HTML5, Flash, and the Battle for Faster Cat Videos
 
Web Apps
Web AppsWeb Apps
Web Apps
 
JS Days HTML5 Flash and the Battle for Faster Cat Videos
JS Days HTML5 Flash and the Battle for Faster Cat VideosJS Days HTML5 Flash and the Battle for Faster Cat Videos
JS Days HTML5 Flash and the Battle for Faster Cat Videos
 
HTML5 video & Amazon elastic transcoder - FCIP August 2014
HTML5 video & Amazon elastic transcoder - FCIP August 2014HTML5 video & Amazon elastic transcoder - FCIP August 2014
HTML5 video & Amazon elastic transcoder - FCIP August 2014
 
2011 06-20 - drupal jam - html5 video
2011 06-20 - drupal jam - html5 video2011 06-20 - drupal jam - html5 video
2011 06-20 - drupal jam - html5 video
 
(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...
(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...
(WS11) Dobrica Pavlinušić: HTML5TV - kako obraditi i objaviti predavanja na w...
 
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
HTML5 and friends - JISC CETIS Conference 2010 Nottingham 15.11.2010
 
Looking into HTML5 + CSS3
Looking into HTML5 + CSS3Looking into HTML5 + CSS3
Looking into HTML5 + CSS3
 
Web Directions @media 2010
Web Directions @media 2010Web Directions @media 2010
Web Directions @media 2010
 
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
Brave new world of HTML5 - WebTech 2010 Milano 09.11.2010
 

Más de brucelawson

HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
brucelawson
 
Bruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japanBruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japan
brucelawson
 
Bruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek MeetBruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek Meet
brucelawson
 

Más de brucelawson (16)

Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Apps
 
HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
 
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
 
Leveraging HTML 5.0
Leveraging HTML 5.0Leveraging HTML 5.0
Leveraging HTML 5.0
 
HTML5 Multimedia Accessibility
HTML5 Multimedia AccessibilityHTML5 Multimedia Accessibility
HTML5 Multimedia Accessibility
 
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScriptWeb Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
Web Anywhere: Mobile Optimisation With HTML5, CSS3, JavaScript
 
W3C Widgets: Apps made with Web Standards
W3C Widgets: Apps made with Web StandardsW3C Widgets: Apps made with Web Standards
W3C Widgets: Apps made with Web Standards
 
Bruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japanBruce lawson-html5-aria-japan
Bruce lawson-html5-aria-japan
 
HTML5 and CSS 3
HTML5 and CSS 3HTML5 and CSS 3
HTML5 and CSS 3
 
Html5 oslo-code-camp
Html5 oslo-code-campHtml5 oslo-code-camp
Html5 oslo-code-camp
 
Disruptive code
Disruptive codeDisruptive code
Disruptive code
 
Bruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek MeetBruce lawson Stockholm Geek Meet
Bruce lawson Stockholm Geek Meet
 
Bruce Lawson HTML5 South By SouthWest presentation
Bruce Lawson HTML5 South By SouthWest presentationBruce Lawson HTML5 South By SouthWest presentation
Bruce Lawson HTML5 South By SouthWest presentation
 
Practical Tips for Mobile Widget development
Practical Tips for Mobile Widget developmentPractical Tips for Mobile Widget development
Practical Tips for Mobile Widget development
 
Bruce Lawson Opera Indonesia
Bruce Lawson Opera IndonesiaBruce Lawson Opera Indonesia
Bruce Lawson Opera Indonesia
 
Standards.next: HTML - Are you mything the point?
Standards.next: HTML - Are you mything the point?Standards.next: HTML - Are you mything the point?
Standards.next: HTML - Are you mything the point?
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 

HTML5 multimedia - where we are, where we're going

  • 1. HTML5 multimedia Where we are, where we're going Bruce Lawson
  • 2. Anne van Kesteren annevk at opera.com Wed Feb 28 05:47:56 PST 2007 Hi, Opera has some internal expiremental builds with an implementation of a <video> element. The element exposes a simple API (for the moment) much like the Audio() object: play() pause() Stop() The idea is that it works like <object> except that it has special <video> semantics much like <img> has image semantics. In markup you could prolly use it as follows: <figure> <video src=news-snippet.ogg> ... </video> <legend>HTML5 in BBC News</legend> </figure> I attached a proposal for the element and as you can see there are still some open issues. The element and its API are of course open for debate. We're not enforcing this upon the world ;-) Cheers, http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-February/009702.html
  • 3. <object width="425" height="344"> <param name="movie" value="http://www.example.com/v/9sEI1AUFJKw&hl=en &fs=1&"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.example.com/v/9sEI1AUFJKw&hl=en&f s=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed> </object>
  • 4. <video src=pudding.webm controls autoplay poster=poster.jpg width=320 height=240> <a href=video.webm>Download movie</a> </video>
  • 5. <audio src=bieber.ogg controls autoplay> <a href=bieber.ogg>Download horrid pap</a> </audio>
  • 7. <audio src=bieber.ogg preload> <audio src=bieber.ogg preload=auto> <audio src=bieber.ogg preload=none> <audio src=bieber.ogg preload=metadata>
  • 10. controlling <video> with JavaScript var v = document.getElementByTagName('video') [0]; v.play(); v.pause(); v.volume = … ; v.currentTime = … ; …
  • 11. 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) …
  • 12. video as native object...why is it important? ● keyboard accessibility built-in ● “play nice” with rest of the page ● Simple API for controls
  • 13.
  • 14. "In addition to giving video an HTML element, we must also agree on a baseline video format that will be universally supported, just like the GIF, JPEG and PNG image format are universally supported. It's important that the video format we choose can be supported by a wide range of devices and that it's royalty-free (RF). RF is a well- established principle for W3C standards." http://people.opera.com/howcome/2007/video/
  • 15. Ogg Theora “free and open”, no licensing/royalties not many tools for it, not web optimised
  • 16. MP4 / H.264 ubiquitous, patent encumbered, licensing/royalties, hardware accelerated
  • 17. WebM "open and royalty-free", web optimised, hardware acceleration on its way
  • 18. video formats webM Ogg/ Theora mp4/ h264 Opera yes yes Chrome yes yes Nope (Chrome.soon) Firefox Yes (FF4) yes Safari yes IE9 Yes (if installed) yes
  • 19. The politics of codecs
  • 20. audio formats mp3 Ogg/ Vobis wav Opera yes yes Chrome yes yes yes Firefox yes yes Safari yes yes IE9 yes
  • 21. Giving everybody video <video controls autoplay poster=… width=… height=…> <source src=pudding.mp4 type=video/mp4> <source src=pudding.webm type=video/webm> <source src=pudding.ogv type=video/ogg> <!-- fallback content --> </video>
  • 22. <video controls poster="…" 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> still include fallback for old browsers http://camendesign.com/code/video_for_everybody
  • 23. Help ● archive.org converts and hosts creative-commons licensed media ● vid.ly has a free conversion/ hosting service (max 1GB source file) see vid.ly/5u4h3e ● Miro video converter is a drag and drop GUI skin on FFMPEG
  • 24. video media queries <video controls> <source src=hi-res.ogv media="(min-device-width:800px)"> <source src=lo-res.ogv> </video> http://dev.w3.org/html5/spec/video.html#the-source-element
  • 25. Full-screen video ● Currently, WebkitEnterFullscreen(); ● May 11, WebKit announced it's implementing Gecko API https://wiki.mozilla.org/Gecko:FullScreenAPI ● Opera likes this approach, too
  • 27.
  • 28. WebM release does not support subtitles WHATWG / W3C RFC will release guidance on subtitles and other overlays in HTML5 <video> in the near future. WebM intends to follow that guidance. http://code.google.com/p/webm/issues/detail?id=11 Egg image Kacper "Kangel" Aniołek http://commons.wikimedia.org/wiki/File:Egg.jpg
  • 29. <track> element <video controls poster=… width=… height=…> <source src=movie.webm type=video/webm> <track src=subtitles-en.vtt kind=subtitles srclang=en> <track src=subtitles-de.vtt kind=subtitles srclang=de> <!-- fallback content --> </video> http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-track-element
  • 31. webVTT WEBVTT FILE 1 01:23:45,678 --> 01:23:46,789 Hello world! 2 01:23:48,910 --> 01:23:49,101 Mój poduszkowiec jest pełen węgorzy
  • 32. WebVTT formatting Supports positioning of text Supports <b> and <i> Colouring individual speakers Support vertical text Supports RTL Supports ruby annotations Validator: http://quuz.org/webvtt/
  • 38.
  • 39. Synchronising media elements Each media element can have a MediaController. A MediaController is an object that coordinates the playback of multiple media elements, for instance so that a sign-language interpreter track can be overlaid on a video track, with the two being kept in sync.... Media elements with a MediaController are said to be slaved to their controller. The MediaController modifies the playback rate and the playback volume of each of the media elements slaved to it, and ensures that when any of its slaved media elements unexpectedly stall, the others are stopped at the same time. When a media element is slaved to a MediaController, its playback rate is fixed to that of the other tracks in the same MediaController, and any looping is disabled. http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#synchronising- multiple-media-elements http://www.w3.org/WAI/PF/HTML/wiki/Media_Multitrack_Media_API
  • 40. How mature is all this? Looping latency people.opera.com/patrickl/experiments/audio/hacky-looper/ HTML5 video issues on the iPad and how to solve them blog.millermedeiros.com/2011/03/html5-video-issues-on-the-ipad-and-how-to-solve-them/ Unsolved HTML5 video issues on iOS http://blog.millermedeiros.com/2011/04/unsolved-html5-video-issues-on-ios/ Audio Sprites (and fixes for iOS) remysharp.com/2010/12/23/audio-sprites/
  • 41. “...extending the language to better support Web applications … This puts HTML in direct competition with other technologies intended for applications deployed over the Web, in particular Flash and Silverlight.” Ian Hickson, Editor of HTML5 http://lists.w3.org/Archives/Public/public-html/2009Jan/0215.html
  • 42. Image © Jackdrawsanything.com "I will draw anything you like to raise funds for the Sick Kids"
  • 43. DISCLAIMER: This is my personal perspective and does not reflect the opinion of Opera. Or my wife, children or hamster. Or anyone else who might be embarrassed by association with me (which is mostly everyone, to be honest). As this is a conference, in the land of Żubrówka, I'll probably get drunk and try to chat you up, so let's make this disclaimer run until Saturday, OK?
  • 44.
  • 45. DRM on HTML5 without changes Henri Sivonen lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010- July/027051.html
  • 46. getUserMedia API (previously known as "HTML5 <device>")
  • 47. <video autoplay></video> <script> var video = document.querySelector(video); If (navigator.getUserMedia) {navigator.getUserMedia('video',successCallback, errorCallback); function successCallback(stream) { video.src = stream; } </script> Tutorial: http://dev.opera.com/articles/view/playing-with-html5-video-and-getusermedia-support/
  • 49. WebRTC is a free, open project that enables web browsers with Real-Time Communications (RTC) capabilities via simple Javascript APIs. The WebRTC components have been optimized to best serve this purpose. The WebRTC initiative is a project supported by Google, Mozilla and Opera. http://sites.google.com/site/webrtc/ http://www.whatwg.org/specs/web-apps/current-work/complete/video-conferencing- and-peer-to-peer-communication.html
  • 50. "We expect to see WebRTC support in Firefox, Opera, and Chrome soon!" http://www.webrtc.org/
  • 51.
  • 53.
  • 55. <video loop> <source src=hixie.mp4 type=video/mp4> <source src=hixie.webm type=video/webm> </video>
  • 56. //grab all the buttons buttons = document.querySelectorAll('button'), //loop through all the <button> elements, and create corresponding //audio elements buildAudio = (function(){ for (var i = 0, l = buttons.length; i < l; i++) { var key = buttons[i].textContent.toLowerCase(); //using the fancy new Audio() constructor here document.body.appendChild(new Audio(key + '.ogg')); }; })()
  • 57. document.addEventListener('ended', function(e){ if (e.target.nodeName == "AUDIO") { // pause the video since the audio //has stopped vid.pause(); } }, true)
  • 58. <button data-text="<q> element">Q</button> <button data-text="Web Workers">W</button>
  • 59. text = document.getElementById('thinger') … text.textContent = el.dataset ? el.dataset.text : el.getAttribute('data-text');
  • 60. #thinger {position:absolute; left:40px; top:200px; text-align: center; font-family: 'hixie', cursive, monospace; font- size:3em; color:red; transform: matrix(0.98,-0.17,-0.17,0.98,0,0);} AEZ Segar font, made into fontface kit with http://www.fontsquirrel.com/fontface/generator
  • 61.
  • 62. Thanks Mike Taylor @miketaylr for JS help, and Patrick Lauke @patrick_h_lauke for the Hixie voice. (What does that "H" stand for?) to me slowly and patiently
  • 63. All rights reserved corner Thanks Takara Tomy for permission to use Gigapudding video. Buy the pudding. Thanks Jack Henderson for permission to his scary DRM picture. Buy his book. HTML5 nazi-killing Bruce on unicorn picture by Marina Lawson. Buy her Dad's book. All others by me or (I believe) public domain.
  • 64. www.opera.com/developer bruce.lawson@opera.com www.brucelawson.co.uk twitter.com/brucel