SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
INTERNET KILLED
 THE VIDEO STAR
 An in-depth look at HTML5’s <video> tag
WHO I AM

• Ben Wilkins
• Director of Interactive Media atagency)
  Talstone Group (an advertising
• A husband and a father
• A die-hard fan of the Kentucky Wildcats
WHAT IS HTML5 VIDEO?
HTML5 video is an element introduced in the
HTML5 draft specification for the purpose of
playing videos or movies, partially replacing the
object element.*




                                              *Wikipedia
WHAT IS HTML5 VIDEO?

•   A DOM object played directly by
    the browser’s built-in player
•   Does not require 3rd party plugins
• Still evolving
FLASH vs. HTML5
FLASH vs. HTML5

• Flash growth depends on Adobe support
• HTML5 video reduces load time
• Interaction and skins for HTML5 video
  can be customized using JavaScript
  and stylesheets
• HTML5companies by all of the major
  internet
           is supported
DOWNSIDES

• Limited full screen support
• Not supported by older browsers
  (*cough* Internet Explorer *cough*)

• It’s technically in beta
• Everyone wants a different codec
BROWSER SUPPORT




  FireFox 3.5+, Safari 3.0+, Chrome 3.0+,
Opera 10.5+, iPhone/iPad 1.0+, Android 2.0+
                  And...
BROWSER SUPPORT
CODECS & CONTAINERS
          H.264 and AAC (.mp4)
• H.264 developed by MPEG group (2003)
• MP4 developed by Apple
• Uses AAC audio codec
• H.24 is patent-encumbered
CODECS & CONTAINERS
       Theora and Vorbis (“Ogg”, .ogv)
• Developed by Xiph.org Foundation
• source-friendly
  Royalty-free, open standard and open


• Unencumbered by any known patents
CODECS & CONTAINERS
      VP8 and Vorbis (“WebM”, .webm)
• Announced May
• Development sponsored by Google
• Most promising container thus far
CODECS & CONTAINERS
    A year from now, the landscape will look
    drastically different, largely due to WebM:
                IE        FIREFOX         SAFARI       CHROME          OPERA         IPHONE         ANDROID
 Ogg             —           3.5+            **           5.0+          10.5+             –            –
MP4            9.0+            –            3.0+          5.0+             –            3.0+          2.0+
WebM          9.0+*          4.0+            **           6.0+          10.6+             –           ***

* Microsoft has implied that the user has to install a VP8 codec, but nothing has been confirmed.
** Safari will play anything QuickTime can play, but QT only comes with MP4 support pre-installed.
*** Google has committed to supporting WebM “in a future release” of Android, but has not set a timeline.
CODECS & CONTAINERS
              Which should I use?

•   You need to use ALL OF THEM.
•   FireFox will continue to reject MP4 as long as
    the MPEG group continues to charge a
    licensing fee for encoding & decoding.
•   Apple will continue to reject Ogg because
    FireFox is rejecting MP4.
•   Google can try to convince Apple to use
    WebM, which would make it compatible
    with every browser and device.
ENCODING: MP4

• QuickTime Pro ($30)
• HandBrake (Free)
ENCODING: OGG

• FireFogg: A free plug-in for FireFox
• Encoded locally
• Open source with an API available for use
ENCODING: WEBM

• Can now also be done with FireFogg
• WebM is also supported(CLI) a
  command line interface
                         in ffmpeg,
MARKING IT UP
Technically, all you need is:
<video src=”trailer.webm”></video>

However, if you’ve been paying attention, you know
we need more.
MARKING IT UP
Just like images, you should add width and height:
<video src=”trailer.webm” width=”320” height=”240”></video>
MARKING IT UP
Let’s remove the source for now and add controls.
<video width=”320” height=”240” controls></video>
MARKING IT UP
Preloading... just hear me out.
If the whole point of the page is to view the video, it
makes sense to have the browser start downloading
the video as soon as the page loads.
<video width=”320” height=”240” controls preload></video>

Telling the browser NOT to preload:
<video width=”320” height=”240” controls preload=”none”></video>
MARKING IT UP
Autoplay... just hear me out, again.
Some people hate autoplay, some love it. The truth is
that sometimes it’s the correct thing to do.
<video width=”320” height=”240” controls autoplay></video>
MARKING IT UP
Before I go on, I should mention MIME
Types. Place the following lines in
your .htaccess file to send the correct MIME
Types to browsers.
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm

* If your video won’t play in FireFox, this is likely the reason why.
Make sure the video/ogg MIME Type has been added correctly.
MARKING IT UP
Adding the source back, but this time I’m going to
add all three codecs. The video element can contain
more than one source, and the browser will go down
the list until it finds one it can play.
<video width=”320” height=”240” controls autoplay>
  <source src=”trailer.mp4” type=”video/mp4”>
  <source src=”trailer.webm” type=”video/webm”>
  <source src=”trailer.ogv” type=”video/ogg”>
</video>

Adding the type attribute lets the browser know if it
can play the file.
MARKING IT UP:
       A FALLBACK PLAN
But what about IE?
•   Most people that use IE also have Flash
    installed, and the modern versions of Flash
    support H.264 video, so you can use the
    MP4 you already encoded.
•   HTML5 let’s you nest an <object> element
    inside the <video> tag.
•   FlowPlayer is a free Flash video player.
MARKING IT UP:
      A FALLBACK PLAN
•   HTML5 will ignore all children of the
    <video> element (other than <source>).
• This allows you to use HTML5 in newer
  browsers and gracefully fall back to Flash
    in older browsers.
• Video forand others have expanded on it
  popular,
            Everybody made this method

    since.
MARKING IT UP:
         iOS ISSUES
•   Prior to iOS4, videos were not
    recognized if a poster attribute is
    included. The poster attribute lets you
    display a custom image while the video
    loads or until the user presses play.
• iOSlisted,onlylist your MP4 file first.
  file
       will
             so
                  recognize the first source
MARKING IT UP:
    ANDROID ISSUES
•   The type attribute on the source
    element confuses Android. Since
    Android can only read H.264, just leave
    off the type attribute for the MP4 file.
    This does not affect other browsers.
• The controls attribute is not supported,
    but it doesn’t hurt anything to
    include it.
THE FULL CODE
<video id="movie" width="320" height="240" preload controls>
 <source src="trailer.mp4" />
 <source src="trailer.webm" type="video/webm" />
 <source src="trailer.ogv" type="video/ogg" />
 <object width="320" height="240"
  type="application/x-shockwave-flash"
  data="flowplayer-3.2.1.swf">
  <param name="movie" value="flowplayer-3.2.1.swf" />
  <param name="allowfullscreen" value="true" />
  <param name="flashvars"
      value='config={"clip": {"url": "http://example.com/vids/trailer.mp4",
"autoPlay":false, "autoBuffering":true}}' />
  <p>Download video as <a href="trailer.mp4">MP4</a>,
  <a href="trailer.webm">WebM</a>, or <a href="trailer.ogv">Ogg</a>.</p>
 </object>
</video>
<script>
 var v = document.getElementById("movie");
 v.onclick = function() {
  if (v.paused) {
     v.play();
  } else {
     v.pause();
  }
 });
</script>
GOING FORWARD

• More useful analytics
• Easier social sharing
• Easy branding
• Calls to action and tracking
• Email capabilities
• Who knows... Maybe TV?

Contenu connexe

Tendances

Developer Training for 23 Video
Developer Training for 23 VideoDeveloper Training for 23 Video
Developer Training for 23 Video
Steffen
 
Online Video Delivery
Online Video DeliveryOnline Video Delivery
Online Video Delivery
Dan O'Hara
 
Koubei banquet 26
Koubei banquet 26Koubei banquet 26
Koubei banquet 26
Koubei UED
 

Tendances (20)

State of Media Accessibility in HTML5
State of Media Accessibility in HTML5State of Media Accessibility in HTML5
State of Media Accessibility in HTML5
 
Vilnius py video
Vilnius py videoVilnius py video
Vilnius py video
 
Rija js video
Rija js videoRija js video
Rija js video
 
Warsawclouddays video
Warsawclouddays videoWarsawclouddays video
Warsawclouddays video
 
Krakow video
Krakow videoKrakow video
Krakow video
 
Html5 Theora
Html5 TheoraHtml5 Theora
Html5 Theora
 
Video js zagreb
Video js zagrebVideo js zagreb
Video js zagreb
 
Developer Training for 23 Video
Developer Training for 23 VideoDeveloper Training for 23 Video
Developer Training for 23 Video
 
Flash Lite, un’occasione da 1.3 Miliardi di mobile phones
Flash Lite, un’occasione da 1.3 Miliardi di mobile phonesFlash Lite, un’occasione da 1.3 Miliardi di mobile phones
Flash Lite, un’occasione da 1.3 Miliardi di mobile phones
 
test
testtest
test
 
Corkgdg video
Corkgdg videoCorkgdg video
Corkgdg video
 
Gdg lublin video
Gdg lublin videoGdg lublin video
Gdg lublin video
 
Html5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentationHtml5 Video Vs Flash Video presentation
Html5 Video Vs Flash Video presentation
 
Beef Up Your Website With Audio And Video - It's Easy!
Beef Up Your Website With Audio And Video - It's Easy!Beef Up Your Website With Audio And Video - It's Easy!
Beef Up Your Website With Audio And Video - It's Easy!
 
Portogdg video
Portogdg videoPortogdg video
Portogdg video
 
Online Video Delivery
Online Video DeliveryOnline Video Delivery
Online Video Delivery
 
Armadajs video
Armadajs videoArmadajs video
Armadajs video
 
Developing FirefoxOS
Developing FirefoxOSDeveloping FirefoxOS
Developing FirefoxOS
 
Make web as webapp
Make web as webappMake web as webapp
Make web as webapp
 
Koubei banquet 26
Koubei banquet 26Koubei banquet 26
Koubei banquet 26
 

En vedette

En vedette (7)

HTML5 Video Player #fsync
HTML5 Video Player #fsyncHTML5 Video Player #fsync
HTML5 Video Player #fsync
 
10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
How to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Similaire à Html5video

Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
Greg Schechter
 
HTML5 Video Right Now
HTML5 Video Right NowHTML5 Video Right Now
HTML5 Video Right Now
Carlos Araya
 

Similaire à Html5video (20)

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
 
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
 
Web DU Mobile Meow
Web DU Mobile MeowWeb DU Mobile Meow
Web DU Mobile Meow
 
HTML5 Multimedia Streaming
HTML5 Multimedia StreamingHTML5 Multimedia Streaming
HTML5 Multimedia Streaming
 
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
 
Flash and HTML5 Video
Flash and HTML5 VideoFlash and HTML5 Video
Flash and HTML5 Video
 
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
 
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
 
Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
 
Mm sys 2013-demo
Mm sys 2013-demoMm sys 2013-demo
Mm sys 2013-demo
 
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologiesCraft 2019 - “The Upside Down” Of The Web - Video technologies
Craft 2019 - “The Upside Down” Of The Web - Video technologies
 
HTML5, Flash, and the Battle For Faster Cat Videos
HTML5, Flash, and the Battle For Faster Cat VideosHTML5, Flash, and the Battle For Faster Cat Videos
HTML5, Flash, and the Battle For Faster Cat Videos
 
Looking into HTML5 + CSS3
Looking into HTML5 + CSS3Looking into HTML5 + CSS3
Looking into HTML5 + CSS3
 
HTML5 Video Right Now
HTML5 Video Right NowHTML5 Video Right Now
HTML5 Video Right Now
 
Frontcon video
Frontcon videoFrontcon video
Frontcon video
 
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
 
Video performance munichfrontend
Video performance munichfrontendVideo performance munichfrontend
Video performance munichfrontend
 
Video Killed My Data Plan: Helsinki
Video Killed My Data Plan: HelsinkiVideo Killed My Data Plan: Helsinki
Video Killed My Data Plan: Helsinki
 
IBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
IBC Content Everywhere Hub Presentation: HTML5 And Fastest EncodingIBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
IBC Content Everywhere Hub Presentation: HTML5 And Fastest Encoding
 
[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!
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Html5video

  • 1. INTERNET KILLED THE VIDEO STAR An in-depth look at HTML5’s <video> tag
  • 2. WHO I AM • Ben Wilkins • Director of Interactive Media atagency) Talstone Group (an advertising • A husband and a father • A die-hard fan of the Kentucky Wildcats
  • 3. WHAT IS HTML5 VIDEO? HTML5 video is an element introduced in the HTML5 draft specification for the purpose of playing videos or movies, partially replacing the object element.* *Wikipedia
  • 4. WHAT IS HTML5 VIDEO? • A DOM object played directly by the browser’s built-in player • Does not require 3rd party plugins • Still evolving
  • 6. FLASH vs. HTML5 • Flash growth depends on Adobe support • HTML5 video reduces load time • Interaction and skins for HTML5 video can be customized using JavaScript and stylesheets • HTML5companies by all of the major internet is supported
  • 7. DOWNSIDES • Limited full screen support • Not supported by older browsers (*cough* Internet Explorer *cough*) • It’s technically in beta • Everyone wants a different codec
  • 8. BROWSER SUPPORT FireFox 3.5+, Safari 3.0+, Chrome 3.0+, Opera 10.5+, iPhone/iPad 1.0+, Android 2.0+ And...
  • 10. CODECS & CONTAINERS H.264 and AAC (.mp4) • H.264 developed by MPEG group (2003) • MP4 developed by Apple • Uses AAC audio codec • H.24 is patent-encumbered
  • 11. CODECS & CONTAINERS Theora and Vorbis (“Ogg”, .ogv) • Developed by Xiph.org Foundation • source-friendly Royalty-free, open standard and open • Unencumbered by any known patents
  • 12. CODECS & CONTAINERS VP8 and Vorbis (“WebM”, .webm) • Announced May • Development sponsored by Google • Most promising container thus far
  • 13. CODECS & CONTAINERS A year from now, the landscape will look drastically different, largely due to WebM: IE FIREFOX SAFARI CHROME OPERA IPHONE ANDROID Ogg — 3.5+ ** 5.0+ 10.5+ – – MP4 9.0+ – 3.0+ 5.0+ – 3.0+ 2.0+ WebM 9.0+* 4.0+ ** 6.0+ 10.6+ – *** * Microsoft has implied that the user has to install a VP8 codec, but nothing has been confirmed. ** Safari will play anything QuickTime can play, but QT only comes with MP4 support pre-installed. *** Google has committed to supporting WebM “in a future release” of Android, but has not set a timeline.
  • 14. CODECS & CONTAINERS Which should I use? • You need to use ALL OF THEM. • FireFox will continue to reject MP4 as long as the MPEG group continues to charge a licensing fee for encoding & decoding. • Apple will continue to reject Ogg because FireFox is rejecting MP4. • Google can try to convince Apple to use WebM, which would make it compatible with every browser and device.
  • 15. ENCODING: MP4 • QuickTime Pro ($30) • HandBrake (Free)
  • 16. ENCODING: OGG • FireFogg: A free plug-in for FireFox • Encoded locally • Open source with an API available for use
  • 17. ENCODING: WEBM • Can now also be done with FireFogg • WebM is also supported(CLI) a command line interface in ffmpeg,
  • 18. MARKING IT UP Technically, all you need is: <video src=”trailer.webm”></video> However, if you’ve been paying attention, you know we need more.
  • 19. MARKING IT UP Just like images, you should add width and height: <video src=”trailer.webm” width=”320” height=”240”></video>
  • 20. MARKING IT UP Let’s remove the source for now and add controls. <video width=”320” height=”240” controls></video>
  • 21. MARKING IT UP Preloading... just hear me out. If the whole point of the page is to view the video, it makes sense to have the browser start downloading the video as soon as the page loads. <video width=”320” height=”240” controls preload></video> Telling the browser NOT to preload: <video width=”320” height=”240” controls preload=”none”></video>
  • 22. MARKING IT UP Autoplay... just hear me out, again. Some people hate autoplay, some love it. The truth is that sometimes it’s the correct thing to do. <video width=”320” height=”240” controls autoplay></video>
  • 23. MARKING IT UP Before I go on, I should mention MIME Types. Place the following lines in your .htaccess file to send the correct MIME Types to browsers. AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm * If your video won’t play in FireFox, this is likely the reason why. Make sure the video/ogg MIME Type has been added correctly.
  • 24. MARKING IT UP Adding the source back, but this time I’m going to add all three codecs. The video element can contain more than one source, and the browser will go down the list until it finds one it can play. <video width=”320” height=”240” controls autoplay> <source src=”trailer.mp4” type=”video/mp4”> <source src=”trailer.webm” type=”video/webm”> <source src=”trailer.ogv” type=”video/ogg”> </video> Adding the type attribute lets the browser know if it can play the file.
  • 25. MARKING IT UP: A FALLBACK PLAN But what about IE? • Most people that use IE also have Flash installed, and the modern versions of Flash support H.264 video, so you can use the MP4 you already encoded. • HTML5 let’s you nest an <object> element inside the <video> tag. • FlowPlayer is a free Flash video player.
  • 26. MARKING IT UP: A FALLBACK PLAN • HTML5 will ignore all children of the <video> element (other than <source>). • This allows you to use HTML5 in newer browsers and gracefully fall back to Flash in older browsers. • Video forand others have expanded on it popular, Everybody made this method since.
  • 27. MARKING IT UP: iOS ISSUES • Prior to iOS4, videos were not recognized if a poster attribute is included. The poster attribute lets you display a custom image while the video loads or until the user presses play. • iOSlisted,onlylist your MP4 file first. file will so recognize the first source
  • 28. MARKING IT UP: ANDROID ISSUES • The type attribute on the source element confuses Android. Since Android can only read H.264, just leave off the type attribute for the MP4 file. This does not affect other browsers. • The controls attribute is not supported, but it doesn’t hurt anything to include it.
  • 29. THE FULL CODE <video id="movie" width="320" height="240" preload controls> <source src="trailer.mp4" /> <source src="trailer.webm" type="video/webm" /> <source src="trailer.ogv" type="video/ogg" /> <object width="320" height="240" type="application/x-shockwave-flash" data="flowplayer-3.2.1.swf"> <param name="movie" value="flowplayer-3.2.1.swf" /> <param name="allowfullscreen" value="true" /> <param name="flashvars" value='config={"clip": {"url": "http://example.com/vids/trailer.mp4", "autoPlay":false, "autoBuffering":true}}' /> <p>Download video as <a href="trailer.mp4">MP4</a>, <a href="trailer.webm">WebM</a>, or <a href="trailer.ogv">Ogg</a>.</p> </object> </video> <script> var v = document.getElementById("movie"); v.onclick = function() { if (v.paused) { v.play(); } else { v.pause(); } }); </script>
  • 30. GOING FORWARD • More useful analytics • Easier social sharing • Easy branding • Calls to action and tracking • Email capabilities • Who knows... Maybe TV?