What the browser can play, from Media Capabilities and canPlayType.
A configuration is a map of the keys of MediaDecodingConfiguration, e.g.
{:type :file :audio {:content-type "audio/mpeg" :bitrate 128000}}
On its own, Media Capabilities refuses some of the commonest files:
So where it says no or rejects a configuration, the answer also has canPlayType's, and playable? accepts either.
What the browser can play, from Media Capabilities and canPlayType.
A configuration is a map of the keys of MediaDecodingConfiguration, e.g.
{:type :file :audio {:content-type "audio/mpeg" :bitrate 128000}}
On its own, Media Capabilities refuses some of the commonest files:
- WebKit says it can't play MP3, and Firefox rejects the configuration.
- Every engine refuses audio/mp4 without codecs, which is how most
podcast feeds give AAC.
- Every engine rejects a video without its width, height, bitrate and
frame rate.
So where it says no or rejects a configuration, the answer also has
canPlayType's, and playable? accepts either.Conversion between Clojure maps with kebab-case keys and the JavaScript objects of the specs' dictionaries, e.g. {:seek-time 12} and {seekTime: 12}.
A single rule converts each name both ways, so a member that the library doesn't know yet passes through too. The rule works because no member name in these specs has two capitals in a row or a digit.
Conversion between Clojure maps with kebab-case keys and the JavaScript
objects of the specs' dictionaries, e.g. {:seek-time 12} and
{seekTime: 12}.
A single rule converts each name both ways, so a member that the
library doesn't know yet passes through too. The rule works because no
member name in these specs has two capitals in a row or a digit.The page's Media Session, which puts what plays on the lock screen and in the notifications, and lets the headphone buttons control it.
The functions that touch the browser do nothing where it has no Media Session, e.g. in Node or the Android WebView. Each takes these opts:
The keys of the maps are the members of the spec's dictionaries in kebab-case, and the values of its enums are keywords, e.g. {:action :seekto :seek-time 754.2}. A player whose buttons just play, pause and seek its media element needs three calls:
(def detach!
(attach! audio))
(metadata! {:title "Blue in Green" :artist "Miles Davis"})
(actions! (element-actions audio {:seekbackward 10
:seekforward 10}))
The page's Media Session, which puts what plays on the lock screen and
in the notifications, and lets the headphone buttons control it.
The functions that touch the browser do nothing where it has no Media
Session, e.g. in Node or the Android WebView. Each takes these opts:
- :session, the MediaSession to set instead of the page's, e.g. a
stand-in in a test, or nil for none
The keys of the maps are the members of the spec's dictionaries in
kebab-case, and the values of its enums are keywords, e.g. {:action
:seekto :seek-time 754.2}. A player whose buttons just play, pause and
seek its media element needs three calls:
(def detach!
(attach! audio))
(metadata! {:title "Blue in Green" :artist "Miles Davis"})
(actions! (element-actions audio {:seekbackward 10
:seekforward 10}))cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |