@@ -18,17 +18,25 @@ final public class ScreenRecorder {
1818
1919 public init ( ) { }
2020
21+ /**
22+ Starts recording the content of the application screen. It works together with stopRecording
23+
24+ - Parameter outputURL: The output where the video will be saved. If nil, it saves it in the documents directory.
25+ - Parameter size: The size of the video. If nil, it will use the app screen size.
26+ - Parameter saveToCameraRoll: Whether to save it to camera roll. False by default.
27+ - Parameter errorHandler: Called when an error is found
28+ */
2129 public func startRecording( to outputURL: URL ? = nil ,
2230 size: CGSize ? = nil ,
2331 saveToCameraRoll: Bool = false ,
24- error : @escaping ( Error ) -> Void ) {
32+ errorHandler : @escaping ( Error ) -> Void ) {
2533 if saveToCameraRoll {
2634 checkPhotoLibraryAuthorizationStatus ( )
2735 }
2836
29- createVideoWriter ( in: outputURL, error: error )
37+ createVideoWriter ( in: outputURL, error: errorHandler )
3038 addVideoWriterInput ( size: size)
31- startCapture ( error: error )
39+ startCapture ( error: errorHandler )
3240 }
3341
3442 private func checkPhotoLibraryAuthorizationStatus( ) {
@@ -107,6 +115,11 @@ final public class ScreenRecorder {
107115 }
108116 }
109117
118+ /**
119+ Stops recording the content of the application screen, after calling startRecording
120+
121+ - Parameter errorHandler: Called when an error is found
122+ */
110123 public func stoprecording( errorHandler: @escaping ( Error ) -> Void ) {
111124 RPScreenRecorder . shared ( ) . stopCapture ( handler: { error in
112125 if let error = error {
0 commit comments