0

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.

Community
  • 1
  • 1
newfind
  • 3
  • 3

1 Answers1

0

I tested for hours by trying to modify manifest file to set audio source but failed.

Accidentally, I found project-option-user permission, select android platform and set record audio true. It works. I do not know if this is correct way of doing that. But it works.That was so easy just as I did not know that option.

user permission contains large information to control the phone!

I tried add some floatanimation in button and listitem of listbox in project. But it seems that animation only works on rectangle or button though i set true in option. this may be another question that should be asked here.

Thanks for viewing.

newfind
  • 3
  • 3