I started to learn webrtc when I tried to implement the basic sample application
<html>
<head>
</head>
<body>
<script type="text/javascript">
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia || navigator.msGetUserMedia;
window.URL = window.URL || window.webkitURL;
navigator.getUserMedia({video: true}, function(localMediaStream) {
var video = document.createElement("video");
video.autoplay = true;
video.src = window.URL.createObjectURL(localMediaStream);
document.body.appendChild(video);
}, function(error) {
console.log(error);
});
</script>
</body>
</html>
I used this code to run in locaL browser google canary I enabled peerconnection and I didnot found mediastream in my browser but I think it might enabled as defalut in my browser.
The problem is this code results as NavigatorUserMediaError in console.i am not finding the way to step out from this problem. Any one have idea where I went wrong in my code.
Did you run this from a web server?
If you run it from a file:// URL, you'll get a NavigatorUserMediaError.
I just tried your code from localhost in Chrome 22.0 and it works fine.
Note that this example does not use RTCPeerConnection and you don't have to enable any flags now in Chrome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With