public interface AliyunIRecorder
限定符和类型 | 方法和说明 |
---|---|
int |
addImage(EffectImage effctImage)
Adds a watermark image.
|
int |
addPaster(EffectPaster effectPaster)
Adds a face sticker.
|
int |
addPaster(EffectPaster effectPaster,
float sx,
float sy,
float sw,
float sh,
float rotation,
boolean flip)
Adds a sticker.
|
int |
applyAnimationFilter(EffectFilter effectFilter)
Applies an animated filter.
|
int |
applyFilter(EffectFilter effectFilter)
Applies a filter.
|
int |
applyMv(EffectBean effectMv)
已过时。
|
void |
cancelRecording()
Cancels recording.
|
void |
destroy()
Releases resources.
|
int |
finishRecording()
Stops recording and starts the composition process.
|
android.net.Uri |
finishRecordingForEdit()
Stops recording and saves information about recorded clips into a JSON file.
|
com.aliyun.log.struct.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.
|
java.util.List<android.hardware.Camera.Size> |
getSupportedPictureSize()
Gets the picture sizes supported by the camera.
|
java.util.SortedSet<com.aliyun.common.utils.Size> |
getSupportedPictureSizes() |
void |
needFaceTrackInternal(boolean need)
Sets whether to enable facial recognition.
|
void |
pauseMv()
已过时。
|
int |
postToGl(java.lang.Runnable r)
已过时。
|
void |
removeAnimationFilter(EffectFilter effctFilter)
Removes an animated filter.
|
int |
removeFromGl(java.lang.Runnable r)
已过时。
|
void |
removeImage(EffectImage effctImage)
Removes a watermark image.
|
void |
removePaster(EffectPaster effectPaster)
Removes a sticker.
|
int |
resizePreviewSize(int width,
int height)
Sets the size of the surface view.
|
void |
restartMv()
已过时。
|
void |
resumeMv()
已过时。
|
void |
setBeautyLevel(int level)
Sets the beauty level.
|
void |
setBeautyStatus(boolean on)
Enables or disables beauty mode.
|
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(android.view.SurfaceView displayView)
Sets the
SurfaceView during preview. |
int |
setEffectView(float xRatio,
float yRatio,
float widthRatio,
float heightRatio,
EffectBase effectBase)
Sets sticker parameters, such as the position and size of the sticker.
|
void |
setEncoderInfoCallback(EncoderInfoCallback callback)
Sets the callback that outputs encoder parameters.
|
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(android.graphics.Point point)
已过时。
|
void |
setFocusMode(int mode)
Sets the focus mode.
|
int |
setGop(int gop)
Sets the GOP size in frames, that is, the number of frames between two I-frames.
|
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 startTime,
long duration)
Sets the background music during recording.
|
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 |
setOnFaceDetectInfoListener(OnFaceDetectInfoListener listener)
Sets the callback that outputs facial recognition data.
|
void |
setOnFrameCallback(OnFrameCallBack callback)
Sets the callback that outputs frame data.
|
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(android.hardware.Camera.Size size)
Sets the picture size.
|
int |
setPictureSize(com.aliyun.common.utils.Size size)
Sets the picture size.
|
int |
setProperty(java.lang.String key,
java.lang.String value) |
void |
setRate(float rate)
Sets the recording speed.
|
void |
setRecordCallback(RecordCallback callback)
Sets the recording callback.
|
void |
setRecordCallBack(RecordCallback callBack)
已过时。
|
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)
Sets the video bitrate.
|
int |
setVideoFlipH(boolean flip) |
void |
setVideoQuality(VideoQuality quality)
Sets the video quality.
|
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)
Takes a picture that captures all effects.
|
void |
takePicture(boolean needBitmap)
Takes a picture that captures no 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
- void setVideoQuality(VideoQuality quality)
quality
- The quality of the video.VideoQuality
int setGop(int gop)
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.int setVideoBitrate(int bitrate)
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(android.view.SurfaceView displayView)
SurfaceView
during preview.displayView
- void setCameraCaptureDataMode(int captureDataMode)
captureDataMode
- com.aliyun.svideosdk.common.struct.recorder
int startPreview()
Activity.onResume()
.void stopPreview()
Activity.onPause()
.void destroy()
int addPaster(EffectPaster effectPaster)
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
int addPaster(EffectPaster effectPaster, float sx, float sy, float sw, float sh, float rotation, boolean flip)
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)
void removePaster(EffectPaster effectPaster)
effectPaster
- int addImage(EffectImage effctImage)
setEffectView(float, float, float, float, EffectBase)
to adjust the position of the watermark.effctImage
- void removeImage(EffectImage effctImage)
effctImage
- int applyFilter(EffectFilter effectFilter)
effectFilter
- null indicates remove all filters.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
- @Deprecated int applyMv(EffectBean effectMv)
effectMv
- EffectBean
@Deprecated void pauseMv()
@Deprecated void resumeMv()
@Deprecated void restartMv()
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
void setMusic(java.lang.String path, long startTime, long duration)
path
- The path of the music file.startTime
- The music start time. Unit: milliseconds.duration
- The duration of the music. Unit: milliseconds.void setRate(float rate)
rate
- Valid values: [0.5, 2.0]void setMute(boolean isMute)
isMute
- Whether to mute the recording.@Deprecated void setFocus(android.graphics.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.void setBeautyStatus(boolean on)
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()
android.net.Uri finishRecordingForEdit()
int setEffectView(float xRatio, float yRatio, float widthRatio, float heightRatio, EffectBase effectBase)
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 setRecordCallback(RecordCallback callback)
callback
- RecordCallback
void setEncoderInfoCallback(EncoderInfoCallback callback)
callback
- EncoderInfoCallback
void setRecordCallBack(RecordCallback callBack)
setRecordCallback(com.aliyun.svideosdk.recorder.RecordCallback)
.callBack
- The callback.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)
void setRecordRotation(int rotation)
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()
void takePhoto(boolean needBitmap)
RecordCallback.onPictureBack(Bitmap)
or RecordCallback.onPictureDataBack(byte[])
to return the picture.needBitmap
- Whether to generate a bitmap image.void takePicture(boolean needBitmap)
RecordCallback.onPictureBack(Bitmap)
or RecordCallback.onPictureDataBack(byte[])
to return the picture.needBitmap
- 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<android.hardware.Camera.Size> getSupportedPictureSize()
java.util.SortedSet<com.aliyun.common.utils.Size> getSupportedPictureSizes()
int setPictureSize(android.hardware.Camera.Size size)
size
- int setPictureSize(com.aliyun.common.utils.Size size)
size
- com.aliyun.log.struct.AliyunLogInfo getAliyunLogInfo()
@Deprecated int postToGl(java.lang.Runnable r)
r
- AliyunErrorCode.OK
if the invocation is successful.
AliyunErrorCode.ERROR_INVALID_STATE
if the invocation fails.@Deprecated int removeFromGl(java.lang.Runnable r)
r
- AliyunErrorCode.OK
if the invocation is successful.
AliyunErrorCode.ERROR_INVALID_STATE
if the invocation fails.int startPreviewAfterTakePicture()
int resizePreviewSize(int width, int height)
width
- The width of the surface view.height
- The height of the surface view.int setProperty(java.lang.String key, java.lang.String value)
key
- the key setted.value
- the value corresponding the above keyint setVideoFlipH(boolean flip)