delphi android 錄影(調用Java的功能)

來源:互聯網
上載者:User

標籤:img   rate   graphics   init   preview   ons   shared   androi   orm   

delphi xe系列內建的控制項都無法儲存錄影,經網友幫忙,昨天終於實現了錄影功能(但有個問題是錄影時無畫面顯示),程式主要使用了JMediaRecorder,MediaRecorder的使用方法可參考網上java的相關說明,下面代碼是可以正常錄影的:

unit Unit8;interfaceuses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,  Androidapi.Helpers, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,FMX.Media.Android,Androidapi.JNI.Media,  FMX.Controls.Presentation, FMX.StdCtrls,System.IOUtils,Androidapi.JNI.GraphicsContentViewText,  Androidapi.JNI.Provider,  Androidapi.JNI.App,  Androidapi.JNI.Net,  Androidapi.JNIBridge,  FMX.Media,  Androidapi.JNI.JavaTypes,  Androidapi.JNI.Os;type  TForm8 = class(TForm)    Button3: TButton;    Button4: TButton;    procedure Button3Click(Sender: TObject);    procedure Button4Click(Sender: TObject);  private    { Private declarations }     texture : JSurfaceTexture;     surface: JSurface;     recorder: JMediaRecorder;  public    { Public declarations }  end;var  Form8: TForm8;implementation{$R *.fmx}procedure TForm8.Button3Click(Sender: TObject);VAR  FILENAME:STRING;begin  texture := TJSurfaceTexture.JavaClass.init(1);  surface := TJSurface.JavaClass.init(texture);  recorder := TJMediaRecorder.Create();  recorder.setPreviewDisplay(surface);  recorder.setAudioSource(TJMediaRecorder_AudioSource.JavaClass.MIC    );  recorder.setVideoSource(TJMediaRecorder_VideoSource.JavaClass.CAMERA);  recorder.setOutputFormat(TJMediaRecorder_OutputFormat.JavaClass.MPEG_4);  recorder.setAudioEncoder(TJMediaRecorder_AudioEncoder.JavaClass.DEFAULT);  recorder.setVideoEncoder(TJMediaRecorder_VideoEncoder.JavaClass.H264);  recorder.setMaxDuration(1800000); // 30 minutes  recorder.setVideoSize(320, 240);  recorder.setVideoFrameRate(15);   filename:=TPath.GetSharedCameraPath+‘/abc0002.mp4‘;  recorder.setOutputFile(StringToJString(FILENAME));  recorder.prepare();  recorder.start();end;procedure TForm8.Button4Click(Sender: TObject);begin   recorder.stop;end;end.

 

http://www.cnblogs.com/qiufeng2014/p/4809144.html

delphi android 錄影(調用Java的功能)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.