I am confused why

Modernizr.getusermedia

is undefined, but when I type in

!!navigator.webkitGetUserMedia

it returns true. I am using Chrome and I know webrtc is supported... so why does Modernizr say its undefined.

The Modernizr that I downloaded with bower has the getusermedia.js file in it with the line:

Modernizr.addTest('getusermedia', !!Modernizr.prefixed('getUserMedia', navigator));

有帮助吗?

解决方案

getUserMedia isn't a core test in Modernizr so it is not included by default. When you setup your own download on the Modernizr website you can select it to include it but Bower loads the default. Bower just clones the Git repo to you local machine so when you want none core tests you'll have to do some extra work.

To add that test also include the file feature-detects/webrtc/getusermedia.js in your page or add the contents of that script to another script on the page.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top