Skip to content

Commit c33a276

Browse files
authored
Merge pull request #4 from dsmurfin/Remove-Video-Device
Adds a method to remove an existing video capture device
2 parents 8dd4ae5 + e55424f commit c33a276

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/VideoIO/Camera.swift

+11
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ public class Camera {
151151
}
152152
}
153153

154+
public func removeVideoCaptureDevice() {
155+
self.captureSession.beginConfiguration()
156+
157+
if let currentVideoDeviceInput = self.videoDeviceInput {
158+
self.captureSession.removeInput(currentVideoDeviceInput)
159+
self.videoDeviceInput = nil
160+
}
161+
162+
self.captureSession.commitConfiguration()
163+
}
164+
154165
public var videoCaptureConnection: AVCaptureConnection? {
155166
return self.videoDataOutput?.connection(with: .video)
156167
}

0 commit comments

Comments
 (0)