getUserMedia is undefined
See original GitHub issueI have a problem with getUserMedia
. The getUserMedia
function doesn’t fire and when I tried to console.log(getUserMedia)
it appears to be undefined
import {
RTCPeerConnection,
RTCMediaStream,
RTCIceCandidate,
RTCSessionDescription,
RTCView, MediaStreamTrack,
mediaDevices,
getUserMedia
} from 'react-native-webrtc';
function getLocalStream(isFront, callback) {
let videoSourceId;
// on android, you don't have to specify sourceId manually, just use facingMode
// uncomment it if you want to specify
if (Platform.OS === 'ios') {
MediaStreamTrack.getSources(sourceInfos => {
console.log("sourceInfos: ", sourceInfos);
for (const i = 0; i < sourceInfos.length; i++) {
const sourceInfo = sourceInfos[i];
if (sourceInfo.kind == "video" && sourceInfo.facing == (isFront ? "front" : "back")) {
videoSourceId = sourceInfo.id;
}
}
});
}
mediaDevices.enumerateDevices().then(sourceInfos => {
console.log('.*****************.', getUserMedia);
getUserMedia({
audio: true,
video: false
}).then(stream => {
console.log('getUserMedia success', stream);
callback(stream);
alert('We are OK');
}).then(logError);
});
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Navigator.getUserMedia and Navigator.webkitGetUserMedia ...
getUserMedia , navigator.webkitGetUserMedia and navigator.mediaDevices can be used only in secure context (https), otherwise they are undefined.
Read more >Cannot read property 'getUserMedia' of undefined · Issue #1200
I want to access the server using my IP address instead of localhost. I am getting the error "Uncaught TypeError: Cannot read property...
Read more >MediaDevices.getUserMedia() - Web APIs | MDN
getUserMedia () is a powerful feature that can only be used in secure contexts; in insecure contexts, navigator.mediaDevices is undefined , preventing access...
Read more >WebRTC Fix For getUserMedia Undefined On Local Hosts
WebRTC Fix For getUserMedia Undefined On Local Hosts ... Or it looks something like this: What this means is that is the browser...
Read more >Help me: Error: Cannot read property 'getUserMedia' of ...
Help me: Error: Cannot read property 'getUserMedia' of undefined (Code and Console Log inside) · Install & Config · joeblyth2020 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JinChengSu you were right It work and @saghul it return a promise, i achieve something like this with
I was able to get the stream promise. You can try this and let me know what you find
@mostafiz93 Please check the README. It’s now in
mediaDevices
.