Extension:TimedMediaHandler/ogv.js

TimedMediaHandler now includes a copy of ogv.js, a JavaScript compatibility shim which provides Ogg (and eventually, WebM) playback through JavaScript allowing audio/video playback for free-codec-only sites such as Wikipedia on Safari, Internet Explorer, and Microsoft Edge browsers.

Compatibility
IE and Edge on Windows x86 and x64 (not on ARM Windows RT or Windows Phone / Windows Mobile) can make use of native WebM support by installing WebM Media Framework components; if this is present it will take priority over ogv.js. Note this does not include ogg audio support; ogv.js will still be used for audio files.

32-bit mobile devices and some older Windows machines may be too slow to play 360p videos via ogv.js; usually a slow browser will be detected and a lower-resolution 160p15 video will be picked instead.

Note that Chrome for iOS is too slow to run ogv.js at all because it uses an old browser API that disables the JavaScript JIT compiler. It will automatically disable itself in this case; if Chrome updates to newer APIs on iOS 8+ in future it should start working automatically as well.

Safari for iOS 6.1 and 7 have some of the APIs necessary but are very buggy, and ogv.js will automatically disable itself there as well.

Limitations
Current limitations:
 * TMH's subtitles are disabled (should be fixed soon)
 * no volume control (should be fixed soon)

Source selection
Note that new Ogg Theora transcodes are being produced at double the bitrate of WebM VP8 transcodes to match visual quality; this means one resolution-step back should be selected versus WebM to use the same amount of network bandwidth (360p Ogg vs 480p WebM, etc).

Safari on a fast Mac can reach up to 1080p playback of Ogg Theora/Vorbis videos, but by default a more modest 360p transcode is used for widest compatibility.

A JavaScript benchmark is used to detect relatively slow machines and either disable ogv.js entirely (if very slow) or default to the lowest-resolution video (160p15). 160p15 videos play back -- barely -- on 32-bit iOS devices as well; 360p plays back comfortably on 64-bit iOS devices.

In the future, automatic switching of sources based on available bandwidth and CPU may be used to provide smoothest possible playback without manual selection, but this requires additional development.