File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ @implementation FlutterRTCAudioRecorder
18
18
19
19
-(id ) initWithPath : (NSString *) path {
20
20
self = [super init ];
21
- recordingSession = [[AVAudioSession alloc ] init ];
22
-
21
+ recordingSession = [AVAudioSession sharedInstance ];
23
22
[recordingSession setCategory: AVAudioSessionCategoryPlayAndRecord error: nil ];
24
23
[recordingSession setActive: true error: nil ];
24
+
25
25
[recordingSession requestRecordPermission: ^(BOOL granted) {
26
26
if (granted) {
27
27
NSError * error;
@@ -33,6 +33,8 @@ -(id) initWithPath:(NSString *) path {
33
33
};
34
34
audioRecorder = [[AVAudioRecorder alloc ] initWithURL: [NSURL URLWithString: path] settings: recordingSettings error: &error];
35
35
36
+ audioRecorder.delegate = self;
37
+
36
38
[audioRecorder prepareToRecord ];
37
39
[audioRecorder record ];
38
40
} else {
@@ -46,7 +48,6 @@ -(id) initWithPath:(NSString *) path {
46
48
}
47
49
48
50
-(void )stop : (OnRecordingStopped) callback {
49
- [recordingSession setActive: false error: nil ];
50
51
onRecordingStopped = callback;
51
52
if (audioRecorder != nil ) {
52
53
[audioRecorder stop ];
You can’t perform that action at this time.
0 commit comments