I have actually followed this WebRTC codelab (https://codelabs.developers.google.com/codelabs/webrtc-web/#7), but get stuck when needing to connect to ICE servers.
Essential code here:
main.js
var pcConfig = {
'iceServers': [{
'url': 'stun:stun.l.google.com:19302'
}
[...]
if (location.hostname !== 'localhost') {
requestTurn(
'https://computeengineondemand.appspot.com/turn?username=41784574&key=4080218913');}
Usually I get either error: “ICE failed”, or “Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://computeengineondemand.appspot.com/turn?username=41784574&key=4080218913. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).”
According to the latter one, I have enabled “A2enmod headers” and set this to apache.conf “Header always set Access-Control-Allow-Origin "*" “
The issue persists. My STUN server is “ 'url': 'stun:stun.l.google.com:19302' “ As far as I have understood, STUN should work 80% of the time. But this never works. Therefore, even if the TURNserver would not be working anymore, it should connect sometimes with the STUN?