Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
explain how to include the polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
sole committed Dec 18, 2015
1 parent 50ae5ca commit 2564902
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Expand Up @@ -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
<head>
// ... more stuff
<script src="mediaDevices-getUserMedia-polyfill.js" defer></script>
<script src="other-code-using-getUserMedia.js" defer></script>
// ... maybe more stuff
</head>
```

### 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...
```

0 comments on commit 2564902

Please sign in to comment.