News for hackers. Stuff that matters.
Re:HTMLMediaElement.canPlayType() by chrisma0 on Sunday February 27, 2022 @10:57AM (#30489548)
Returns either `probably`, `maybe` or '' (definitely not) for whether a browser is able to play a MIME type.

As the method returns strings anyways and `maybe` is pretty unhelpful, I request the return be changed to '¯\_(ツ)_/¯' (which is equally unhelpful, but at least a bit more fun).

Re:HTMLMediaElement.canPlayType() by DaleCurtis on Sunday February 27, 2022 @11:53AM (#30490094)
+1 to changing maybe to a shrug :)

MediaCapabilities is the new way to ask the "can I play this" question: https://developer.mozilla.org/en-US/docs/Web/API/Media_Capab...

It returns a boolean for whether a codec is supported or not.

Re:HTMLMediaElement.canPlayType() by Bilal_io on Sunday February 27, 2022 @12:24PM (#30490405)
MediaCapabilites.IsTypeSupported was very unhelpful when used to check if mimetype is supported for encoding instead of decoding. But perhaps that's not what it was created for.
Re:HTMLMediaElement.canPlayType() by DaleCurtis on Sunday February 27, 2022 @01:00PM (#30490723)
Yes, it was originally for decoding information only.

https://developer.mozilla.org/en-US/docs/Web/API/MediaCapabi... is on the way. I believe the latest Safari preview has it implemented and Chromium should have it shortly as well.

Re:HTMLMediaElement.canPlayType() by msoad on Sunday February 27, 2022 @12:44PM (#30490590)
problem is mime types are also as meaningless. This whole API is worthless as you can tell from the return values!
Re:HTMLMediaElement.canPlayType() by LeoNatan25 on Sunday February 27, 2022 @01:47PM (#30491233)
It’s true. “video/mp4” really means nothing. At most, it’s a mime type for the file container, but exposes no information on the video and audio codecs contained in it. A better approach would be using this API for querying whether the video, audio and subtitle elements are playable, in addition to the container.