webrtcfreeswitchmod-verto

How can I fix "Cannot read property 'srcObject' of undefined" in Freeswitch Verto


I'm trying to get verto to work on in Chrome 57.0.2987.133 (64-bit).

After following https://dopensource.com/2017/01/21/setting-up-freeswitch-webrtc-functionality/, I was able to get webrtc/verto working on the server. I was able to get the demo app (in the verto repo) to connect and make calls.

I followed http://evoluxbr.github.io/verto-docs/tut/making-a-call.html to setup verto on my end, but I get (Uncaught TypeError: Cannot read property 'srcObject' of undefined and Uncaught TypeError: Cannot read property 'sinkId' of undefined) in chrome console. See below:

Uncaught TypeError: Cannot read property 'srcObject' of undefined
    at FSRTCattachMediaStream (jquery.FSRTC.js:236)
    at onRemoteStream (jquery.FSRTC.js:255)
    at Object.self.peer.FSRTCPeerConnection.onRemoteStream (jquery.FSRTC.js:593)
    at RTCPeerConnection.FSRTCPeerConnection.peer.onaddstream (jquery.FSRTC.js:737)
Uncaught TypeError: Cannot read property 'sinkId' of undefined
    at $.verto.dialog.setAudioPlaybackDevice (jquery.verto.js:2144)
    at jquery.verto.js:2214

https://pastebin.com/j4GrER0Q. My script imports look like https://pastebin.com/H55piU1r.

Assistance will be greatly appreciated


Solution

  • So, I figured this out eventually. The verto codebase has changed since http://evoluxbr.github.io/verto-docs/ was put up.

    I had cloned the latest (48 hrs old) FS repo to get the verto js libs.

    Turns out I had to do these additional things;

    1. Include the vendor/adapter-latest.js just before the verto libs in your index.html (or whatever it's called)
    2. In the new verto config, add tag: "<whatever>",
    3. Insert <video id="<whatever>"></video> in your index.html. You can add a display: none; to hide the video - if all you need is audio.

    That solved it.

    Update: If all you need is audio, then just use the <audio> tag.