AV1 detection out of date and/or too broad
Type of bug
- Differences between Can I use & Modernizr
- False positive
- Modernizr error
Describe the bug It's more of a "False negative", but here goes: It seems the detection for the AV1 codec doesn't work correctly, or at all. The string it's using to detect AV1: https://github.com/Modernizr/Modernizr/blob/44fa7b07c367a1814e8699e3a2f15c53fbe32df7/feature-detects/video/video.js#L60
returns empty string, i.e. "not supported" on both Vivaldi/Chromium, as well as Firefox, despite support being available.
How to Reproduce I wasn't strictly using Modernizr, but the detection isn't exactly complex so I ran it manually in the browser console(s). Vivaldi Snapshot 6.10.3468.4 (Chromium 128-something):
testEl.canPlayType('video/mp4; codecs="av01"')
''Firefox 130:
testEl.canPlayType('video/mp4; codecs="av01"')
""
Cannot play media. No decoders for requested formats: video/mp4; codecs="av01"Chromium 128.0.6613.137:
testEl.canPlayType('video/mp4; codecs="av01"')
''Expected behavior
The MIME Type being used should return either probably, or at least maybe, otherwise it will always be detected as "unsupported".
Additional context
I tested actual browser support using an AV1 encoded video on YouTube. When set to 4320p YouTube will guaranteed deliver an AV1 video. To make sure this is not just some YouTube shenanigans I also downloaded the video using yt-dlp, confirmed the codec with ffprobe, and opened the file in the browser, where it played fine as well.
I think the issue here is that av01 is too broad because the MIME-Type expects codec parameters, so av01 is technically an invalid MIME-Type.
I ran ran the test with what YouTube displays in its "Stats for Nerds", and it did return correctly:
testEl.canPlayType('video/mp4; codecs="av01.0.16M.08"')
'probably'
testEl.canPlayType('video/mp4; codecs="av01.0"')
''
testEl.canPlayType('video/mp4; codecs="av01.0.16M"')
''As you can see I also tried shortening it which resulted in "no support" as well.
I'm not sure what a good test string would be though since testing every possible permutation of the three required parameters could get out of hand fast.
Source: Modernizr/Modernizr