juanpablo said almost 3 years ago on Video Chat with WebRTC :
Could you explain how did you get the credentials (urls, credential, username) with coturn please?

David Kimura PRO said almost 3 years ago on Video Chat with WebRTC :
  Here's how I created the coturn server. Using an Ubuntu 18.04LTS virtual machine.

apt-get update && apt-get install -y coturn && apt-get clean

Edit the environment file to set some environment variables. Be sure to change as necessary.

# vi /etc/environment
TURN_PORT=3478
TURN_PORT_START=10000
TURN_PORT_END=20000
TURN_SECRET=yoursecretkey
TURN_SERVER_NAME=turn
TURN_REALM=YOURDOMAINNAME

Run source to set the variables

source /etc/environment

Edit the coturn file

sudo vi /etc/default/coturn

And change the value to 1

TURNSERVER_ENABLED=1

Generate an encrypted password. Be sure to use the same TURN_REALM name as set in the /etc/environment

turnadmin -k -u USERNAME -r YOURDOMAINNAME -p PASSWORD

Edit the turnserver configuration file

sudo vi /etc/turnserver.conf

Add the user into the configuration file. The encrypted password would be something like 0x0000000

user=USERNAME:PASSWORD

Restart coturn

sudo service coturn restart

Also, depending on where this is being hosted. You will need to open the UDP ports on your firewall based on the configuration set in /etc/environment. So, the password that you set will be encrypted on the server, but will need to be entered as plain text within the javascript stimulus controller.

Simon Kiteley PRO said almost 3 years ago on Video Chat with WebRTC :
Don't know if anyone has a clue... used as is. Using the numb server:

Uncaught (in promise) DOMException: Failed to execute 'createAnswer' on 
'RTCPeerConnection': PeerConnection cannot create an answer in a state other than 
have-remote-offer or have-local-pranswer.

Uncaught (in promise) DOMException: Failed to execute 'createAnswer' on 
'RTCPeerConnection': PeerConnection cannot create an answer in a state other than 
have-remote-offer or have-local-pranswer.

Uncaught (in promise) DOMException: Failed to execute 'setRemoteDescription' on 
'RTCPeerConnection': Failed to set remote answer sdp: Called in wrong state: kStable

Any help appreciated...

ajmaseda PRO said over 2 years ago on Video Chat with WebRTC :
Thank you very much. Here's a working example for anyone wanting to use the twilio api for stun and turn servers: https://github.com/TonyMaseda/rails-react-bootstrap .. I personally use the figaro gem for storing the ENV variables (ACCOUNT_SID and AUTH_TOKEN). You can create those credentials when you sign up with twilio.. then look in the Room model and the stimulus controller to see how to dynamically populate the iceServers array. Note: you'll need to unccomment the redis gem to run Action Cable in production (add Heroku Redis dyno if using Heroku)

 

tgrushka said almost 2 years ago on Video Chat with WebRTC :
Wasn't working for me in iOS / mobile Safari -- I was getting a black screen on the videos, I was seeing my mobile video on my desktop, but black videos on mobile -- but audio was working. (I thought: could it be I improperly setup my TURN server or something, or was there some obscure bug/deprecation in the JavaScript?)

Then I found Safari has had a bug (which Apple probably calls a "feature" -- lovely -- https://bugs.webkit.org/show_bug.cgi?id=176843) since iOS 11, which requires playsinline to be true on video elements. Which has nothing to do with user permissions, but rather fullscreen video... weird. The following worked for me:

In video_chat_controller.js, around line 158, after const element = document.createElement("video"), add:
            element.setAttribute('playsinline', '')

Then, in show.html.erb, add playsinline as an attribute on the video tag.

Also, data-video="chat-target.local_video" type of attributes have now been deprecated in Stimulus. The Stimulus error is helpful: just change them to data-video-chat-target="local_video". The full code for that tag would then be:

    <video data-video-chat-target="local_video" playsinline autoplay></video>



millisami said about 1 year ago on Video Chat with WebRTC :
Hi, thanks for the video.
I could run this app with rails 7 and few modifications in import in video_chat_controoler.js locally without valid TURN server creds. Thought this was only in local.
Then I deployed the app on Render at https://drkiq.onrender.com/rooms and here also it works without valid TURN serve credential? 
Hows that possible just with Redis/ActionCable/Stimulus? 
Whats the exact role of TURN server here since its running without it?

David Kimura PRO said about 1 year ago on Video Chat with WebRTC :
This answer on StackOverflow may shed some light. https://stackoverflow.com/a/59907030

Login to Comment