modify based on TMG conclusion and update some api comments

Signed-off-by: magekkkk <lixin113@huawei.com>
This commit is contained in:
AOL 2022-03-16 03:23:36 +00:00 committed by Gitee
parent f636a72c6b
commit d27c0017e2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 724 additions and 377 deletions

View File

@ -24,33 +24,50 @@ declare namespace audio {
/**
* Obtains an AudioManager instance.
* @return AudioManager object.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Core
*/
function getAudioManager(): AudioManager;
/**
* Creates a AudioCapturer instance.
* @param options All options used for audio capturer.
* @return AudioCapturer instance.
* Obtains an AudioCapturer instance. This method uses an asynchronous callback to return the capturer instance.
* @param options Capturer configurations.
* @param callback Callback used to return the audio capturer instance.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Capturer
*/
function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<AudioCapturer>): void;
/**
* Obtains an AudioCapturer instance. This method uses a promise to return the capturer instance.
* @param options Capturer configurations.
* @return Promise used to return the audio capturer instance.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Capturer
*/
function createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer>;
/**
* Creates a AudioRenderer instance.
* @param options All options used for audio renderer.
* @return AudioRenderer instance.
* Obtains an AudioRenderer instance. This method uses an asynchronous callback to return the renderer instance.
* @param options Renderer configurations.
* @param callback Callback used to return the audio renderer instance.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback<AudioRenderer>): void;
/**
* Obtains an AudioRenderer instance. This method uses a promise to return the renderer instance.
* @param options Renderer configurations.
* @return Promise used to return the audio renderer instance.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
function createAudioRenderer(options: AudioRendererOptions): Promise<AudioRenderer>;
/**
* Enumerates the rendering states of the current device.
* Enumerates the audio states.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -62,7 +79,7 @@ declare namespace audio {
*/
STATE_INVALID = -1,
/**
* Create New instance state.
* Create new instance state.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -106,25 +123,25 @@ declare namespace audio {
*/
enum AudioVolumeType {
/**
* Audio streams for voice calls
* Audio streams for voice calls.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Volume
*/
VOICE_CALL = 0,
/**
* Audio streams for ring tones
* Audio streams for ringtones.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Volume
*/
RINGTONE = 2,
/**
* Audio streams for media purpose
* Audio streams for media purpose.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Volume
*/
MEDIA = 3,
/**
* Audio stream for voice assistant
* Audio stream for voice assistant.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Volume
*/
@ -138,19 +155,19 @@ declare namespace audio {
*/
enum DeviceFlag {
/**
* Output devices
* Output devices.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
OUTPUT_DEVICES_FLAG = 1,
/**
* Input devices
* Input devices.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
INPUT_DEVICES_FLAG = 2,
/**
* All devices
* All devices.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
@ -164,13 +181,13 @@ declare namespace audio {
*/
enum DeviceRole {
/**
* Input role
* Input role.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
INPUT_DEVICE = 1,
/**
* Output role
* Output role.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
@ -184,13 +201,13 @@ declare namespace audio {
*/
enum DeviceType {
/**
* Invalid device
* Invalid device.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
INVALID = 0,
/**
* A pair of built-in earpieces.
* Built-in earpiece.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
@ -214,19 +231,19 @@ declare namespace audio {
*/
WIRED_HEADPHONES = 4,
/**
* Bluetooth device using the synchronous connection oriented link (SCO)
* Bluetooth device using the synchronous connection oriented link (SCO).
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
BLUETOOTH_SCO = 7,
/**
* Bluetooth device using advanced audio distribution profile (A2DP)
* Bluetooth device using advanced audio distribution profile (A2DP).
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
BLUETOOTH_A2DP = 8,
/**
* Built-in microphone
* Built-in microphone.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
@ -240,19 +257,19 @@ declare namespace audio {
}
/**
* Enumerates Active device types.
* Enumerates the active device types.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
enum ActiveDeviceType {
/**
* Speaker
* Speaker.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
SPEAKER = 2,
/**
* Bluetooth device using the synchronous connection oriented link (SCO)
* Bluetooth device using the SCO link.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Device
*/
@ -260,25 +277,25 @@ declare namespace audio {
}
/**
* Enumerates Audio Ringer modes
* Enumerates ringer modes.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Communication
*/
enum AudioRingMode {
/**
* Silent mode
* Silent mode.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Communication
*/
RINGER_MODE_SILENT = 0,
/**
* Vibration mode
* Vibration mode.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Communication
*/
RINGER_MODE_VIBRATE = 1,
/**
* Normal mode
* Normal mode.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Communication
*/
@ -286,7 +303,7 @@ declare namespace audio {
}
/**
* Enumerates the sample format.
* Enumerates the audio sample formats.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -304,19 +321,19 @@ declare namespace audio {
*/
SAMPLE_FORMAT_U8 = 0,
/**
* Signed 16 low-end format.
* Signed 16 bit integer, little endian.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
SAMPLE_FORMAT_S16LE = 1,
/**
* Signed 24 low-end format.
* Signed 24 bit integer, little endian.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
SAMPLE_FORMAT_S24LE = 2,
/**
* Signed 32 low-end format.
* Signed 32 bit integer, little endian.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -330,13 +347,13 @@ declare namespace audio {
*/
enum AudioChannel {
/**
* First channel.
* Channel 1.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
CHANNEL_1 = 0x1 << 0,
/**
* Second channel.
* Channel 2.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -430,7 +447,7 @@ declare namespace audio {
*/
ENCODING_TYPE_INVALID = -1,
/**
* Raw pcm type.
* PCM encoding.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -514,31 +531,31 @@ declare namespace audio {
}
/**
* Interface for audio stream info
* Describes audio stream information.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
interface AudioStreamInfo {
/**
* Audio sampling rate
* Sampling rate.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
samplingRate: AudioSamplingRate;
/**
* Audio channels
* Audio channels.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
channels: AudioChannel;
/**
* Audio sample format
* Audio sample format.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
sampleFormat: AudioSampleFormat;
/**
* Audio encoding type
* Audio encoding type.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -546,25 +563,25 @@ declare namespace audio {
}
/**
* Interface for audio renderer info
* Describes audio renderer information.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
interface AudioRendererInfo {
/**
* Audio content type
* Content type.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
content: ContentType;
/**
* Audio stream usage
* Stream usage.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
usage: StreamUsage;
/**
* Audio renderer flags
* Audio renderer flags.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Core
*/
@ -572,19 +589,19 @@ declare namespace audio {
}
/**
* Interface for audio renderer options
* Describes audio renderer configuration options.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
interface AudioRendererOptions {
/**
* Audio stream info
* Stream information.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
streamInfo: AudioStreamInfo;
/**
* Audio renderer info
* Renderer information.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
@ -592,25 +609,25 @@ declare namespace audio {
}
/**
* Enum for audio renderer rate
* Enumerates the audio renderer rates.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
enum AudioRendererRate {
/**
* Normal rate
* Normal rate.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
RENDER_RATE_NORMAL = 0,
/**
* Double rate
* Double rate.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
RENDER_RATE_DOUBLE = 1,
/**
* Half rate
* Half rate.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
@ -618,20 +635,20 @@ declare namespace audio {
}
/**
* Enumerates audio interruption event types.
* Enumerates the interrupt types.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
enum InterruptType {
/**
* An audio interruption event starts.
* Audio playback interruption started.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_TYPE_BEGIN = 1,
/**
* An audio interruption event ends.
* Audio playback interruption ended.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
@ -639,47 +656,47 @@ declare namespace audio {
}
/**
* Enumerates the types of hints for audio interruption.
* Enumerates the interrupt hints.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
enum InterruptHint {
/**
* Audio no interrupt.
* None.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_HINT_NONE = 0,
/**
* Audio resumed.
* Resume the playback.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_HINT_RESUME = 1,
/**
* Audio paused.
* Paused/Pause the playback.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_HINT_PAUSE = 2,
/**
* Audio stopped.
* Stopped/Stop the playback.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_HINT_STOP = 3,
/**
* Audio ducking. (In ducking, the audio volume is reduced, but not silenced.)
* Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.)
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_HINT_DUCK = 4,
/**
* Audio unducking.
* Unducked the playback.
* @since 8
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
@ -687,50 +704,48 @@ declare namespace audio {
}
/**
* Interrupt force type.
* @since 8
* Enumerates the interrupt force types.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
* @systemapi
*/
enum InterruptForceType {
/**
* Force type, system change audio state.
* @since 8
* Forced action taken by system.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_FORCE = 0,
/**
* Share type, application change audio state.
* @since 8
* Share type, application can choose to take action or ignore.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
INTERRUPT_SHARE
}
/**
* Interrupt events
* @since 8
* Describes the interrupt event received by the app when playback is interrupted.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
interface InterruptEvent {
/**
* Interrupt event type, begin or end
* @since 8
* Indicates whether the interruption has started or finished.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
eventType: InterruptType;
/**
* Interrupt force type, force or share
* @since 8
* Indicates whether the action is taken by system or to be taken by the app.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
forceType: InterruptForceType;
/**
* Interrupt hint type. In force type, the audio state already changed,
* but in share mode, only provide a hint for application to decide.
* @since 8
* Indicates the kind of action.
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
*/
hintType: InterruptHint;
@ -814,20 +829,26 @@ declare namespace audio {
}
/**
* Manages audio volume and audio device information.
* Implements audio volume and audio device management.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Core
*/
interface AudioManager {
/**
* Sets volume for a stream. This method uses an asynchronous callback to return the execution result.
* Sets the volume for a stream. This method uses an asynchronous callback to return the result.
* @param volumeType Audio stream type.
* @param volume Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume.
* @param callback Callback used to return the result.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Volume
* @permission ohos.permission.ACCESS_NOTIFICATION_POLICY
*/
setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback<void>): void;
/**
* Sets volume for a stream. This method uses a promise to return the execution result.
* Sets the volume for a stream. This method uses a promise to return the result.
* @param volumeType Audio stream type.
* @param volume Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume.
* @return Promise used to return the result.
* @since 7
* @syscap SystemCapability.Multimedia.Audio.Volume
* @permission ohos.permission.ACCESS_NOTIFICATION_POLICY
@ -1409,9 +1430,8 @@ declare namespace audio {
* Subscribes for audio interrupt event callback.
* @param type Event type.
* @return InterruptEvent callback.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Audio.Renderer
* @systemapi
*/
on(type: 'interrupt', callback: Callback<InterruptEvent>): void;
/**

File diff suppressed because it is too large Load Diff

View File

@ -139,20 +139,20 @@ declare namespace image {
/**
* Enum for image formats.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
enum ImageFormat {
/**
* YCBCR422 semi-planar format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
YCBCR_422_SP = 1000,
/**
* JPEG encoding format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
JPEG = 2000
@ -160,35 +160,34 @@ declare namespace image {
/**
* The componet type of image.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @systemapi
*/
enum ComponentType {
/**
* Luma info.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
YUV_Y = 1,
/**
* Chrominance info.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
YUV_U = 2,
/**
* Chroma info.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
YUV_V = 3,
/**
* Jpeg type.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
JPEG = 4,
@ -373,35 +372,34 @@ declare namespace image {
/**
* Describes image color components.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @systemapi
*/
interface Component {
/**
* Component type.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
readonly componentType: ComponentType;
/**
* Row stride.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
readonly rowStride: number;
/**
* Pixel stride.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
readonly pixelStride: number;
/**
* Component buffer.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
readonly byteBuffer: ArrayBuffer;
@ -477,7 +475,7 @@ declare namespace image {
/**
* Creates an ImageReceiver instance.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @param width The default width in pixels of the Images that this receiver will produce.
* @param height The default height in pixels of the Images that this receiver will produce.
@ -485,7 +483,6 @@ declare namespace image {
* {@link ImageFormat} constants. Note that not all formats are supported, like ImageFormat.NV21.
* @param capacity The maximum number of images the user will want to access simultaneously.
* @return Returns the ImageReceiver instance if the operation is successful; returns null otherwise.
* @systemapi
*/
function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver;
@ -818,35 +815,34 @@ declare namespace image {
/**
* Provides basic image operations, including obtaining image information, and reading and writing image data.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @systemapi
*/
interface Image {
/**
* Sets or gets the image area to crop, default is size.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
clipRect: Region;
/**
* Image size.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
readonly size: Size;
/**
* Image format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
*/
readonly format: number;
/**
* Get component buffer from image and uses a callback to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param componentType The componet type of image.
* @param callback Callback used to return the component buffer.
@ -855,7 +851,7 @@ declare namespace image {
/**
* Get component buffer from image and uses a promise to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param componentType The componet type of image.
* @return A Promise instance used to return the component buffer.
@ -864,7 +860,7 @@ declare namespace image {
/**
* Release current image to receive another and uses a callback to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param callback Callback to return the operation result.
*/
@ -872,7 +868,7 @@ declare namespace image {
/**
* Release current image to receive another and uses a promise to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @return A Promise instance used to return the operation result.
*/
@ -881,28 +877,27 @@ declare namespace image {
/**
* Image receiver object.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @systemapi
*/
interface ImageReceiver {
/**
* Image size.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
readonly size: Size;
/**
* Image capacity.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
readonly capacity: number;
/**
* Image format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
*/
readonly format: ImageFormat;
@ -910,7 +905,7 @@ declare namespace image {
/**
* get an id which indicates a surface and can be used to set to Camera or other component can receive a surface
* and uses a callback to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @param callback Callback used to return the surface id.
*/
@ -919,7 +914,7 @@ declare namespace image {
/**
* get an id which indicates a surface and can be used to set to Camera or other component can receive a surface
* and uses a promise to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @return A Promise instance used to return the surface id.
*/
@ -927,7 +922,7 @@ declare namespace image {
/**
* Get lasted image from receiver and uses a callback to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @param callback Callback used to return the latest image.
*/
@ -935,7 +930,7 @@ declare namespace image {
/**
* Get lasted image from receiver and uses a promise to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @return A Promise instance used to return the latest image.
*/
@ -943,7 +938,7 @@ declare namespace image {
/**
* Get next image from receiver and uses a callback to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @param callback Callback used to return the next image.
*/
@ -951,7 +946,7 @@ declare namespace image {
/**
* Get next image from receiver and uses a promise to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @return A Promise instance used to return the next image.
*/
@ -959,7 +954,7 @@ declare namespace image {
/**
* Subscribe callback when receiving an image
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @param type Callback used to return the next image.
* @param callback Callback used to return image.
@ -968,7 +963,7 @@ declare namespace image {
/**
* Release image receiver instance and uses a callback to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @param callback Callback to return the operation result.
*/
@ -976,7 +971,7 @@ declare namespace image {
/**
* Release image receiver instance and uses a promise to return the result.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Image.ImageReceiver
* @return A Promise instance used to return the operation result.
*/

View File

@ -58,20 +58,18 @@ declare namespace media {
/**
* Creates an VideoRecorder instance.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @import import media from '@ohos.multimedia.media'
* @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise.
* @systemapi
*/
function createVideoRecorder(callback: AsyncCallback<VideoRecorder>): void;
/**
* Creates an VideoRecorder instance.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @import import media from '@ohos.multimedia.media'
* @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise.
* @systemapi
*/
function createVideoRecorder(): Promise<VideoRecorder>;
@ -610,23 +608,21 @@ declare namespace media {
/**
* Describes video recorder states.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @systemapi
*/
type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error';
/**
* Manages and record video. Before calling an VideoRecorder method, you must use createVideoRecorder()
* to create an VideoRecorder instance.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @systemapi
*/
interface VideoRecorder {
/**
* Prepares for recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param config Recording parameters.
* @param callback A callback instance used to return when prepare completed.
@ -634,7 +630,7 @@ declare namespace media {
prepare(config: VideoRecorderConfig, callback: AsyncCallback<void>): void;
/**
* Prepares for recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param config Recording parameters.
* @return A Promise instance used to return when prepare completed.
@ -642,84 +638,84 @@ declare namespace media {
prepare(config: VideoRecorderConfig): Promise<void>;
/**
* get input surface.it must be called between prepare completed and start.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback Callback used to return the input surface id in string.
*/
getInputSurface(callback: AsyncCallback<string>): void;
/**
* get input surface. it must be called between prepare completed and start.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return the input surface id in string.
*/
getInputSurface(): Promise<string>;
/**
* Starts video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback A callback instance used to return when start completed.
*/
start(callback: AsyncCallback<void>): void;
/**
* Starts video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return when start completed.
*/
start(): Promise<void>;
/**
* Pauses video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback A callback instance used to return when pause completed.
*/
pause(callback: AsyncCallback<void>): void;
/**
* Pauses video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return when pause completed.
*/
pause(): Promise<void>;
/**
* Resumes video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback A callback instance used to return when resume completed.
*/
resume(callback: AsyncCallback<void>): void;
/**
* Resumes video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return when resume completed.
*/
resume(): Promise<void>;
/**
* Stops video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback A callback instance used to return when stop completed.
*/
stop(callback: AsyncCallback<void>): void;
/**
* Stops video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return when stop completed.
*/
stop(): Promise<void>;
/**
* Releases resources used for video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback A callback instance used to return when release completed.
*/
release(callback: AsyncCallback<void>): void;
/**
* Releases resources used for video recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return when release completed.
*/
@ -728,7 +724,7 @@ declare namespace media {
* Resets video recording.
* Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
* you must call prepare() to set the recording configurations for another recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param callback A callback instance used to return when reset completed.
*/
@ -737,14 +733,14 @@ declare namespace media {
* Resets video recording.
* Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
* you must call prepare() to set the recording configurations for another recording.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @return A Promise instance used to return when reset completed.
*/
reset(): Promise<void>;
/**
* Listens for video recording error events.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @param type Type of the video recording error event to listen for.
* @param callback Callback used to listen for the video recording error event.
@ -753,7 +749,7 @@ declare namespace media {
/**
* video recorder state.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly state: VideoRecordState;
@ -1211,77 +1207,76 @@ declare namespace media {
/**
* Provides the video recorder profile definitions.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @systemapi
*/
interface VideoRecorderProfile {
/**
* Indicates the audio bit rate.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly audioBitrate: number;
/**
* Indicates the number of audio channels.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly audioChannels: number;
/**
* Indicates the audio encoding format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly audioCodec: CodecMimeType;
/**
* Indicates the audio sampling rate.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly audioSampleRate: number;
/**
* Indicates the output file format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly fileFormat: ContainerFormatType;
/**
* Indicates the video bit rate.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly videoBitrate: number;
/**
* Indicates the video encoding format.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly videoCodec: CodecMimeType;
/**
* Indicates the video width.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly videoFrameWidth: number;
/**
* Indicates the video height.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly videoFrameHeight: number;
/**
* Indicates the video frame rate.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
readonly videoFrameRate: number;
@ -1289,21 +1284,20 @@ declare namespace media {
/**
* Enumerates audio source type for recorder.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @import import media from '@ohos.multimedia.media'
* @systemapi
*/
enum AudioSourceType {
/**
* default audio source type.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
AUDIO_SOURCE_TYPE_DEFAULT = 0,
/**
* source type mic.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
AUDIO_SOURCE_TYPE_MIC = 1,
@ -1311,21 +1305,20 @@ declare namespace media {
/**
* Enumerates video source type for recorder.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @import import media from '@ohos.multimedia.media'
* @systemapi
*/
enum VideoSourceType {
/**
* surface raw data.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
VIDEO_SOURCE_TYPE_SURFACE_YUV = 0,
/**
* surface ES data.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
VIDEO_SOURCE_TYPE_SURFACE_ES = 1,
@ -1333,29 +1326,28 @@ declare namespace media {
/**
* Provides the video recorder configuration definitions.
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
* @systemapi
*/
interface VideoRecorderConfig {
/**
* audio source type, details see @AudioSourceType .
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
audioSourceType: AudioSourceType;
/**
* video source type, details see @VideoSourceType .
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
videoSourceType: VideoSourceType;
/**
* video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile .
* @since 8
* @since 9
* @syscap SystemCapability.Multimedia.Media.VideoRecorder
*/
profile:VideoRecorderProfile;
profile: VideoRecorderProfile;
/**
* video output uri.support two kind of uri now.
* format like: scheme + "://" + "context".