(constraints)
| 33 | } |
| 34 | |
| 35 | getUserMedia(constraints) { |
| 36 | return this.driver.executeAsyncScript((constraints) => { |
| 37 | const callback = arguments[arguments.length - 1]; |
| 38 | if (!window.localStreams) { |
| 39 | window.localStreams = {}; |
| 40 | } |
| 41 | |
| 42 | return navigator.mediaDevices.getUserMedia(constraints) |
| 43 | .then((stream) => { |
| 44 | window.localStreams[stream.id] = stream; |
| 45 | callback({id: stream.id, tracks: stream.getTracks().map((t) => { |
| 46 | return {id: t.id, kind: t.kind}; |
| 47 | })}); |
| 48 | }, (e) => callback(e)); |
| 49 | }, constraints || {audio: true, video: true}) |
| 50 | .then((streamObj) => { |
| 51 | const stream = new MediaStream(streamObj.tracks); |
| 52 | stream.id = streamObj.id; |
| 53 | return stream; |
| 54 | }); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | class PeerConnection { |
no test coverage detected