TypeError: SIP.WebRTC.getUserMedia is not a function

611 views
Skip to first unread message

michael...@gmail.com

unread,
Feb 2, 2016, 5:21:04 PM2/2/16
to SIP.js
I am trying to reuse the media stream per this guide:

http://sipjs.com/guides/reuse-mediastreams/

I keep getting this error in my Firefox console:

Tue Feb 02 2016 16:43:18 GMT-0500 (Eastern Standard Time) | sip.transport | connecting to WebSocket wss://WEBSOCKETURL/ws" sip-0.7.3.js:2884:3
TypeError: SIP.WebRTC.getUserMedia is not a function
vici_phone.js:503:1

This is the code in question:
// get a media stream so users are not constantly prompted
var mediaStream;
var mediaConstraints = {
audio: true,
video: false
};
function getUserMediaSuccess (stream) {
console.log('getUserMedia succeeded', stream)
mediaStream = stream;
}
function getUserMediaFailure (e) {
console.error('getUserMedia failed:', e);
}
SIP.WebRTC.getUserMedia(mediaConstraints, getUserMediaSuccess, getUserMediaFailure);

Will Mitchell

unread,
Feb 2, 2016, 5:23:23 PM2/2/16
to SIP.js, michael...@gmail.com
Hi,

SIP.WebRTC.getUserMedia is a little quirky.  It only gets initialized after you (or SIP.js) calls SIP.WebRTC.isSupported() for the first time.  This is to allow support in environments where, for example, a plugin is being used that doesn't initialize right away.

...It could probably be slightly better.

-Will

michael...@gmail.com

unread,
Feb 2, 2016, 5:29:01 PM2/2/16
to SIP.js, michael...@gmail.com
Thanks. Calling that function fixed the issue. That should probably be added to the guide.
Reply all
Reply to author
Forward
0 new messages