From 0c6dab61dbb3d57f2708a5442959684da21d28cf Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:34:18 +0800 Subject: [PATCH 1/8] add the media js API8 Signed-off-by: sharpshooter_t Change-Id: Iafa739c37072a300bf8fab3216625889a56039c2 --- api/@ohos.multimedia.media.d.ts | 1044 ++++++++++++++++++++++++++++++- 1 file changed, 1028 insertions(+), 16 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 54d94dab6c..8167f0c51a 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -41,13 +41,128 @@ declare namespace media { */ function createAudioRecorder(): AudioRecorder; + /** + * Creates an VideoPlayer instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + */ + function createVideoPlayer(callback: AsyncCallback): void; + /** + * Creates an VideoPlayer instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.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. + */ + function createVideoPlayer() : Promise; + + /** + * Creates an VideoRecorder instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + */ + function createVideoRecorder(callback: AsyncCallback): void; + /** + * Creates an VideoRecorder instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. + */ + function createVideoRecorder(): Promise; + + /** + * Enumerates ErrorCode types, return in BusinessError::code + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum MediaErrorCode { + /** + * operation success. + */ + MSERR_OK = 0, + + /** + * malloc or new memory failed. maybe system have no memory. + */ + MSERR_NO_MEMORY = 1, + + /** + * no permission for the operation. + */ + MSERR_OPERATION_NOT_PERMIT = 2, + + /** + * invalid argument. + */ + MSERR_INVALID_VAL = 3, + + /** + * an IO error occurred. + */ + MSERR_IO = 4, + + /** + * operation time out. + */ + MSERR_TIMEOUT = 5, + + /** + * unknown error. + */ + MSERR_UNKNOWN = 6, + + /** + * media service died. + */ + MSERR_SERVICE_DIED = 7, + + /** + * operation is not permit in current state. + */ + MSERR_INVALID_STATE = 8, + + /** + * operation is not supported in current version. + */ + MSERR_UNSUPPORTED = 9, + } + + /** + * Enumerates buffering info type, for network playback. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum BufferingInfoType { + /* begin to buffering*/ + BUFFERING_START = 1, + + /* end to buffering*/ + BUFFERING_END = 2, + + /* buffering percent*/ + BUFFERING_PERCENT = 3, + + /* cached duration in milliseconds*/ + CACHED_DURATION = 4, + } + /** * Describes audio playback states. */ - type AudioState = 'idle' | 'playing' | 'paused' | 'stopped'; + 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. + * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() + * or createAudioPlayerAsync() to create an AudioPlayer instance. */ interface AudioPlayer { /** @@ -74,10 +189,10 @@ declare namespace media { */ stop(): void; - /** + /**` * Resets audio playback. * @devices phone, tablet, tv, wearable - * @since 7 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ reset(): void; @@ -107,9 +222,37 @@ declare namespace media { * @SysCap SystemCapability.Multimedia.Media */ release(): void; + /** + * get all track infos in MediaDescription, should be called after data loaded callback. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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.. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param index track index. + * @return A Promise instance used to return the track info in MediaDescription. + */ + getTrackDescription() : Promise>; + /** + * Listens for audio playback buffering events. + * @devices phone, tablet, tv, wearable + * @since 6 + * @SysCap SystemCapability.Multimedia.Media + * @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; /** * Audio media URI. Mainstream audio formats are supported. + * local:fd://XXX, file://XXX. network:http://xxx * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -133,7 +276,7 @@ declare namespace media { readonly currentTime: number; /** - * Playback duration. When the data source does not support seek, it returns - 1, such as a live broadcast scenario. + * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -180,7 +323,7 @@ declare namespace media { } /** - * Enumerates audio encoding formats. + * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to instead of. * @since 6 * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' @@ -194,7 +337,7 @@ declare namespace media { } /** - * Enumerates audio output formats. + * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to instead of. * @since 6 * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' @@ -216,7 +359,7 @@ declare namespace media { /** * Latitude. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media */ latitude: number; @@ -224,7 +367,7 @@ declare namespace media { /** * Longitude. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media */ longitude: number; @@ -232,7 +375,8 @@ declare namespace media { interface AudioRecorderConfig { /** - * Audio encoding format. The default value is DEFAULT. + * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. + * use "audioEncoderMime" instead. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -245,7 +389,7 @@ declare namespace media { * @since 6 * @SysCap SystemCapability.Multimedia.Media */ - audioEncodeBitRate?: number; + audioEncodeBitrate?: number; /** * Audio sampling rate. @@ -264,7 +408,8 @@ declare namespace media { numberOfChannels?: number; /** - * Audio output format. The default value is DEFAULT. + * Audio output format. The default value is DEFAULT, it will be deprecated after API8. + * it will be use "fileFormat" to instead of. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -285,10 +430,25 @@ declare namespace media { /** * Geographical location information. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media */ location?: Location; + + /** + * audio encoding format MIME. it used to instead of audioEncoder. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + audioEncoderMime?: CodecMimeType; + /** + * output file format. see @ContainerFormatType , it used to instead of "format". + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + fileFormat?: ContainerFormatType; } interface AudioRecorder { @@ -343,7 +503,8 @@ declare namespace media { /** * 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. + * 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. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -370,6 +531,857 @@ declare namespace media { */ on(type: 'error', callback: ErrorCallback): void; } -} -export default media; \ No newline at end of file + /** + * Describes video recorder states. + */ + type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; + + interface VideoRecorder { + /** + * Prepares for recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param config Recording parameters. + * @param callback A callback instance used to return when prepare completed. + */ + prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param config Recording parameters. + * @return A Promise instance used to return when prepare completed. + */ + prepare(config: VideoRecorderConfig): Promise; + /** + * get input surface.it must be called between prepare completed and start. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return the input surface id in string. + */ + getInputSurface(): Promise; + /** + * Starts video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when start completed. + */ + start(callback: AsyncCallback): void; + /** + * Starts video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when start completed. + */ + start(): Promise; + /** + * Pauses video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when pause completed. + */ + pause(callback: AsyncCallback): void; + /** + * Pauses video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when pause completed. + */ + pause(): Promise; + /** + * Resumes video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when resume completed. + */ + resume(callback: AsyncCallback): void; + /** + * Resumes video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when resume completed. + */ + resume(): Promise; + /** + * Stops video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when stop completed. + */ + stop(callback: AsyncCallback): void; + /** + * Stops video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when stop completed. + */ + stop(): Promise; + /** + * Releases resources used for video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when release completed. + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when reset completed. + */ + reset(): Promise; + /** + * Listens for video recording error events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly state: VideoRecordState; + } + + /** + * Describes video playback states. + */ + type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; + + /** + * Enumerates playback speed. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum PlaybackSpeed { + /* playback at 0.75x normal speed */ + SPEED_FORWARD_0_75_X = 0, + /* playback at normal speed */ + SPEED_FORWARD_1_00_X = 1, + /* playback at 1.25x normal speed */ + SPEED_FORWARD_1_25_X = 2, + /* playback at 1.75x normal speed */ + SPEED_FORWARD_1_75_X = 3, + /* playback at 2.0x normal speed */ + SPEED_FORWARD_2_00_X = 4, + } + + /** + * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer + * instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + interface VideoPlayer { + /** + * set display surface. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + */ + setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; + /** + * set display surface. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + */ + setDisplaySurface(surfaceId: string): Promise; + /** + * prepare video playback, it will request resource for playing. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when prepare completed. + */ + prepare(callback: AsyncCallback): void; + /** + * prepare video playback, it will request resource for playing. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when prepare completed. + */ + prepare(): Promise; + /** + * Starts video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when start completed. + */ + play(callback: AsyncCallback): void; + /** + * Starts video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when start completed. + */ + play(): Promise; + /** + * Pauses video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when pause completed. + */ + pause(callback: AsyncCallback): void; + /** + * Pauses video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when pause completed. + */ + pause(): Promise; + /** + * Stops video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when stop completed. + */ + stop(callback: AsyncCallback): void; + /** + * Stops video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when stop completed. + */ + stop(): Promise; + /** + * Resets video playback, it will release the resource. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when reset completed. + */ + reset(callback: AsyncCallback): void; + /** + * Resets video playback, it will release the resource. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when reset completed. + */ + reset(): Promise; + /** + * Jumps to the specified playback position by default SeekMode(SEEK_CLOSEST), + * the performance may be not the best. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param timeMs Playback position to jump + * @param callback A callback instance used to return when seek completed + * and return the seeking position result. + */ + seek(timeMs: number, callback: AsyncCallback): void; + /** + * Jumps to the specified playback position. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param timeMs Playback position to jump + * @param mode seek mode, see @SeekMode . + * @param callback A callback instance used to return when seek completed + * and return the seeking position result. + */ + seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void; + /** + * Jumps to the specified playback position. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param timeMs Playback position to jump + * @param mode seek mode, see @SeekMode . + * @return A Promise instance used to return when seek completed + * and return the seeking position result. + */ + seek(timeMs: number, mode?:SeekMode): Promise; + /** + * Sets the volume. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + */ + setVolume(vol: number, callback: AsyncCallback): void; + /** + * Sets the volume. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + */ + setVolume(vol: number): Promise; + /** + * Releases resources used for video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when release completed. + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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.. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param index track index. + * @return A Promise instance used to return the track info in MediaDescription. + */ + getTrackDescription() : Promise>; + + /** + * media url. Mainstream video formats are supported. + * local:fd://XXX, file://XXX. network:http://xxx + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + url: string; + + /** + * Whether to loop video playback. The value true means to loop playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + loop: boolean; + + /** + * Current playback position. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly currentTime: number; + + /** + * Playback duration, if -1 means cannot seek. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly duration: number; + + /** + * Playback state. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly state: VideoPlayState; + + /** + * video width, valid after prepared. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly width: number; + + /** + * video height, valid after prepared. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly height: number; + + /** + * set payback speed. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param speed playback speed, see @PlaybackSpeed . + * @param callback Callback used to return actually speed. + */ + setSpeed(speed:number, callback: AsyncCallback): void; + /** + * set output surface. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param speed playback speed, see @PlaybackSpeed . + * @return A Promise instance used to return actually speed. + */ + setSpeed(speed:number): Promise; + + /** + * Listens for video playback completed events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return . + */ + on(type: 'playbackCompleted', callback: Callback): void; + + /** + * Listens for video playback buffering events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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 playback error events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @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; + } + + /** + * Enumerates container format type(The abbreviation for 'container format type' is CFT). + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum ContainerFormatType { + /** + * A video container format type mp4. + */ + CFT_MPEG_4 = "mp4", + + /** + * A audio container format type m4a. + */ + CFT_MPEG_4A = "m4a", + } + + /** + * Enumerates media data type. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum MediaType { + /** + * track is audio. + */ + MEDIA_TYPE_AUD = 0, + /** + * track is video. + */ + MEDIA_TYPE_VID = 1, + } + + /** + * Enumerates media description key. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum MediaDescriptionKey { + /** + * key for track index, value type is number. + */ + MD_KEY_TRACK_INDEX = "track_index", + + /** + * key for track type, value type is number, see @MediaType . + */ + MD_KEY_TRACK_TYPE = "track_type", + + /** + * key for codec mime type, value type is string. + */ + MD_KEY_CODEC_MIME = "codec_mime", + + /** + * key for duration, value type is number. + */ + MD_KEY_DURATION = "duration", + + /** + * key for bitrate, value type is number. + */ + MD_KEY_BITRATE = "bitrate", + + /** + * key for video width, value type is number. + */ + MD_KEY_WIDTH = "width", + + /** + * key for video height, value type is number. + */ + MD_KEY_HEIGHT = "height", + + /** + * key for video frame rate, value type is number,The value is 100 times the actual frame rate. + * example: The real frame rate is 23.99, so this value is 2399. + */ + MD_KEY_FRAME_RATE = "frame_rate", + + /** + * key for audio channel count, value type is number + */ + MD_KEY_AUD_CHANNEL_COUNT = "channel_count", + + /** + * key for audio sample rate, value type is number + */ + MD_KEY_AUD_SAMPLE_RATE = "sample_rate", + } + + interface VideoRecorderProfile { + /** + * Indicates the audio bit rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioBitrate: number; + + /** + * Indicates the number of audio channels. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioChannels: number; + + /** + * Indicates the audio encoding format. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioCodec: CodecMimeType; + + /** + * Indicates the audio sampling rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioSampleRate: number; + + /** + * Indicates the output file format. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly fileFormat: ContainerFormatType; + + /** + * Indicates the video bit rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoBitrate: number; + + /** + * Indicates the video encoding format. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoCodec: CodecMimeType; + + /** + * Indicates the video width. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoFrameWidth: number; + + /** + * Indicates the video height. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoFrameHeight: number; + + /** + * Indicates the video frame rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoFrameRate: number; + } + + /** + * Enumerates audio source type for recorder. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum AudioSourceType { + /** + * default audio source type. + */ + AUDIO_SOURCE_TYPE_DEFAULT = 0, + /** + * source type mic. + */ + AUDIO_SOURCE_TYPE_MIC = 1, + } + + /** + * Enumerates video source type for recorder. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum VideoSourceType { + /** + * surface raw data. + */ + VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, + /** + * surface ES data. + */ + VIDEO_SOURCE_TYPE_SURFACE_ES = 1, + } + + interface VideoRecorderConfig { + /** + * audio source type, details see @AudioSourceType . + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + audioSourceType: AudioSourceType; + /** + * video source type, details see @VideoSourceType . + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + videoSourceType: VideoSourceType; + /** + * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + profile:VideoRecorderProfile; + /** + * video output uri.support two kind of uri now. + * format like: scheme + "://" + "context". + * file: file://path + * fd: fd://fd + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + 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. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + rotation?: number; + /** + * geographical location information. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + location?: Location; + } + + interface MediaDescription { + /** + * key:value pair, key see @MediaDescriptionKey . + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + [key : string]: Object; + } + + /** + * Enumerates seek mode. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum SeekMode { + /** + * seek to the next sync frame of the given timestamp + * @since 8 + */ + SEEK_NEXT_SYNC = 0, + /** + * seek to the previous sync frame of the given timestamp + * @since 8 + */ + SEEK_PREV_SYNC = 1, + } + + /** + * Enumerates Codec MIME types. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum CodecMimeType { + /** + * H.263 codec MIME type. + * @since 8 + */ + VIDEO_H263 = 'video/h263', + /** + * H.264 codec MIME type. + * @since 8 + */ + VIDEO_AVC = 'video/avc', + /** + * MPEG2 codec MIME type. + * @since 8 + */ + VIDEO_MPEG2 = 'video/mpeg2', + /** + * MPEG4 codec MIME type + * @since 8 + */ + VIDEO_MPEG4 = 'video/mp4v-es', + + /** + * VP8 codec MIME type + * @since 8 + */ + VIDEO_VP8 = 'video/x-vnd.on2.vp8', + + /** + * AAC codec MIME type. + * @since 8 + */ + AUDIO_AAC = 'audio/mp4a-latm', + + /** + * vorbis codec MIME type. + * @since 8 + */ + AUDIO_VORBIS = 'audio/vorbis', + + /** + * flac codec MIME type. + * @since 8 + */ + AUDIO_FLAC = 'audio/flac', + } +} +export default media; -- Gitee From 7f7394fa3b1c6093ce14fff44fb8cc86dec701ce Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:39:33 +0800 Subject: [PATCH 2/8] fix spell Signed-off-by: sharpshooter_t Change-Id: I8db6b39bb526f6ddb98b22dee34b0060fd8b33e8 --- api/@ohos.multimedia.media.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 8167f0c51a..c4b3492c8a 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -189,10 +189,10 @@ declare namespace media { */ stop(): void; - /**` + /** * Resets audio playback. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 7 * @SysCap SystemCapability.Multimedia.Media */ reset(): void; -- Gitee From 76105c934237650df91ec00969cccd6e8989d775 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:45:53 +0800 Subject: [PATCH 3/8] fix spell Signed-off-by: sharpshooter_t Change-Id: I11b51e6077ee521762d0d8b744771365f4fb67d4 --- api/@ohos.multimedia.media.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index c4b3492c8a..36ef1dde04 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -359,7 +359,7 @@ declare namespace media { /** * Latitude. * @devices phone, tablet, tv, wearable - * @since 8 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ latitude: number; @@ -367,7 +367,7 @@ declare namespace media { /** * Longitude. * @devices phone, tablet, tv, wearable - * @since 8 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ longitude: number; @@ -430,7 +430,7 @@ declare namespace media { /** * Geographical location information. * @devices phone, tablet, tv, wearable - * @since 8 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ location?: Location; -- Gitee From 2c84839cf3e226bb793cadc16dd33843ac8338a9 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:47:51 +0800 Subject: [PATCH 4/8] fix spell Signed-off-by: sharpshooter_t Change-Id: If1f30ce1a9352ba728a89a958a87625382622b9c --- api/@ohos.multimedia.media.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 36ef1dde04..9ad74fec33 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -244,7 +244,7 @@ declare namespace media { /** * Listens for audio playback buffering events. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media * @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. -- Gitee From ea14f1ace6b776fa6c2fd64424f864a5f13a9e4d Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:55:05 +0800 Subject: [PATCH 5/8] fix comment Signed-off-by: sharpshooter_t Change-Id: Icd4e6c82426f32e83eaf3f30053de00dbce53491 --- api/@ohos.multimedia.media.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 9ad74fec33..07780b9568 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -1117,8 +1117,7 @@ declare namespace media { MD_KEY_HEIGHT = "height", /** - * key for video frame rate, value type is number,The value is 100 times the actual frame rate. - * example: The real frame rate is 23.99, so this value is 2399. + * key for video frame rate, value type is number. */ MD_KEY_FRAME_RATE = "frame_rate", -- Gitee From ed480714984b0aa3138ccc1c204fa8c093701057 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Mon, 14 Feb 2022 09:50:25 +0800 Subject: [PATCH 6/8] remove the change of api6 interfaces Change-Id: I3c1ba34d3ef12970a889ffbb745a0f71bed27b17 Signed-off-by: sharpshooter_t --- api/@ohos.multimedia.media.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 07780b9568..031435b82b 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -389,7 +389,7 @@ declare namespace media { * @since 6 * @SysCap SystemCapability.Multimedia.Media */ - audioEncodeBitrate?: number; + audioEncodeBitRate?: number; /** * Audio sampling rate. -- Gitee From faf8be79b8a010b138ad0f3d24078fe4ad66f5bb Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Mon, 14 Feb 2022 14:41:32 +0800 Subject: [PATCH 7/8] fix the syscaps annotation Signed-off-by: sharpshooter_t Change-Id: Ia64868b9d5d7d587c96cdb8f31f752316f3009bf --- api/@ohos.multimedia.media.d.ts | 384 +++++++++++--------------------- 1 file changed, 134 insertions(+), 250 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 031435b82b..528753e1b7 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -20,13 +20,12 @@ import { ErrorCallback, AsyncCallback, Callback } from './basic'; * @since 6 * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable */ declare namespace media { /** * Creates an AudioPlayer instance. * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -35,7 +34,7 @@ declare namespace media { /** * Creates an AudioRecorder instance. * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -44,7 +43,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ @@ -52,7 +51,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ @@ -61,7 +60,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @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. */ @@ -69,7 +68,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @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. */ @@ -78,9 +77,8 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum MediaErrorCode { /** @@ -137,9 +135,8 @@ declare namespace media { /** * Enumerates buffering info type, for network playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum BufferingInfoType { /* begin to buffering*/ @@ -157,6 +154,9 @@ declare namespace media { /** * Describes audio playback states. + * @since 6 + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @import import media from '@ohos.multimedia.media' */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -167,75 +167,66 @@ declare namespace media { interface AudioPlayer { /** * Starts audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ play(): void; /** * Pauses audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ pause(): void; /** * Stops audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ stop(): void; /** * Resets audio playback. - * @devices phone, tablet, tv, wearable * @since 7 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ reset(): void; /** * Jumps to the specified playback position. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param timeMs Playback position to jump */ seek(timeMs: number): void; /** * Sets the volume. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @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%). */ setVolume(vol: number): void; /** * Releases resources used for audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ release(): void; /** * get all track infos in MediaDescription, should be called after data loaded callback. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @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.. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -243,9 +234,8 @@ declare namespace media { /** * Listens for audio playback buffering events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ @@ -253,49 +243,43 @@ declare namespace media { /** * Audio media URI. Mainstream audio formats are supported. * local:fd://XXX, file://XXX. network:http://xxx - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ src: string; /** * Whether to loop audio playback. The value true means to loop playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ loop: boolean; /** * Current playback position. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ readonly currentTime: number; /** * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ readonly duration: number; /** * Playback state. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ readonly state: AudioState; /** * Listens for audio playback events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -303,9 +287,8 @@ declare namespace media { /** * Listens for audio playback events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -313,9 +296,8 @@ declare namespace media { /** * Listens for playback error events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -325,9 +307,8 @@ declare namespace media { /** * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to instead of. * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable */ enum AudioEncoder { /** @@ -339,9 +320,8 @@ declare namespace media { /** * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to instead of. * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable */ enum AudioOutputFormat { /** @@ -358,17 +338,15 @@ declare namespace media { interface Location { /** * Latitude. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core */ latitude: number; /** * Longitude. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core */ longitude: number; } @@ -377,42 +355,37 @@ declare namespace media { /** * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. * use "audioEncoderMime" instead. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncoder?: AudioEncoder; /** * Audio encoding bit rate. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncodeBitRate?: number; /** * Audio sampling rate. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioSampleRate?: number; /** * Number of audio channels. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ numberOfChannels?: number; /** * Audio output format. The default value is DEFAULT, it will be deprecated after API8. * it will be use "fileFormat" to instead of. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ format?: AudioOutputFormat; @@ -421,32 +394,28 @@ declare namespace media { * format like: scheme + "://" + "context". * file: file://path * fd: fd://fd - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ uri: string; /** * Geographical location information. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ location?: Location; /** * audio encoding format MIME. it used to instead of audioEncoder. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncoderMime?: CodecMimeType; /** * output file format. see @ContainerFormatType , it used to instead of "format". - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ fileFormat?: ContainerFormatType; } @@ -454,50 +423,44 @@ declare namespace media { interface AudioRecorder { /** * Prepares for recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @param config Recording parameters. */ prepare(config: AudioRecorderConfig): void; /** * Starts audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ start(): void; /** * Pauses audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ pause(): void; /** * Resumes audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ resume(): void; /** * Stops audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ stop(): void; /** * Releases resources used for audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ release(): void; @@ -505,17 +468,15 @@ declare namespace media { * 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. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ reset(): void; /** * Listens for audio recording events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -523,9 +484,8 @@ declare namespace media { /** * Listens for audio recording error events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.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. */ @@ -534,121 +494,109 @@ declare namespace media { /** * Describes video recorder states. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; interface VideoRecorder { /** * Prepares for recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @param callback A callback instance used to return when prepare completed. */ prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; /** * Prepares for recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @return A Promise instance used to return when prepare completed. */ prepare(config: VideoRecorderConfig): Promise; /** * get input surface.it must be called between prepare completed and start. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @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. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return the input surface id in string. */ getInputSurface(): Promise; /** * Starts video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when start completed. */ start(callback: AsyncCallback): void; /** * Starts video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when start completed. */ start(): Promise; /** * Pauses video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Resumes video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when resume completed. */ resume(callback: AsyncCallback): void; /** * Resumes video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when resume completed. */ resume(): Promise; /** * Stops video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Releases resources used for video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @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. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when release completed. */ release(): Promise; @@ -656,9 +604,8 @@ declare namespace media { * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; @@ -666,17 +613,15 @@ declare namespace media { * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Listens for video recording error events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @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. */ @@ -684,24 +629,23 @@ declare namespace media { /** * video recorder state. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly state: VideoRecordState; } /** * Describes video playback states. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Enumerates playback speed. * @since 8 - * @SysCap SystemCapability.Multimedia.Media - * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ enum PlaybackSpeed { /* playback at 0.75x normal speed */ @@ -720,115 +664,101 @@ declare namespace media { * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer * instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ interface VideoPlayer { /** * set display surface. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; /** * set display surface. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ setDisplaySurface(surfaceId: string): Promise; /** * prepare video playback, it will request resource for playing. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when prepare completed. */ prepare(callback: AsyncCallback): void; /** * prepare video playback, it will request resource for playing. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when prepare completed. */ prepare(): Promise; /** * Starts video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when start completed. */ play(callback: AsyncCallback): void; /** * Starts video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when start completed. */ play(): Promise; /** * Pauses video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Stops video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Resets video playback, it will release the resource. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; /** * Resets video playback, it will release the resource. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Jumps to the specified playback position by default SeekMode(SEEK_CLOSEST), * the performance may be not the best. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param callback A callback instance used to return when seek completed * and return the seeking position result. @@ -836,9 +766,8 @@ declare namespace media { seek(timeMs: number, callback: AsyncCallback): void; /** * Jumps to the specified playback position. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @param callback A callback instance used to return when seek completed @@ -847,9 +776,8 @@ declare namespace media { seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void; /** * Jumps to the specified playback position. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @return A Promise instance used to return when seek completed @@ -858,52 +786,46 @@ declare namespace media { seek(timeMs: number, mode?:SeekMode): Promise; /** * Sets the volume. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ setVolume(vol: number, callback: AsyncCallback): void; /** * Sets the volume. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ setVolume(vol: number): Promise; /** * Releases resources used for video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @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. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @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.. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -912,74 +834,65 @@ declare namespace media { /** * media url. Mainstream video formats are supported. * local:fd://XXX, file://XXX. network:http://xxx - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ url: string; /** * Whether to loop video playback. The value true means to loop playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ loop: boolean; /** * Current playback position. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly currentTime: number; /** * Playback duration, if -1 means cannot seek. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly duration: number; /** * Playback state. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly state: VideoPlayState; /** * video width, valid after prepared. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly width: number; /** * video height, valid after prepared. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly height: number; /** * set payback speed. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @param callback Callback used to return actually speed. */ setSpeed(speed:number, callback: AsyncCallback): void; /** * set output surface. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @return A Promise instance used to return actually speed. */ @@ -987,9 +900,8 @@ declare namespace media { /** * Listens for video playback completed events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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 . */ @@ -997,9 +909,8 @@ declare namespace media { /** * Listens for video playback buffering events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ @@ -1007,9 +918,8 @@ declare namespace media { /** * Listens for start render video frame events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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 . */ @@ -1017,9 +927,8 @@ declare namespace media { /** * Listens for video size changed event. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ @@ -1027,9 +936,8 @@ declare namespace media { /** * Listens for playback error events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.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. */ @@ -1039,9 +947,8 @@ declare namespace media { /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum ContainerFormatType { /** @@ -1058,9 +965,8 @@ declare namespace media { /** * Enumerates media data type. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum MediaType { /** @@ -1076,9 +982,8 @@ declare namespace media { /** * Enumerates media description key. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum MediaDescriptionKey { /** @@ -1135,81 +1040,71 @@ declare namespace media { interface VideoRecorderProfile { /** * Indicates the audio bit rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioBitrate: number; /** * Indicates the number of audio channels. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioChannels: number; /** * Indicates the audio encoding format. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioCodec: CodecMimeType; /** * Indicates the audio sampling rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioSampleRate: number; /** * Indicates the output file format. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly fileFormat: ContainerFormatType; /** * Indicates the video bit rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoBitrate: number; /** * Indicates the video encoding format. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoCodec: CodecMimeType; /** * Indicates the video width. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameWidth: number; /** * Indicates the video height. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameHeight: number; /** * Indicates the video frame rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameRate: number; } @@ -1217,9 +1112,8 @@ declare namespace media { /** * Enumerates audio source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum AudioSourceType { /** @@ -1235,9 +1129,8 @@ declare namespace media { /** * Enumerates video source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum VideoSourceType { /** @@ -1253,23 +1146,20 @@ declare namespace media { interface VideoRecorderConfig { /** * audio source type, details see @AudioSourceType . - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ audioSourceType: AudioSourceType; /** * video source type, details see @VideoSourceType . - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ videoSourceType: VideoSourceType; /** * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ profile:VideoRecorderProfile; /** @@ -1277,24 +1167,21 @@ declare namespace media { * format like: scheme + "://" + "context". * file: file://path * fd: fd://fd - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ 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. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ rotation?: number; /** * geographical location information. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ location?: Location; } @@ -1302,9 +1189,8 @@ declare namespace media { interface MediaDescription { /** * key:value pair, key see @MediaDescriptionKey . - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core */ [key : string]: Object; } @@ -1312,9 +1198,8 @@ declare namespace media { /** * Enumerates seek mode. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum SeekMode { /** @@ -1332,9 +1217,8 @@ declare namespace media { /** * Enumerates Codec MIME types. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum CodecMimeType { /** -- Gitee From d65a2825850e0d1e42a6d23a17f60aecd25e8531 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Mon, 14 Feb 2022 16:24:30 +0800 Subject: [PATCH 8/8] fix the syscaps annotation Signed-off-by: sharpshooter_t Change-Id: I936e5c82b9a61e7add300edc5e14faf5f6b3779a --- api/@ohos.multimedia.media.d.ts | 446 +++++++++++++++++++++----------- 1 file changed, 298 insertions(+), 148 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 528753e1b7..c33f70bef3 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -18,14 +18,13 @@ import { ErrorCallback, AsyncCallback, Callback } from './basic'; /** * @name media * @since 6 - * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' */ declare namespace media { /** * Creates an AudioPlayer instance. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @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. */ @@ -34,7 +33,7 @@ declare namespace media { /** * Creates an AudioRecorder instance. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @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. */ @@ -43,7 +42,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -51,7 +50,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -60,7 +59,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @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. */ @@ -68,7 +67,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @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. */ @@ -77,57 +76,77 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum MediaErrorCode { /** * operation success. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OK = 0, /** * malloc or new memory failed. maybe system have no memory. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_NO_MEMORY = 1, /** * no permission for the operation. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OPERATION_NOT_PERMIT = 2, /** * invalid argument. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_VAL = 3, /** * an IO error occurred. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_IO = 4, /** * operation time out. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_TIMEOUT = 5, /** * unknown error. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNKNOWN = 6, /** * media service died. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_SERVICE_DIED = 7, /** * operation is not permit in current state. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_STATE = 8, /** * operation is not supported in current version. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNSUPPORTED = 9, } @@ -135,68 +154,86 @@ declare namespace media { /** * Enumerates buffering info type, for network playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum BufferingInfoType { - /* begin to buffering*/ + /** + * begin to buffering + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ BUFFERING_START = 1, - /* end to buffering*/ + /** + * end to buffering + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ BUFFERING_END = 2, - /* buffering percent*/ + /** + * buffering percent + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ BUFFERING_PERCENT = 3, - /* cached duration in milliseconds*/ + /** + * cached duration in milliseconds + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ CACHED_DURATION = 4, } /** * Describes audio playback states. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() - * or createAudioPlayerAsync() to create an AudioPlayer instance. + * to create an AudioPlayer instance. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ interface AudioPlayer { /** * Starts audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ play(): void; /** * Pauses audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ pause(): void; /** * Stops audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ stop(): void; /** * Resets audio playback. * @since 7 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ reset(): void; /** * Jumps to the specified playback position. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param timeMs Playback position to jump */ seek(timeMs: number): void; @@ -204,7 +241,7 @@ declare namespace media { /** * Sets the volume. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @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%). */ setVolume(vol: number): void; @@ -212,13 +249,13 @@ declare namespace media { /** * Releases resources used for audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ release(): void; /** * get all track infos in MediaDescription, should be called after data loaded callback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param callback async callback return track info in MediaDescription. */ getTrackDescription(callback: AsyncCallback>): void; @@ -226,7 +263,7 @@ declare namespace media { /** * get all track infos in MediaDescription, should be called after data loaded callback.. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -235,7 +272,7 @@ declare namespace media { /** * Listens for audio playback buffering events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @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. */ @@ -244,42 +281,42 @@ declare namespace media { * Audio media URI. Mainstream audio formats are supported. * local:fd://XXX, file://XXX. network:http://xxx * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ src: string; /** * Whether to loop audio playback. The value true means to loop playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ loop: boolean; /** * Current playback position. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ readonly currentTime: number; /** * 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 + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ readonly duration: number; /** * Playback state. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ readonly state: AudioState; /** * Listens for audio playback events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @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. */ @@ -288,7 +325,7 @@ declare namespace media { /** * Listens for audio playback events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @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. */ @@ -297,7 +334,7 @@ declare namespace media { /** * Listens for playback error events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @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. */ @@ -305,87 +342,107 @@ declare namespace media { } /** - * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to instead of. + * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' + * @deprecated since 8 */ enum AudioEncoder { /** * Advanced Audio Coding Low Complexity (AAC-LC). + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ AAC_LC = 3, } /** - * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to instead of. + * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to replace. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' + * @deprecated since 8 */ enum AudioOutputFormat { /** * Indicates the Moving Picture Experts Group-4 (MPEG4) media format. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ MPEG_4 = 2, /** * Audio Data Transport Stream (ADTS), a transmission stream format of Advanced Audio Coding (AAC) audio. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ AAC_ADTS = 6 } + /** + * Provides the geographical location definitions for media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.Core + */ interface Location { /** * Latitude. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core */ latitude: number; /** * Longitude. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core */ longitude: number; } + /** + * Provides the audio recorder configuration definitions. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + */ interface AudioRecorderConfig { /** * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. * use "audioEncoderMime" instead. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 8 */ audioEncoder?: AudioEncoder; /** * Audio encoding bit rate. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncodeBitRate?: number; /** * Audio sampling rate. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ audioSampleRate?: number; /** * Number of audio channels. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ numberOfChannels?: number; /** * Audio output format. The default value is DEFAULT, it will be deprecated after API8. - * it will be use "fileFormat" to instead of. + * it will be replaced with "fileFormat". * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 8 */ format?: AudioOutputFormat; @@ -395,36 +452,42 @@ declare namespace media { * file: file://path * fd: fd://fd * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ uri: string; /** * Geographical location information. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ location?: Location; /** - * audio encoding format MIME. it used to instead of audioEncoder. + * audio encoding format MIME. it used to replace audioEncoder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncoderMime?: CodecMimeType; /** - * output file format. see @ContainerFormatType , it used to instead of "format". + * output file format. see @ContainerFormatType , it used to replace "format". * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ fileFormat?: ContainerFormatType; } + /** + * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder() + * to create an AudioRecorder instance. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + */ interface AudioRecorder { /** * Prepares for recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param config Recording parameters. */ prepare(config: AudioRecorderConfig): void; @@ -432,35 +495,35 @@ declare namespace media { /** * Starts audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ start(): void; /** * Pauses audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ pause(): void; /** * Resumes audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ resume(): void; /** * Stops audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ stop(): void; /** * Releases resources used for audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ release(): void; @@ -469,14 +532,14 @@ declare namespace media { * 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 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ reset(): void; /** * Listens for audio recording events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @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. */ @@ -485,7 +548,7 @@ declare namespace media { /** * Listens for audio recording error events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @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. */ @@ -495,15 +558,21 @@ declare namespace media { /** * Describes video recorder states. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @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 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ interface VideoRecorder { /** * Prepares for recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @param callback A callback instance used to return when prepare completed. */ @@ -511,7 +580,7 @@ declare namespace media { /** * Prepares for recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @return A Promise instance used to return when prepare completed. */ @@ -519,84 +588,84 @@ declare namespace media { /** * get input surface.it must be called between prepare completed and start. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @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 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return the input surface id in string. */ getInputSurface(): Promise; /** * Starts video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when start completed. */ start(callback: AsyncCallback): void; /** * Starts video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when start completed. */ start(): Promise; /** * Pauses video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Resumes video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when resume completed. */ resume(callback: AsyncCallback): void; /** * Resumes video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when resume completed. */ resume(): Promise; /** * Stops video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Releases resources used for video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @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 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when release completed. */ release(): Promise; @@ -605,7 +674,7 @@ declare namespace media { * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; @@ -614,14 +683,14 @@ declare namespace media { * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Listens for video recording error events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @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. */ @@ -630,7 +699,7 @@ declare namespace media { /** * video recorder state. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly state: VideoRecordState; } @@ -638,25 +707,45 @@ declare namespace media { /** * Describes video playback states. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Enumerates playback speed. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ enum PlaybackSpeed { - /* playback at 0.75x normal speed */ + /** + * playback at 0.75x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_0_75_X = 0, - /* playback at normal speed */ + /** + * playback at normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_1_00_X = 1, - /* playback at 1.25x normal speed */ + /** + * playback at 1.25x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_1_25_X = 2, - /* playback at 1.75x normal speed */ + /** + * playback at 1.75x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_1_75_X = 3, - /* playback at 2.0x normal speed */ + /** + * playback at 2.0x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_2_00_X = 4, } @@ -664,14 +753,14 @@ declare namespace media { * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer * instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' */ interface VideoPlayer { /** * set display surface. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -679,7 +768,7 @@ declare namespace media { /** * set display surface. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -687,70 +776,70 @@ declare namespace media { /** * prepare video playback, it will request resource for playing. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @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 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when prepare completed. */ prepare(): Promise; /** * Starts video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when start completed. */ play(callback: AsyncCallback): void; /** * Starts video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when start completed. */ play(): Promise; /** * Pauses video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Stops video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Resets video playback, it will release the resource. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; /** * Resets video playback, it will release the resource. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when reset completed. */ reset(): Promise; @@ -758,7 +847,7 @@ declare namespace media { * Jumps to the specified playback position by default SeekMode(SEEK_CLOSEST), * the performance may be not the best. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param callback A callback instance used to return when seek completed * and return the seeking position result. @@ -767,7 +856,7 @@ declare namespace media { /** * Jumps to the specified playback position. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @param callback A callback instance used to return when seek completed @@ -777,7 +866,7 @@ declare namespace media { /** * Jumps to the specified playback position. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @return A Promise instance used to return when seek completed @@ -787,7 +876,7 @@ declare namespace media { /** * Sets the volume. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -795,7 +884,7 @@ declare namespace media { /** * Sets the volume. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -803,21 +892,21 @@ declare namespace media { /** * Releases resources used for video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @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 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback async callback return track info in MediaDescription. */ getTrackDescription(callback: AsyncCallback>): void; @@ -825,7 +914,7 @@ declare namespace media { /** * get all track infos in MediaDescription, should be called after data loaded callback.. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -835,56 +924,56 @@ declare namespace media { * media url. Mainstream video formats are supported. * local:fd://XXX, file://XXX. network:http://xxx * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ url: string; /** * Whether to loop video playback. The value true means to loop playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ loop: boolean; /** * Current playback position. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly currentTime: number; /** * Playback duration, if -1 means cannot seek. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly duration: number; /** * Playback state. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly state: VideoPlayState; /** * video width, valid after prepared. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly width: number; /** * video height, valid after prepared. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly height: number; /** * set payback speed. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @param callback Callback used to return actually speed. */ @@ -892,7 +981,7 @@ declare namespace media { /** * set output surface. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @return A Promise instance used to return actually speed. */ @@ -901,7 +990,7 @@ declare namespace media { /** * Listens for video playback completed events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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 . */ @@ -910,7 +999,7 @@ declare namespace media { /** * Listens for video playback buffering events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -919,7 +1008,7 @@ declare namespace media { /** * Listens for start render video frame events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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 . */ @@ -928,7 +1017,7 @@ declare namespace media { /** * Listens for video size changed event. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -937,7 +1026,7 @@ declare namespace media { /** * Listens for playback error events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @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. */ @@ -947,17 +1036,21 @@ declare namespace media { /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum ContainerFormatType { /** * A video container format type mp4. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ CFT_MPEG_4 = "mp4", /** * A audio container format type m4a. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ CFT_MPEG_4A = "m4a", } @@ -965,16 +1058,20 @@ declare namespace media { /** * Enumerates media data type. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum MediaType { /** * track is audio. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MEDIA_TYPE_AUD = 0, /** * track is video. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MEDIA_TYPE_VID = 1, } @@ -982,129 +1079,154 @@ declare namespace media { /** * Enumerates media description key. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum MediaDescriptionKey { /** * key for track index, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_TRACK_INDEX = "track_index", /** - * key for track type, value type is number, see @MediaType . + * key for track type, value type is number, see @MediaType. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_TRACK_TYPE = "track_type", /** * key for codec mime type, value type is string. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_CODEC_MIME = "codec_mime", /** * key for duration, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_DURATION = "duration", /** * key for bitrate, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_BITRATE = "bitrate", /** * key for video width, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_WIDTH = "width", /** * key for video height, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_HEIGHT = "height", /** * key for video frame rate, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_FRAME_RATE = "frame_rate", /** * key for audio channel count, value type is number + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_AUD_CHANNEL_COUNT = "channel_count", /** * key for audio sample rate, value type is number + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_AUD_SAMPLE_RATE = "sample_rate", } + /** + * Provides the video recorder profile definitions. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ interface VideoRecorderProfile { /** * Indicates the audio bit rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioBitrate: number; /** * Indicates the number of audio channels. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioChannels: number; /** * Indicates the audio encoding format. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioCodec: CodecMimeType; /** * Indicates the audio sampling rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioSampleRate: number; /** * Indicates the output file format. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly fileFormat: ContainerFormatType; /** * Indicates the video bit rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoBitrate: number; /** * Indicates the video encoding format. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoCodec: CodecMimeType; /** * Indicates the video width. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameWidth: number; /** * Indicates the video height. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameHeight: number; /** * Indicates the video frame rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameRate: number; } @@ -1112,16 +1234,20 @@ declare namespace media { /** * Enumerates audio source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' */ enum AudioSourceType { /** * default audio source type. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ AUDIO_SOURCE_TYPE_MIC = 1, } @@ -1129,37 +1255,46 @@ declare namespace media { /** * Enumerates video source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' */ enum VideoSourceType { /** * surface raw data. - */ + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, } + /** + * Provides the video recorder configuration definitions. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ interface VideoRecorderConfig { /** * audio source type, details see @AudioSourceType . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ audioSourceType: AudioSourceType; /** * video source type, details see @VideoSourceType . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ videoSourceType: VideoSourceType; /** * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ profile:VideoRecorderProfile; /** @@ -1168,29 +1303,34 @@ declare namespace media { * file: file://path * fd: fd://fd * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ 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 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ rotation?: number; /** * geographical location information. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ location?: Location; } + /** + * Provides the container definition for media description key-value pairs. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ interface MediaDescription { /** * key:value pair, key see @MediaDescriptionKey . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core */ [key : string]: Object; } @@ -1198,18 +1338,20 @@ declare namespace media { /** * Enumerates seek mode. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum SeekMode { /** * seek to the next sync frame of the given timestamp * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ SEEK_NEXT_SYNC = 0, /** * seek to the previous sync frame of the given timestamp * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ SEEK_PREV_SYNC = 1, } @@ -1217,52 +1359,60 @@ declare namespace media { /** * Enumerates Codec MIME types. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum CodecMimeType { /** * H.263 codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_H263 = 'video/h263', /** * H.264 codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_AVC = 'video/avc', /** * MPEG2 codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_MPEG2 = 'video/mpeg2', /** * MPEG4 codec MIME type * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_MPEG4 = 'video/mp4v-es', /** * VP8 codec MIME type * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_VP8 = 'video/x-vnd.on2.vp8', /** * AAC codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ AUDIO_AAC = 'audio/mp4a-latm', /** * vorbis codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ AUDIO_VORBIS = 'audio/vorbis', /** * flac codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ AUDIO_FLAC = 'audio/flac', } -- Gitee