PeerJS no audio

205 views
Skip to first unread message

Дмитрий Виенко

unread,
Aug 23, 2018, 10:11:53 AM8/23/18
to PeerJS

The problem is that I have success connection when I'm making call but there is no audio, I can't here anything. Here is my code:

Function to call:

  private makeCall() {
let self = this;
var options = {
  'constraints': {
      'mandatory': {
          'OfferToReceiveAudio': true,
          'OfferToReceiveVideo': true
      }
  }
 }
  navigator.getUserMedia({audio: true, video: true}, function(stream){
  var call = self.peer.call(self.idToConnect, stream, options);
  call.on('stream', function(stream) {
    console.log('STREAM');
    console.log(stream);
  })
},
err => console.log(err));
}

This is how I answer the call:

  this.peer.on('call', function(call) {
navigator.getUserMedia({
audio: true,
video: true
}, function(stream) {
call.answer(stream);
call.on('stream', function(stream) {
  console.log('RESPONED CALL');
  console.log(stream)
});
}, function(error) {
//...
});
});

Have I missed something?

Jairo

unread,
Aug 23, 2018, 10:18:06 AM8/23/18
to PeerJS
which browsers and Operating systems?

Дмитрий Виенко

unread,
Aug 23, 2018, 10:20:21 AM8/23/18
to PeerJS
chrome Version 68.0.3440.106, windows 10

четверг, 23 августа 2018 г., 17:18:06 UTC+3 пользователь Jairo написал:

Jairo

unread,
Aug 23, 2018, 10:37:28 AM8/23/18
to PeerJS
I can't get it working, it doesn't even start the call, sorry but I have no time to understand your code right now, here there is a good example using audio and video:




El jueves, 23 de agosto de 2018, 16:11:53 (UTC+2), Дмитрий Виенко escribió:

Дмитрий Виенко

unread,
Aug 27, 2018, 8:15:38 AM8/27/18
to PeerJS
Thanks, that helped me a lot! But one more thing, in that example the connection with server closes after about 1 min. Is there a way to fix that?

четверг, 23 августа 2018 г., 17:37:28 UTC+3 пользователь Jairo написал:
Reply all
Reply to author
Forward
0 new messages