I am developing a django project and including video call with using peerjs.So when user is calling on the other side confirm doesn't show.Can anyone help me ?(Actually the same code worked yesterday but today I didn't change anything nevertheless it isn't working now)
var currentUserSlug = JSON.parse(document.getElementById('requestUserUsername').textContent);
var other_user_slug = JSON.parse(document.getElementById('other_user').textContent);
var video1=document.getElementById("video1");
var video2=document.getElementById("video2");
var camera=document.getElementById("camera");
var microfone=document.getElementById("microfone");
var isMicOpen=true;
var isCamOpen=true;
var side=window.location.search.substr(1).split("=")[1];
const peer = new Peer(currentUserSlug, { host: 'localhost', port: 9000, path: '/' })
navigator.mediaDevices.getUserMedia({audio:true,video:true})
.then(function(stream){
video2.srcObject=stream
video2.play()
video2.muted=true
if(side=="caller"){
var call=peer.call(other_user_slug,stream)
call.on("stream",function(remoteStream){
video1.srcObject=remoteStream
video1.play()
})
}else{
peer.on("call",function(call){
var resCall=confirm("Videocall incoming, do you want to accept it ?");
if(resCall){
call.answer(stream)
call.on("stream",function(remoteStream){
video1.srcObject=remoteStream
video1.play()
});
}
else{
console.log("declined.");
}
})
}
})