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.
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
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)
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:
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?
Edit the environment file to set some environment variables. Be sure to change as necessary.
Run source to set the variables
Edit the coturn file
And change the value to 1
Generate an encrypted password. Be sure to use the same TURN_REALM name as set in the /etc/environment
Edit the turnserver configuration file
Add the user into the configuration file. The encrypted password would be something like 0x0000000
Restart coturn
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.
Any help appreciated...
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:
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:
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?