0

I am using RTCMulticonnection v3 for video/audio/text chat. In my project I am not starting streaming when any user joins the room. I am starting streaming when user clicks on Camera icon beside username. Check the below screenshot.

Getting error when executing below code.

myConnection.dontCaptureUserMedia = false;
mySession = {audio: true, video: true};
myConnection.captureUserMedia(function (stream) {
    var streamid = myConnection.token();
    myConnection.customStreams[streamid] = stream;

    myConnection.sendMessage({
        hasCamera: true,
        streamid: streamid,
        session: mySession,
        room_id: room_id,
        username: username
    });
    myConnection.addStream({
        audio: true,
        video: true
    });
}, mySession);

Getting error while executing above code.

RTCMultiConnection.min.js:2150 Uncaught TypeError: Cannot read property 'getAudioTracks' of undefined at window.RTCMultiConnection.connection.addStream (RTCMultiConnection.min.js:2150) at ui.peer-connection-new.js:340 at window.RTCMultiConnection.connection.getUserMedia.connection.captureUserMedia (RTCMultiConnection.min.js:1973) at rtcMultiConnection.onCustomMessage (ui.peer-connection-new.js:334) at r.emit (socket.io.js:1) at r.onevent (socket.io.js:2) at r.onpacket (socket.io.js:2) at r. (socket.io.js:2) at r.emit (socket.io.js:1) at r.ondecoded (socket.io.js:1)

Check below screenshot

 'getAudioTracks' of undefined

I have taken reference of MultiRTC: Skype-like app demo.

Pankaj Makwana
  • 3,030
  • 6
  • 31
  • 47
  • If I were you I would avoid using Muaz Khan code. He is well know on the WebRTC community but unfortunately his code is ugly and messed up. It's easier to build from ground up than using his libraries. Also, you will understand more about media stream api and webrtc by building it yourself. – Keyne Viana Mar 01 '18 at 17:33
  • Do you have any idea about other api? – Pankaj Makwana Mar 03 '18 at 04:10
  • https://codelabs.developers.google.com/codelabs/webrtc-web/#0 – Keyne Viana Mar 03 '18 at 23:13

0 Answers0