The following very useful code was published in another post. Is it possible to pass the SystemSoundID (1302 in this case) to the Sub as a parameter?
B4X:
Sub PlayBeep
Dim NativeMe As NativeObject = Me
NativeMe.RunMethod("beep", Null)
End Sub
#If ObjC
#import <AVFoundation/AVAudioPlayer.h>
- (void) beep {
AudioServicesPlaySystemSound(1302);
}
#End If
I wanted to play a simple .wav file in B4i, but after searching and searching I couldn't find a clear example of how to do it. An example of how to play a default IOS sound would also be useful. Thank you very much. From what I read, I came with this useless code: Private Sub...
I know this is old, but I found this thread from Google, and it did not look like it was answered.
Here is the answer:
B4X:
#If ObjC
#import <AVFoundation/AVAudioPlayer.h>
-(void) beepWithSoundID:(UInt32)beepNumber {
AudioServicesPlaySystemSound(beepNumber);
}
#End If
public Sub short_beep
Dim NativeMe As NativeObject = Me
NativeMe.RunMethod("beepWithSoundID:", Array(1323)) '1323=Train Sound
End Sub