Hacker News new | ask | show | jobs
by vim_wannabe 3193 days ago
Out of interest: why is a JS player required for video? Is it just to make more browsers compatible, the video more hackable for annotations/ads, or is there something else?

Edit: And a related question: would Cloudflare Stream work without the JS player using a regular video-tag?

4 comments

More reliable & easier to use API, extendable support for other codecs/streams, customizable UI, customizable playback, plugin ecosystem, tracking
> Edit: And a related question: would Cloudflare Stream work without the JS player using a regular video-tag?

Depends on the browser. This is the primary reason why people actually use a JS player that wraps around video tag. The other reasons are to accommodate business logic (i. e. overlay on top of the video, pre-roll, thumbnail, etc.) and better UX.

The latter reason I get, but looking at video-tag compatibility on https://caniuse.com/#feat=video shouldn't just offering h264 as the baseline and the higher resolution formats in source-tags (https://caniuse.com/#search=source) cover almost any browser?
Yes but that is just the baseline. You want HEVC / VP9 for browsers which can play that, you want 5.1 audio for home theaters, you want adaptive streaming when the support is available, and so on. You don't want just the minimum for _all_ of your clients. You want some code that tailors the experience based on client capability. That's what the JS player handles.
Adaptive streaming sure, but can you not handle the different audio combinations using source-tags? And HEVC/VP9 with h264 fallback I would imagine is the primary use case they (WHATWG?) were thinking of supporting when creating the source tag.
Technically you could have a single URL that returns any manifest based on user-agent or whatever player info is available in the GET request.

But yeah, JS players make life a whole lot easier by providing a single API for customisation, handling media source extensions and a bunch of other stuff.

I do not like the player in post - it stops me using Safari's PiP feature.
How does it? THere's nothing specifically incompatible between PiP and post-video overlay.
Ok. Turns out there's a button for that. Usually (i.e. in youtube) I right click twice and get option to pip it.
It is required for adaptive bitrate streaming in browsers that do not support HLS (all browsers except Safari and Chrome on Android only).
Both.