Delphi Android Video (call Java function)

Source: Internet
Author: User

Delphi XE series of control can not save video, after the help of netizens, yesterday finally realized the video function (but there is a problem is the video display without screen), the program is mainly used Jmediarecorder, The use of Mediarecorder can refer to the Web-based Java instructions, the following code is capable of normal recording:

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:to Bject);  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);  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 Video (call Java function)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.