Skip to content

Commit 0441b0d

Browse files
committed
refactor: move CameraSessionDelegate to extention
1 parent 0a45d85 commit 0441b0d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

SimpleWebRTC/ViewController/ViewController.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ import UIKit
1313

1414
class ViewController: UIViewController, WebSocketDelegate, WebRTCClientDelegate, CameraSessionDelegate {
1515

16-
func didOutput(_ sampleBuffer: CMSampleBuffer) {
17-
if self.useCustomCapturer {
18-
self.webRTCClient.captureCurrentFrame(sampleBuffer: sampleBuffer)
19-
}
20-
}
21-
22-
2316
enum messageType {
2417
case greet
2518
case introduce
@@ -317,7 +310,7 @@ extension ViewController {
317310
}
318311

319312
func didDisconnectWebRTC() {
320-
self.webRTCStatusLabel.textColor = .red
313+
self.webRTCStatusLabel.textColor = .red
321314
}
322315

323316
func didOpenDataChannel() {
@@ -334,3 +327,12 @@ extension ViewController {
334327
self.webRTCMessageLabel.text = message
335328
}
336329
}
330+
331+
// Mark: - CameraSessionDelegate
332+
extension ViewController {
333+
func didOutput(_ sampleBuffer: CMSampleBuffer) {
334+
if self.useCustomCapturer {
335+
self.webRTCClient.captureCurrentFrame(sampleBuffer: sampleBuffer)
336+
}
337+
}
338+
}

0 commit comments

Comments
 (0)