Reputation: 187
I have a web app that plays video broadcasted using WebRTC. I'm using a COTURN simple implementation (as described here: https://gabrieltanner.org/blog/turn-server). My turnserver.conf looks like this:
# TURN server name and realm
realm=<server_domain>
server-name=turnserver
# Use fingerprint in TURN message
fingerprint
# IPs the TURN server listens to
listening-ip=0.0.0.0
# External IP-Address of the TURN server
external-ip=<server_public_ip>
# Main listening port
listening-port=3478
# Further ports that are open for communication
min-port=10000
max-port=20000
# Log file path
log-file=/var/log/turnserver.log
# Enable verbose logging
verbose
# Specify the user for the TURN authentification
user=username:password
# Enable long-term credential mechanism
lt-cred-mech
# SSL certificates
cert=<crt_file>
pkey=<key_file>
# 443 for TURN over TLS, which can bypass firewalls
tls-listening-port=443
And I tested this server here: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and it works fine.
On my WebApp I'm doing
const test = () => {
const configuration = {
iceServers: [
{ urls: "stun:stun.l.google.com:19302" },
{
urls: "turn:<domain>:3478",
username: "username",
credential: "password",
},
],
};
let pc = new RTCPeerConnection(configuration);
pc.ontrack = function (event) {...}
pc.createOffer()
.then((offer) => {
console.log(offer);
}
But the offer looks like this:
RTCSessionDescription {type: "offer", sdp: "v=0
↵o=- 35287960452273588 2 IN IP4 127.0.0.1
↵s=-…0 0
↵a=extmap-allow-mixed
↵a=msid-semantic: WMS
↵"
which causes the other peer to throw SetRemoteDescription called with no fingerprint
and I'm not sure why is it missing so much information, am I doing something wrong?
Thank you in advance!
Upvotes: 1
Views: 266
Reputation: 4242
When offering you need to have at least one media section. You can either add a Transceiver or do a data channel.
let pc = new RTCPeerConnection()
// Create data channel
pc.createDataChannel('foobar')
// Create a audio or video transceiver
pc.addTransceiver('audio')
pc.addTransceiver('video')
Upvotes: 3
Reputation: 187
I'm not sure if it was some sort of update on the RTCPeerConnection constructor (because it just stopped working without anyone touching the code), but in case anyone needs this, I solved it by adding
{ offerToReceiveVideo: true }
I'm not sure it was something that was default until a today or something, but it did solve a problem that wasn't there for months.
Upvotes: 0