firemonkey audio capture setAudioSource failed

  

I am copying exactly the codes from here and here to capture audio on android phone.


MyAudio : TAudioCaptureDevice;
end;
var
Form3: TForm3;
implementation
{$R *.fmx}
procedure TForm3.Button1Click(Sender: TObject);
begin
if Button1.Text = ‘Start Audio Capture’ then begin
MyAudio := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
if MyAudio <> nil then begin
Button1.Text := ‘Stop Audio Capture’;
MyAudio.FileName := ‘TestAudio.mp3’;
MyAudio.StartCapture;
end
else
// not copy // Caption := ‘Audio capture devices not available.’;
end
else begin
MyAudio.StopCapture;
Button1.Text := ‘Start Audio Capture’
end;
end;

Error prompts:

java.lang.RunTimeException:
setAudioSource failed.

When click button1 for the second time, it prompts:

java.lang.illegalStateException.

Here i found some post related to it, but it seems it is Java.

I am testing on Android 4.4.2, delphi xe8.

Can it be solved in firemonkey?

thanks.

Comments are closed.