Skip to content

Adds a delay between two executions: deactivating and pausing a session #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ios/RNSoundRecorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ + (BOOL)requiresMainQueueSetup
return;
}

NSError* err = nil;
__block NSError* err = nil;

[_recorder stop];

Expand All @@ -162,7 +162,10 @@ + (BOOL)requiresMainQueueSetup
_recorder = nil; // release it

AVAudioSession* session = [AVAudioSession sharedInstance];
[session setActive:NO error:&err];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(100.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[session setActive:NO error:&err];
});

if (err) {
reject(@"session_set_active_error", [[err userInfo] description], err);
Expand Down