I am trying to make a video call web app on local server and my task is to make video call on local server between two different browser. Currently i am stuck on two point
My code is as follow
<video src="" id="localVideo"></video>
<video src="" id="remoteVideo"></video>
<input type="button" id="start" value="Start">
<input type="button" id="call" value="Call">
<input type="button" id="hangup" value="Hang Up">
<script src="jquery-min.js"></script>
var localStream;
var gotRemoteStream;
var localPeerConnection;
var remotePeerConnection;
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia;
$("#start").click(function(){
navigator.getUserMedia({video: true, audio: true}, function(localMediaStream) {
localStream=localMediaStream;
var src=window.URL.createObjectURL(localMediaStream);
$("#localVideo").attr('src',src);
$("#localVideo").attr('autoplay',true);
}
, function(e){
console.log(e);});
});
$("#call").click(function(){
localPeerConnection=new webkitRTCPeerConnection(null);
localPeerConnection.addStream(localStream);
console.log('called');
localPeerConnection.createOffer(gotLocalDescription);
remotePeerConnection =
new webkitRTCPeerConnection(null); // eslint-disable-line new-cap
remotePeerConnection.onaddstream = gotRemoteStream;
console.log('Offer called');
});
function gotLocalDescription(description) {
localPeerConnection.setLocalDescription(description);
trace('Offer from localPeerConnection: \n' + description.sdp);
remotePeerConnection.setRemoteDescription(description);
remotePeerConnection.createAnswer(gotRemoteDescription);
}
function remoteStream(stream){
var src=window.URL.createObjectURL(stream);
$("#remoteVideo").attr('src',src);
localPeerConnection.createOffer(gotLocalDescription);
}
function gotLocalDescription(description) {
localPeerConnection.setLocalDescription(description);
trace('Offer from localPeerConnection: \n' + description.sdp);
remotePeerConnection.setRemoteDescription(description);
remotePeerConnection.createAnswer(gotRemoteDescription);
}
function createOffer1(){
console.log('waiting for offer');
}
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/71cf640b-fd55-49c5-8d3d-3aa347a9ed40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.