Friends, I want to develop an application for Flutter using webrtc, but unfortunately I am facing problems that I am not able to solve.
errorCode: AddStream is not available with Unified Plan SdpSemantics. Please use AddTrack instead.
Thanks
Map<String, dynamic> configuration = {
"iceServers": [
{"url": "stun:stun1.l.google.com:19302"},
]
};
final Map<String, dynamic> offerSdpConstraints = {
"mandatory": {
"OfferToReceiveAudio": true,
"OfferToReceiveVideo": true,
},
'optional': [
{'DollsSftpKeyAgreement': true},
],
};
Map<String,dynamic> mediaConstraints = {
'audio': true,
'video': true,
};
_localStream = await navigator.mediaDevices.getUserMedia(mediaConstraints);
_localRenderer.srcObject = _localStream;
RTCPeerConnection pc = await createPeerConnection(configuration,offerSdpConstraints);
pc.addStream(_localStream!);
I finally found the cause of this error and realized that
RTCPeerConnection.addStream(localStream)
It is obsoleteand I use it
localStream?.getTracks().forEach((track) { peerConnection?.addTrack(track, localStream!); });
I hope it will be useful for you