iOS Question Sound record problem.

Wave

Member
Licensed User
Longtime User
Hi Guys,

I have a little question. I making sound record application. but the sound is too low when I play it. Can you help with this.

Record Code

B4X:
audioRec.Initialize(File.DirDocuments, "test.mp4", 44100, True, 16, True)
audioRec.Record

Play Code

B4X:
vv.Initialize("vm")
vv.LoadVideo(File.DirDocuments, "test.mp4")
vv.Play

thank you all.
 

Wave

Member
Licensed User
Longtime User
thank for answer. but problem is continue. maybe problem is audioRecord object.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You need to set the audio session each time after you finish recording.

B4X:
Sub SetAudioSession
 Dim no As NativeObject = Me
 no.RunMethod("setAudioSession", Null)
End Sub

#if OBJC
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
- (void)setAudioSession {
   AVAudioSession *audioSession = [AVAudioSession sharedInstance];
   NSError *err = nil;
   BOOL success = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&err];
   if (success) {
     success = [audioSession setActive:YES error:&err];
   }
   if (!success)
     [NSException raise:@"" format:@"Error setting audio session: %@", err];
}
#end if
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…