File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
- navigator . getMedia = navigator . getUserMedia || navigator . webkitGetUserMedia || navigator . mozGetUserMedia || navigator . msGetUserMedia ;
2
- navigator . getMedia ( { video : true , audio : false } , function ( stream ) {
1
+ // The following lines try to handle getUserMedia in many different browsers
2
+ if ( navigator . mediaDevices . getUserMedia ) {
3
+ function getUserMedia ( constraints , ready , err ) {
4
+ navigator . mediaDevices . getUserMedia ( constraints ) . then ( ready ) . catch ( err )
5
+ }
6
+ } else {
7
+ var getUserMedia = ( navigator . getUserMedia || navigator . webkitGetUserMedia || navigator . mozGetUserMedia ) . bind ( navigator )
8
+ if ( ! getUserMedia ) {
9
+ throw new Error ( 'getUserMedia is not supported' )
10
+ }
11
+ }
12
+
13
+ getUserMedia ( { video : true , audio : false } , function ( stream ) {
3
14
var Peer = require ( 'simple-peer' )
4
15
var peer = new Peer ( {
5
16
initiator : location . hash === '#init' ,
You can’t perform that action at this time.
0 commit comments