Cap-go / capacitor-screen-recorder

Record the screen of the phone with native API
https://capgo.app
7 stars 7 forks source link

Not working on IOS. #20

Closed Saqib92 closed 1 year ago

Saqib92 commented 1 year ago

Not Recording screen on IOS. also app crashes when call on stop().

Github repo: https://github.com/Saqib92/capacitor-screen-recording

riderx commented 1 year ago

can you share logs ?

Saqib92 commented 1 year ago

when calling start()

To Native ->  ScreenRecorder start 130865217
2023-01-31 12:29:06.203554+0500 App[2542:21722]  [ERROR] -[RPScreenRecorder 
startCaptureWithHandler:completionHandler:]_block_invoke:521 undefined completion handler

When Calling stop()

To Native ->  ScreenRecorder stop 130865218
2023-01-31 12:30:17.515043+0500 App[2542:23074] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInput markAsFinished] Cannot call method when status is 0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000018040e7ec __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x0000000180051144 objc_exception_throw + 56
    2   AVFCore                             0x00000001a5250f6c -[AVAssetWriterInputHelper markCurrentPassAsFinished] + 0
    3   AVFCore                             0x00000001a524cf6c -[AVAssetWriterInput markAsFinished] + 112
    4   CapgoCapacitorScreenRecorder        0x000000010301b31c $s28CapgoCapacitorScreenRecorder0cD0C13stoprecording7handleryys5Error_pSgc_tFyAGcfU_ + 276
    5   CapgoCapacitorScreenRecorder        0x000000010301b848 $ss5Error_pSgIegg_So7NSErrorCSgIeyBy_TR + 116
    6   ReplayKit                           0x00000001036a48a0 __43-[RPScreenRecorder stopCaptureWithHandler:]_block_invoke + 64
    7   ReplayKit                           0x00000001036a47c4 -[RPScreenRecorder stopCaptureWithHandler:] + 264
    8   CapgoCapacitorScreenRecorder        0x000000010301b1ec $s28CapgoCapacitorScreenRecorder0cD0C13stoprecording7handleryys5Error_pSgc_tF + 244
    9   CapgoCapacitorScreenRecorder        0x00000001030185c4 $s28CapgoCapacitorScreenRecorder0cD6PluginC4stopyySo13CAPPluginCallCF + 132
    10  CapgoCapacitorScreenRecorder        0x00000001030188bc $s28CapgoCapacitorScreenRecorder0cD6PluginC4stopyySo13CAPPluginCallCFTo + 52
    11  Capacitor                           0x00000001031ae198 $s9Capacitor0A6BridgeC12handleJSCall4callyAA0D0V_tFyycfU_ + 796
    12  Capacitor                           0x00000001031a2758 $sIeg_IeyB_TR + 48
    13  libdispatch.dylib                   0x000000010348c594 _dispatch_call_block_and_release + 24
    14  libdispatch.dylib                   0x000000010348dd5c _dispatch_client_callout + 16
    15  libdispatch.dylib                   0x0000000103496040 _dispatch_lane_serial_drain + 928
    16  libdispatch.dylib                   0x0000000103496d80 _dispatch_lane_invoke + 428
    17  libdispatch.dylib                   0x00000001034a4b40 _dispatch_workloop_worker_thread + 1720
    18  libsystem_pthread.dylib             0x00000001af2568fc _pthread_wqthread + 284
    19  libsystem_pthread.dylib             0x00000001af2556c0 start_wqthread + 8
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInput markAsFinished] Cannot call method when status is 0'
terminating with uncaught exception of type NSException
CoreSimulator 857.13 - Device: iPhone 14 Pro Max (B7FCB276-6A43-4C45-AA7E-9CEF110B6747) - Runtime: iOS 16.1 (20B72) - DeviceType: iPhone 14 Pro Max
(lldb) 

Device: IOS Simulator OS: 16.1 Xcode 14.1

Saqib92 commented 1 year ago

any update?

Saqib92 commented 1 year ago

Any Update?? start() is working on both android and iOS. stop() is working on Android NOT working on iOS ( App Crashes)

Saqib92 commented 1 year ago

It working now. After investigation found in xcode log that NSPhotoLibraryUsageDescription gallery permission was missing. Adding NSPhotoLibraryUsageDescription in Info.plist it worked. Thank you for the plugin.

riderx commented 1 year ago

Oh thanks I updated the readme !