当前位置 : 主页 > 编程语言 > delphi >

delphi xe10 麦克风、摄像头操作

来源:互联网 收集:自由互联 发布时间:2021-06-23
TakePhotoFromCameraAction1: TTakePhotoFromCameraAction; // 通过手机摄像头获取图片 TakePhotoFromLibraryAction1: TTakePhotoFromLibraryAction; //获取手机已存在图片 ShowShareSheetAction1: TShowShareSheetAction;//用其它程序

TakePhotoFromCameraAction1: TTakePhotoFromCameraAction; // 通过手机摄像头获取图片
TakePhotoFromLibraryAction1: TTakePhotoFromLibraryAction; //获取手机已存在图片
ShowShareSheetAction1: TShowShareSheetAction;//用其它程序分享图片(Bitmap.Assign();)

获取麦克风设置 FMX.Media
FMicrophone: TAudioCaptureDevice;
FMicrophone := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
FMicrophone.FileName 设置路径
FMicrophone.State = TCaptureDeviceState.Capturing 设备状态
FMicrophone.StartCapture; //开始录音
FMicrophone.StopCapture; // 结束录音
MediaPlayer: TMediaPlayer; 媒体播放器
MediaPlayer.FileName 设置路径
MediaPlayer.Play; // 开始播放
MediaPlayer.Stop; // 结束播放

获取手机摄像头Camera: TCameraComponent;Camera.Active := True; //打开Camera.Active := False; //停止Camera.SampleBufferToBitmap(imgCameraView.Bitmap, True); //保存图片 TThread.Synchronize(TThread.CurrentThread, GetImage); //线程保存图片Camera.Quality 图像质量Camera.HasFlash 是否有闪光灯Camera.TorchMode := TTorchMode.ModeOn; //打开闪光灯 Camera.FlashMode := FMX.Media.TFlashMode.fmFlashOff;Camera.TorchMode := TTorchMode.ModeOff;//关闭闪光灯 Camera.FlashMode := FMX.Media.TFlashMode.fmFlashOn;Camera.Kind := FMX.Media.TCameraKind.ckFrontCamera;//前置摄像头Camera.Kind := FMX.Media.TCameraKind.ckBackCamera;//后置摄像头

网友评论