Home » Javascript » Twilio.Device.setup(token) is throwing exception. Twilio js version 1.4

Twilio.Device.setup(token) is throwing exception. Twilio js version 1.4

Posted by: admin November 1, 2017 Leave a comment

Questions:

I am using Twilio api for developing a video calling web app. Web app is responsive and can be used on mobile device to make video calls.
But when I open my web page on mobile device browser it is not using loudspeaker by default.
As per Twilio API Doc we can use Twilio.Device object to set loudspeaker as default. I am stucked on below code, where it is throwing exception followed by the code.

Twilio.Device.setup(token)

Uncaught TypeError: Cannot read property 'length' of undefined
    at twilio.min.js:182
    at Object.objectize (twilio.min.js:179)
    at a.register (twilio.min.js:80)
    at new a (twilio.min.js:76)
    at Function.setup (twilio.min.js:90)
    at Object.success (index.js:159)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at A (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)

Twilio team please help …

Answers: