From 6f5ce2e4f852613ec21af81115aa4e991ef5cc3c Mon Sep 17 00:00:00 2001 From: xxb-wzy Date: Tue, 20 Sep 2022 17:07:54 +0800 Subject: [PATCH 1/4] Signed-off-by: xxb-wzy Change-Id: I39a521faa16541fe1d89192c55dce109402ae99f --- api/@ohos.multimedia.media.d.ts | 832 +++++++++++++++++++++++--------- 1 file changed, 598 insertions(+), 234 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 9d9547f180..62409f2b28 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -23,7 +23,7 @@ import audio from "./@ohos.multimedia.audio"; */ declare namespace media { /** - * Creates an AudioPlayer instance. + * Creates an AudioPlayer instance, it will be deprecated after API10, use @createAVPlayer to replace. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' @@ -32,7 +32,7 @@ declare namespace media { function createAudioPlayer(): AudioPlayer; /** - * Creates an AudioRecorder instance. + * Creates an AudioRecorder instance, it will be deprecated after API10, use @createAVRecorder to replace. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' @@ -41,7 +41,7 @@ declare namespace media { function createAudioRecorder(): AudioRecorder; /** - * Creates an VideoPlayer instance. + * Creates an VideoPlayer instance, it will be deprecated after API10, use @createAVPlayer to replace. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' @@ -49,7 +49,7 @@ declare namespace media { */ function createVideoPlayer(callback: AsyncCallback): void; /** - * Creates an VideoPlayer instance. + * Creates an VideoPlayer instance, it will be deprecated after API10, use @createAVPlayer to replace. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' @@ -58,24 +58,44 @@ declare namespace media { function createVideoPlayer() : Promise; /** - * Creates an VideoRecorder instance. + * Creates an AVPlayer instance. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVPlayer * @import import media from '@ohos.multimedia.media' - * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + * @return callback Callback used to return an AVPlayer instance if the operation is successful; returns null otherwise. */ - function createVideoRecorder(callback: AsyncCallback): void; + function createAVPlayer(callback: AsyncCallback): void; + + /** + * Creates an AVPlayer instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @import import media from '@ohos.multimedia.media' + * @return A Promise instance used to return an AVPlayer instance if the operation is successful; returns null otherwise. + */ + function createAVPlayer() : Promise; + /** - * Creates an VideoRecorder instance. + * Creates an AVRecorder instance. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder * @import import media from '@ohos.multimedia.media' - * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. + * @return callback Callback used to return an AVRecorder instance if the operation is successful; returns null otherwise. */ - function createVideoRecorder(): Promise; + function createAVRecorder(callback: AsyncCallback): void; /** - * Enumerates ErrorCode types, return in BusinessError::code + * Creates an AVRecorder instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @import import media from '@ohos.multimedia.media' + * @return A Promise instance used to return an AVRecorder instance if the operation is successful; returns null otherwise. + */ + function createAVRecorder() : Promise; + + /** + * Enumerates ErrorCode types, return in BusinessError::code, it will be deprecated after API10, + * see ErrorCode in wiki. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' @@ -215,7 +235,482 @@ declare namespace media { } /** - * Describes audio playback states. + * Enumerates state change reason. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.Core + * @import import media from '@ohos.multimedia.media' + */ + enum StateChangeReason { + /** + * state change by user operation + * @since 9 + * @syscap SystemCapability.Multimedia.Media.Core + */ + USER = 1, + + /** + * state change by system manager + * @since 9 + * @syscap SystemCapability.Multimedia.Media.Core + */ + SYSTEM = 2, + } + + /** + * Describes media playback states. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @import import media from '@ohos.multimedia.media' + */ + type AVPlayerState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'released' | 'error'; + + /** + * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer() + * to create an AVPlayer instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + interface AVPlayer { + /** + * prepare video playback, it will request resource for playing. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param callback A callback instance used to return when prepare completed. + */ + prepare(callback: AsyncCallback): void; + /** + * prepare video playback, it will request resource for playing. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @return A Promise instance used to return when prepare completed. + */ + prepare(): Promise; + + /** + * Starts media playback. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + play(): void; + + /** + * Pauses media playback. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + pause(): void; + + /** + * Stops media playback. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + stop(): void; + + /** + * Resets media playback. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + reset(): void; + + /** + * Jumps to the specified playback position. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param timeMs Playback position to jump + * @param mode seek mode, see @SeekMode . + * @throws {BusinessError} if type of timeMs is not number or type of timeMs is not SeekMode + * or timeMs is out of [0, 2147483647]. + */ + seek(timeMs: number, mode?:SeekMode): void; + + /** + * Sets the volume. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @throws {BusinessError} if type of vol is not number or vol is out of [0.00, 1.00] + */ + setVolume(vol: number): void; + + /** + * Releases resources used for AVPlayer. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param callback A callback instance used to return when release completed. + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for AVPlayer. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @return A Promise instance used to return when release completed. + */ + release(): Promise; + + /** + * get all track infos in MediaDescription, should be called after data loaded callback. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param callback async callback return track info in MediaDescription. + */ + getTrackDescription(callback: AsyncCallback>): void; + + /** + * get all track infos in MediaDescription, should be called after data loaded callback.. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @return A Promise instance used to return the track info in MediaDescription. + */ + getTrackDescription() : Promise>; + + /** + * Listens for audio playback buffering events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback buffering update event to listen for. + * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; + + /** + * Media URI. Mainstream media formats are supported. + * network:http://xxx + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + url: string; + + /** + * Media file descriptor. Mainstream media formats are supported. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + fdSrc: AVFileDescriptor; + + /** + * Whether to loop media playback. The value true means to loop playback. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + loop: boolean; + + /** + * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not + * set, the default mode will be used. Set it before calling the {@link #play()} in the + * first time in order for the interrupt mode to become effective thereafter. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + audioInterruptMode ?: audio.InterruptMode; + + /** + * SurfaceId surface id, video player will use this id get a surface instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + surfaceId ?: string; + + /** + * Current playback position. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + readonly currentTime: number; + + /** + * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + readonly duration: number; + + /** + * Playback state. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + readonly state: AVPlayerState; + + /** + * video width, valid after prepared. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + readonly width: number; + + /** + * video height, valid after prepared. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + readonly height: number; + + /** + * video scale type. Defaultly, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more + * information, refer to {@link #VideoScaleType} + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + videoScaleType ?: VideoScaleType; + + /** + * set payback speed. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param speed playback speed, see @AVPlayerSpeed . + * @throws {BusinessError} if type of speed is not number or not in PlaybackSpeed. + */ + setSpeed(speed:number): void; + + /** + * select a specified bitrate to playback, only valid for HLS protocal network stream. Defaulty, the + * player will select the appropriate bitrate according to the network connection speed. The + * available bitrates list reported by {@link #on('availableBitrates')}. Set it to select + * a specified bitrate. If the specified bitrate is not in the list of available bitrates, the player + * will select the minimal and closest one from the available bitrates list. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param bitrate the playback bitrate must be expressed in bits per second. + * @throws {BusinessError} if type of bitrate is not number or is out of [0, 2147483647]. + */ + setBitrate(bitrate: number): void; + + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback stateChange event. + */ + on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void; + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback volume event. + */ + on(type: 'volumeChange', callback: Callback): void; + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback playComplete event. + */ + on(type: 'playComplete', callback: Callback): void; + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback seekDone event. + */ + on(type: 'seekDone', callback: Callback): void; + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback speedDone event. + */ + on(type: 'speedDone', callback: Callback): void; + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback setBitrateDone event. + */ + on(type: 'bitrateDone', callback: Callback): void; + /** + * Listens for media playback events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback timeUpdate event. + */ + on(type: 'timeUpdate', callback: Callback): void; + + /** + * Listens for video playback buffering events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback buffering update event to listen for. + * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; + + /** + * Listens for start render video frame events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return . + */ + on(type: 'startRenderFrame', callback: Callback): void; + + /** + * Listens for video size changed event. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return video size. + */ + on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; + + /** + * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return audio interrupt info. + */ + on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; + + /** + * Listens for available bitrates collect completed events for HLS protocal stream playback. + * This event will be reported after the {@link #prepare} called. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return available bitrates. + */ + on(type: 'availableBitrates', callback: (bitrates: Array) => void): void; + + /** + * Listens for playback error events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param type Type of the playback error event to listen for. + * @param callback Callback used to listen for the playback error event. + */ + on(type: 'error', callback: ErrorCallback): void; + } + + /** + * Describes media recorder states. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @import import media from '@ohos.multimedia.media' + */ + type AVRecorderState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'released' | 'error'; + + /** + * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder() + * to create an AVRecorder instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + interface AVRecorder { + /** + * Prepares for recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param config Recording parameters. + * @throws {BusinessError} if type of config is not AVRecorderConfig or AVRecorderConfig property type is not right. + * @permission ohos.permission.MICROPHONE + */ + prepare(config: AVRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param config Recording parameters. + * @throws {BusinessError} if type of config is not AVRecorderConfig or AVRecorderConfig property type is not right. + * @permission ohos.permission.MICROPHONE + */ + prepare(config: AVRecorderConfig): Promise; + /** + * get input surface.it must be called between prepare completed and start. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param callback Callback used to return the input surface id in string. + */ + getInputSurface(callback: AsyncCallback): void; + /** + * get input surface. it must be called between prepare completed and start. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @return A Promise instance used to return the input surface id in string. + */ + getInputSurface(): Promise; + + /** + * Starts audio recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + start(): void; + + /** + * Pauses audio recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + pause(): void; + + /** + * Resumes audio recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + resume(): void; + + /** + * Stops audio recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + stop(): void; + + /** + * Releases resources used for AVRecorder. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param callback A callback instance used to return when release completed. + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for AVRecorder. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @return A Promise instance used to return when release completed. + */ + release(): Promise; + + /** + * Resets audio recording. + * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, + * you must call prepare() to set the recording configurations for another recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + reset(): void; + + /** + * Listens for audio recording events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param type Type of the audio recording event to listen for. + * @param callback Callback used to listen for the audio recording event. + */ + on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void; + + /** + * Listens for audio recording error events. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @param type Type of the audio recording error event to listen for. + * @param callback Callback used to listen for the audio recording error event. + */ + on(type: 'error', callback: ErrorCallback): void; + } + + /** + * Describes audio playback states, it will be deprecated after API10, use @AVPlayerState instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' @@ -224,7 +719,7 @@ declare namespace media { /** * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() - * to create an AudioPlayer instance. + * to create an AudioPlayer instance, it will be deprecated after API10, use @AVPlayer instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ @@ -504,7 +999,8 @@ declare namespace media { } /** - * Provides the audio recorder configuration definitions. + * Provides the audio recorder configuration definitions, it will be deprecated after API10, + * use @AVRecorderConfig instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ @@ -581,7 +1077,7 @@ declare namespace media { /** * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder() - * to create an AudioRecorder instance. + * to create an AudioRecorder instance, it will be deprecated after API10, use @AVRecorder instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ @@ -659,165 +1155,14 @@ declare namespace media { } /** - * Describes video recorder states. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - */ - 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 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - */ - interface VideoRecorder { - /** - * Prepares for recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param config Recording parameters. - * @param callback A callback instance used to return when prepare completed. - * @permission ohos.permission.MICROPHONE - */ - prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; - /** - * Prepares for recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param config Recording parameters. - * @return A Promise instance used to return when prepare completed. - * @permission ohos.permission.MICROPHONE - */ - prepare(config: VideoRecorderConfig): Promise; - /** - * get input surface.it must be called between prepare completed and start. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback Callback used to return the input surface id in string. - */ - getInputSurface(callback: AsyncCallback): void; - /** - * get input surface. it must be called between prepare completed and start. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return the input surface id in string. - */ - getInputSurface(): Promise; - /** - * Starts video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback A callback instance used to return when start completed. - */ - start(callback: AsyncCallback): void; - /** - * Starts video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when start completed. - */ - start(): Promise; - /** - * Pauses video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback A callback instance used to return when pause completed. - */ - pause(callback: AsyncCallback): void; - /** - * Pauses video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when pause completed. - */ - pause(): Promise; - /** - * Resumes video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback A callback instance used to return when resume completed. - */ - resume(callback: AsyncCallback): void; - /** - * Resumes video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when resume completed. - */ - resume(): Promise; - /** - * Stops video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback A callback instance used to return when stop completed. - */ - stop(callback: AsyncCallback): void; - /** - * Stops video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when stop completed. - */ - stop(): Promise; - /** - * Releases resources used for video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback A callback instance used to return when release completed. - */ - release(callback: AsyncCallback): void; - /** - * Releases resources used for video recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when release completed. - */ - release(): Promise; - /** - * 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 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @param callback A callback instance used to return when reset completed. - */ - reset(callback: AsyncCallback): void; - /** - * 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 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when reset completed. - */ - reset(): Promise; - /** - * Listens for video recording error events. - * @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. - */ - on(type: 'error', callback: ErrorCallback): void; - - /** - * video recorder state. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - */ - readonly state: VideoRecordState; - } - - /** - * Describes video playback states. + * Describes video playback states, it will be deprecated after API10, use @AVPlayerState instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** - * Enumerates playback speed. + * Enumerates playback speed, it will be deprecated after API10, use @AVPlayerSpeed instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ @@ -854,9 +1199,47 @@ declare namespace media { SPEED_FORWARD_2_00_X = 4, } + /** + * Enumerates AVPlayer speed. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + enum AVPlayerSpeed { + /** + * playback at 0.75x normal speed + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + SPEED_FORWARD_0_75_X = 0, + /** + * playback at normal speed + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + SPEED_FORWARD_1_00_X = 1, + /** + * playback at 1.25x normal speed + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + SPEED_FORWARD_1_25_X = 2, + /** + * playback at 1.75x normal speed + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + SPEED_FORWARD_1_75_X = 3, + /** + * playback at 2.0x normal speed + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + SPEED_FORWARD_2_00_X = 4, + } + /** * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer - * instance. + * instance, it will be deprecated after API10, use @AVPlayer instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' @@ -1177,25 +1560,6 @@ declare namespace media { */ on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; - /** - * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent} - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param type Type of the playback event to listen for. - * @param callback Callback used to listen for the playback event return audio interrupt info. - */ - on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; - - /** - * Listens for available bitrates collect completed events for HLS protocal stream playback. - * This event will be reported after the {@link #prepare} called. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param type Type of the playback event to listen for. - * @param callback Callback used to listen for the playback event return available bitrates. - */ - on(type: 'availableBitratesCollect', callback: (bitrates: Array) => void): void; - /** * Listens for playback error events. * @since 8 @@ -1209,7 +1573,7 @@ declare namespace media { /** * Enumerates video scale type. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer * @import import media from '@ohos.multimedia.media' */ enum VideoScaleType { @@ -1218,7 +1582,7 @@ declare namespace media { * the aspect ratio of the content is not same as the display surface, the aspect * of the content is not maintained. This is the default scale type. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer */ VIDEO_SCALE_TYPE_FIT = 0, @@ -1227,7 +1591,7 @@ declare namespace media { * the aspect ratio of the content is not the same as the display surface, content's * aspect ratio is maintained and the content is cropped to fit the display surface. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer */ VIDEO_SCALE_TYPE_FIT_CROP = 1, } @@ -1354,99 +1718,99 @@ declare namespace media { } /** - * Provides the video recorder profile definitions. + * Provides the media recorder profile definitions. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - interface VideoRecorderProfile { + interface AVRecorderProfile { /** * Indicates the audio bit rate. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly audioBitrate: number; + audioBitrate: number; /** * Indicates the number of audio channels. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly audioChannels: number; + audioChannels: number; /** * Indicates the audio encoding format. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly audioCodec: CodecMimeType; + audioCodec: CodecMimeType; /** * Indicates the audio sampling rate. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly audioSampleRate: number; + audioSampleRate: number; /** * Indicates the output file format. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly fileFormat: ContainerFormatType; + fileFormat: ContainerFormatType; /** * Indicates the video bit rate. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly videoBitrate: number; + videoBitrate: number; /** * Indicates the video encoding format. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly videoCodec: CodecMimeType; + videoCodec: CodecMimeType; /** * Indicates the video width. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly videoFrameWidth: number; + videoFrameWidth: number; /** * Indicates the video height. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly videoFrameHeight: number; + videoFrameHeight: number; /** * Indicates the video frame rate. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - readonly videoFrameRate: number; + videoFrameRate: number; } /** * Enumerates audio source type for recorder. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder * @import import media from '@ohos.multimedia.media' */ enum AudioSourceType { /** * default audio source type. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ AUDIO_SOURCE_TYPE_MIC = 1, } @@ -1454,68 +1818,68 @@ declare namespace media { /** * Enumerates video source type for recorder. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder * @import import media from '@ohos.multimedia.media' */ enum VideoSourceType { /** * surface raw data. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, } /** - * Provides the video recorder configuration definitions. + * Provides the media recorder configuration definitions. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - interface VideoRecorderConfig { + interface AVRecorderConfig { /** * audio source type, details see @AudioSourceType . * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ audioSourceType: AudioSourceType; /** * video source type, details see @VideoSourceType . * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - videoSourceType: VideoSourceType; + videoSourceType?: VideoSourceType; /** - * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . + * video recorder profile, can get by "getMediaRecorderProfile", details see @MediaRecorderProfile . * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - profile: VideoRecorderProfile; + profile: AVRecorderProfile; /** * video output uri.support two kind of uri now. * format like: scheme + "://" + "context". * file: file://path * fd: fd://fd * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ url: string; /** * Sets the video rotation angle in output file, and for the file to playback. mp4 support. * the range of rotation angle should be {0, 90, 180, 270}, default is 0. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ rotation?: number; /** * geographical location information. * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder */ location?: Location; } -- Gitee From 82de1cd6c71b4b0756da3c86b19cf2505b49b693 Mon Sep 17 00:00:00 2001 From: xxb-wzy Date: Wed, 21 Sep 2022 09:32:21 +0800 Subject: [PATCH 2/4] Signed-off-by: xxb-wzy Change-Id: I13569cbf495b440490ffd8bbb5bd70e575d92015 --- api/@ohos.multimedia.media.d.ts | 50 +++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 62409f2b28..0c891c313f 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -28,6 +28,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' * @return Returns an AudioPlayer instance if the operation is successful; returns null otherwise. + * @deprecated since 10 */ function createAudioPlayer(): AudioPlayer; @@ -37,6 +38,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' * @return Returns an AudioRecorder instance if the operation is successful; returns null otherwise. + * @deprecated since 10 */ function createAudioRecorder(): AudioRecorder; @@ -46,6 +48,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + * @deprecated since 10 */ function createVideoPlayer(callback: AsyncCallback): void; /** @@ -54,6 +57,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. + * @deprecated since 10 */ function createVideoPlayer() : Promise; @@ -99,6 +103,7 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' + * @deprecated since 10 */ enum MediaErrorCode { /** @@ -306,13 +311,22 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer */ stop(): void; - + + /** + * reset AVPlayer, it will to idle state and can set src again. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param callback A callback instance used to return when reset completed. + */ + reset(callback: AsyncCallback): void; + /** - * Resets media playback. + * reset AVPlayer, it will to idle state and can set src again. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @return A Promise instance used to return when reset completed. */ - reset(): void; + reset(): Promise; /** * Jumps to the specified playback position. @@ -681,14 +695,21 @@ declare namespace media { */ release(): Promise; - /** - * Resets audio recording. - * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, - * you must call prepare() to set the recording configurations for another recording. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVRecorder - */ - reset(): void; + /** + * reset AVRecorder, it will to idle state. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param callback A callback instance used to return when reset completed. + */ + reset(callback: AsyncCallback): void; + + /** + * reset AVRecorder, it will to idle state. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @return A Promise instance used to return when reset completed. + */ + reset(): Promise; /** * Listens for audio recording events. @@ -714,6 +735,7 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' + * @deprecated since 10 */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -722,6 +744,7 @@ declare namespace media { * to create an AudioPlayer instance, it will be deprecated after API10, use @AVPlayer instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 10 */ interface AudioPlayer { /** @@ -1003,6 +1026,7 @@ declare namespace media { * use @AVRecorderConfig instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 10 */ interface AudioRecorderConfig { /** @@ -1080,6 +1104,7 @@ declare namespace media { * to create an AudioRecorder instance, it will be deprecated after API10, use @AVRecorder instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 10 */ interface AudioRecorder { /** @@ -1158,6 +1183,7 @@ declare namespace media { * Describes video playback states, it will be deprecated after API10, use @AVPlayerState instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 10 */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -1165,6 +1191,7 @@ declare namespace media { * Enumerates playback speed, it will be deprecated after API10, use @AVPlayerSpeed instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 10 */ enum PlaybackSpeed { /** @@ -1243,6 +1270,7 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' + * @deprecated since 10 */ interface VideoPlayer { /** -- Gitee From 312be195334aa65b4a8a5ea32040c553e75dba91 Mon Sep 17 00:00:00 2001 From: xxb-wzy Date: Mon, 17 Oct 2022 15:06:18 +0800 Subject: [PATCH 3/4] no throw and add systemapi for videorecorder Signed-off-by: xxb-wzy Change-Id: Ic804e74d43955da14f7ef293661cad129c17d753 --- api/@ohos.multimedia.media.d.ts | 511 +++++++++++++++++++++++++------- 1 file changed, 409 insertions(+), 102 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 0c891c313f..ae0e781cf3 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -23,44 +23,63 @@ import audio from "./@ohos.multimedia.audio"; */ declare namespace media { /** - * Creates an AudioPlayer instance, it will be deprecated after API10, use @createAVPlayer to replace. + * Creates an AudioPlayer instance, it will be deprecated after API9, use @createAVPlayer to replace. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' * @return Returns an AudioPlayer instance if the operation is successful; returns null otherwise. - * @deprecated since 10 + * @deprecated since 9 */ function createAudioPlayer(): AudioPlayer; /** - * Creates an AudioRecorder instance, it will be deprecated after API10, use @createAVRecorder to replace. + * Creates an AudioRecorder instance, it will be deprecated after API9, use @createAVRecorder to replace. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' * @return Returns an AudioRecorder instance if the operation is successful; returns null otherwise. - * @deprecated since 10 + * @deprecated since 9 */ function createAudioRecorder(): AudioRecorder; /** - * Creates an VideoPlayer instance, it will be deprecated after API10, use @createAVPlayer to replace. + * Creates an VideoPlayer instance, it will be deprecated after API9, use @createAVPlayer to replace. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. - * @deprecated since 10 + * @deprecated since 9 */ function createVideoPlayer(callback: AsyncCallback): void; /** - * Creates an VideoPlayer instance, it will be deprecated after API10, use @createAVPlayer to replace. + * Creates an VideoPlayer instance, it will be deprecated after API9, use @createAVPlayer to replace. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. - * @deprecated since 10 + * @deprecated since 9 */ function createVideoPlayer() : Promise; + /** + * Creates an VideoRecorder instance. + * @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): void; + /** + * Creates an VideoRecorder instance. + * @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; + /** * Creates an AVPlayer instance. * @since 9 @@ -98,12 +117,12 @@ declare namespace media { function createAVRecorder() : Promise; /** - * Enumerates ErrorCode types, return in BusinessError::code, it will be deprecated after API10, + * Enumerates ErrorCode types, return in BusinessError::code, it will be deprecated after API9, * see ErrorCode in wiki. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @deprecated since 10 + * @deprecated since 9 */ enum MediaErrorCode { /** @@ -247,18 +266,18 @@ declare namespace media { */ enum StateChangeReason { /** - * state change by user operation + * state change by user operation. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ USER = 1, /** - * state change by system manager + * state change by background action. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ - SYSTEM = 2, + BACKGROUND = 2, } /** @@ -332,10 +351,8 @@ declare namespace media { * Jumps to the specified playback position. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param timeMs Playback position to jump + * @param timeMs Playback position to jump, should be in [0, 2147483647]. * @param mode seek mode, see @SeekMode . - * @throws {BusinessError} if type of timeMs is not number or type of timeMs is not SeekMode - * or timeMs is out of [0, 2147483647]. */ seek(timeMs: number, mode?:SeekMode): void; @@ -344,7 +361,6 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). - * @throws {BusinessError} if type of vol is not number or vol is out of [0.00, 1.00] */ setVolume(vol: number): void; @@ -379,15 +395,6 @@ declare namespace media { */ getTrackDescription() : Promise>; - /** - * Listens for audio playback buffering events. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param type Type of the playback buffering update event to listen for. - * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. - */ - on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; - /** * Media URI. Mainstream media formats are supported. * network:http://xxx @@ -418,13 +425,6 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer */ audioInterruptMode ?: audio.InterruptMode; - - /** - * SurfaceId surface id, video player will use this id get a surface instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVPlayer - */ - surfaceId ?: string; /** * Current playback position. @@ -447,6 +447,13 @@ declare namespace media { */ readonly state: AVPlayerState; + /** + * SurfaceId surface id, video player will use this id get a surface instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + */ + surfaceId ?: string; + /** * video width, valid after prepared. * @since 9 @@ -474,9 +481,8 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param speed playback speed, see @AVPlayerSpeed . - * @throws {BusinessError} if type of speed is not number or not in PlaybackSpeed. */ - setSpeed(speed:number): void; + setSpeed(speed: number): void; /** * select a specified bitrate to playback, only valid for HLS protocal network stream. Defaulty, the @@ -487,7 +493,6 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param bitrate the playback bitrate must be expressed in bits per second. - * @throws {BusinessError} if type of bitrate is not number or is out of [0, 2147483647]. */ setBitrate(bitrate: number): void; @@ -567,13 +572,13 @@ declare namespace media { on(type: 'startRenderFrame', callback: Callback): void; /** - * Listens for video size changed event. + * Listens for video size change event. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return video size. */ - on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; + on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void; /** * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent} @@ -610,7 +615,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @import import media from '@ohos.multimedia.media' */ - type AVRecorderState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'released' | 'error'; + type AVRecorderState = 'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error'; /** * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder() @@ -624,7 +629,6 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param config Recording parameters. - * @throws {BusinessError} if type of config is not AVRecorderConfig or AVRecorderConfig property type is not right. * @permission ohos.permission.MICROPHONE */ prepare(config: AVRecorderConfig, callback: AsyncCallback): void; @@ -633,24 +637,9 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param config Recording parameters. - * @throws {BusinessError} if type of config is not AVRecorderConfig or AVRecorderConfig property type is not right. * @permission ohos.permission.MICROPHONE */ prepare(config: AVRecorderConfig): Promise; - /** - * get input surface.it must be called between prepare completed and start. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @param callback Callback used to return the input surface id in string. - */ - getInputSurface(callback: AsyncCallback): void; - /** - * get input surface. it must be called between prepare completed and start. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @return A Promise instance used to return the input surface id in string. - */ - getInputSurface(): Promise; /** * Starts audio recording. @@ -698,7 +687,7 @@ declare namespace media { /** * reset AVRecorder, it will to idle state. * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; @@ -706,45 +695,68 @@ declare namespace media { /** * reset AVRecorder, it will to idle state. * @since 9 - * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @syscap SystemCapability.Multimedia.Media.AVRecorder * @return A Promise instance used to return when reset completed. */ reset(): Promise; + /** + * get input surface.it must be called between prepare completed and start. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param callback Callback used to return the input surface id in string. + */ + getInputSurface(callback: AsyncCallback): void; + + /** + * get input surface. it must be called between prepare completed and start. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @return A Promise instance used to return the input surface id in string. + */ + getInputSurface(): Promise; + + /** + * Recorder state. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.AVRecorder + */ + readonly state: AVRecorderState; + /** * Listens for audio recording events. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param type Type of the audio recording event to listen for. - * @param callback Callback used to listen for the audio recording event. + * @param callback Callback used to listen for the recorder stateChange event. */ on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void; /** * Listens for audio recording error events. * @since 9 - * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param type Type of the audio recording error event to listen for. - * @param callback Callback used to listen for the audio recording error event. + * @param callback Callback used to listen for the recorder error event. */ on(type: 'error', callback: ErrorCallback): void; } /** - * Describes audio playback states, it will be deprecated after API10, use @AVPlayerState instead. + * Describes audio playback states, it will be deprecated after API9, use @AVPlayerState instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' - * @deprecated since 10 + * @deprecated since 9 */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() - * to create an AudioPlayer instance, it will be deprecated after API10, use @AVPlayer instead. + * to create an AudioPlayer instance, it will be deprecated after API9, use @AVPlayer instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer - * @deprecated since 10 + * @deprecated since 9 */ interface AudioPlayer { /** @@ -1022,11 +1034,11 @@ declare namespace media { } /** - * Provides the audio recorder configuration definitions, it will be deprecated after API10, + * Provides the audio recorder configuration definitions, it will be deprecated after API9, * use @AVRecorderConfig instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @deprecated since 10 + * @deprecated since 9 */ interface AudioRecorderConfig { /** @@ -1101,10 +1113,10 @@ declare namespace media { /** * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder() - * to create an AudioRecorder instance, it will be deprecated after API10, use @AVRecorder instead. + * to create an AudioRecorder instance, it will be deprecated after API9, use @AVRecorder instead. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @deprecated since 10 + * @deprecated since 9 */ interface AudioRecorder { /** @@ -1180,18 +1192,189 @@ declare namespace media { } /** - * Describes video playback states, it will be deprecated after API10, use @AVPlayerState instead. + * Describes video recorder states. + * @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 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + interface VideoRecorder { + /** + * Prepares for recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param config Recording parameters. + * @param callback A callback instance used to return when prepare completed. + * @permission ohos.permission.MICROPHONE + * @systemapi + */ + prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param config Recording parameters. + * @return A Promise instance used to return when prepare completed. + * @permission ohos.permission.MICROPHONE + * @systemapi + */ + prepare(config: VideoRecorderConfig): Promise; + /** + * get input surface.it must be called between prepare completed and start. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback Callback used to return the input surface id in string. + * @systemapi + */ + getInputSurface(callback: AsyncCallback): void; + /** + * get input surface. it must be called between prepare completed and start. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return the input surface id in string. + * @systemapi + */ + getInputSurface(): Promise; + /** + * Starts video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback A callback instance used to return when start completed. + * @systemapi + */ + start(callback: AsyncCallback): void; + /** + * Starts video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return when start completed. + * @systemapi + */ + start(): Promise; + /** + * Pauses video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback A callback instance used to return when pause completed. + * @systemapi + */ + pause(callback: AsyncCallback): void; + /** + * Pauses video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return when pause completed. + * @systemapi + */ + pause(): Promise; + /** + * Resumes video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback A callback instance used to return when resume completed. + * @systemapi + */ + resume(callback: AsyncCallback): void; + /** + * Resumes video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return when resume completed. + * @systemapi + */ + resume(): Promise; + /** + * Stops video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback A callback instance used to return when stop completed. + * @systemapi + */ + stop(callback: AsyncCallback): void; + /** + * Stops video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return when stop completed. + * @systemapi + */ + stop(): Promise; + /** + * Releases resources used for video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback A callback instance used to return when release completed. + * @systemapi + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for video recording. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return when release completed. + * @systemapi + */ + release(): Promise; + /** + * 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 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @param callback A callback instance used to return when reset completed. + * @systemapi + */ + reset(callback: AsyncCallback): void; + /** + * 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 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @return A Promise instance used to return when reset completed. + * @systemapi + */ + reset(): Promise; + /** + * Listens for video recording error events. + * @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. + * @systemapi + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * video recorder state. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly state: VideoRecordState; + } + + /** + * Describes video playback states, it will be deprecated after API9, use @AVPlayerState instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @deprecated since 10 + * @deprecated since 9 */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** - * Enumerates playback speed, it will be deprecated after API10, use @AVPlayerSpeed instead. + * Enumerates playback speed, it will be deprecated after API9, use @AVPlayerSpeed instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @deprecated since 10 + * @deprecated since 9 */ enum PlaybackSpeed { /** @@ -1266,11 +1449,11 @@ declare namespace media { /** * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer - * instance, it will be deprecated after API10, use @AVPlayer instead. + * instance, it will be deprecated after API9, use @AVPlayer instead. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' - * @deprecated since 10 + * @deprecated since 9 */ interface VideoPlayer { /** @@ -1526,32 +1709,6 @@ declare namespace media { */ setSpeed(speed:number): Promise; - /** - * select a specified bitrate to playback, only valid for HLS protocal network stream. Defaulty, the - * player will select the appropriate bitrate according to the network connection speed. The - * available bitrates list reported by {@link #on('availableBitratesCollect')}. Set it to select - * a specified bitrate. If the specified bitrate is not in the list of available bitrates, the player - * will select the minimal and closest one from the available bitrates list. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param bitrate the playback bitrate must be expressed in bits per second. - * @return A Promise instance used to return actually selected bitrate. - */ - selectBitrate(bitrate: number): Promise; - - /** - * select a specified bitrate to playback, only valid for HLS protocal network stream. Defaulty, the - * player will select the appropriate bitrate according to the network connection speed. The - * available bitrates list reported by {@link #on('availableBitratesCollect')}. Set it to select - * a specified bitrate. If the specified bitrate is not in the list of available bitrates, the player - * will select the minimal and closest one from the available bitrates list. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param bitrate the playback bitrate must be expressed in bits per second. - * @param callback Callback used to return actually selected bitrate. - */ - selectBitrate(bitrate: number, callback: AsyncCallback): void; - /** * Listens for video playback completed events. * @since 8 @@ -1588,6 +1745,15 @@ declare namespace media { */ on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; + /** + * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return audio interrupt info. + */ + on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; + /** * Listens for playback error events. * @since 8 @@ -1745,6 +1911,94 @@ declare namespace media { MD_KEY_AUD_SAMPLE_RATE = "sample_rate", } + /** + * Provides the video recorder profile definitions. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + interface VideoRecorderProfile { + /** + * Indicates the audio bit rate. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly audioBitrate: number; + + /** + * Indicates the number of audio channels. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly audioChannels: number; + + /** + * Indicates the audio encoding format. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly audioCodec: CodecMimeType; + + /** + * Indicates the audio sampling rate. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly audioSampleRate: number; + + /** + * Indicates the output file format. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly fileFormat: ContainerFormatType; + + /** + * Indicates the video bit rate. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly videoBitrate: number; + + /** + * Indicates the video encoding format. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly videoCodec: CodecMimeType; + + /** + * Indicates the video width. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly videoFrameWidth: number; + + /** + * Indicates the video height. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly videoFrameHeight: number; + + /** + * Indicates the video frame rate. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + readonly videoFrameRate: number; + } + /** * Provides the media recorder profile definitions. * @since 9 @@ -1889,9 +2143,8 @@ declare namespace media { */ profile: AVRecorderProfile; /** - * video output uri.support two kind of uri now. + * video output uri.support a kind of uri now. * format like: scheme + "://" + "context". - * file: file://path * fd: fd://fd * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder @@ -1912,6 +2165,60 @@ declare namespace media { location?: Location; } + /** + * Provides the video recorder configuration definitions. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + interface VideoRecorderConfig { + /** + * audio source type, details see @AudioSourceType . + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + audioSourceType: AudioSourceType; + /** + * video source type, details see @VideoSourceType . + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + videoSourceType: VideoSourceType; + /** + * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + profile: VideoRecorderProfile; + /** + * video output uri.support a kind of uri now. + * format like: scheme + "://" + "context". + * fd: fd://fd + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + url: string; + /** + * Sets the video rotation angle in output file, and for the file to playback. mp4 support. + * the range of rotation angle should be {0, 90, 180, 270}, default is 0. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + rotation?: number; + /** + * geographical location information. + * @since 9 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + */ + location?: Location; + } + /** * Provides the container definition for media description key-value pairs. * @since 8 -- Gitee From e3641cd2e6eb5e781e8fc94ec5b8c11437e6714f Mon Sep 17 00:00:00 2001 From: xxb-wzy Date: Tue, 25 Oct 2022 17:50:06 +0800 Subject: [PATCH 4/4] fix useinstead and changeable params Signed-off-by: xxb-wzy Change-Id: If227bb83e2408cec7c074d39dba75b9b5534539d --- api/@ohos.multimedia.media.d.ts | 191 ++++++++++++++++++++++++++++++-- 1 file changed, 179 insertions(+), 12 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index ae0e781cf3..82ba9a7934 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -29,6 +29,7 @@ declare namespace media { * @import import media from '@ohos.multimedia.media' * @return Returns an AudioPlayer instance if the operation is successful; returns null otherwise. * @deprecated since 9 + * @useinstead ohos.multimedia.media#createAVPlayer */ function createAudioPlayer(): AudioPlayer; @@ -39,6 +40,7 @@ declare namespace media { * @import import media from '@ohos.multimedia.media' * @return Returns an AudioRecorder instance if the operation is successful; returns null otherwise. * @deprecated since 9 + * @useinstead ohos.multimedia.media#createAVRecorder */ function createAudioRecorder(): AudioRecorder; @@ -49,6 +51,7 @@ declare namespace media { * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. * @deprecated since 9 + * @useinstead ohos.multimedia.media#createAVPlayer */ function createVideoPlayer(callback: AsyncCallback): void; /** @@ -58,6 +61,7 @@ declare namespace media { * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. * @deprecated since 9 + * @useinstead ohos.multimedia.media#createAVPlayer */ function createVideoPlayer() : Promise; @@ -401,14 +405,14 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer */ - url: string; + url ?: string; /** * Media file descriptor. Mainstream media formats are supported. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVPlayer */ - fdSrc: AVFileDescriptor; + fdSrc ?: AVFileDescriptor; /** * Whether to loop media playback. The value true means to loop playback. @@ -748,6 +752,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerState */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -757,12 +762,15 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer */ interface AudioPlayer { /** * Starts audio playback. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#play */ play(): void; @@ -770,6 +778,8 @@ declare namespace media { * Pauses audio playback. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#pause */ pause(): void; @@ -777,6 +787,8 @@ declare namespace media { * Stops audio playback. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#stop */ stop(): void; @@ -784,6 +796,8 @@ declare namespace media { * Resets audio playback. * @since 7 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#reset */ reset(): void; @@ -792,6 +806,8 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param timeMs Playback position to jump + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#seek */ seek(timeMs: number): void; @@ -800,6 +816,8 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#setVolume */ setVolume(vol: number): void; @@ -807,6 +825,8 @@ declare namespace media { * Releases resources used for audio playback. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#release */ release(): void; /** @@ -814,6 +834,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param callback async callback return track info in MediaDescription. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#getTrackDescription */ getTrackDescription(callback: AsyncCallback>): void; @@ -822,6 +844,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @return A Promise instance used to return the track info in MediaDescription. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#getTrackDescription */ getTrackDescription() : Promise>; @@ -831,6 +855,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:bufferingUpdate */ on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; @@ -840,6 +866,8 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @permission ohos.permission.READ_MEDIA or ohos.permission.INTERNET + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#src */ src: string; @@ -847,6 +875,8 @@ declare namespace media { * Audio file descriptor. Mainstream audio formats are supported. * @since 9 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#fdSrc */ fdSrc: AVFileDescriptor; @@ -854,6 +884,8 @@ declare namespace media { * Whether to loop audio playback. The value true means to loop playback. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#loop */ loop: boolean; @@ -863,6 +895,8 @@ declare namespace media { * first time in order for the interrupt mode to become effective thereafter. * @since 9 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#audioInterruptMode */ audioInterruptMode ?: audio.InterruptMode; @@ -870,6 +904,8 @@ declare namespace media { * Current playback position. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#currentTime */ readonly currentTime: number; @@ -877,6 +913,8 @@ declare namespace media { * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#duration */ readonly duration: number; @@ -884,6 +922,8 @@ declare namespace media { * Playback state. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#state */ readonly state: AudioState; @@ -893,6 +933,10 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:stateChange + * @useinstead ohos.multimedia.media.AVPlayer#event:volumeChange + * @useinstead ohos.multimedia.media.AVPlayer#event:playComplete */ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange', callback: () => void): void; @@ -902,6 +946,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:timeUpdate */ on(type: 'timeUpdate', callback: Callback): void; @@ -911,6 +957,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return audio interrupt info. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:audioInterrupt */ on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; @@ -920,6 +968,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback error event to listen for. * @param callback Callback used to listen for the playback error event. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:error */ on(type: 'error', callback: ErrorCallback): void; } @@ -1039,6 +1089,7 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorderConfig */ interface AudioRecorderConfig { /** @@ -1054,6 +1105,7 @@ declare namespace media { * Audio encoding bit rate. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ audioEncodeBitRate?: number; @@ -1061,6 +1113,7 @@ declare namespace media { * Audio sampling rate. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ audioSampleRate?: number; @@ -1068,6 +1121,7 @@ declare namespace media { * Number of audio channels. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ numberOfChannels?: number; @@ -1087,6 +1141,7 @@ declare namespace media { * fd: fd://fd * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ uri: string; @@ -1094,6 +1149,7 @@ declare namespace media { * Geographical location information. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ location?: Location; @@ -1101,12 +1157,14 @@ declare namespace media { * audio encoding format MIME. it used to replace audioEncoder. * @since 8 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ audioEncoderMime?: CodecMimeType; /** * output file format. see @ContainerFormatType , it used to replace "format". * @since 8 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 */ fileFormat?: ContainerFormatType; } @@ -1117,6 +1175,7 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder */ interface AudioRecorder { /** @@ -1125,6 +1184,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param config Recording parameters. * @permission ohos.permission.MICROPHONE + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#prepare */ prepare(config: AudioRecorderConfig): void; @@ -1132,6 +1193,8 @@ declare namespace media { * Starts audio recording. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#start */ start(): void; @@ -1139,6 +1202,8 @@ declare namespace media { * Pauses audio recording. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#pause */ pause(): void; @@ -1146,6 +1211,8 @@ declare namespace media { * Resumes audio recording. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#resume */ resume(): void; @@ -1153,6 +1220,8 @@ declare namespace media { * Stops audio recording. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#stop */ stop(): void; @@ -1160,6 +1229,8 @@ declare namespace media { * Releases resources used for audio recording. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#release */ release(): void; @@ -1169,6 +1240,8 @@ declare namespace media { * you must call prepare() to set the recording configurations for another recording. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#reset */ reset(): void; @@ -1178,6 +1251,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param type Type of the audio recording event to listen for. * @param callback Callback used to listen for the audio recording event. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#stateChange */ on(type: 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset', callback: () => void): void; @@ -1187,6 +1262,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param type Type of the audio recording error event to listen for. * @param callback Callback used to listen for the audio recording error event. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVRecorder#error */ on(type: 'error', callback: ErrorCallback): void; } @@ -1375,36 +1452,47 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerSpeed */ enum PlaybackSpeed { /** * playback at 0.75x normal speed * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerSpeed */ SPEED_FORWARD_0_75_X = 0, /** * playback at normal speed * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerSpeed */ SPEED_FORWARD_1_00_X = 1, /** * playback at 1.25x normal speed * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerSpeed */ SPEED_FORWARD_1_25_X = 2, /** * playback at 1.75x normal speed * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerSpeed */ SPEED_FORWARD_1_75_X = 3, /** * playback at 2.0x normal speed * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayerSpeed */ SPEED_FORWARD_2_00_X = 4, } @@ -1454,6 +1542,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer */ interface VideoPlayer { /** @@ -1462,6 +1551,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. * @return A Promise instance used to return when release output buffer completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#surfaceId */ setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; /** @@ -1470,6 +1561,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. * @return A Promise instance used to return when release output buffer completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#surfaceId */ setDisplaySurface(surfaceId: string): Promise; /** @@ -1477,6 +1570,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when prepare completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#prepare */ prepare(callback: AsyncCallback): void; /** @@ -1484,6 +1579,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when prepare completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#prepare */ prepare(): Promise; /** @@ -1491,6 +1588,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when start completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#play */ play(callback: AsyncCallback): void; /** @@ -1498,6 +1597,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when start completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#play */ play(): Promise; /** @@ -1505,6 +1606,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when pause completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#pause */ pause(callback: AsyncCallback): void; /** @@ -1512,6 +1615,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when pause completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#pause */ pause(): Promise; /** @@ -1519,6 +1624,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when stop completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#stop */ stop(callback: AsyncCallback): void; /** @@ -1526,6 +1633,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when stop completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#stop */ stop(): Promise; /** @@ -1533,6 +1642,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when reset completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#reset */ reset(callback: AsyncCallback): void; /** @@ -1540,6 +1651,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when reset completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#reset */ reset(): Promise; /** @@ -1550,6 +1663,8 @@ declare namespace media { * @param timeMs Playback position to jump * @param callback A callback instance used to return when seek completed * and return the seeking position result. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#seek */ seek(timeMs: number, callback: AsyncCallback): void; /** @@ -1560,6 +1675,8 @@ declare namespace media { * @param mode seek mode, see @SeekMode . * @param callback A callback instance used to return when seek completed * and return the seeking position result. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#seek */ seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void; /** @@ -1570,6 +1687,8 @@ declare namespace media { * @param mode seek mode, see @SeekMode . * @return A Promise instance used to return when seek completed * and return the seeking position result. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#seek */ seek(timeMs: number, mode?:SeekMode): Promise; /** @@ -1578,6 +1697,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). * @param callback A callback instance used to return when set volume completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#setVolume */ setVolume(vol: number, callback: AsyncCallback): void; /** @@ -1586,6 +1707,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). * @return A Promise instance used to return when set volume completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#setVolume */ setVolume(vol: number): Promise; /** @@ -1593,6 +1716,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when release completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#release */ release(callback: AsyncCallback): void; /** @@ -1600,6 +1725,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when release completed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#release */ release(): Promise; /** @@ -1607,6 +1734,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback async callback return track info in MediaDescription. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#getTrackDescription */ getTrackDescription(callback: AsyncCallback>): void; @@ -1615,6 +1744,8 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return the track info in MediaDescription. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#getTrackDescription */ getTrackDescription() : Promise>; @@ -1623,6 +1754,8 @@ declare namespace media { * local:fd://XXX, file://XXX. network:http://xxx * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#url */ url: string; @@ -1630,6 +1763,8 @@ declare namespace media { * Video file descriptor. Mainstream video formats are supported. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#fdSrc */ fdSrc: AVFileDescriptor; @@ -1637,6 +1772,8 @@ declare namespace media { * Whether to loop video playback. The value true means to loop playback. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#loop */ loop: boolean; @@ -1644,6 +1781,8 @@ declare namespace media { * Current playback position. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#currentTime */ readonly currentTime: number; @@ -1651,6 +1790,8 @@ declare namespace media { * Playback duration, if -1 means cannot seek. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#duration */ readonly duration: number; @@ -1658,6 +1799,8 @@ declare namespace media { * Playback state. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#state */ readonly state: VideoPlayState; @@ -1665,6 +1808,8 @@ declare namespace media { * video width, valid after prepared. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#width */ readonly width: number; @@ -1672,6 +1817,8 @@ declare namespace media { * video height, valid after prepared. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#height */ readonly height: number; @@ -1681,6 +1828,8 @@ declare namespace media { * first time in order for the interrupt mode to become effective thereafter. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#audioInterruptMode */ audioInterruptMode ?: audio.InterruptMode; @@ -1689,6 +1838,8 @@ declare namespace media { * information, refer to {@link #VideoScaleType} * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#videoScaleType */ videoScaleType ?: VideoScaleType; @@ -1698,6 +1849,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @param callback Callback used to return actually speed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#setSpeed */ setSpeed(speed:number, callback: AsyncCallback): void; /** @@ -1706,6 +1859,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @return A Promise instance used to return actually speed. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#setSpeed */ setSpeed(speed:number): Promise; @@ -1715,6 +1870,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return . + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:playComplete */ on(type: 'playbackCompleted', callback: Callback): void; @@ -1724,6 +1881,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:bufferingUpdate */ on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; @@ -1733,6 +1892,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return . + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:startRenderFrame */ on(type: 'startRenderFrame', callback: Callback): void; @@ -1742,6 +1903,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return video size. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:videoSizeChange */ on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; @@ -1751,6 +1914,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return audio interrupt info. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:audioInterrupt */ on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; @@ -1760,6 +1925,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback error event to listen for. * @param callback Callback used to listen for the playback error event. + * @deprecated since 9 + * @useinstead ohos.multimedia.media.AVPlayer#event:error */ on(type: 'error', callback: ErrorCallback): void; } @@ -2010,28 +2177,28 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - audioBitrate: number; + audioBitrate?: number; /** * Indicates the number of audio channels. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - audioChannels: number; + audioChannels?: number; /** * Indicates the audio encoding format. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - audioCodec: CodecMimeType; + audioCodec?: CodecMimeType; /** * Indicates the audio sampling rate. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - audioSampleRate: number; + audioSampleRate?: number; /** * Indicates the output file format. @@ -2045,35 +2212,35 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - videoBitrate: number; + videoBitrate?: number; /** * Indicates the video encoding format. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - videoCodec: CodecMimeType; + videoCodec?: CodecMimeType; /** * Indicates the video width. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - videoFrameWidth: number; + videoFrameWidth?: number; /** * Indicates the video height. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - videoFrameHeight: number; + videoFrameHeight?: number; /** * Indicates the video frame rate. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - videoFrameRate: number; + videoFrameRate?: number; } /** @@ -2129,7 +2296,7 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ - audioSourceType: AudioSourceType; + audioSourceType?: AudioSourceType; /** * video source type, details see @VideoSourceType . * @since 9 -- Gitee