public interface AliyunIRecorder
Modifier and Type | Method and Description |
---|---|
int |
addImage(EffectImage effctImage)
Deprecated.
in v3.27.0 ,use
getPasterManager() instead. |
int |
addPaster(EffectPaster effectPaster)
Deprecated.
in v3.27.0 ,use
getPasterManager() instead. |
int |
addPaster(EffectPaster effectPaster,
float sx,
float sy,
float sw,
float sh,
float rotation,
boolean flip)
Deprecated.
in v3.27.0 ,use
getPasterManager() instead. |
int |
applyAnimationFilter(EffectFilter effectFilter)
Applies an animated filter.
|
int |
applyBackgroundMusic(EffectStream effectStream)
Added in v3.27.0
Sets the background music during recording.
|
int |
applyFilter(EffectFilter effectFilter)
Applies a filter.
|
void |
cancelRecording()
Cancels recording.
|
void |
destroy()
Deprecated.
in v3.27.0, use
release() instead. |
int |
finishRecording()
Stops recording and starts the composition process.
|
Uri |
finishRecordingForEdit()
Stops recording and saves information about recorded clips into a JSON file.
|
AliyunLogInfo |
getAliyunLogInfo()
Gets log information.
|
int |
getBeautyLevel()
Gets the beauty level.
|
int |
getCameraCount()
Gets the number of cameras.
|
AliyunIClipManager |
getClipManager()
Gets the clip manager.
|
float |
getCurrentExposureCompensationRatio()
Gets the current exposure level.
|
AliyunIRecordPasterManager |
getPasterManager()
Get sticker manager interface
|
java.util.List<Camera.Size> |
getSupportedPictureSize()
Gets the picture sizes supported by the camera.
|
java.util.SortedSet<Size> |
getSupportedPictureSizes() |
void |
needFaceTrackInternal(boolean need)
Sets whether to enable facial recognition.
|
void |
release()
Releases resources.
|
void |
removeAnimationFilter(EffectFilter effctFilter)
Removes an animated filter.
|
int |
removeBackgroundMusic()
remove the background music.
|
int |
removeFilter()
Added in v3.27.0
Remove a filter.
|
void |
removeImage(EffectImage effctImage)
Deprecated.
in v3.27.0 ,use
getPasterManager() instead. |
void |
removePaster(EffectPaster effectPaster)
Deprecated.
in v3.27.0 ,use
getPasterManager() instead. |
int |
resizePreviewSize(int width,
int height)
Sets the size of the surface view.
|
void |
setBeautyLevel(int level)
Sets the beauty level.
|
void |
setBeautyStatus(boolean on)
Deprecated.
in v3.27.0, use
setBeautyLevel(int) instead. |
void |
setCamera(CameraType camera)
Sets the camera during preview.
|
void |
setCameraCaptureDataMode(int captureDataMode)
Sets the data capture method during preview.
|
void |
setCameraParam(CameraParam cameraParam)
Sets camera parameters during preview.
|
void |
setDisplayView(SurfaceView displayView)
Sets the
SurfaceView during preview. |
int |
setEffectView(float xRatio,
float yRatio,
float widthRatio,
float heightRatio,
EffectBase effectBase)
Deprecated.
in v3.27.0 ,use
getPasterManager() instead. |
int |
setExposureCompensationRatio(float value)
Sets the exposure level.
|
void |
setFaceDetectRotation(int rotation)
Sets the rotation angle of the gyro sensor when performing facial recognition.
|
int |
setFaces(float[][] faces)
Sets the coordinate points to define faces.
|
void |
setFaceTrackInternalMaxFaceCount(int maxFaceCount)
Sets the maximum number of faces that can be recognized at the same time.
|
int |
setFaceTrackInternalModelPath(java.lang.String path)
Sets the path to facial recognition models.
|
void |
setFocus(float xRatio,
float yRatio)
Sets the focus point.
|
void |
setFocus(Point point)
Deprecated.
|
void |
setFocusMode(int mode)
Sets the focus mode.
|
int |
setGop(int gop)
Deprecated.
in v3.27.0, use
setMediaInfo(MediaInfo) instead. |
void |
setIsAutoClearClipVideos(boolean isAutoClear) |
boolean |
setLight(FlashType flashType)
Sets the flash mode.
|
void |
setMediaInfo(MediaInfo mediaInfo)
Sets the media information during recording.
|
void |
setMusic(java.lang.String path,
long startTimeMills,
long durationMills)
Deprecated.
in v3.27.0, use
applyBackgroundMusic(EffectStream) instead. |
void |
setMute(boolean isMute)
Sets whether to mute the recording.
|
void |
setOnAudioCallback(OnAudioCallBack callback)
Sets the callback that outputs audio data in 44.1 kHz 16-bit mono PCM format.
|
void |
setOnChoosePictureSizeCallBack(OnChoosePictureSizeCallback callback)
Sets the callback that outputs the image resolution.
|
void |
setOnEncoderInfoCallback(OnEncoderInfoCallback callback)
Modified in v3.27.0 : setEncoderInfoCallback -> setOnEncoderInfoCallback
Sets the callback that outputs encoder parameters.
|
void |
setOnFaceDetectInfoListener(OnFaceDetectInfoListener listener)
Sets the callback that outputs facial recognition data.
|
void |
setOnFrameCallback(OnFrameCallback callback)
Sets the callback that outputs frame data.
|
void |
setOnRecordCallback(OnRecordCallback callback)
Modified in v3.27.0 : setRecordCallback -> setOnRecordCallback
Sets the recording callback.
|
void |
setOnTextureIdCallback(OnTextureIdCallback callback)
Sets the callback that outputs the texture on every frame.
|
int |
setOutputPath(java.lang.String path)
Sets the output path.
|
int |
setPictureSize(Camera.Size size)
Sets the picture size.
|
int |
setPictureSize(Size size)
Sets the picture size.
|
void |
setRate(float rate)
Sets the recording speed.
|
void |
setRecordRotation(int rotation)
Sets the rotation angle of the gyro sensor during recording.
|
void |
setRotation(int rotation)
Sets the rotation angle of the gyro sensor.
|
void |
setShutterSound(boolean bNeedShutterSound)
Sets whether to turn on the shutter sound.
|
void |
setTakePicturePreview(boolean bPreviewAfterPicture)
Sets whether to start preview after taking a picture.
|
int |
setVideoBitrate(int bitrate)
Deprecated.
in v3.27.0, use
setMediaInfo(MediaInfo) instead. |
int |
setVideoFlipH(boolean flip) |
void |
setVideoQuality(VideoQuality quality)
Deprecated.
in v3.27.0, use
setMediaInfo(MediaInfo) instead. |
int |
setZoom(float rate)
Sets the zoom level.
|
int |
startPreview()
Starts preview.
|
int |
startPreviewAfterTakePicture()
Use this method to start preview after taking a picture.
|
int |
startRecording()
Starts recording.
|
void |
stopPreview()
Stops preview.
|
int |
stopRecording()
Stops recording.
|
int |
switchCamera()
Switches cameras.
|
FlashType |
switchLight()
Switches flash modes.
|
void |
takePhoto(boolean needBitmap)
Deprecated.
in v3.27.0, use
takeSnapshot(boolean, OnPictureCallback) instead.
This is an asynchronous method. Call RecordCallback.onPictureBack(Bitmap)
or RecordCallback.onPictureDataBack(byte[]) to return the picture. |
void |
takePicture(boolean needBitmap)
Deprecated.
in v3.27.0, use
takePicture(boolean, OnPictureCallback) instead.
This is an asynchronous method. Call RecordCallback.onPictureBack(Bitmap)
or RecordCallback.onPictureDataBack(byte[]) to return the picture. |
void |
takePicture(boolean needBitmap,
OnPictureCallback pictureCallback)
Added in v3.27.0
Takes a picture that captures no effects.
|
void |
takeSnapshot(boolean needBitmap,
OnPictureCallback pictureCallback)
Added in v3.27.0
Takes a picture that captures all effects.
|
int |
updateAnimationFilter(EffectFilter effectFilter)
update an animated filter.
|
java.lang.String |
version()
Gets the SDK version.
|
void setMediaInfo(MediaInfo mediaInfo)
mediaInfo
- MediaInfo
AliyunIClipManager getClipManager()
AliyunIClipManager
int setOutputPath(java.lang.String path)
path
- @Deprecated void setVideoQuality(VideoQuality quality)
setMediaInfo(MediaInfo)
instead.quality
- The quality of the video.VideoQuality
@Deprecated int setGop(int gop)
setMediaInfo(MediaInfo)
instead.gop
- Valid values: [0, 9,000] When this parameter is set to 0, full I-frames may be possible depending on the device type.AliyunErrorCode.OK
if the invocation is successful.
AliyunErrorCode.ERROR_INVALID_ARGUMENTS
if the GOP parameter is invalid.@Deprecated int setVideoBitrate(int bitrate)
setMediaInfo(MediaInfo)
instead.bitrate
- AliyunErrorCode.ERROR_INVALID_ARGUMENTS
if the specified bitrate is invalid.void setCamera(CameraType camera)
switchCamera()
to switch cameras.camera
- CameraType.BACK
,
CameraType.FRONT
void setDisplayView(SurfaceView displayView)
SurfaceView
during preview.displayView
- void setCameraCaptureDataMode(int captureDataMode)
captureDataMode
- CameraCaptureDataMode
int startPreview()
Activity#onResume()
.void stopPreview()
Activity#onPause()
.@Deprecated void destroy()
release()
instead.void release()
Added in v3.27.0
@Deprecated int addPaster(EffectPaster effectPaster)
getPasterManager()
instead.setRotation(int)
must be invoked to add face stickers. For details about calculating the rotation parameter, see the demo.
Use this method to add face stickers only. To add other stickers, call addPaster(EffectPaster, float, float, float, float, float, boolean)
.effectPaster
- EffectPaster
@Deprecated int addPaster(EffectPaster effectPaster, float sx, float sy, float sw, float sh, float rotation, boolean flip)
getPasterManager()
instead.setEffectView(float, float, float, float, EffectBase)
and this method can be used to add multiple effects.effectPaster
- sx
- The x coordinate of the sticker relative to the video resolution.sy
- The x coordinate of the sticker relative to the video resolution.sw
- The width of the sticker relative to the video resolution.sh
- The height of the sticker relative to the video resolution.rotation
- The rotation angle of the sticker.flip
- Whether to flip the sticker.setEffectView(float, float, float, float, EffectBase)
@Deprecated void removePaster(EffectPaster effectPaster)
getPasterManager()
instead.effectPaster
- AliyunIRecordPasterManager getPasterManager()
Added in v3.27.0
AliyunIRecordPasterManager
@Deprecated int addImage(EffectImage effctImage)
getPasterManager()
instead.setEffectView(float, float, float, float, EffectBase)
to adjust the position of the watermark.effctImage
- @Deprecated void removeImage(EffectImage effctImage)
getPasterManager()
instead.effctImage
- int applyFilter(EffectFilter effectFilter)
effectFilter
- null indicates remove all filters.int removeFilter()
Added in v3.27.0 Remove a filter.
int applyAnimationFilter(EffectFilter effectFilter)
EffectBase.setPath(String)
and use the path of the filter as the input parameter.
Alternatively, call EffectFilter.Builder
to create the filter object.effectFilter
- int updateAnimationFilter(EffectFilter effectFilter)
EffectBase.setPath(String)
and use the path of the filter as the input parameter.
Alternatively, call EffectFilter.Builder
to create the filter object.effectFilter
- void removeAnimationFilter(EffectFilter effctFilter)
effctFilter
- int getCameraCount()
void setCameraParam(CameraParam cameraParam)
cameraParam
- CameraParam
int switchCamera()
FlashType switchLight()
FlashType.AUTO
,
FlashType.OFF
,
FlashType.ON
boolean setLight(FlashType flashType)
flashType
- int setZoom(float rate)
rate
- int setExposureCompensationRatio(float value)
value
- void setFocusMode(int mode)
mode
- CameraParam.FOCUS_MODE_CONTINUE
,
CameraParam.FOCUS_MODE_AUTO
@Deprecated void setMusic(java.lang.String path, long startTimeMills, long durationMills)
applyBackgroundMusic(EffectStream)
instead.path
- The path of the music file.startTimeMills
- The music start time. Unit: milliseconds.durationMills
- The duration of the music. Unit: milliseconds.int applyBackgroundMusic(EffectStream effectStream)
Added in v3.27.0 Sets the background music during recording.
effectStream
- The music beanint removeBackgroundMusic()
Added in v3.27.0
void setRate(float rate)
rate
- Valid values: [0.5, 2.0]void setMute(boolean isMute)
isMute
- Whether to mute the recording.@Deprecated void setFocus(Point point)
setFocus(float xRatio, float yRatio)
Sets the focus point.point
- void setFocus(float xRatio, float yRatio)
setFocusMode(int)
is set to CameraParam.FOCUS_MODE_AUTO
.xRatio
- The x coordinate of the focus point relative to the surface view.yRatio
- The y coordinate of the focus point relative to the surface view.int getBeautyLevel()
void setBeautyLevel(int level)
level
- Valid values: [0, 100]. A value of 0 indicates disable beauty mode.@Deprecated void setBeautyStatus(boolean on)
setBeautyLevel(int)
instead.on
- A value of true indicates enable beauty mode. A value of false indicates disable beauty mode.int startRecording()
int stopRecording()
int finishRecording()
void cancelRecording()
Uri finishRecordingForEdit()
@Deprecated int setEffectView(float xRatio, float yRatio, float widthRatio, float heightRatio, EffectBase effectBase)
getPasterManager()
instead.xRatio
- The x coordinate of the sticker relative to the video resolution.yRatio
- The y coordinate of the sticker relative to the video resolution.widthRatio
- The width of the sticker relative to the video resolution.heightRatio
- The height of the sticker relative to the video resolution.effectBase
- The sticker.void setOnRecordCallback(OnRecordCallback callback)
callback
- OnRecordCallback
void setOnEncoderInfoCallback(OnEncoderInfoCallback callback)
callback
- OnEncoderInfoCallback
void setOnFrameCallback(OnFrameCallback callback)
callback
- OnFrameCallback
void setOnChoosePictureSizeCallBack(OnChoosePictureSizeCallback callback)
callback
- void setOnAudioCallback(OnAudioCallBack callback)
callback
- int setFaces(float[][] faces)
faces
- Represented by a 2D array of size N*6.
point[i][0] => LEFT_EYE_X
point[i][1] => LEFT_EYE_Y
point[i][2] => RIGHT_EYE_X
point[i][3] => RIGHT_EYE_Y
point[i][4] => MOUTH_X
point[i][5] => MOUTH_Y
The above example defines the six features of face i.void setRotation(int rotation)
private int getSensorRotation() { int orientation = orientationDetector.getOrientation(); int rotation = 90; if (orientation >= 45 && orientation < 135) { rotation = 180; } if (orientation >= 135 && orientation < 225) { rotation = 270; } if (orientation >= 225 && orientation < 315) { rotation = 0; } if (mCameraType == CameraType.FRONT) { if (rotation != 0) { rotation = 360 - rotation; } } return rotation; }
rotation
- Do not use this method to control the angle when performing facial recognition or recording.setFaceDetectRotation(int)
,
setRecordRotation(int)
void setFaceDetectRotation(int rotation)
setRecordRotation(int)
,
setRotation(int)
void setRecordRotation(int rotation)
if (rotation == 90 || rotation == 270) { rotation = (rotation + 90) % 360; if (mAliyunCamera.getCameraInfo().facing == CameraInfo.CAMERA_FACING_BACK) { rotation += 180; rotation %= 360; } } else if (rotation == 0 || rotation == 180) { rotation = (rotation + 270) % 360; }
setRotation(int)
,
setFaceDetectRotation(int)
void setOnTextureIdCallback(OnTextureIdCallback callback)
callback
- OnTextureIdCallback
void setOnFaceDetectInfoListener(OnFaceDetectInfoListener listener)
OnFaceDetectInfoListener.onFaceInfoChange(FaceDetectInfo)
is invoked when changes in facial recognition data are detected.listener
- float getCurrentExposureCompensationRatio()
@Deprecated void takePhoto(boolean needBitmap)
takeSnapshot(boolean, OnPictureCallback)
instead.
This is an asynchronous method. Call RecordCallback.onPictureBack(Bitmap)
or RecordCallback.onPictureDataBack(byte[])
to return the picture.needBitmap
- Whether to generate a bitmap image.@Deprecated void takePicture(boolean needBitmap)
takePicture(boolean, OnPictureCallback)
instead.
This is an asynchronous method. Call RecordCallback.onPictureBack(Bitmap)
or RecordCallback.onPictureDataBack(byte[])
to return the picture.needBitmap
- void takePicture(boolean needBitmap, OnPictureCallback pictureCallback)
Added in v3.27.0
Takes a picture that captures no effects. This is an asynchronous method. Call OnPictureCallback.onPicture(Bitmap, byte[])
to return the picture.
needBitmap
- void takeSnapshot(boolean needBitmap, OnPictureCallback pictureCallback)
Added in v3.27.0
Takes a picture that captures all effects. This is an asynchronous method. Call OnPictureCallback.onPicture(Bitmap, byte[])
to return the picture.
needBitmap
- Whether to generate a bitmap image.void needFaceTrackInternal(boolean need)
need
- int setFaceTrackInternalModelPath(java.lang.String path)
path
- AliyunErrorCode.OK
if the invocation is successful.
AliyunErrorCode.ERROR_INVALID_ARGUMENTS
if the invocation fails, the path is invalid, or the model files are damaged.void setFaceTrackInternalMaxFaceCount(int maxFaceCount)
maxFaceCount
- void setShutterSound(boolean bNeedShutterSound)
bNeedShutterSound
- true indicates turn on the shutter sound. false indicates turn off the shutter sound.
Default value: true.void setTakePicturePreview(boolean bPreviewAfterPicture)
bPreviewAfterPicture
- true indicates start preview. false indicates load the newly taken picture on the screen.
Default value: true.java.lang.String version()
java.util.List<Camera.Size> getSupportedPictureSize()
java.util.SortedSet<Size> getSupportedPictureSizes()
int setPictureSize(Camera.Size size)
size
- int setPictureSize(Size size)
size
- AliyunLogInfo getAliyunLogInfo()
int startPreviewAfterTakePicture()
int resizePreviewSize(int width, int height)
width
- The width of the surface view.height
- The height of the surface view.int setVideoFlipH(boolean flip)
void setIsAutoClearClipVideos(boolean isAutoClear)