Mobile Meow at Mobilism

Greg Schechter
Greg SchechterWeb Warrior at Facebook
Mobile Meow
      Bring YouTube to the Mobile Web




By YouTube's Greg Schechter and Eugene Goldin
Greg Schechter           Eugene Goldin
The Web Warrior          Code Crusader




schechter@google.com   eugenegoldin@google.com
Video
Video
Mobile Meow at Mobilism
Mobile Meow at Mobilism
A Brief History
Video
Flash
<video>
Video
Playback Stats
Flash   Native   <video>
Flash
Flash
         ==   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
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>
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>
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
Custom Controls
● Preserve your brand
● Unified experience across platforms and
  browsers
Custom Controls




  Lets get some custom controls
Custom Controls
● 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
●   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
Custom Controls Pro Tips
●   Don't trigger content with hover
●   Fullscreen
    ○ The browsing context is always fullscreen so fake it
Fullscreen
requestFullScreen
requestFullScreen
● Desktop Only
  ○ Firefox, Safari, and Chrome
  ○ Vendor Prefixed
What about Mobile?
Isn't it already fullscreen?
Yes (sort of)
Mobile Fullscreen

●   Open New Tab
●   webkitEnterFullscreen
      ■ Webkit only
      ■ Video element only
      ■ metadata must be loaded
Mobile Fullscreen

●   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; }
autoplay




           <video autoplay>
Mobile Meow at Mobilism
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()">
Mobile Meow at Mobilism
Mobile Meow at Mobilism
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);
}
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>
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);
}
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




   for more information check out http://bitbeam.org/
The Future




 Cats in Space by WF&TD
Mobile Meow at Mobilism
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>
Camera Access with
  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
eugenegoldin@google.com
1 of 94

Recommended

Web DU Mobile Meow by
Web DU Mobile MeowWeb DU Mobile Meow
Web DU Mobile MeowGreg Schechter
858 views112 slides
JS Days Mobile Meow by
JS Days Mobile MeowJS Days Mobile Meow
JS Days Mobile MeowGreg Schechter
16.9K views97 slides
HTML5, Flash, and the Battle For Faster Cat Videos by
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 VideosGreg Schechter
9.5K views69 slides
JS Days HTML5 Flash and the Battle for Faster Cat Videos by
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 VideosGreg Schechter
1.7K views76 slides
Movies On Custom Web Sites 2 by
Movies On Custom Web Sites 2Movies On Custom Web Sites 2
Movies On Custom Web Sites 2CO767
405 views10 slides
FUGN - Stage Video and Molehill by
FUGN - Stage Video and MolehillFUGN - Stage Video and Molehill
FUGN - Stage Video and MolehillAnne Kathrine Petterøe
473 views8 slides

More Related Content

What's hot

HTML+CSS Resources by
HTML+CSS ResourcesHTML+CSS Resources
HTML+CSS ResourcesRamses Cabello
644 views38 slides
Play with html games by
Play with html gamesPlay with html games
Play with html gamesHuan Du
858 views24 slides
Multimedia Project Choices by
Multimedia Project ChoicesMultimedia Project Choices
Multimedia Project ChoicesKatie Morrow
27K views22 slides
Get Seen: Web Video Word Camp Boston by
Get Seen: Web Video Word Camp BostonGet Seen: Web Video Word Camp Boston
Get Seen: Web Video Word Camp BostonSteve Garfield
1.8K views88 slides
YouTube for Developers by
YouTube for DevelopersYouTube for Developers
YouTube for Developerscityofroundrock
1.6K views36 slides
Building Video Applications with YouTube APIs by
Building Video Applications with YouTube APIsBuilding Video Applications with YouTube APIs
Building Video Applications with YouTube APIsJarek Wilkiewicz
12K views43 slides

What's hot(16)

Play with html games by Huan Du
Play with html gamesPlay with html games
Play with html games
Huan Du858 views
Multimedia Project Choices by Katie Morrow
Multimedia Project ChoicesMultimedia Project Choices
Multimedia Project Choices
Katie Morrow27K views
Get Seen: Web Video Word Camp Boston by Steve Garfield
Get Seen: Web Video Word Camp BostonGet Seen: Web Video Word Camp Boston
Get Seen: Web Video Word Camp Boston
Steve Garfield1.8K views
Building Video Applications with YouTube APIs by Jarek Wilkiewicz
Building Video Applications with YouTube APIsBuilding Video Applications with YouTube APIs
Building Video Applications with YouTube APIs
Jarek Wilkiewicz12K views
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autón... by Jarek Wilkiewicz
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 Wilkiewicz1.4K views
Videogram - Building a product with Sencha Touch by Alexander Wilhelm
Videogram - Building a product with Sencha TouchVideogram - Building a product with Sencha Touch
Videogram - Building a product with Sencha Touch
Alexander Wilhelm1.2K views
Evaluation question 4 by tempzstah
Evaluation question 4Evaluation question 4
Evaluation question 4
tempzstah100 views
Appa by Kaoem Oi
AppaAppa
Appa
Kaoem Oi594 views
Wordpress customisation for travel blogs by GetawayMagazine
Wordpress customisation for travel blogs Wordpress customisation for travel blogs
Wordpress customisation for travel blogs
GetawayMagazine835 views
C_purvis_assign_3 by Sissitech
C_purvis_assign_3C_purvis_assign_3
C_purvis_assign_3
Sissitech169 views

Similar to Mobile Meow at Mobilism

GDD HTML5, Flash, and the Battle for Faster Cat Videos by
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 VideosGreg Schechter
14.2K views75 slides
HTML5 multimedia - where we are, where we're going by
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 goingbrucelawson
3.1K views64 slides
Multimedia on the web - HTML5 video and audio by
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioChristian Heilmann
4.3K views85 slides
Html5video by
Html5videoHtml5video
Html5videobenwilkins
659 views30 slides
HTML5 Multimedia: where we are, where we're going by
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 goingbrucelawson
2.8K views39 slides
Warsawclouddays video by
Warsawclouddays videoWarsawclouddays video
Warsawclouddays videoDoug Sillars
147 views91 slides

Similar to Mobile Meow at Mobilism(20)

GDD HTML5, Flash, and the Battle for Faster Cat Videos by Greg Schechter
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 Schechter14.2K views
HTML5 multimedia - where we are, where we're going by brucelawson
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
brucelawson3.1K views
Multimedia on the web - HTML5 video and audio by Christian Heilmann
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
Christian Heilmann4.3K views
HTML5 Multimedia: where we are, where we're going by brucelawson
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
brucelawson2.8K views
Warsawclouddays video by Doug Sillars
Warsawclouddays videoWarsawclouddays video
Warsawclouddays video
Doug Sillars147 views
Using the Presentation API and external screens on Android by Xavier Hallade
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on Android
Xavier Hallade21.4K views
Html5 browser api_support by 상길 안
Html5 browser api_supportHtml5 browser api_support
Html5 browser api_support
상길 안992 views
3 2-1-Action! Screencasting Tools by Diana Benner
3 2-1-Action! Screencasting Tools3 2-1-Action! Screencasting Tools
3 2-1-Action! Screencasting Tools
Diana Benner6K views
Integrating web-based videos in your PDFs (with FrameMaker-to Acrobat TimeSav... by Shlomo Perets
Integrating web-based videos in your PDFs (with FrameMaker-to Acrobat TimeSav...Integrating web-based videos in your PDFs (with FrameMaker-to Acrobat TimeSav...
Integrating web-based videos in your PDFs (with FrameMaker-to Acrobat TimeSav...
Shlomo Perets694 views
Video Killed My Data Plan: Helsinki by Doug Sillars
Video Killed My Data Plan: HelsinkiVideo Killed My Data Plan: Helsinki
Video Killed My Data Plan: Helsinki
Doug Sillars184 views

Recently uploaded

Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...ShapeBlue
48 views17 slides
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
77 views29 slides
State of the Union - Rohit Yadav - Apache CloudStack by
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStackShapeBlue
145 views53 slides
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
58 views21 slides
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlueShapeBlue
50 views23 slides
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueShapeBlue
46 views15 slides

Recently uploaded(20)

Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue48 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc77 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue145 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue50 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue46 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue88 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue56 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue131 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue111 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely56 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10369 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi141 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue83 views

Mobile Meow at Mobilism

  • 1. Mobile Meow Bring YouTube to the Mobile Web By YouTube's Greg Schechter and Eugene Goldin
  • 2. Greg Schechter Eugene Goldin The Web Warrior Code Crusader schechter@google.com eugenegoldin@google.com
  • 11. Video
  • 13. Flash Native <video>
  • 14. Flash Flash == Flash
  • 15. Flash Flash
  • 17. 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
  • 19. The Different Browsers Safari Android
  • 20. The Different Browsers Opera Safari Android Chrome Silk Mini Firefox Opera IE
  • 21. The Different Browsers Opera Safari Android Chrome Silk Mini Firefox Opera IE AMP LE S
  • 22. By brownpau at http://www.flickr.com/photos/brownpau/533267369/
  • 23. How do we start <video>
  • 24. The Source <video src="funny_cat_video">
  • 26. 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
  • 27. The Source <video> <source src="funny_cat_video.mp4"> <source src="funny_cat_video.webm"> </video>
  • 28. Power
  • 29. Power Consumption: H264 vs WebM **fullscreen flash **windowed flash Research done by Yossi Oren For more information visit http://iss.oy.ne.ro/
  • 30. Stick it in a page
  • 31. 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
  • 32. Give it a poster and click it
  • 33. 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
  • 34. 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
  • 35. 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
  • 36. Controls <video controls>
  • 37. 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
  • 38. Custom Controls ● Preserve your brand ● Unified experience across platforms and browsers
  • 39. Custom Controls Lets get some custom controls
  • 40. Custom Controls ● Allows us to expand the set of controls and add our own ○ annotations ○ playlist ○ captions ○ more
  • 41. 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
  • 42. 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
  • 43. Custom Controls Pro Tips ● Don't trigger content with hover ● Fullscreen ○ The browsing context is always fullscreen so fake it
  • 46. requestFullScreen ● Desktop Only ○ Firefox, Safari, and Chrome ○ Vendor Prefixed
  • 48. Isn't it already fullscreen?
  • 50. Mobile Fullscreen ● Open New Tab ● webkitEnterFullscreen ■ Webkit only ■ Video element only ■ metadata must be loaded
  • 51. Mobile Fullscreen ● 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
  • 52. @viewport { width: device-width; }
  • 53. autoplay <video autoplay>
  • 55. 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.
  • 57. Autoplay Chrome Safari Firefox Opera IE Android Attribute Scripted Buggy
  • 59. autoplay <video onclick="this.play()">
  • 62. 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(); }
  • 63. 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); }
  • 66. Embeds <script> ○ We need our content to be sandboxed ○ More than just a video tag
  • 67. Embeds <script> ○ We need our content to be sandboxed ○ More than just a video tag <object>
  • 68. 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
  • 70. Embeds <iframe> ○ Allows our content to be sandboxed ○ JavaScript API communication
  • 71. Embeds <iframe type="text/html" width="640" height="385" frameborder="0" src="http://www.youtube.com/embed/VIDEO_ID" allowfullscreen> </iframe>
  • 72. 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>
  • 73. Embeds Pro Tips: html { /** Hack to fix iPhone resizing. */ overflow: hidden; }
  • 74. 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); }
  • 76. Testing: The Old Fashioned Way ● Device lab ○ accurate ○ costly ○ space inefficient ○ boring
  • 77. 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
  • 78. 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
  • 79. Testing: Automation ● Selenium! ○ use with simulated or real devices ○ not boring
  • 80. 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
  • 81. Testing: Automation ● Chrome, Opera ○ Driver APIs built-in ○ Remote debugging ● FFMobile ○ No webdriver APIs
  • 82. Testing: Automation Strategy ● Test API methods in mobile context first ○ cheap ○ can approximate video playback by video. currentTime
  • 83. Testing: Automation Strategy ● More sophisticated tests to follow ○ screenreader ● Screen cap processing ○ check for distortion ○ playback accuracy
  • 84. Testing: Automation Strategy ● Screen cap processing
  • 85. Testing: Hardware Assistance for more information check out http://bitbeam.org/
  • 86. The Future Cats in Space by WF&TD
  • 88. Or
  • 91. Track <video> <track src="cats_meow" kind="subtitles"> </video>
  • 92. Camera Access with getUserMedia
  • 93. 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
  • 94. Questions? can haz question? By cloudzilla http://www.flickr.com/photos/cloudzilla/378829651/ schechter@google.com eugenegoldin@google.com