For some years we have included the ogv.js codec shim in TimedMediaHandler to play WebM and Ogg media on versions of IE, Edge, and Safari that didn't support them natively. Over time platforms have improved support for WebM, and we are now deploying alternate transcodes for older iOS devices using Motion-JPEG (hopefully to be replaced with MPEG-4 Visual) and MP3.
In short, there's no longer a need to include ogv.js in TimedMediaHandler: all current browsers can play our WebM videos and MP3 audios, and older iOS devices can be handled with the fallback codec well enough.
ogv.js is only maintained by me (bvibber) and nobody else code reviews it, so getting this library with its JS frontend and Wasm blob backends out of the production pipeline is a simplification for our security surface.
Steps:
- Stub out public references to ogv.js setup in the JS classes in case anything's trying to launch a compatible startup
- Remove all active references to ogv.js and the checks for native VP9 support in JS frontend
- Remove ogv from the foreign-resources.yml dev deps
- Remove the ogv.js dist
- Profit!
Expected behavior changes from this patch:
- iOS 17.3 and earlier, and a few older desktop setups, will let the <video> element error out instead of replacing it with an ogv.js shim player if there is not a compatible transcode present.
- Plus: smaller security surface
- Plus: less likely to encounter weird unexpected errors from ogv.js or the interface with video.js!
- Minus: a few attempts to play a video on older devices will fail where a transcoded .mov file didn't get generated. Note we do not have any useful metrics for video playback except some old attempts to pull loading data from the hit logs and have no real idea if this will be impactful. Best way to follow this up is to poke at the transcode infrastructure.
Rough QA plan
Take a set of test videos if possible with .webm, .ogv and .mpg sources to exercise all code paths. Note that WebM sources may be VP8, VP9, or AV1 depending on the file and tool. Currently we're pushing VP9 in WebM transcodes.
_Note_ iOS 17.4 added WebM playback support to mobile Safari, but individual iOS 17 devices may or may not have a VP9 codec in the SoC. If someone happens to have such a device for testing, it should play back WebM containing VP8 -- such as the .360p.webm transcode or some original uploads -- but not VP9 or AV1. iOS 18-compatible devices all have a VP9 codec but do not all have an AV1 codec. AV1 support on iOS is currently untested by me --bv
- Most browsers will see no change when all transcodes are available:
- (web) iOS 11-17.3 plays .mov transcode
- (app) iOS 11-17.3 plays .mov transcode
- (web) iOS 18-26 plays .webm transcode
- (app) iOS 18-26 plays .webm transcode
- Desktop Safari plays .webm transcode
- Firefox plays .webm transcode
- Chrome plays .webm transcode
- On videos with .webm transcode but missing .mov transcodes, iOS pre-17.4 will error out instead of trying to load ogv.js:
- (web) iOS 11-17.3 will error out <- new behavior
- (app) iOS 11-17.3 will error out <- new behavior
- (web) iOS 18-26 plays .webm transcode
- (app) iOS 18-26 plays .webm transcode
- Desktop Safari plays .webm transcode
- Firefox plays .webm transcode
- Chrome plays .webm transcode
- Videos with neither .webm transcode nor .mov transcode should will change iOS pre-17.4 to erroring out instead of trying to load ogv.js
- (web) iOS 11-17.3 will error out <- new behavior
- (app) iOS 11-17.3 will error out <- new behavior
- (web) iOS 18-26 plays .webm VP8/VP9 source, or errors out
- (app) iOS 18-26 plays .webm VP8/VP9 source, or errors out
- Desktop Safari plays .webm VP8/VP9 or possibly MPEG-1/2 .mpg source, or errors out
- Firefox plays .webm VP8/VP9/AV1 or .ogv source, or errors out
- Chrome plays .webm VP8/VP9/AV1 source, or errors out