diff --git a/README.md b/README.md index 032ec72..05e3ed4 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,38 @@ navigator.getUserMedia({ video: true, audio: true }, function(stream) { Look at [index.html](example/index.html) and [main.js](./example/main.js) in the [example](./example) folder to see how to use the result of the stream to display a video on screen when successful, or how to detect errors and showing a message to the user. Here is a list of [browser support for WebRTC / getUserMedia](http://iswebrtcreadyyet.com/). + +## Using the polyfill + +Always make sure it's included before anything else that uses `getUserMedia` in your code. + +### Option A: include the script + +Download and save [the polyfill code](https://raw.githubusercontent.com/mozdevs/mediaDevices-getUserMedia-polyfill/master/mediaDevices-getUserMedia-polyfill.js) and include it in your own code: + +```html + + // ... more stuff + + + // ... maybe more stuff + +``` + +### Option B: use npm + +If you prefer to use npm to manage your dependencies: + +Install the polyfill: + +```bash +npm install --save md-gum-polyfill +``` + +And load it with `require` before using code that uses `getUserMedia`: + +```javascript +require('md-gum-polyfill'); + +// ... code using getUserMedia... +```