Audio & Video on the Web - It's all happening!
Audio & Video on the Web
It's all happening!
Web Native Audio & Video - The Stats
- ◼◼◼◼◼◼ Supports
- ◼ Mixed
- ◼ Does Not Support
source: statcounter.com
Simple Example ( Markup )
<video controls >
<source src="elvis.mp4" type="video/mp4">
<source src="elvis.webm" type="video/webm">
</video>
But what about IE8 ??!
<video controls >
<source src="elvis.mp4" type="video/mp4">
<source src="elvis.webm" type="video/webm">
<!-- add your fallback solution here -->
</video>
Simple Example ( JavaScript )
var audio = document.createElement('audio');
audio.setAttribute("src","elvis.mp3");
Establishing Support
canPlayType("audio/ogg")
Which reminds me ...
You may have to touch the server.
Video MIME Types / Content Types
Add .htaccess or similar
- AddType video/ogg .ogv
- AddType video/mp4 .mp4
- AddType video/webm .webm
- AddType video/mp4 .m4v
Audio MIME Types / Content Types
Add .htaccess or similar
- AddType audio/mpeg .mp3
- AddType audio/mp4 .m4a
- AddType audio/ogg .ogg
- AddType audio/wav .wav
OMG how many formats are there?
almost ...
WebM Support
MP4 Support
Audio Codec Support (MP3, OGG)
Almost identical situation as video.
In general, Mozilla deciding to support whatever the underlying OS supports, Opera moving to Blink (will likely support the same codecs as Chrome).
Libraries and other Fallbacks
You can use jPlayer and other libraries to help you deal with browser inconsistencies.
They can allow you to :
- Achieve a consistent player in all browsers
- Fallback to Flash for unsupported codecs
Video - Going Deeper
You can use Canvas to manipulate video.
Canvas allows you access to the pixel data of each frame.
Essentially you can grab each frame, manipulate it and re-draw it.
Video - Seriously.js
Seriously.js is a real-time, node-based video compositor for the web. Inspired by professional software such as After Effects and Nuke, Seriously.js renders high-quality video effects, but allows them to be dynamic and interactive.
Audio - Going Deeper
You can create a WAV file on the fly by supplying Base 64 encoded data directly to the source.
Speak.js is a great example of what you can do with this approach.
Audio - Going DeeperAdvanced Audio APIs
In the beginning ...
- Audio Data API (Firefox 4+)
- Media Stream API
- Web Audio API (WebKit)
Audio - Going DeeperAdvanced Audio Libraries
There Can Be Only One!
And the Winner is The Web Audio API
The Web Audio API is a high-level JavaScript API for processing and synthesizing audio in web applications.
It takes a node based approach, each node performs an audio function and connected together to define the overall audio rendering.
It can be as simple as this ...
or as complex as this ...
Web Audio API Support
Web Audio API - Demo 1Three Audio
Web Audio API - Demo 2Perceptive Media
Audio and Video - Going DeeperTranscripts break audio out of its black box
And make it ...
- Navigable
- Searchable
- Shareable
Audio and Video - Going Deeper
Hyperaudio
Audio and Video - Going Deeper
Technology
- Popcorn.js ↬
- jPlayer ↬
- jQuery ↬ / Zepto.js (soon)↬
Popcorn.js
- ✔ Light
- ✔ Modular
- ✔ Time based events built in
- ✔ Active community
- ✔ Library independent
- ✔ IE8+ compatible to an extent
jPlayer
- ✔ Light
- ✔ Modular
- ✔ Skinnable
- ✔ Active community
- ✔ Flash fallback built in
- ✔ IE6+ compatible
Popcorn.js + jPlayer
A winning combo?
- support IE8 using a custom player
- use one audio/video format
- masks browser differences
Audio and Video - Going Deeper
Hyperaudio Pad
The elephant in the room
How do we create word-aligned timed transcripts?
- Use third-party services
- By hand
- Both
Third party transcription services (paid)
- $ 3PlayMedia ↬
- $ Koemei ↬
- $ DotSub ↬
- $ Dragon Speech Engine ↬
- $ PlyMedia ↬
- $ Ramp ↬
- $ SpeakerText ↬
- $ VoiceBase (freemium) ↬
Third party transcription services (free)
- ☮ Amara (formerly Universal Subtitles) ↬
- ☮ CMU Sphinx ↬
- ☮ Shout Toolkit ↬
- ☮ Something that hasn't been made yet!
What's around the corner?
Lots of new media related web technology:
- WebRTC
- Web Speech API
- Media Fragments
WebRTC
A technology to facilitate P2P comms.
WebRTC
- Designed for browser-to-browser comms
- Handles live streaming of audio and video
- Facilitates the streaming of any type of data
Useful for ..
- Voice Calling / Video Chat
- P2P File sharing
- Games
WebRTC - MediaStream Demo
Opus Audio Codec
- Mandatory part of the WebRTC standard
- Support for both constant bit-rate (CBR) and variable bit-rate (VBR)
- Audio bandwidth from narrowband to fullband
- Dynamically adjustable bitrate, audio bandwidth, and frame size
- Good loss robustness and packet loss concealment (PLC)
ORBX.js, a downloadable HD codec
- Written in JS and WebGL
- No encumbered-format
- IP-blind runtimes
- 25% better compression than H.264
- Adaptive bit-rate while streaming
and (soon) floating point coding, better color depth, better intra-frame coding, a more parallelizable design
Audio Codecs in JavaScript
- JSMad (MP3)
- ALAC.js
- FLAC.js
- AAC.js
DRM and Watermarking
*Digital watermarking aims record and expose the origin of the video.
Mobile is Getting Better
But watch out for older mobile browsers.
- Cannot autoplay
- May not be able to affect volume
- May not be able to play simultaneous audio
- Will most likely not preload
Live Streaming is Possible
- Pausing streams will cause audio to buffer. Reconnect to keep live.
- Streams can break, and the browser generally recovers, but detection and reconnection is faster.
- Only Flash can handle RTMP streams.
- Chrome does not like the ICY response headers (often used by SHOUTcast). AAC will break.
Media Fragments
The three main parts are :
- Spatial Dimension - eg #xywh=160,120,320,240
- Temporal Dimension - eg #t=9,20
- Track - eg #track='audio'
Web Speech API
- An API for speech based input
- Currently Chrome only
- Server based