![Media Recorder API Delphi C++ Builder | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/09/Media-Recorder-API-Delphi-C-Builder.png?resize=1140%2C675&ssl=1)
Table of Contents
Overview
To make their jobs easier, all photo and video editing applications make use of media libraries. This article is about the WINSOFT Media Recorder component for Android. This Media Recorder component for Android makes use of the Android MediaRecorder API to record audio and video.
The Android MediaRecorder API supports capturing and encoding a wide range of popular audio and video formats. In this post, you’ll learn how to create a custom audio and video library on Android using Winsoft Media Recorder and IDE software.
Intro
This is a commercial library that has a trial version with all features for evaluation only and if you wish to distribute the Media Recorder component as a part of your project you should get a license.
Moreover, some of the demo applications were built with the TACamera component for Android by WINSOFT.
Specifications
- Supports Windows 32 & Windows 64
- Available for Delphi & C++ Builder 6-10.4 FMX
Configuration
The installation of this Media Recorder component is easy, you just need to download the installer and run the installer. RAD Studio should be closed while installing.
Development
![uiofthemediarecorderapplicationdelphicbuilderfiremonkey | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/09/ui-of-the-media-recorder-application-delphi-cbuilder-firemonkey.png?resize=240%2C435&ssl=1)
The UI is simple, we have the Settings button which requests permission and shows the camera settings. The Start button starts capturing, it can be a Stop button when it is capturing. Take Picture button takes a picture and we have a triggered function that ensures the photo taking is finished and saves the data to .jpeg file.
Here is the implementation for the Take Picture button and the PictureTaken procedure.
1 2 3 4 5 6 7 8 9 10 11 |
procedure TFormMain.ButtonTakePictureClick(Sender: TObject); begin ACamera.TakePicture; end; procedure TFormMain.ACameraPictureTaken(Sender: TObject; Data: TArray<System.Byte>); begin TFile.WriteAllBytes(TPath.Combine(TPath.GetPublicPath, 'picture_' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.jpeg'), Data); end; |
Within the TTimer component, we can set output file format and path.
1 2 3 4 5 6 7 8 9 10 11 12 |
procedure TFormMain.TimerTimer(Sender: TObject); begin Timer.Enabled := False; AMediaRecorder.OutputFile := TPath.Combine(TPath.GetPublicPath, 'video_' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.mp4'); AMediaRecorder.Active := True; AMediaRecorder.Start; ButtonTakePicture.Enabled := True; ButtonStartStop.Text := 'Stop'; end; |
As you can see after giving the path and format, it changes Active status to True and starts recording.
TAMediaRecorder component has many built-in features to use. For instance, you can set VideoEncodingBitRate, VideoFrameRate, Video Encoding types like H263, Mpeg4SP, and many more options to utilize.
Here is the list of all the features of the TAMediaRecorder component:
![TAMediaRecorderDelphiCBuilderFireMonkeyAndroid | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/09/TAMediaRecorder-Delphi-CBuilder-FireMonkey-Android.png?resize=233%2C406&ssl=1)
In the next post, we will see how we can record audio with the TAMediaRecorder component.
Head over and check out the full WINSOFT Media Recorder component!
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition