Last active
June 21, 2019 22:41
-
-
Save LFSCamargo/df2095d806119a97613e5bc37a5e9fdf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MediaStreamTrack.getSources((sourceInfos)) => { | |
console.log('MediaStreamTrack.getSources', sourceInfos) | |
let videoSourceId | |
for (let i = 0; i < sourceInfos.length; i++) { | |
const sourceInfo = sourceInfos[i] | |
if (sourceInfo.kind === 'video' && sourceInfo.facing === 'front') { | |
videoSourceId = sourceInfo.id | |
} | |
} | |
getUserMedia( | |
{ | |
audio: true, | |
video: { | |
mandatory: { | |
// here you pass the resolutions and the | |
// minimun frame rate for the video | |
minWidth: 1280, | |
minHeight: 720, | |
minFrameRate: 30, | |
}, | |
// here you can choose the camera mode `environment` and `user` | |
facingMode: 'user', | |
optional: videoSourceId ? [{ sourceId: videoSourceId }] : [], | |
}, | |
}, | |
(receivedStream: any) => { | |
// run a pc.addStream() and pass the receivedStream as a param | |
// store the stream on the localstate display on a <RTCView /> | |
}, | |
e => { | |
// Tracking Errors | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment