zoukankan      html  css  js  c++  java
  • Delphi Video Capturing in Android

    unit Unit2;
    
    interface
    
    uses
    System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
    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,Androidapi.Helpers;
    
    type
    TForm2 = class(TForm)
      Button1: TButton;
      Button2: TButton;
      procedure Button1Click(Sender: TObject);
      procedure Button2Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
      texture : JSurfaceTexture;
      surface: JSurface;
      recorder: JMediaRecorder;
    end;
    
    var
    Form2: TForm2;
    
    implementation
    
    {$R *.fmx}
    
    procedure TForm2.Button1Click(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.CAMCORDER);   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 TForm2.Button2Click(Sender: TObject); begin   recorder.stop; end; end.
  • 相关阅读:
    javascript类的封装『转』
    闭包概念
    继承
    理解面向对象
    cookie的使用
    开园啦。。。
    Myslq 之常用命令
    Myslq 之修改提示符
    Myslq 之登陆、退出
    Javascript 之 Number
  • 原文地址:https://www.cnblogs.com/timba1322/p/12668198.html
Copyright © 2011-2022 走看看