어떻게 Chrome 및 Mozilla와 같은 브라우저에서 WebRTC 비디오 (및 오디오)를 볼 수 있습니까? 내가 사용하고WebRTC 비디오를 볼 수 없습니다.
코드는 다음과
HTML입니다 :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title> WebRTC</title>
</head>
<body>
<video id="peer2-to-peer1" autoplay controls style="width:40%;"></video>
<script src="script.js"></script>
</body>
</html>
자바 스크립트 파일 :
navigator.getUserMedia ||
(navigator.getUserMedia = navigator.mozGetUserMedia ||
navigator.webkitGetUserMedia || navigator.msGetUserMedia);
if (navigator.getUserMedia) {
navigator.getUserMedia({
audio: true
}, function(localMediaStream) {alert('in');
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
video.onloadedmetadata = function(e) {
// Do something with the video here.
};
}, onError);
} else {
alert('getUserMedia is not supported in this browser.');
}
function onSuccess() {
alert('Successful!');
}
function onError() {
alert('There has been a problem retrieving the streams - did you allow access?');
}
하지만,
는 onSuccess 기능 '이기 때문에 내가 오류를 얻고있다 Nt가 호출되었습니다.
LINK :이 전화
http://www.creativebloq.com/javascript/get-started-webrtc-1132857
아직도 크롬 것이 점점하지 M (버전 36), 오차 함수에 크롬 (34)로했다. – deepjyoti22
(브라우저의 콘솔에있는 경우) 오류를 게시 할 수 있습니까? 서버에서 파일을 가져 옵니까? 브라우저로 파일을 열면 작동하지 않습니다. –
우리는 로컬 컴퓨터에 파일을 저장하고 있습니다 ... 그리고 나는 링크를 따라 가고 있습니다 : http://www.creativebloq.com/javascript/get-started-webrtc-1132857 – deepjyoti22