SlideShare a Scribd company logo
Perfecting <video> 
playback on the web 
Janessa Det (@jandet)! 
Web Lead at 
https://vine.co/v/OmQZQAjhOrj 
Vine by Reid Wiseman
✨ let’s build Vine! ✨ 
videos that loop 
(encoding: h264 mp4) 
https://twitter.com/cher/status/398735343207186433 
@jandet
piece of cake  
<video src=“https://happyvideourl.mp4”></video> 
@jandet
cross-browser support 
FF mp4 support! 
transcoding?! 
mediasource.js! 
flash 
https://vine.co/v/On1YDQKJmMw @jandet
crash those browsers 
too many video players 
crash Chrome! 
> 1 video player w/ same 
src freezes up video 
player b/c of cache 
locking! 
https://vine.co/v/O76KLlqh7Kd @jandet
mobile web 
iOS fullscreens video! 
autoplay difficult! 
HTTP Range Header! 
initializing too many 
video players at once 
caused all of them to fail! 
ppl have data plans 
https://vine.co/v/OhqUT3w7A3z @jandet
preloading 
video files are big! 
how do we make the 
scrolling playback 
experience smooth and 
seamless! 
(w/o firing off a gajillion 
requests at once) 
https://vine.co/v/OhqUbwIKDbu @jandet
loops 
Vine is the best way to see and share life in motion. Create 
short, beautiful, looping videos! 
in a simple and fun way for your friends and family to see. 
@jandet
let's take a look 
@jandet
https://vine.co/v/MYA1WJl1Ymp 
@jandet
what is going on here?! 
video 
audio! 
0.05sec 0.05sec 
playback behavior 
@jandet
seamless loops 
<video> 
<video> 
toggle! 
opacity! 
at specific! 
timestamp 
video 
audio! 
video 
audio! 
(but browsers…) 
@jandet
 the answer  
Media Source Extensions 
 
@jandet
video 
audio! 
video 
audio! 
video 
audio! 
source buffer 
video 
audio! 
@jandet
transcoding to MPEG-Dash <— streaming format! 
Initialize MediaSource 
get ! 
the raw file…! 
! 
! 
client.open('GET', file, true); 
! 
client.responseType = 'arraybuffer'; 
client.! 
send(); 
! 
! 
! 
! 
! 
client.onload…! 
! 
var mediaSource = new MediaSource(); 
player.setSrc(window.URL.createObjectURL(mediaSource)); 
! 
var buffer = new Uint8Array(client.response); 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
mediaSource.onsourceopen…! 
! 
var sourceBuffer = mediaSource.addSourceBuffer( 
@jandet 
'video/mp4; codecs="avc1.4d401e, mp4a.40.2”’ 
);
source buffer 
video 
timestampOffset 
audio! 
appendWindowStart 
appendWindowEnd 
video 
appendWindowEnd 
audio! 
timestampOffset 
appendWindowStart 
var appendTime = sourceBuffer.buffered.length > 0 ? 
…ad infinitum 
sourceBuffer.buffered.end(sourceBuffer.buffered.length - 1) : CUT_OFF; 
! 
sourceBuffer.timestampOffset = appendTime - CUT_OFF; 
! 
sourceBuffer.appendWindowStart = appendTime; 
sourceBuffer.appendWindowEnd = appendTime + duration - 2 * CUT_OFF; 
! 
sourceBuffer.appendBuffer(buffer); 
@jandet
 additional challenges  
copy ad infintum?! 
MPEG-Dash files are 
larger! 
we have ONE player 
element! 
UA sniffing? nevarr 
https://vine.co/v/OJuPB2ZbJ1V @jandet
special thanks 
Thomas Rix! 
Mike Kaplinskiy! 
Felix Fung! 
Chrome video team 
@jandet 
https://vine.co/v/Ml0BxhrtwVA 
https://vine.co/v/O1U0nVB6UOX 
https://vine.co/v/On1bum1O679

More Related Content

PDF
Rise of the Nodebots
PDF
Forbes
TXT
PDF
2017年12月 linux kernel
PPTX
Video and audio
PPTX
Online Samurai
PDF
Kharkivjs javascript debugging. know your enemy
PDF
Java 9 – The Ultimate Feature List
Rise of the Nodebots
Forbes
2017年12月 linux kernel
Video and audio
Online Samurai
Kharkivjs javascript debugging. know your enemy
Java 9 – The Ultimate Feature List

Similar to Perfecting video playback on the web (20)

PDF
Craft 2019 - “The Upside Down” Of The Web - Video technologies
PDF
Responsive Videos, mehr oder weniger
PDF
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
PDF
HTML5 APIs - The New Frontier
KEY
HTML5 Video Player - HTML5 Dev Conf 2012
PDF
Multimedia on the web - HTML5 video and audio
PDF
Mobile Web Video
PDF
HTML5 Multimedia: where we are, where we're going
PDF
HTML5 multimedia - where we are, where we're going
PDF
HTML5 APIs - The New Frontier - ConFoo 2011
PDF
HTML5 APIs - The New Frontier - Jfokus 2011
KEY
Web Apps
PPTX
Building a Video Encoding Pipeline at The New York Times
PDF
HTML5 multimedia - browser-native video and audio - DevUp HTML5 / Barcelona /...
PDF
Html5 Open Video Tutorial
PPTX
HTML5 Multimedia Support
PDF
StoryCode Immersion #5 - Popcorn.JS Deep Dive
KEY
Upgrade to HTML5 Video
PDF
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
PDF
HTML5 Multimedia Accessibility
Craft 2019 - “The Upside Down” Of The Web - Video technologies
Responsive Videos, mehr oder weniger
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
HTML5 APIs - The New Frontier
HTML5 Video Player - HTML5 Dev Conf 2012
Multimedia on the web - HTML5 video and audio
Mobile Web Video
HTML5 Multimedia: where we are, where we're going
HTML5 multimedia - where we are, where we're going
HTML5 APIs - The New Frontier - ConFoo 2011
HTML5 APIs - The New Frontier - Jfokus 2011
Web Apps
Building a Video Encoding Pipeline at The New York Times
HTML5 multimedia - browser-native video and audio - DevUp HTML5 / Barcelona /...
Html5 Open Video Tutorial
HTML5 Multimedia Support
StoryCode Immersion #5 - Popcorn.JS Deep Dive
Upgrade to HTML5 Video
HTML5 multimedia - browser-native video, audio and canvas - meet.js Summit / ...
HTML5 Multimedia Accessibility
Ad

Recently uploaded (20)

PDF
Five Habits of High-Impact Board Members
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
STKI Israel Market Study 2025 version august
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
CloudStack 4.21: First Look Webinar slides
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
Hybrid model detection and classification of lung cancer
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Tartificialntelligence_presentation.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPT
Geologic Time for studying geology for geologist
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPT
What is a Computer? Input Devices /output devices
DOCX
search engine optimization ppt fir known well about this
Five Habits of High-Impact Board Members
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
STKI Israel Market Study 2025 version august
Getting started with AI Agents and Multi-Agent Systems
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
CloudStack 4.21: First Look Webinar slides
O2C Customer Invoices to Receipt V15A.pptx
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Chapter 5: Probability Theory and Statistics
Web Crawler for Trend Tracking Gen Z Insights.pptx
Hybrid model detection and classification of lung cancer
Getting Started with Data Integration: FME Form 101
Tartificialntelligence_presentation.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Final SEM Unit 1 for mit wpu at pune .pptx
Geologic Time for studying geology for geologist
sustainability-14-14877-v2.pddhzftheheeeee
What is a Computer? Input Devices /output devices
search engine optimization ppt fir known well about this
Ad

Perfecting video playback on the web

  • 1. Perfecting <video> playback on the web Janessa Det (@jandet)! Web Lead at https://vine.co/v/OmQZQAjhOrj Vine by Reid Wiseman
  • 2. ✨ let’s build Vine! ✨ videos that loop (encoding: h264 mp4) https://twitter.com/cher/status/398735343207186433 @jandet
  • 3. piece of cake  <video src=“https://happyvideourl.mp4”></video> @jandet
  • 4. cross-browser support FF mp4 support! transcoding?! mediasource.js! flash https://vine.co/v/On1YDQKJmMw @jandet
  • 5. crash those browsers too many video players crash Chrome! > 1 video player w/ same src freezes up video player b/c of cache locking! https://vine.co/v/O76KLlqh7Kd @jandet
  • 6. mobile web iOS fullscreens video! autoplay difficult! HTTP Range Header! initializing too many video players at once caused all of them to fail! ppl have data plans https://vine.co/v/OhqUT3w7A3z @jandet
  • 7. preloading video files are big! how do we make the scrolling playback experience smooth and seamless! (w/o firing off a gajillion requests at once) https://vine.co/v/OhqUbwIKDbu @jandet
  • 8. loops Vine is the best way to see and share life in motion. Create short, beautiful, looping videos! in a simple and fun way for your friends and family to see. @jandet
  • 9. let's take a look @jandet
  • 11. what is going on here?! video audio! 0.05sec 0.05sec playback behavior @jandet
  • 12. seamless loops <video> <video> toggle! opacity! at specific! timestamp video audio! video audio! (but browsers…) @jandet
  • 13.  the answer  Media Source Extensions  @jandet
  • 14. video audio! video audio! video audio! source buffer video audio! @jandet
  • 15. transcoding to MPEG-Dash <— streaming format! Initialize MediaSource get ! the raw file…! ! ! client.open('GET', file, true); ! client.responseType = 'arraybuffer'; client.! send(); ! ! ! ! ! client.onload…! ! var mediaSource = new MediaSource(); player.setSrc(window.URL.createObjectURL(mediaSource)); ! var buffer = new Uint8Array(client.response); ! ! ! ! ! ! ! ! ! ! ! ! ! mediaSource.onsourceopen…! ! var sourceBuffer = mediaSource.addSourceBuffer( @jandet 'video/mp4; codecs="avc1.4d401e, mp4a.40.2”’ );
  • 16. source buffer video timestampOffset audio! appendWindowStart appendWindowEnd video appendWindowEnd audio! timestampOffset appendWindowStart var appendTime = sourceBuffer.buffered.length > 0 ? …ad infinitum sourceBuffer.buffered.end(sourceBuffer.buffered.length - 1) : CUT_OFF; ! sourceBuffer.timestampOffset = appendTime - CUT_OFF; ! sourceBuffer.appendWindowStart = appendTime; sourceBuffer.appendWindowEnd = appendTime + duration - 2 * CUT_OFF; ! sourceBuffer.appendBuffer(buffer); @jandet
  • 17.  additional challenges  copy ad infintum?! MPEG-Dash files are larger! we have ONE player element! UA sniffing? nevarr https://vine.co/v/OJuPB2ZbJ1V @jandet
  • 18. special thanks Thomas Rix! Mike Kaplinskiy! Felix Fung! Chrome video team @jandet https://vine.co/v/Ml0BxhrtwVA https://vine.co/v/O1U0nVB6UOX https://vine.co/v/On1bum1O679