Search code examples
pythonflasktwiliotwilio-video

Twilio Flask app video call is not connecting over a public IP address


I created an application in Flask Python with a frontend in HTML and Twilio SDK JavaScript version 2.3.0.

A video call is working on local host, but if I try the same app over HTTPS with a valid certificate, it is fetching the token correctly for the video call, but it can't establish a connection to Twilio.

I have tried forcing the browser permissions for the camera and audio to allow and it did not make a difference.


Solution

  • So to load the Twilio script, you need to enable https in both the website and the script. Otherwise, it will mix up HTTP and HTTPS and fail. So there are two simple things to do:

    • put your website over HTTPS
    • load the https://media.twiliocdn.com/sdk/js/video/releases/2.3.0/twilio-video.min.js file over HTTPS in file index.html.

    This will solve your problem.