buddyrocker
buddyrocker

Reputation: 61

Feature Detection With Modernizr Not Working?

I'm trying to use Modernizr to detect if the browser supports certain audio codecs, and it doesn't seem to be doing what I expected.

I ran the following

if(Modernizr.audio.mp4){

     //Do Something

}

But when I tested on Safari (which supports MP4), any logic inside the brackets was not hit. Perhaps I have my logic wrong, or I'm not understanding what Modernizr actually does?

All I want to do is test if the browser supports MP4 audio or not. Modernizr seemed to be the consensus to do this.

Any insights?

Thanks!

Upvotes: 0

Views: 179

Answers (1)

Wander Nauta
Wander Nauta

Reputation: 19625

You're probably looking for Modernizr.audio.m4a.

On my browser, Modernizr.audio.m4a is "maybe" (true), while Modernizr.audio.mp4 is "undefined" (false).

Refer to the documentation for more details.

Upvotes: 1

Related Questions