Configure TURN server for webRTC with Firefox


Initially, I was using turn server for webRTC in my application only with Chrome but later i got the requirement of using turn server with Firefox as well.

I tried to run my application on Firefox with the same code as for Chrome,but i was getting the below error :

uncaught exception: buildPeerConnection failed, call not completed

Actually, as i mentioned in my previous blog Configure turn server for WebRTC on Amazon EC2 for configuring turn server that add below code in JavaScript file to use turn server:


var pc_config = {“iceServers”: [{“url”: “stun:stun.l.google.com:19302″},
                                {“url”:”turn:my_username@’amazon ec2 PUBLIC IP address’“, 
                                 “credential”:”my_password”}]};

Above code will run perfectly on Chrome but if you want to run on Firefox then change the above code as :


var pc_config = {“iceServers”: [{“url”: “stun:stun.l.google.com:19302″},
                                {“url”:”turn:’amazon ec2 PUBLIC ip address’ “, 
                                 "username":"my_username",
                                 “credential”:”my_password”}]};

Above code will run for both Chrome and Firefox.

In older format, Firefox cannot find the username, and will not attempt to authenticate itself to the TURN server.

Cheers !

Advertisements

About Rishi Khandelwal

Sr. Software Consultant having more than 6 years industry experience. He has working experience in various technologies such as Scala, Java, Play, Akka, Spark, Hive, Cassandra, Akka-http, ElasticSearch, Backbone.js, html5, javascript, Less, Amazon EC2, WebRTC, SBT
This entry was posted in AJAX, Amazon EC2, Cloud, JavaScript, jQuery, Web. Bookmark the permalink.

2 Responses to Configure TURN server for webRTC with Firefox

  1. This doesn’t actually prove that FireFox uses TURN, which everything I’ve read says it doesn’t support yet. Try your code block without the STUN entry and also “url” is now deprecated in favor of “urls”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s