8000 set audio recorder delegate · coder-wuyan/flutter-webrtc@c24296d · GitHub
[go: up one dir, main page]

Skip to content

Commit c24296d

Browse files
committed
set audio recorder delegate
1 parent db5fbe5 commit c24296d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ios/Classes/FlutterRTCAudioRecorder.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ @implementation FlutterRTCAudioRecorder
1818

1919
-(id) initWithPath:(NSString *) path {
2020
self = [super init];
21-
recordingSession = [[AVAudioSession alloc] init];
22-
21+
recordingSession = [AVAudioSession sharedInstance];
2322
[recordingSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
2423
[recordingSession setActive:true error:nil];
24+
2525
[recordingSession requestRecordPermission:^(BOOL granted) {
2626
if (granted) {
2727
NSError* error;
@@ -33,6 +33,8 @@ -(id) initWithPath:(NSString *) path {
3333
};
3434
audioRecorder = [[AVAudioRecorder alloc] initWithURL:[NSURL URLWithString:path] settings: recordingSettings error:&error];
3535

36+
audioRecorder.delegate = self;
37+
3638
[audioRecorder prepareToRecord];
3739
[audioRecorder record];
3840
} else {
@@ -46,7 +48,6 @@ -(id) initWithPath:(NSString *) path {
4648
}
4749

4850
-(void)stop:(OnRecordingStopped) callback {
49-
[recordingSession setActive:false error:nil];
5051
onRecordingStopped = callback;
5152
if (audioRecorder != nil) {
5253< 37BA div class="diff-text-inner"> [audioRecorder stop];

0 commit comments

Comments
 (0)
0