From 53d245fc9422fcdc89ca230426f1529ae4eafb87 Mon Sep 17 00:00:00 2001 From: decanus <7621705+decanus@users.noreply.github.com> Date: Wed, 3 Feb 2021 15:47:28 +0100 Subject: [PATCH] fix --- Sources/ion/Client.swift | 7 +++---- Sources/ion/WebRTC/WebRTC.swift | 13 ++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Sources/ion/Client.swift b/Sources/ion/Client.swift index 09ae905..9eec5a3 100644 --- a/Sources/ion/Client.swift +++ b/Sources/ion/Client.swift @@ -36,14 +36,13 @@ class Client { stream.delegate = self } -// _ = publisher.createAudioTrack(label: "audio", streamId: "stream") - publisher.offer(completion: { result in switch result { case .failure: - break - case let .success(description): break // @TODO + case let .success(description): + debugPrint(description) +// self.signal.offer(description) } }) } diff --git a/Sources/ion/WebRTC/WebRTC.swift b/Sources/ion/WebRTC/WebRTC.swift index 2f15e87..1c8d851 100644 --- a/Sources/ion/WebRTC/WebRTC.swift +++ b/Sources/ion/WebRTC/WebRTC.swift @@ -108,13 +108,13 @@ final class WebRTCClient: NSObject { return completion(.failure(error)) } - if let sdp = sdp { - return completion(.success(sdp)) - } - - // @TODO SET REMOTE + peerConnection.setRemoteDescription(sdp, completionHandler: { error in + if let error = error { + return completion(.failure(error)) + } - fatalError("both SDP and Error were nil") + return completion(.success(sdp)) + }) }) } @@ -148,7 +148,6 @@ final class WebRTCClient: NSObject { let track = WebRTCClient.factory.audioTrack(with: audioSource, trackId: label) - // @TODO FIGURE THIS PART OUT peerConnection.add(track, streamIds: [streamId]) peerConnection.addTransceiver(with: track)