首页 > 代码库 > FMX.MEDIA中的录音功能实现

FMX.MEDIA中的录音功能实现

  FMicrophone := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
   if Assigned(FMicrophone) then
   begin
     FMicrophone.FileName := udpclients.tempsavepath + ‘\RecordTest.wav‘;
     try
       FMicrophone.StartCapture;
     
     except
      
       ShowMessage(‘设备不识别或不支持。‘);
     end;
   end
   else
     ShowMessage(‘没有可用的麦克风。‘);

 

if Assigned(FMicrophone) then    try     

     if FMicrophone.State = TCaptureDeviceState.Capturing then   

   begin        FMicrophone.StopCapture;

     end;    except

     ShowMessage(‘设备不识别或不支持‘);    end;