SlideShare a Scribd company logo
Mobile Meow
    Bring YouTube to the Mobile Web




By YouTube's Greg Schechter and Matt Ward
Greg Schechter            Matt Ward
The Web Warrior        Seek Bar Engineer




schechter@google.com    mattward@google.com
Video
Video
A Brief History
Video
Flash
<video>
<video>             <video>             <video>


  IE                Chrome              Firefox


          <video>             <video>


          Opera               Safari
Video
Playback Stats
Flash   Flash
Flash   Native   <video>
Flash
Flash
         ==   Flash
Native
Native


 ○   For fallbacks, use rtsp:// protocol (serving .3pg) if the
     device won't support HTML5
 ○   Use custom protocol / URL scheme to launch your own
     Android, iOS native app (no Windows Phone yet)
      ■ youtube://video_id
<video>
The Different Browsers




        Safari           Android
The Different Browsers

                             Opera
Safari    Android   Chrome                Silk
                              Mini




    Firefox   Opera
                                     IE
The Different Browsers

                             Opera
Safari    Android   Chrome                Silk
                              Mini




    Firefox   Opera
                                     IE




                    AMP LE
              S
Fragmentation
By brownpau at http://www.flickr.com/photos/brownpau/533267369/
How do we start




              <video>
The Source




     <video src="funny_cat_video">
The Source




<video src="funny_cat_video.webm/mp4/ogg">
Mobile Formats Support


        Chrome       Safari           Firefox   Opera        IE   Android
H.264



WebM    Android 4+                              Android 4+        Android 4+



HLS                                                               Android 3+




 Platform Versions and Distribution
The Source




   <video>
    <source src="funny_cat_video.mp4">
    <source src="funny_cat_video.webm">
   </video>
HLS = HTTP Live Streaming




   <video src="playlist.m3u8">
HLS


                              video-0-1.ts
              format-0.m3u8   video-0-2.ts
                                   ...

                              video-1-1.ts
 index.m3u8   format-0.m3u8   video-1-2.ts
                                   ...

                              video-2-1.ts
              format-0.m3u8   video-2-2.ts
                                   ...
HLS

Big Features
    ○   Live and Adaptive Streaming
    ○   Built in CDN failover
    ○   Metadata + Cue Points


Apple App Requirements
   ○ > 10 minutes in duration or 5 mb in 5 minutes
   ○ at least one 64 kbps or lower stream required

Tools and more information on Apple's website:
Apple's Using HTTP Live Streaming
Power
Power Consumption: H264 vs WebM


                                                                              **fullscreen flash
                                                                              **windowed flash




Research done by Yossi Oren For more information visit http://iss.oy.ne.ro/
Stick it in a page
Basic video tag
Safari
   ○   Renders a thumbnail poster and play button (flaky)
   ○   Background is set to black and cannot be overwritten
   ○   If a parent element has display:none set at any point the video fails to
       playback properly

Opera
   ○   Gives video dimentions black background if the information is
       available
   ○   Has issues with stretching WebM

IE and Android
   ○   Play button/film icon for all video tags regardless if browser can play
       the format
   ○   Background is set to black/grey and cannot be overwritten
Give it a poster and click it
Poster Attribute
Use the poster attribute to get a thumbnail

Safari, Chrome, Android, and Opera
   ○ Preserve aspect ratio of poster image
IE and Firefox
    ○ Stretch image to size of video tag
IE
     ○   Keeps poster as paused state

All Others
    ○ Replace video with the paused frame
Basic video tag


Chrome
   ○ Default click to toggle play/pause
   ○ Remove with an empty onclick handler
Safari
   ○     Will launch any supported video with or without an onclick handler

Android and IE
   ○ Shows click interactions but does not play with empty onclick
Basic video tag



Pro tips:
   ○   Create your own cued state to convey you can play the video
   ○   Set the background color to black for continuity across platforms
Controls




           <video controls>
Lets get some controls
Controls
             Chrome   Safari       Firefox       Opera           IE           Android
Play/pause
Button


Volume                Only in      Mute toggle   Don't work in
Controls              Fullscreen   only          Android 4


Seek bar



Fullscreen   Button   Gesture                                                 Button
button

Playback     Both     Fullscreen   Inline only   Determined      Fullscreen   Both
Type                  only                       by hardware     only
Fullscreen
requestFullScreen
requestFullScreen
● Desktop Only
  ○ Firefox, Safari, and Chrome
  ○ Vendor Prefixed
Fullscreen
var elem = document.getElementById("my-element");
document.onwebkitfullscreenchange = function() {
 // The fullscreen element:
 // document.webkitFullScreenElement;
 console.log ("We went fullscreen!");
};
elem.webkitRequestFullScreen();
What about Mobile?
Isn't it already fullscreen?
Yes (sort of)
Fullscreen
● Desktop
  ○ requestFullScreen
● Mobile
Fullscreen
● Desktop
  ○ requestFullScreen
● Mobile
  ○ Open New Tab
Fullscreen
● Desktop
  ○ requestFullScreen
● Mobile
  ○ Open New Tab
  ○ webkitEnterFullscreen
       ●   Webkit only
       ●   Video element only
       ●   metadata must be loaded
Fullscreen
● Desktop
  ○ requestFullScreen
● Mobile
  ○ Open New Tab
  ○ webkitEnterFullscreen
       ● Webkit only
       ● Video element only
       ● metadata must be loaded
● Pro Tip: Remember size context changes so
  use viewport to scale icons and controls
@viewport { width: device-width; }
Custom Controls




  Lets get some custom controls
Custom Controls
● Preserve your brand
● Unified experience across platforms and
  browsers
● Allows us to expand the set of controls and add our own
  ○ annotations
  ○ playlist
  ○ captions
  ○ more
Custom Controls Pro Tips
● User expect to be able to drag the progress
  bar
  ○ Need to remender to prevent scroll on touchstart
● Volume can't be set everywhere and users
  are accustomed to using device controls
  ○ So don't build controls for it
Custom Controls Pro Tips
● Fullscreen
  ○ The browsing context is always fullscreen so fake it
● Don't overload clicking for both play/pause
  and show/hiding controls
● Don't trigger content with hover
Custom Controls Pro Tips
● Fingers are fat
  ○ Average finger is 11mm so make targets at least
       40px with 10px padding
   ○   Use SVG's so icons can be scaled and shared with
       desktop application
   ○   Do what you can in css
autoplay




           <video autoplay>
autoplay


In Safari on iOS (for all devices, including iPad),
where the user may be on a cellular network and
be charged per data unit, preload and autoplay are
disabled. No data is loaded until the user initiates it.
autoplay


In Safari on iOS (for all devices, including iPad),
where the user may be on a cellular network and
be charged per data unit, preload and autoplay are
disabled. No data is loaded until the user initiates it.
What about everyone else?
Autoplay


            Chrome   Safari   Firefox   Opera   IE   Android
Attribute



Scripted                                             Buggy
autoplay
autoplay




       <video onclick="this.play()">
autoplay
function someClickEvent(evt) {
  // In a user initiated thread.
  myVideoElement.load();
  getVideoData(); // Triggers an ajax call.
}

function onGetVideoDataReturned(data) {
  // Not in a user initiated thread.
  setVideoElementSrc(data);
  myVideoElement.load();
  myVideoElement.play();
}
autoplay
function someClickEvent(evt) {
  // In a user initiated thread.
  myVideoElement.load();
  getVideoData(); // Triggers an ajax call.
}

function onGetVideoDataReturned(data) {
  // Not in a user initiated thread.
  setVideoElementSrc(data);
  myVideoElement.load();
  // For Android
  window.setTimeout(function() {
    myVideoElement.play();
  }, 0);
}
autoplay




   setMediaPlaybackRequiresUserAction
Embeds
Embeds
 <script>
Embeds
 <script>
   ○ We need our content to be sandboxed
   ○ More than just a video tag
Embeds
 <script>
   ○ We need our content to be sandboxed
   ○ More than just a video tag
 <object>
Embeds
 <script>
   ○ We need our content to be sandboxed
   ○ More than just a video tag
 <object>
   ○ Can load content with the data
      attribute
   ○ But no way to interact with it via
      JavaScript
Embeds
 <iframe>
Embeds
 <iframe>
    ○ Allows our content to be sandboxed
    ○ JavaScript API communication
Embeds

<iframe type="text/html"
  width="640"
  height="385"
  frameborder="0"
  src="http://www.youtube.com/embed/VIDEO_ID"
  allowfullscreen>
</iframe>
Daily impressions of Embed




Total

object




iframe


    April 2011                                April 2012
Embeds
Pro tip: Plan for the future (if you can)

<iframe type="text/html"
  width="640"
  height="385"
  frameborder="0"
  src="http://www.youtube.com/embed/VIDEO_ID"
  allowfullscreen>
</iframe>
Embeds Pro Tips:



html {
  /** Hack to fix iPhone resizing. */
  overflow: hidden;
}
Embeds Pro Tips:

body {
  /** Dymanic Resizing **/
  background-color: #000;
  height: 100%;
  width: 100%;
  /** Remove highlight when use clicks **/
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
API
API Communication
API Communication
● Poll the URL fragment?
  ○ http://youtube.com/embed/video_id#fragment
API Communication
● Poll the URL fragment?
  ○ http://youtube.com/embed/video_id#fragment
● Messages are one dimensional.
● Polling eats up CPU and is not instant.
● Both directions of communication use the same
  fragment.
API Communication
● Better idea: PostMessage API
  ○ someWindow.postMessage(message, targetOrigin);
API Communication
● Better idea: PostMessage API.
  ○ someWindow.postMessage(message, targetOrigin);
● Uses JSON for native encoding and decoding of data.
● No polling.
● Native event listeners.
● Communications are sandboxed per-window.
● Calls are asynchronous.
● Great for Mobile, but desktop support is missing in IE7
Remember all communication is
      asynchronous
Testing
Testing: The Old Fashioned Way
 ●   Device lab
      ○ accurate
      ○ costly
      ○ space inefficient
      ○ boring
Testing: With Software
 ● Hardware Emulators / Simulators
    ○ available for major systems
    ○ approximation varies
    ○ still boring
 ● Android Emulator
    ○ bulky, slow, no video codecs
 ● iOs Simulator
    ○ both tablet and phone
Testing: With Software
 ● Browser Simulators
   ○ Poorer approximation
 ● Opera Mobile Simulator
   ○ missing video tag support
 ● Fennec (FF) Simulator
   ○ poor touch control mapping
   ○ sends desktop user agent
Testing: Automation
 ● Selenium!
   ○ use with simulated or real devices
   ○ not boring
Testing: Automation
 ● Android Webdriver
    ○ Still no video support
 ● iOS Webdriver
    ○ Need to register as ios dev
    ○ Intermittent issues with playback
 ● IE
    ○ No webdriver APIs for mobile
Testing: Automation
 ● Chrome, Opera
   ○ Driver APIs built-in
   ○ Remote debugging
 ● FFMobile
   ○ No webdriver APIs
Testing: Automation Strategy
 ● Test API methods in mobile context first
   ○ cheap
   ○ can approximate video playback by video.
      currentTime
Testing: Automation Strategy
 ● More sophisticated tests to follow
   ○ screenreader
 ● Screen cap processing
   ○ check for distortion
   ○ playback accuracy
Testing: Automation Strategy
 ● Screen cap processing
Testing: Hardware Assistance
The Future




 Cats in Space by WF&TD
Or
PointerEvents
http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
http://imgs.xkcd.com/comics/in_ur_reality.png
Track



<video>
 <track src="cats_meow" kind="subtitles">
</video>
getUserMedia
More to learn
 ● HTML5 Video Spec
   ○ http://dev.w3.org/html5/spec-author-view/video.html
 ● Browser Blogs
   ○ http://dev.opera.com/
   ○ http://hacks.mozilla.org/
   ○ http://blogs.msdn.com/b/ie/
   ○ http://peter.sh/
 ● Documentation
   ○ https://developer.mozilla.org/en-US/
 ● Other
   ○ http://developer.apple.
        com/library/safari/#documentation/AudioVideo/Conceptual/Using_HT
        ML5_Audio_Video/Device-SpecificConsiderations/Device-
        SpecificConsiderations.html
Questions?




     can haz question?
            By cloudzilla http://www.flickr.com/photos/cloudzilla/378829651/
schechter@google.com
mattward@google.com

More Related Content

What's hot

YouTube for Developers
YouTube for DevelopersYouTube for Developers
YouTube for Developers
cityofroundrock
 
Building Video Applications with YouTube APIs
Building Video Applications with YouTube APIsBuilding Video Applications with YouTube APIs
Building Video Applications with YouTube APIs
Jarek Wilkiewicz
 
Building apps for multiple devices
Building apps for multiple devicesBuilding apps for multiple devices
Building apps for multiple devices
Terry Ryan
 
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...
Jarek Wilkiewicz
 
YouTube APIs Workshop
YouTube APIs WorkshopYouTube APIs Workshop
YouTube APIs Workshop
Jarek Wilkiewicz
 
Introduction to Jetpack- WordCamp Chicago 2014
Introduction to Jetpack- WordCamp Chicago 2014Introduction to Jetpack- WordCamp Chicago 2014
Introduction to Jetpack- WordCamp Chicago 2014
Michele Butcher-Jones
 
Developer Training for 23 Video
Developer Training for 23 VideoDeveloper Training for 23 Video
Developer Training for 23 VideoSteffen
 
Youtube api at Glance
Youtube api at GlanceYoutube api at Glance
Youtube api at Glance
Ashok Basnet
 
Videogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha TouchVideogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha Touch
Alexander Wilhelm
 
WordCamp Raleigh WordPress & Social Media Integration
WordCamp Raleigh WordPress & Social Media IntegrationWordCamp Raleigh WordPress & Social Media Integration
WordCamp Raleigh WordPress & Social Media Integration
Digital Strategy Works LLC
 
Video js zagreb
Video js zagrebVideo js zagreb
Video js zagreb
Doug Sillars
 
Vilnius py video
Vilnius py videoVilnius py video
Vilnius py video
Doug Sillars
 
Warsawclouddays video
Warsawclouddays videoWarsawclouddays video
Warsawclouddays video
Doug Sillars
 
GameIS 2010 Developing Wii Games with Flash
GameIS 2010 Developing Wii Games with FlashGameIS 2010 Developing Wii Games with Flash
GameIS 2010 Developing Wii Games with Flash
Almog Koren
 
Gdg lublin video
Gdg lublin videoGdg lublin video
Gdg lublin video
Doug Sillars
 
HTML5 audio & video
HTML5 audio & videoHTML5 audio & video
HTML5 audio & video
Hamza Zahid
 
Rija js video
Rija js videoRija js video
Rija js video
Doug Sillars
 

What's hot (20)

YouTube for Developers
YouTube for DevelopersYouTube for Developers
YouTube for Developers
 
Building Video Applications with YouTube APIs
Building Video Applications with YouTube APIsBuilding Video Applications with YouTube APIs
Building Video Applications with YouTube APIs
 
Building apps for multiple devices
Building apps for multiple devicesBuilding apps for multiple devices
Building apps for multiple devices
 
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón...
 
YouTube APIs Workshop
YouTube APIs WorkshopYouTube APIs Workshop
YouTube APIs Workshop
 
Introduction to Jetpack- WordCamp Chicago 2014
Introduction to Jetpack- WordCamp Chicago 2014Introduction to Jetpack- WordCamp Chicago 2014
Introduction to Jetpack- WordCamp Chicago 2014
 
Developer Training for 23 Video
Developer Training for 23 VideoDeveloper Training for 23 Video
Developer Training for 23 Video
 
Youtube api at Glance
Youtube api at GlanceYoutube api at Glance
Youtube api at Glance
 
Videogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha TouchVideogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha Touch
 
Slide w12
Slide w12Slide w12
Slide w12
 
WordCamp Raleigh WordPress & Social Media Integration
WordCamp Raleigh WordPress & Social Media IntegrationWordCamp Raleigh WordPress & Social Media Integration
WordCamp Raleigh WordPress & Social Media Integration
 
Video js zagreb
Video js zagrebVideo js zagreb
Video js zagreb
 
Vilnius py video
Vilnius py videoVilnius py video
Vilnius py video
 
Appa
AppaAppa
Appa
 
Warsawclouddays video
Warsawclouddays videoWarsawclouddays video
Warsawclouddays video
 
Roy4
Roy4Roy4
Roy4
 
GameIS 2010 Developing Wii Games with Flash
GameIS 2010 Developing Wii Games with FlashGameIS 2010 Developing Wii Games with Flash
GameIS 2010 Developing Wii Games with Flash
 
Gdg lublin video
Gdg lublin videoGdg lublin video
Gdg lublin video
 
HTML5 audio & video
HTML5 audio & videoHTML5 audio & video
HTML5 audio & video
 
Rija js video
Rija js videoRija js video
Rija js video
 

Viewers also liked

Milieu
MilieuMilieu
Milieu
tuurs
 
Genetic modification
Genetic modificationGenetic modification
Genetic modificationLyndsae Drury
 
프레젠테이션1
프레젠테이션1프레젠테이션1
프레젠테이션1akibara
 
Biological molecules intro to the carbohydrates
Biological molecules intro to  the carbohydratesBiological molecules intro to  the carbohydrates
Biological molecules intro to the carbohydratesLyndsae Drury
 
Unit 2 coshh
Unit 2 coshhUnit 2 coshh
Unit 2 coshh
Lyndsae Drury
 
Genetic drift of iow
Genetic drift of iowGenetic drift of iow
Genetic drift of iowLyndsae Drury
 

Viewers also liked (6)

Milieu
MilieuMilieu
Milieu
 
Genetic modification
Genetic modificationGenetic modification
Genetic modification
 
프레젠테이션1
프레젠테이션1프레젠테이션1
프레젠테이션1
 
Biological molecules intro to the carbohydrates
Biological molecules intro to  the carbohydratesBiological molecules intro to  the carbohydrates
Biological molecules intro to the carbohydrates
 
Unit 2 coshh
Unit 2 coshhUnit 2 coshh
Unit 2 coshh
 
Genetic drift of iow
Genetic drift of iowGenetic drift of iow
Genetic drift of iow
 

Similar to Web DU Mobile Meow

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
brucelawson
 
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
Christian Heilmann
 
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
Greg Schechter
 
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
brucelawson
 
Krakow video
Krakow videoKrakow video
Krakow video
Doug Sillars
 
Portogdg video
Portogdg videoPortogdg video
Portogdg video
Doug Sillars
 
Corkgdg video
Corkgdg videoCorkgdg video
Corkgdg video
Doug Sillars
 
Armadajs video
Armadajs videoArmadajs video
Armadajs video
Doug Sillars
 
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
RZasadzinski
 
Html5 browser api_support
Html5 browser api_supportHtml5 browser api_support
Html5 browser api_support
상길 안
 
Replacing flash with HTML5 and CSS3
Replacing flash with HTML5 and CSS3Replacing flash with HTML5 and CSS3
Replacing flash with HTML5 and CSS3
Saurabh Kheni
 
Html5 Open Video Tutorial
Html5 Open Video TutorialHtml5 Open Video Tutorial
Html5 Open Video Tutorial
Silvia Pfeiffer
 
Сергей Батищев: 2D игры на HTML5: мифы и реальность разработки
Сергей Батищев: 2D игры на HTML5: мифы и реальность разработкиСергей Батищев: 2D игры на HTML5: мифы и реальность разработки
Сергей Батищев: 2D игры на HTML5: мифы и реальность разработки
DevGAMM Conference
 
Video Killed My Data Plan: Helsinki
Video Killed My Data Plan: HelsinkiVideo Killed My Data Plan: Helsinki
Video Killed My Data Plan: Helsinki
Doug Sillars
 
NodeJS Edinburgh Video Killed My Data Plan
NodeJS Edinburgh Video Killed My Data PlanNodeJS Edinburgh Video Killed My Data Plan
NodeJS Edinburgh Video Killed My Data Plan
Doug Sillars
 
(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
 
Video performance snowcamp
Video performance snowcampVideo performance snowcamp
Video performance snowcamp
Doug Sillars
 
HTML5 Video Right Now
HTML5 Video Right NowHTML5 Video Right Now
HTML5 Video Right NowCarlos Araya
 

Similar to Web DU Mobile Meow (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
 
Html5video
Html5videoHtml5video
Html5video
 
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
 
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
 
Krakow video
Krakow videoKrakow video
Krakow video
 
Portogdg video
Portogdg videoPortogdg video
Portogdg video
 
Corkgdg video
Corkgdg videoCorkgdg video
Corkgdg video
 
Armadajs video
Armadajs videoArmadajs video
Armadajs video
 
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 browser api_support
Html5 browser api_supportHtml5 browser api_support
Html5 browser api_support
 
FUGN - Stage Video and Molehill
FUGN - Stage Video and MolehillFUGN - Stage Video and Molehill
FUGN - Stage Video and Molehill
 
Replacing flash with HTML5 and CSS3
Replacing flash with HTML5 and CSS3Replacing flash with HTML5 and CSS3
Replacing flash with HTML5 and CSS3
 
Html5 Open Video Tutorial
Html5 Open Video TutorialHtml5 Open Video Tutorial
Html5 Open Video Tutorial
 
Сергей Батищев: 2D игры на HTML5: мифы и реальность разработки
Сергей Батищев: 2D игры на HTML5: мифы и реальность разработкиСергей Батищев: 2D игры на HTML5: мифы и реальность разработки
Сергей Батищев: 2D игры на HTML5: мифы и реальность разработки
 
Video Killed My Data Plan: Helsinki
Video Killed My Data Plan: HelsinkiVideo Killed My Data Plan: Helsinki
Video Killed My Data Plan: Helsinki
 
NodeJS Edinburgh Video Killed My Data Plan
NodeJS Edinburgh Video Killed My Data PlanNodeJS Edinburgh Video Killed My Data Plan
NodeJS Edinburgh Video Killed My Data Plan
 
(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...
 
Video performance snowcamp
Video performance snowcampVideo performance snowcamp
Video performance snowcamp
 
HTML5 Video Right Now
HTML5 Video Right NowHTML5 Video Right Now
HTML5 Video Right Now
 

Recently uploaded

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

Web DU Mobile Meow

  • 1. Mobile Meow Bring YouTube to the Mobile Web By YouTube's Greg Schechter and Matt Ward
  • 2. Greg Schechter Matt Ward The Web Warrior Seek Bar Engineer schechter@google.com mattward@google.com
  • 5.
  • 6.
  • 11. <video> <video> <video> IE Chrome Firefox <video> <video> Opera Safari
  • 12. Video
  • 14. Flash Flash
  • 15. Flash Native <video>
  • 16. Flash Flash == Flash
  • 18. Native ○ For fallbacks, use rtsp:// protocol (serving .3pg) if the device won't support HTML5 ○ Use custom protocol / URL scheme to launch your own Android, iOS native app (no Windows Phone yet) ■ youtube://video_id
  • 20. The Different Browsers Safari Android
  • 21. The Different Browsers Opera Safari Android Chrome Silk Mini Firefox Opera IE
  • 22. The Different Browsers Opera Safari Android Chrome Silk Mini Firefox Opera IE AMP LE S
  • 24. By brownpau at http://www.flickr.com/photos/brownpau/533267369/
  • 25. How do we start <video>
  • 26. The Source <video src="funny_cat_video">
  • 28. Mobile Formats Support Chrome Safari Firefox Opera IE Android H.264 WebM Android 4+ Android 4+ Android 4+ HLS Android 3+ Platform Versions and Distribution
  • 29. The Source <video> <source src="funny_cat_video.mp4"> <source src="funny_cat_video.webm"> </video>
  • 30. HLS = HTTP Live Streaming <video src="playlist.m3u8">
  • 31. HLS video-0-1.ts format-0.m3u8 video-0-2.ts ... video-1-1.ts index.m3u8 format-0.m3u8 video-1-2.ts ... video-2-1.ts format-0.m3u8 video-2-2.ts ...
  • 32. HLS Big Features ○ Live and Adaptive Streaming ○ Built in CDN failover ○ Metadata + Cue Points Apple App Requirements ○ > 10 minutes in duration or 5 mb in 5 minutes ○ at least one 64 kbps or lower stream required Tools and more information on Apple's website: Apple's Using HTTP Live Streaming
  • 33. Power
  • 34. Power Consumption: H264 vs WebM **fullscreen flash **windowed flash Research done by Yossi Oren For more information visit http://iss.oy.ne.ro/
  • 35. Stick it in a page
  • 36. Basic video tag Safari ○ Renders a thumbnail poster and play button (flaky) ○ Background is set to black and cannot be overwritten ○ If a parent element has display:none set at any point the video fails to playback properly Opera ○ Gives video dimentions black background if the information is available ○ Has issues with stretching WebM IE and Android ○ Play button/film icon for all video tags regardless if browser can play the format ○ Background is set to black/grey and cannot be overwritten
  • 37. Give it a poster and click it
  • 38. Poster Attribute Use the poster attribute to get a thumbnail Safari, Chrome, Android, and Opera ○ Preserve aspect ratio of poster image IE and Firefox ○ Stretch image to size of video tag IE ○ Keeps poster as paused state All Others ○ Replace video with the paused frame
  • 39. Basic video tag Chrome ○ Default click to toggle play/pause ○ Remove with an empty onclick handler Safari ○ Will launch any supported video with or without an onclick handler Android and IE ○ Shows click interactions but does not play with empty onclick
  • 40. Basic video tag Pro tips: ○ Create your own cued state to convey you can play the video ○ Set the background color to black for continuity across platforms
  • 41. Controls <video controls>
  • 42. Lets get some controls
  • 43. Controls Chrome Safari Firefox Opera IE Android Play/pause Button Volume Only in Mute toggle Don't work in Controls Fullscreen only Android 4 Seek bar Fullscreen Button Gesture Button button Playback Both Fullscreen Inline only Determined Fullscreen Both Type only by hardware only
  • 46. requestFullScreen ● Desktop Only ○ Firefox, Safari, and Chrome ○ Vendor Prefixed
  • 47. Fullscreen var elem = document.getElementById("my-element"); document.onwebkitfullscreenchange = function() { // The fullscreen element: // document.webkitFullScreenElement; console.log ("We went fullscreen!"); }; elem.webkitRequestFullScreen();
  • 49. Isn't it already fullscreen?
  • 51. Fullscreen ● Desktop ○ requestFullScreen ● Mobile
  • 52. Fullscreen ● Desktop ○ requestFullScreen ● Mobile ○ Open New Tab
  • 53. Fullscreen ● Desktop ○ requestFullScreen ● Mobile ○ Open New Tab ○ webkitEnterFullscreen ● Webkit only ● Video element only ● metadata must be loaded
  • 54. Fullscreen ● Desktop ○ requestFullScreen ● Mobile ○ Open New Tab ○ webkitEnterFullscreen ● Webkit only ● Video element only ● metadata must be loaded ● Pro Tip: Remember size context changes so use viewport to scale icons and controls
  • 55. @viewport { width: device-width; }
  • 56. Custom Controls Lets get some custom controls
  • 57. Custom Controls ● Preserve your brand ● Unified experience across platforms and browsers ● Allows us to expand the set of controls and add our own ○ annotations ○ playlist ○ captions ○ more
  • 58. Custom Controls Pro Tips ● User expect to be able to drag the progress bar ○ Need to remender to prevent scroll on touchstart ● Volume can't be set everywhere and users are accustomed to using device controls ○ So don't build controls for it
  • 59. Custom Controls Pro Tips ● Fullscreen ○ The browsing context is always fullscreen so fake it ● Don't overload clicking for both play/pause and show/hiding controls ● Don't trigger content with hover
  • 60. Custom Controls Pro Tips ● Fingers are fat ○ Average finger is 11mm so make targets at least 40px with 10px padding ○ Use SVG's so icons can be scaled and shared with desktop application ○ Do what you can in css
  • 61. autoplay <video autoplay>
  • 62.
  • 63. autoplay In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it.
  • 64. autoplay In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it.
  • 66. Autoplay Chrome Safari Firefox Opera IE Android Attribute Scripted Buggy
  • 68. autoplay <video onclick="this.play()">
  • 69.
  • 70.
  • 71. autoplay function someClickEvent(evt) { // In a user initiated thread. myVideoElement.load(); getVideoData(); // Triggers an ajax call. } function onGetVideoDataReturned(data) { // Not in a user initiated thread. setVideoElementSrc(data); myVideoElement.load(); myVideoElement.play(); }
  • 72. autoplay function someClickEvent(evt) { // In a user initiated thread. myVideoElement.load(); getVideoData(); // Triggers an ajax call. } function onGetVideoDataReturned(data) { // Not in a user initiated thread. setVideoElementSrc(data); myVideoElement.load(); // For Android window.setTimeout(function() { myVideoElement.play(); }, 0); }
  • 73. autoplay setMediaPlaybackRequiresUserAction
  • 76. Embeds <script> ○ We need our content to be sandboxed ○ More than just a video tag
  • 77. Embeds <script> ○ We need our content to be sandboxed ○ More than just a video tag <object>
  • 78. Embeds <script> ○ We need our content to be sandboxed ○ More than just a video tag <object> ○ Can load content with the data attribute ○ But no way to interact with it via JavaScript
  • 80. Embeds <iframe> ○ Allows our content to be sandboxed ○ JavaScript API communication
  • 81. Embeds <iframe type="text/html" width="640" height="385" frameborder="0" src="http://www.youtube.com/embed/VIDEO_ID" allowfullscreen> </iframe>
  • 82. Daily impressions of Embed Total object iframe April 2011 April 2012
  • 83. Embeds Pro tip: Plan for the future (if you can) <iframe type="text/html" width="640" height="385" frameborder="0" src="http://www.youtube.com/embed/VIDEO_ID" allowfullscreen> </iframe>
  • 84. Embeds Pro Tips: html { /** Hack to fix iPhone resizing. */ overflow: hidden; }
  • 85. Embeds Pro Tips: body { /** Dymanic Resizing **/ background-color: #000; height: 100%; width: 100%; /** Remove highlight when use clicks **/ -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
  • 86. API
  • 88. API Communication ● Poll the URL fragment? ○ http://youtube.com/embed/video_id#fragment
  • 89. API Communication ● Poll the URL fragment? ○ http://youtube.com/embed/video_id#fragment ● Messages are one dimensional. ● Polling eats up CPU and is not instant. ● Both directions of communication use the same fragment.
  • 90. API Communication ● Better idea: PostMessage API ○ someWindow.postMessage(message, targetOrigin);
  • 91. API Communication ● Better idea: PostMessage API. ○ someWindow.postMessage(message, targetOrigin); ● Uses JSON for native encoding and decoding of data. ● No polling. ● Native event listeners. ● Communications are sandboxed per-window. ● Calls are asynchronous. ● Great for Mobile, but desktop support is missing in IE7
  • 92. Remember all communication is asynchronous
  • 94. Testing: The Old Fashioned Way ● Device lab ○ accurate ○ costly ○ space inefficient ○ boring
  • 95. Testing: With Software ● Hardware Emulators / Simulators ○ available for major systems ○ approximation varies ○ still boring ● Android Emulator ○ bulky, slow, no video codecs ● iOs Simulator ○ both tablet and phone
  • 96. Testing: With Software ● Browser Simulators ○ Poorer approximation ● Opera Mobile Simulator ○ missing video tag support ● Fennec (FF) Simulator ○ poor touch control mapping ○ sends desktop user agent
  • 97. Testing: Automation ● Selenium! ○ use with simulated or real devices ○ not boring
  • 98. Testing: Automation ● Android Webdriver ○ Still no video support ● iOS Webdriver ○ Need to register as ios dev ○ Intermittent issues with playback ● IE ○ No webdriver APIs for mobile
  • 99. Testing: Automation ● Chrome, Opera ○ Driver APIs built-in ○ Remote debugging ● FFMobile ○ No webdriver APIs
  • 100. Testing: Automation Strategy ● Test API methods in mobile context first ○ cheap ○ can approximate video playback by video. currentTime
  • 101. Testing: Automation Strategy ● More sophisticated tests to follow ○ screenreader ● Screen cap processing ○ check for distortion ○ playback accuracy
  • 102. Testing: Automation Strategy ● Screen cap processing
  • 104. The Future Cats in Space by WF&TD
  • 105.
  • 106. Or
  • 109. Track <video> <track src="cats_meow" kind="subtitles"> </video>
  • 111. More to learn ● HTML5 Video Spec ○ http://dev.w3.org/html5/spec-author-view/video.html ● Browser Blogs ○ http://dev.opera.com/ ○ http://hacks.mozilla.org/ ○ http://blogs.msdn.com/b/ie/ ○ http://peter.sh/ ● Documentation ○ https://developer.mozilla.org/en-US/ ● Other ○ http://developer.apple. com/library/safari/#documentation/AudioVideo/Conceptual/Using_HT ML5_Audio_Video/Device-SpecificConsiderations/Device- SpecificConsiderations.html
  • 112. Questions? can haz question? By cloudzilla http://www.flickr.com/photos/cloudzilla/378829651/ schechter@google.com mattward@google.com