iOS Swift - WebRTC Video connection is not working

376 views
Skip to first unread message

Sudha Sandhiya

unread,
Feb 4, 2020, 6:28:12 AM2/4/20
to discuss-webrtc
Am trying to test webrtc in iphone devices. I have created peer connection and offer is generated in one application. In the another application Answer SDP is not created for received Offer SDP and the error "Failed to set remote offer sdp: Failed to set remote video description send parameters." is throwing.

I am using SwiftUI to render the video . Kindly provide your suggestion for this.

Following are the constraints used while creating Video's Peer connection

fileprivate let videoCallConstraint = RTCMediaConstraints(mandatoryConstraints: ["OfferToReceiveAudio" : "true", "OfferToReceiveVideo": "true"],

fileprivate let defaultConnectionConstraint = RTCMediaConstraints(mandatoryConstraints: nil, optionalConstraints: ["DtlsSrtpKeyAgreement": "true"])

let iceServers : [RTCIceServer] = [RTCIceServer(urlStrings: ["stun:stun.l.google.com:19302"], username: "", credential: "")];

let configuration = RTCConfiguration()
configuration.iceServers = self.iceServers
self.peerConnection = self.connectionFactory.peerConnection(with: configuration,
constraints: self.defaultConnectionConstraint,
delegate: self)

Local Stream
func localStream() -> RTCMediaStream {
let factory = self.connectionFactory
let localStream = factory.mediaStream(withStreamId: "ARDAMS")

if self.isVideoCall {
if !AVCaptureState.isVideoDisabled {
let videoSource: RTCVideoSource = factory.videoSource()
let capturer = RTCCameraVideoCapturer(delegate: videoSource)
self.delegate?.webrtcClient(client: self, didCreateLocalCapturer: capturer)
let videoTrack = factory.videoTrack(with: videoSource, trackId: "ARDAMSv0")
videoTrack.isEnabled = true
localStream.addVideoTrack(videoTrack)
} else {
// show alert for video permission disabled
let error = NSError.init(domain: ErrorDomain.videoPermissionDenied, code: 0, userInfo: nil)
self.delegate?.webrtcClient(client: self, didReceiveError: error)
}
}
}

Format of Offer SDP

"sdp":"v=0\r\no=- 314812981526444882 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE video\r\na=msid-semantic: WMS FVStream\r\nm=video 9 UDP\/TLS\/RTP\/SAVPF 96 97 98 99 100 101 127\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:Hrj2\r\na=ice-pwd:wQebg+0ODwkYNcxEyjI\/Wjjy\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 DF:43:19:36:75:94:F5:3D:82:18:1D:81:70:47:D8:DB:F3:3F:E6:17:38:DF:BA:AE:77:B1:0C:A7:A3:48:2E:97\r\na=setup:actpass\r\na=mid:video\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time\r\na=extmap:4 urn:3gpp:video-orientation\r\na=extmap:5 http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:6 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/playout-delay\r\na=extmap:7 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/video-content-type\r\na=extmap:8 http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/video-timing\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8\/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx\/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9\/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtpmap:99 rtx\/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 red\/90000\r\na=rtpmap:101 rtx\/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 ulpfec\/90000\r\na=ssrc-group:FID 1605453867 1642504153\r\na=ssrc:1605453867 cname:\/e73wJ6KygIhMLvf\r\na=ssrc:1605453867 msid:FVStream FAvideo\r\na=ssrc:1605453867 mslabel:FVStream\r\na=ssrc:1605453867 label:FAvideo\r\na=ssrc:1642504153 cname:\/e73wJ6KygIhMLvf\r\na=ssrc:1642504153 msid:FVStream FAvideo\r\na=ssrc:1642504153 mslabel:FVStream\r\na=ssrc:1642504153 label:FAvideo\r\n"
Reply all
Reply to author
Forward
0 new messages