I am trying to configure a conference module in my application. So I found and created a stream between two users.
The problem is that others cannot join.
I tried to read the documentation, but I cannot figure out how to implement it.
Here is my code:
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
navigator.getUserMedia({audio: true, video: true}, function (stream) {
$('#my-video').prop('src', URL.createObjectURL(stream));
window.localStream = stream;
}, function () {
$('#step1-error').show();
});
peerFactory.on('error', function (err) {
alert(err.message);
});
peerFactory.on('connection', function (id) {
alert('new logon' + id);
});
peerFactory.on('call', function (call) {
var r = confirm('Ny kald fra ');
if (r) {
call.answer(window.localStream);
$scope.currentCall = true;
$scope.$apply();
streamCall(call);
}
else
{
call.close();
window.existingCall.close();
}
});
$scope.makeCall = function (callId) {
var call = peerFactory.call(callId, window.localStream);
$scope.currentCall = true;
streamCall(call);
};
$scope.hangUp = function()
{
$scope.currentCall = false;
window.existingCall.close();
};
function streamCall(call) {
if (window.existingCall) {
window.existingCall.close();
}
call.on('stream', function (stream) {
$('#their-video').prop('src', URL.createObjectURL(stream));
});
window.existingCall = call;
$('#their-id').text(call.peerFactory);
call.on('error', function () {
var i = 0;
});
}
Can someone give me a push in the right direction?
source
share