From f9dda0b660601ecfafccb67f1162034bb061afcd Mon Sep 17 00:00:00 2001 From: magekkkk Date: Tue, 8 Mar 2022 07:47:25 +0000 Subject: [PATCH] update sdk defination and comment to sync with sdk7 Signed-off-by: magekkkk --- api/@ohos.multimedia.audio.d.ts | 59 +++++++++++------ api/@ohos.multimedia.media.d.ts | 2 + api/@ohos.multimedia.mediaLibrary.d.ts | 88 +++++++++++++------------- 3 files changed, 84 insertions(+), 65 deletions(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 817083957e..4d24d3403a 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -276,13 +276,13 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ - RINGER_MODE_VIBRATE, + RINGER_MODE_VIBRATE = 1, /** * Normal mode * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication */ - RINGER_MODE_NORMAL, + RINGER_MODE_NORMAL = 2, } /** @@ -510,7 +510,7 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core */ - STREAM_USAGE_NOTIFICATION_RINGTONE = 3 + STREAM_USAGE_NOTIFICATION_RINGTONE = 6 } /** @@ -823,50 +823,52 @@ declare namespace audio { * Sets volume for a stream. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ - setVolume(audioType: AudioVolumeType, volume: number, callback: AsyncCallback): void; + setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; /** * Sets volume for a stream. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ - setVolume(audioType: AudioVolumeType, volume: number): Promise; + setVolume(volumeType: AudioVolumeType, volume: number): Promise; /** * Obtains volume of a stream. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - getVolume(audioType: AudioVolumeType, callback: AsyncCallback): void; + getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the volume of a stream. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - getVolume(audioType: AudioVolumeType): Promise; + getVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - getMinVolume(audioType: AudioVolumeType, callback: AsyncCallback): void; + getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the minimum volume allowed for a stream. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - getMinVolume(audioType: AudioVolumeType): Promise; + getMinVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - getMaxVolume(audioType: AudioVolumeType, callback: AsyncCallback): void; + getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the maximum volume allowed for a stream. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - getMaxVolume(audioType: AudioVolumeType): Promise; + getMaxVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the audio devices of a specified flag. This method uses an asynchronous callback to return the execution result. * @since 7 @@ -884,71 +886,77 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - mute(audioType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; + mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; /** * Sets the stream to mute. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - mute(audioType: AudioVolumeType, mute: boolean): Promise; + mute(volumeType: AudioVolumeType, mute: boolean): Promise; /** * Checks whether the stream is muted. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - isMute(audioType: AudioVolumeType, callback: AsyncCallback): void; + isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether the stream is muted. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - isMute(audioType: AudioVolumeType): Promise; + isMute(volumeType: AudioVolumeType): Promise; /** * Checks whether the stream is active. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - isActive(audioType: AudioVolumeType, callback: AsyncCallback): void; + isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether the stream is active. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume */ - isActive(audioType: AudioVolumeType): Promise; + isActive(volumeType: AudioVolumeType): Promise; /** * Mute/Unmutes the microphone. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @permission ohos.permission.MICROPHONE */ setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; /** * Mute/Unmutes the microphone. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @permission ohos.permission.MICROPHONE */ setMicrophoneMute(mute: boolean): Promise; /** * Checks whether the microphone is muted. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @permission ohos.permission.MICROPHONE */ isMicrophoneMute(callback: AsyncCallback): void; /** * Checks whether the microphone is muted. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @permission ohos.permission.MICROPHONE */ isMicrophoneMute(): Promise; /** * Sets the ringer mode. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; /** * Sets the ringer mode. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY */ setRingerMode(mode: AudioRingMode): Promise; /** @@ -967,12 +975,14 @@ declare namespace audio { * Sets the audio parameter. This method uses an asynchronous callback to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core + * @permission ohos.permission.MODIFY_AUDIO_SETTINGS */ setAudioParameter(key: string, value: string, callback: AsyncCallback): void; /** * Sets the audio parameter. This method uses a promise to return the execution result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core + * @permission ohos.permission.MODIFY_AUDIO_SETTINGS */ setAudioParameter(key: string, value: string): Promise; /** @@ -1054,12 +1064,19 @@ declare namespace audio { */ getAudioScene(): Promise; /** - * Monitors device changes - * @since 7 - * @syscap SystemCapability.Multimedia.Audio.Device - */ + * Monitors device changes + * @since 7 + * @syscap SystemCapability.Multimedia.Audio.Device + */ on(type: 'deviceChange', callback: Callback): void; + /** + * Cancels the listening of device change events. + * @since 7 + * @syscap SystemCapability.Multimedia.Audio.Device + */ + off(type: 'deviceChange', callback?: Callback): void; + /** * Listens for audio interruption events. When the audio of an application is interrupted by another application, * the callback is invoked to notify the former application. diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index c08a3fb85b..5d6692bde3 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -284,6 +284,7 @@ declare namespace media { * local:fd://XXX, file://XXX. network:http://xxx * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @permission ohos.permission.READ_MEDIA, ohos.permission.INTERNET */ src: string; @@ -540,6 +541,7 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param config Recording parameters. + * @permission ohos.permission.MICROPHONE */ prepare(config: AudioRecorderConfig): void; diff --git a/api/@ohos.multimedia.mediaLibrary.d.ts b/api/@ohos.multimedia.mediaLibrary.d.ts index 45a0cbd125..5c9b1822bd 100644 --- a/api/@ohos.multimedia.mediaLibrary.d.ts +++ b/api/@ohos.multimedia.mediaLibrary.d.ts @@ -125,26 +125,26 @@ declare namespace mediaLibrary { /** * Provides methods to encapsulate file attributes. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' */ interface FileAsset { /** * File ID. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly id: number; /** * URI of the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly uri: string; /** * MIME type, for example, video/mp4, audio/mp4, or audio/amr-wb. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly mimeType: string; @@ -156,13 +156,13 @@ declare namespace mediaLibrary { readonly mediaType: MediaType; /** * Display name (with a file name extension) of the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ displayName: string; /** * File name title (without the file name extension). - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ title: string; @@ -180,25 +180,25 @@ declare namespace mediaLibrary { readonly parent: number; /** * Data size of the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly size: number; /** * Date (timestamp) when the file was added. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly dateAdded: number; /** * Date (timestamp) when the file was modified. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly dateModified: number; /** * Date (timestamp) when the file was taken. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly dateTaken: number; @@ -216,20 +216,20 @@ declare namespace mediaLibrary { readonly audioAlbum: string; /** * Display width of the file. This is valid only for videos and images. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly width: number; /** * Display height of the file. This is valid only for videos and images. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly height: number; /** * Rotation angle of the file, in degrees. * The rotation angle can be 0, 90, 180, or 270 degrees. This is valid only for videos. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ orientation: number; @@ -241,7 +241,7 @@ declare namespace mediaLibrary { readonly duration: number; /** * ID of the album where the file is located. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly albumId: number; @@ -253,7 +253,7 @@ declare namespace mediaLibrary { readonly albumUri: string; /** * Name of the album where the file is located. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly albumName: string; @@ -537,25 +537,25 @@ declare namespace mediaLibrary { /** * Fetch parameters applicable on images, videos, audios, albums and other media - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ interface MediaFetchOptions { /** * Fields to retrieve, for example, selections: "media_type =? OR media_type =?". - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ selections: string; /** * Conditions for retrieval, for example, selectionArgs: [IMAGE, VIDEO]. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ selectionArgs: Array; /** * Sorting criterion of the retrieval results, for example, order: "datetaken DESC,display_name DESC, file_id DESC". - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ order?: string; @@ -581,21 +581,21 @@ declare namespace mediaLibrary { /** * Implements file retrieval. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' */ interface FetchFileResult { /** * Obtains the total number of files in the file retrieval result. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @return Total number of files. */ getCount(): number; /** * Checks whether the result set points to the last row. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @return Whether the file is the last one. * You need to check whether the file is the last one before calling getNextObject, @@ -604,20 +604,20 @@ declare namespace mediaLibrary { isAfterLast(): boolean; /** * Releases the FetchFileResult instance and invalidates it. Other methods cannot be called. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ close(): void; /** * Obtains the first FileAsset in the file retrieval result. This method uses a callback to return the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return the file in the format of a FileAsset instance. */ getFirstObject(callback: AsyncCallback): void; /** * Obtains the first FileAsset in the file retrieval result. This method uses a promise to return the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @return A Promise instance used to return the file in the format of a FileAsset instance. */ @@ -627,7 +627,7 @@ declare namespace mediaLibrary { * This method uses a callback to return the file. * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. * This method returns the next file only when True is returned for isAfterLast(). - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return the file in the format of a FileAsset instance. */ @@ -637,21 +637,21 @@ declare namespace mediaLibrary { * This method uses a promise to return the file. * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. * This method returns the next file only when True is returned for isAfterLast(). - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @return A Promise instance used to return the file in the format of a FileAsset instance. */ getNextObject(): Promise; /** * Obtains the last FileAsset in the file retrieval result. This method uses a callback to return the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return the file in the format of a FileAsset instance. */ getLastObject(callback: AsyncCallback): void; /** * Obtains the last FileAsset in the file retrieval result. This method uses a promise to return the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @return A Promise instance used to return the file in the format of a FileAsset instance. */ @@ -659,7 +659,7 @@ declare namespace mediaLibrary { /** * Obtains the FileAsset with the specified index in the file retrieval result. * This method uses a callback to return the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param index Index of the file to obtain. * @param callback Callback used to return the file in the format of a FileAsset instance. @@ -668,7 +668,7 @@ declare namespace mediaLibrary { /** * Obtains the FileAsset with the specified index in the file retrieval result. * This method uses a promise to return the file. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param index Index of the file to obtain. * @return A Promise instance used to return the file in the format of a FileAsset instance. @@ -679,7 +679,7 @@ declare namespace mediaLibrary { * This method uses a callback to return the result. After this method is called, * close() is automatically called to release the FetchFileResult instance and invalidate it. * In this case, other methods cannot be called. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return a FileAsset array. */ @@ -689,7 +689,7 @@ declare namespace mediaLibrary { * This method uses a promise to return the result. that store the selected media resources. * close() is automatically called to release the FetchFileResult instance and invalidate it. * In this case, other methods cannot be called. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @return A Promise instance used to return a FileAsset array. */ @@ -700,18 +700,18 @@ declare namespace mediaLibrary { * Defines the album. * * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @since 8 + * @since 7 */ interface Album { /** * Album ID. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly albumId: number; /** * Album name. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ albumName: string; @@ -723,7 +723,7 @@ declare namespace mediaLibrary { readonly albumUri: string; /** * Date (timestamp) when the album was last modified. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core */ readonly dateModified: number; @@ -763,7 +763,7 @@ declare namespace mediaLibrary { commitModify(): Promise; /** * SObtains files in an album. This method uses an asynchronous callback to return the files. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param callback Callback used to return the files in the format of a FetchFileResult instance. @@ -771,7 +771,7 @@ declare namespace mediaLibrary { getFileAssets(callback: AsyncCallback): void; /** * SObtains files in an album. This method uses an asynchronous callback to return the files. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. @@ -780,7 +780,7 @@ declare namespace mediaLibrary { getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; /** * Obtains files in an album. This method uses a promise to return the files. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. @@ -859,7 +859,7 @@ declare namespace mediaLibrary { /** * query all assets just for count & first cover * if need all data, getAllObject from FetchFileResult - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param options, Media retrieval options. @@ -869,7 +869,7 @@ declare namespace mediaLibrary { /** * query all assets just for count & first cover * if need all data, getAllObject from FetchFileResult - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param options Media retrieval options. @@ -936,7 +936,7 @@ declare namespace mediaLibrary { deleteAsset(uri: string): Promise; /** * Obtains albums based on the media retrieval options. This method uses an asynchronous callback to return. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. @@ -945,7 +945,7 @@ declare namespace mediaLibrary { getAlbums(options: MediaFetchOptions, callback: AsyncCallback>): void; /** * Obtains albums based on the media retrieval options. This method uses a promise to return the albums. - * @since 8 + * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. -- Gitee