Ziggeo / ReactNativeSDK

React Native SDK
Apache License 2.0
7 stars 6 forks source link

Error AVFoundationErrorDomain 11800 When Record Starts In iOS #38

Closed yaronlevi closed 4 years ago

yaronlevi commented 4 years ago

Hi (-:

We are facing another crash on iOS when starting a new recording on a real device. The recording code is:

const onClick = async () => {
    Ziggeo.setAppToken('xxx');    
    const token = await Ziggeo.record();
}

The error is:

2020-04-07 10:09:52.214 [info][tid:com.facebook.react.ZiggeoRecorderQueue][RCTZiggeoRecorder.m:133] application token set: xxxxx
2020-04-07 10:09:52.215 [info][tid:com.facebook.react.ZiggeoPlayerQueue][RCTZiggeoPlayer.m:20] application token set: xxxxx
2020-04-07 10:09:52.960993+0300 ziggeo_test_2[4232:162032] Capture session runtime error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-10868), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x2832b5e00 {Error Domain=NSOSStatusErrorDomain Code=-10868 "(null)"}}
2020-04-07 10:09:52.961669+0300 ziggeo_test_2[4232:162032] foreground request
2020-04-07 10:09:52.962132+0300 ziggeo_test_2[4232:162032] request dump: ---REQUEST------------------
URL: https://embed-eu-west-1.ziggeo.com/v1/applications/xxxxx/session
METHOD: POST
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
BODY: 
----------------------------
2020-04-07 10:09:53.522093+0300 ziggeo_test_2[4232:163701] foreground request
2020-04-07 10:09:53.522863+0300 ziggeo_test_2[4232:163701] request dump: ---REQUEST------------------
URL: https://embed-eu-west-1.ziggeo.com/v1/applications/xxxxx/debugger?i07af2jp98rvoctt26y5egy3xxxxx=r10c97e976859d0c3fb7027b9d2fa689&
METHOD: POST
Content-Type: application/x-www-form-urlencoded
Content-Length: 531
BODY: events=[%7B%22message%22:%22Capture%20session%20runtime%20error:%20Error%20Domain=AVFoundationErrorDomain%20Code=-11800%20%22The%20operation%20could%20not%20be%20completed%22%20UserInfo=%7BNSLocalizedFailureReason=An%20unknown%20error%20occurred%20(-10868),%20NSLocalizedDescription=The%20operation%20could%20not%20be%20completed,%20NSUnderlyingError=0x2832b5e00%20%7BError%20Domain=NSOSStatusErrorDomain%20Code=-10868%20%22(null)%22%7D%7D%22,%22source%22:%22ziggeo.ios.sdk%22,%22lineno%22:0,%22colno%22:0,%22time%22:1586243392%7D]
----------------------------

I replaced our token with xxxxx for security reasons.

I've created a repo to easily reproduce the problem.

alexyats commented 4 years ago

Hi @yaronlevi , thanks for reporting this, we were able to reproduce it on iPad. Please follow the updated instruction and change the audio session category, this should resolve the issue: https://github.com/Ziggeo/ReactNativeSDK/blob/master/README.md#ios-react-native-app-additional-required-steps

yaronlevi commented 4 years ago

@alexyats Thanks! that solves the issue.

#import <AVFoundation/AVFoundation.h>

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
                          withOptions:AVAudioSessionCategoryOptionDuckOthers
  | AVAudioSessionCategoryOptionDefaultToSpeaker
                          error:nil];