The short video SDK provides the basic recording feature and allows you to apply recording effects such as music, speed adjustment, and face stickers to short videos.
Differences among editions
|Professional Edition||All features are supported.|
|Standard Edition||The basic recording and music features are supported. The facial recognition feature is not supported.|
|Basic Edition||The basic recording feature is supported. The music and facial recognition features are not supported.|
|Set parameters.||This step is performed to create or destroy a recording instance.|
|Set callbacks.||This step is performed to set callbacks.|
|Manage preview.||This step is performed to start or stop the preview.|
|Configure and manage recording.||This step is performed to configure recording information.|
|Configure effects.||This step is performed to configure beautification and filters for recording.|
|Start recording.||This step is performed to start, cancel, or stop recording a video clip.|
|Complete recording.||This step is performed to end recording.|
Action Sample code Create a recording instance.
AliyunIRecorder recorder = AliyunRecorderCreator.getRecorderInstance(Context context);// The context parameter indicates the context of the current screen.
Destroy a recording instance.
- Output settings
Action Sample code Set output parameters for the recorded video.
AliyunIRecorder.setMediaInfo(MediaInfo mediaInfo);// For more information about the related parameters, see MediaInfo in the SDK documentation.
Set the output path.
Set the quality of the recorded video.
Set the bitrate of the recorded video.
AliyunIRecorder.setVideoBitrate(int bitrate);// Unit: Kbit/s.
Set the group of pictures (GOP) size of the recorded video.
AliyunIRecorder.setGop(int gop);// Unit: frames.
|Set the recording callback.||
|Set the callback for video frame collection.||
|Set the audio collection callback.||
|Start the preview.||
|Stop the preview.||
Configure and manage recording
- Configure recording
Action Sample code Obtain the number of cameras.
Set the camera type.
Set the camera preview parameters, including the flash mode, focus mode, zoom factor, and exposure value.
AliyunIRecorder.setCameraParam(CameraParam cameraParam);// You can also separately set the parameters. For more information, see the following methods.
Switch between the front and rear cameras.
Set the flash mode.
Set the zoom factor.
Set the exposure value.
Set the focus mode.
Set the manual focus point.
AliyunIRecorder.setFocus(float xRatio, float yRatio);
Set the preview view.
Set the sensor rotation angle. This configuration is very important. We recommend that you carefully read the SDK documentation.
Set the face detection angle. This configuration is very important. We recommend that you carefully read the SDK documentation.
Set the video recording angle. This configuration is very important. We recommend that you carefully read the SDK documentation.
Specify whether to mute the audio during recording.
- Manage recording
Action Sample code Obtain the clip manager.
Set the maximum recording duration, which is the maximum duration of all video clips instead of a single video clip.
Set the minimum recording duration, which is the minimum duration of all video clips instead of a single video clip.
Obtain the total duration of video clips.
Obtain the total number of video clips.
Delete the last video clip.
Delete the specified video clip.
Delete all video clips.
Obtain the paths of video clips.
Action Sample code Set the beautification level.
Enable or disable beautification.
- Common filter
Action Sample code Add a common filter.
AliyunIRecorder.applyFilter(EffectFilter effectFilter);// You can remove a common filter by setting its path to null.
Remove a common filter.
- Animated filter
Action Sample code Add an animated filter, such as the filter that provides the effect of spirit freed from the body.
Remove an animated filter.
- Facial recognition (supported only in Professional Edition)
Action Sample code Set face coordinates. The coordinates are required by third-party facial recognition products.
Specify whether to use the built-in facial recognition feature of the SDK.
Specify a model file to use the built-in facial recognition feature of the SDK.
Set the maximum number of faces that can be recognized by using the built-in facial recognition feature of the SDK.
- Animated sticker (supported only in Professional Edition)
Action Sample code Add an animated face sticker.
Add a common animated sticker.
AliyunIRecorder.addPaster(EffectPaster effectPaster,float sx,float sy,float sw,float sh,float rotation,boolean flip);
Remove an animated sticker.
- Static watermark and static sticker
Action Sample code Add a static watermark or static sticker.
Remove a static watermark or static sticker.
- Background music (supported in Professional Edition and Standard Edition)
Action Sample code Set the background music.
AliyunIRecorder.setMusic(String path,long startTime,long duration);
Remove the background music.
AliyunIRecorder.setMusic(null, 0, 0);
- Speed adjustment (supported in Professional Edition and Standard Edition)
Action Sample code Set the recording speed.
- Custom rendering
Action Sample code Set the callback for custom rendering.
- Photo taking
Action Sample code Take a photo with effects.
Take a photo by using the system camera feature. In this case, a photo is taken without effects.
Set the photo size. This method is supported only when you use the system camera feature to take a photo.
Action Sample code Configure the effect information, including the position and size of a watermark, a static sticker, or an animated sticker.
AliyunIRecorder.setEffectView(float xRatio,float yRatio,float widthRatio,float heightRatio,EffectBase effectBase);
|Start recording a video clip.||
|Cancel recording a video clip.||
|Stop recording a video clip.||
|Stop the recording and merge the recorded video clips into one video.||
|Stop the recording and generate the configuration information of the recorded video clips without merging the video clips.||