diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index ba9645edc9171895a40e2693093f433d7f0a44a4..aeb31407fa8e15824a5272b3aca56ad7f043c88f 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -21,9 +21,9 @@ import { ErrorCallback, AsyncCallback, Callback, BusinessError } from './@ohos.base'; import audio from "./@ohos.multimedia.audio"; import photoAccessHelper from './@ohos.file.photoAccessHelper'; -import image from './@ohos.multimedia.image'; -import { SoundPool as _SoundPool } from './multimedia/soundPool'; -import { PlayParameters as _PlayParameters } from './multimedia/soundPool'; +import type image from './@ohos.multimedia.image'; +import type { SoundPool as _SoundPool } from './multimedia/soundPool'; +import type { PlayParameters as _PlayParameters } from './multimedia/soundPool'; import type drm from './@ohos.multimedia.drm'; /** @@ -66,10 +66,20 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVPlayer(callback: AsyncCallback): void; + /** + * Creates an AVPlayer instance. + * @param { AsyncCallback } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function createAVPlayer(callback: AsyncCallback): void; /** * Creates an AVPlayer instance. @@ -93,10 +103,20 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVPlayer(): Promise; + /** + * Creates an AVPlayer instance. + * @returns { Promise } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function createAVPlayer(): Promise; /** * Creates an AVRecorder instance. @@ -111,10 +131,19 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVRecorder(callback: AsyncCallback): void; + /** + * Creates an AVRecorder instance. + * @param { AsyncCallback } callback - used to return AVRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + function createAVRecorder(callback: AsyncCallback): void; /** * Creates an AVRecorder instance. @@ -130,10 +159,20 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVRecorder(): Promise; + /** + * Creates an AVRecorder instance. + * @returns { Promise } A Promise instance used to return AVRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function createAVRecorder(): Promise; /** * Creates an AudioPlayer instance. @@ -179,6 +218,20 @@ declare namespace media { * @since 13 */ function createMediaSourceWithUrl(url: string, headers?: Record): MediaSource; + /** + * Create MediaSource from url. + * @param { string } url : The location for the media source. + * @param { Record } headers : Headers attached to network request while player request data. + * @returns { MediaSource | undefined } MediaSource instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400101 - No memory. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function createMediaSourceWithUrl(url: string, headers?: Record): MediaSource | undefined; /** * Create media source from media stream array. @@ -190,6 +243,17 @@ declare namespace media { * @since 18 */ function createMediaSourceWithStreamData(streams: Array): MediaSource; + /** + * Create media source from media stream array. + * @param { Array } streams - The player uses it to get stream source info. + * @returns { MediaSource | undefined } MediaSource instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + function createMediaSourceWithStreamData(streams: Array): MediaSource | undefined; /** * Creates an VideoPlayer instance. @@ -228,10 +292,21 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Return by callback. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createVideoRecorder(callback: AsyncCallback): void; + /** + * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder + * Creates an VideoRecorder instance. + * @param { AsyncCallback } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function createVideoRecorder(callback: AsyncCallback): void; /** * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder @@ -250,40 +325,77 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Return by promise. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createVideoRecorder(): Promise; + /** + * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder + * Creates an VideoRecorder instance. + * @returns { Promise } A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function createVideoRecorder(): Promise; /** * Creates a soundPool instance. * - * @param {int} maxStreams The maximum number of simultaneous streams for this soundPool instance + * @param {number} maxStreams The maximum number of simultaneous streams for this soundPool instance * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information * @param {AsyncCallback} callback Callback used to return soundPool instance if the operation is successful; returns null otherwise. * @throws { BusinessError } 5400101 - No memory. Return by callback. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ function createSoundPool( - maxStreams: int, + maxStreams: number, audioRenderInfo: audio.AudioRendererInfo, callback: AsyncCallback ): void; - /** * Creates a soundPool instance. * * @param {int} maxStreams The maximum number of simultaneous streams for this soundPool instance * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information + * @param {AsyncCallback} callback Callback used to return soundPool instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.SoundPool + * @since 20 + * @arkts 1.2 + */ + function createSoundPool( + maxStreams: int, + audioRenderInfo: audio.AudioRendererInfo, + callback: AsyncCallback + ): void; + + /** + * Creates a soundPool instance. + * + * @param {number} maxStreams The maximum number of simultaneous streams for this soundPool instance + * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information * @returns {Promise} A Promise instance used to return SoundPool instance if the operation is successful; returns null otherwise. * @throws { BusinessError } 5400101 - No memory. Return by promise. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ - function createSoundPool(maxStreams: int, audioRenderInfo: audio.AudioRendererInfo): Promise; + function createSoundPool(maxStreams: number, audioRenderInfo: audio.AudioRendererInfo): Promise; + /** + * Creates a soundPool instance. + * + * @param {int} maxStreams The maximum number of simultaneous streams for this soundPool instance + * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information + * @returns {Promise} A Promise instance used to return SoundPool instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.SoundPool + * @since 20 + * @arkts 1.2 + */ + function createSoundPool(maxStreams: int, audioRenderInfo: audio.AudioRendererInfo): Promise; /** * Creates an AVScreenCaptureRecorder instance. @@ -291,15 +403,24 @@ declare namespace media { * returns null otherwise. * @throws { BusinessError } 5400101 - No memory. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVScreenCaptureRecorder(): Promise; + /** + * Creates an AVScreenCaptureRecorder instance. + * @returns { Promise } A Promise instance used to return AVScreenCaptureRecorder instance if the operation is successful; + * returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 20 + * @arkts 1.2 + */ + function createAVScreenCaptureRecorder(): Promise; /** * Report user choice back to AVScreenCapture server * - * @param {number} sessionId The AVScreenCapture server session ID. + * @param {int} sessionId The AVScreenCapture server session ID. * @param {string} choice Content chosen by user. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. @@ -307,9 +428,10 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - function reportAVScreenCaptureUserChoice(sessionId: number, choice: string): Promise; + function reportAVScreenCaptureUserChoice(sessionId: int, choice: string): Promise; /** * Creates a AVTranscoder instance. @@ -317,10 +439,19 @@ declare namespace media { * @returns {Promise} A Promise instance used to return AVTranscoder instance if the operation is successful; returns null otherwise. * @throws { BusinessError } 5400101 - No memory. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVTranscoder(): Promise; + /** + * Creates a AVTranscoder instance. + * + * @returns {Promise} A Promise instance used to return AVTranscoder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 20 + * @arkts 1.2 + */ + function createAVTranscoder(): Promise; /** * Get the ScreenCaptureMonitor instance @@ -331,10 +462,22 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getScreenCaptureMonitor(): Promise; + /** + * Get the ScreenCaptureMonitor instance + * + * @returns { Promise } A Promise instance used to return ScreenCaptureMonitor instance if the operation is successful; + * returns null otherwise. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getScreenCaptureMonitor(): Promise; /** * Manages and plays sound. Before calling an SoundPool method, you must use createSoundPool() @@ -360,14 +503,14 @@ declare namespace media { /** * Enumerates state change reason. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 9 */ /** * Enumerates state change reason. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since 11 @@ -375,7 +518,7 @@ declare namespace media { /** * Enumerates state change reason. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice @@ -441,10 +584,20 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVMetadataExtractor(): Promise; + /** + * Creates an AVMetadataExtractor instance. + * @returns { Promise } A Promise instance used to return AVMetadataExtractor instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + function createAVMetadataExtractor(): Promise; /** * Creates an AVMetadataExtractor instance. @@ -461,10 +614,20 @@ declare namespace media { * @throws { BusinessError } 5400101 - No memory. Returned by callback. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVMetadataExtractor(callback: AsyncCallback): void; + /** + * Creates an AVMetadataExtractor instance. + * @param { AsyncCallback } callback - Callback used to return AVMetadataExtractor instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + function createAVMetadataExtractor(callback: AsyncCallback): void; /** * Creates an AVImageGenerator instance. @@ -472,10 +635,19 @@ declare namespace media { * if the operation is successful; returns null otherwise. * @throws { BusinessError } 5400101 - No memory. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVImageGenerator - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVImageGenerator(): Promise; + /** + * Creates an AVImageGenerator instance. + * @returns { Promise } A Promise instance used to return AVImageGenerator instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 20 + * @arkts 1.2 + */ + function createAVImageGenerator(): Promise; /** * Creates an AVImageGenerator instance. @@ -483,10 +655,19 @@ declare namespace media { * if the operation is successful; returns null otherwise. * @throws { BusinessError } 5400101 - No memory. Returned by callback. * @syscap SystemCapability.Multimedia.Media.AVImageGenerator - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ function createAVImageGenerator(callback: AsyncCallback): void; + /** + * Creates an AVImageGenerator instance. + * @param { AsyncCallback } callback - Callback used to return AVImageGenerator instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 20 + * @arkts 1.2 + */ + function createAVImageGenerator(callback: AsyncCallback): void; /** * Fetch media meta data or audio art picture from source. Before calling an AVMetadataExtractor method, @@ -552,10 +733,20 @@ declare namespace media { * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ fetchMetadata(callback: AsyncCallback): void; + /** + * It will extract the resource to fetch media meta data info. + * @param { AsyncCallback } callback - A callback instance used to return when fetchMetadata completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + fetchMetadata(callback: AsyncCallback): void; /** * It will extract the resource to fetch media meta data info. @@ -572,10 +763,20 @@ declare namespace media { * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ fetchMetadata(): Promise; + /** + * It will extract the resource to fetch media meta data info. + * @returns { Promise } A Promise instance used to return when fetchMetadata completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + fetchMetadata(): Promise; /** * It will extract the audio resource to fetch an album cover. @@ -594,10 +795,21 @@ declare namespace media { * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ fetchAlbumCover(callback: AsyncCallback): void; + /** + * It will extract the audio resource to fetch an album cover. + * @param { AsyncCallback } callback - A callback instance used + * to return when fetchAlbumCover completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + fetchAlbumCover(callback: AsyncCallback): void; /** * It will extract the audio resource to fetch an album cover. @@ -614,36 +826,48 @@ declare namespace media { * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @crossplatform - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ fetchAlbumCover(): Promise; + /** + * It will extract the audio resource to fetch an album cover. + * @returns { Promise } A Promise instance used to return when fetchAlbumCover completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 20 + * @arkts 1.2 + */ + fetchAlbumCover(): Promise; /** * Get timestamp according to frame index. - * @param { number } index - Index of the frame. - * @returns { Promise } A Promise instance used to return frame timestamp, in microseconds. + * @param { int } index - Index of the frame. + * @returns { Promise } A Promise instance used to return frame timestamp, in microseconds. * @throws { BusinessError } 401 - The parameter check failed. Return by promise. * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - getTimeByFrameIndex(index: number): Promise; + getTimeByFrameIndex(index: int): Promise; /** * Get frame index according to the given timestamp. - * @param { number } timeUs - Timestamp of the frame, in microseconds. - * @returns { Promise } A Promise instance used to return frame index. + * @param { long } timeUs - Timestamp of the frame, in microseconds. + * @returns { Promise } A Promise instance used to return frame index. * @throws { BusinessError } 401 - The parameter check failed. Return by promise. * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - getFrameIndexByTime(timeUs: number): Promise; + getFrameIndexByTime(timeUs: long): Promise; /** * Release resources used for AVMetadataExtractor. @@ -1038,7 +1262,7 @@ declare namespace media { /** * Enumerates options about the HDR Type of the video. - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @since arkts {'1.1':'12','1.2':'20'} @@ -1084,7 +1308,7 @@ declare namespace media { /** * It will fetch a picture at @timeUs from the given video resource. - * @param { long } timeUs - The time expected to fetch picture from the video resource. + * @param { number } timeUs - The time expected to fetch picture from the video resource. * The unit is microsecond(us). * @param { AVImageQueryOptions } options - The time options about the relationship * between the given timeUs and a key frame, see @AVImageQueryOptions . @@ -1094,16 +1318,32 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. * @syscap SystemCapability.Multimedia.Media.AVImageGenerator - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - fetchFrameByTime(timeUs: long, options: AVImageQueryOptions, param: PixelMapParams, + fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams, callback: AsyncCallback): void; + /** + * It will fetch a picture at @timeUs from the given video resource. + * @param { long } timeUs - The time expected to fetch picture from the video resource. + * The unit is microsecond(us). + * @param { AVImageQueryOptions } options - The time options about the relationship + * between the given timeUs and a key frame, see @AVImageQueryOptions . + * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams . + * @param { AsyncCallback } callback - A callback instance used + * to return when fetchFrameByTime completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 20 + * @arkts 1.2 + */ + fetchFrameByTime(timeUs: long, options: AVImageQueryOptions, param: PixelMapParams, + callback: AsyncCallback): void; /** * It will decode the given video resource. Then fetch a picture * at @timeUs according the given @options and @param . - * @param { long } timeUs - The time expected to fetch picture from the video resource. + * @param { number } timeUs - The time expected to fetch picture from the video resource. * The unit is microsecond(us). * @param { AVImageQueryOptions } options - The time options about the relationship * between the given timeUs and a key frame, see @AVImageQueryOptions . @@ -1113,10 +1353,26 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. * @syscap SystemCapability.Multimedia.Media.AVImageGenerator - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams): Promise; + /** + * It will decode the given video resource. Then fetch a picture + * at @timeUs according the given @options and @param . + * @param { long } timeUs - The time expected to fetch picture from the video resource. + * The unit is microsecond(us). + * @param { AVImageQueryOptions } options - The time options about the relationship + * between the given timeUs and a key frame, see @AVImageQueryOptions . + * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams . + * @returns { Promise } A Promise instance used to return the pixel map + * when fetchFrameByTime completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 20 + * @arkts 1.2 */ - fetchFrameByTime(timeUs: long, options: AVImageQueryOptions, param: PixelMapParams): Promise; + fetchFrameByTime(timeUs: long, options: AVImageQueryOptions, param: PixelMapParams): Promise; /** * Release resources used for AVImageGenerator. @@ -1141,7 +1397,7 @@ declare namespace media { /** * Enumerates options about the relationship between the given timeUs and a key frame. - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVImageGenerator * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 @@ -1225,7 +1481,7 @@ declare namespace media { /** * Enumerates options about the expected color options for the fetched image. - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVImageGenerator * @systemapi * @since arkts {'1.1':'11','1.2':'20'} @@ -1263,14 +1519,14 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 9 */ /** * Enumerates ErrorCode types, return in BusinessError::code. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since 11 @@ -1278,11 +1534,12 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ enum AVErrorCode { /** @@ -1301,7 +1558,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_OK = 0, @@ -1321,7 +1579,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_NO_PERMISSION = 201, @@ -1341,7 +1600,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_INVALID_PARAMETER = 401, @@ -1361,7 +1621,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_UNSUPPORT_CAPABILITY = 801, @@ -1381,7 +1642,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_NO_MEMORY = 5400101, @@ -1401,7 +1663,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_OPERATE_NOT_PERMIT = 5400102, @@ -1421,7 +1684,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO = 5400103, @@ -1441,7 +1705,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_TIMEOUT = 5400104, @@ -1461,7 +1726,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_SERVICE_DIED = 5400105, @@ -1481,7 +1747,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_UNSUPPORT_FORMAT = 5400106, @@ -1496,7 +1763,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_AUDIO_INTERRUPTED = 5400107, /** @@ -1504,7 +1772,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_HOST_NOT_FOUND = 5411001, /** @@ -1512,7 +1781,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_CONNECTION_TIMEOUT = 5411002, /** @@ -1520,7 +1790,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_NETWORK_ABNORMAL = 5411003, /** @@ -1528,7 +1799,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_NETWORK_UNAVAILABLE = 5411004, /** @@ -1536,7 +1808,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_NO_PERMISSION = 5411005, /** @@ -1544,7 +1817,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_REQUEST_DENIED = 5411006, /** @@ -1552,7 +1826,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_RESOURCE_NOT_FOUND = 5411007, /** @@ -1561,7 +1836,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_SSL_CLIENT_CERT_NEEDED = 5411008, /** @@ -1570,7 +1846,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_SSL_CONNECTION_FAILED = 5411009, /** @@ -1578,7 +1855,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_SSL_SERVER_CERT_UNTRUSTED = 5411010, /** @@ -1586,14 +1864,16 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 14 + * @since arkts {'1.1':'14','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_IO_UNSUPPORTED_REQUEST = 5411011, /** * Seek continuous unsupported. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_SEEK_CONTINUOUS_UNSUPPORTED = 5410002, @@ -1601,7 +1881,8 @@ declare namespace media { * Super-resolution unsupported. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_SUPER_RESOLUTION_UNSUPPORTED = 5410003, @@ -1609,7 +1890,8 @@ declare namespace media { * No PlaybackStrategy set to enable super-resolution feature. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ AVERR_SUPER_RESOLUTION_NOT_ENABLED = 5410004, } @@ -2209,38 +2491,41 @@ declare namespace media { /** * Get selected tracks, should be called after prepared state. - * @returns { Promise> } A Promise instance used to return selected track index. + * @returns { Promise> } A Promise instance used to return selected track index. * @throws { BusinessError } 5400102 - Operation not allowed. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - getSelectedTracks(): Promise>; + getSelectedTracks(): Promise>; /** * Select specific track to play. - * @param { number } index - Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX + * @param { int } index - Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX * @param { SwitchMode } mode - set switchmode for track select behavior. * @returns { Promise } A Promise instance used to return when select track completed. * @throws { BusinessError } 401 - The parameter check failed. Return by promise. * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - selectTrack(index: number, mode?: SwitchMode): Promise; + selectTrack(index: int, mode?: SwitchMode): Promise; /** * Deselect specific track to play. - * @param { number } index : Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX + * @param { int } index : Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX * @returns { Promise } A Promise instance used to return when deselect track completed. * @throws { BusinessError } 401 - The parameter check failed. Return by promise. * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - deselectTrack(index: number): Promise; + deselectTrack(index: int): Promise; /** * Set MediaSource to AVPlayer, this interface is exclusive with fd/url/dataSrc assign. @@ -2252,26 +2537,28 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ setMediaSource(src: MediaSource, strategy?: PlaybackStrategy): Promise; /** * Add subtitle resource represented by FD to the player. - * @param { number } fd : The file descriptor of subtitle source from file system. + * @param { int } fd : The file descriptor of subtitle source from file system. * The caller is responsible to close the file descriptor. - * @param { number } offset : The offset into the file where the data to be read, in bytes. + * @param { long } offset : The offset into the file where the data to be read, in bytes. * By default, the offset is zero. - * @param { number } length : The length in bytes of the data to be read. + * @param { long } length : The length in bytes of the data to be read. * By default, the length is the rest of bytes in the file from the offset. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - The parameter check failed. Return by promise. * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - addSubtitleFromFd(fd: number, offset?: number, length?: number): Promise; + addSubtitleFromFd(fd: int, offset?: long, length?: long): Promise; /** * Add subtitle resource represented by url to the player. After the Promise returns, @@ -2282,17 +2569,19 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ addSubtitleFromUrl(url: string): Promise; /** * Get statistic infos of current player. - * @returns { Promise> } Statistic infos of current player. + * @returns { Promise } Statistic infos of current player. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - getPlaybackInfo(): Promise>; + getPlaybackInfo(): Promise; /** * Set playback strategy to AVPlayer. @@ -2302,7 +2591,8 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ setPlaybackStrategy(strategy: PlaybackStrategy): Promise; @@ -2315,16 +2605,17 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ setMediaMuted(mediaType: MediaType, muted: boolean): Promise; /** * Set playback start position and end position. - * @param { number } startTimeMs - Playback start position, should be in [0, duration), + * @param { int } startTimeMs - Playback start position, should be in [0, duration), * -1 means that the start position is not set, * and the playback will start from 0. - * @param { number } endTimeMs - Playback end position, which should usually be in (startTimeMs, duration], + * @param { int } endTimeMs - Playback end position, which should usually be in (startTimeMs, duration], * -1 means that the end position is not set, * and the playback will be ended at the end of the stream. * @param { SeekMode } [mode] - Use the specified seek mode to jump to the playback start position, @@ -2335,9 +2626,10 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - setPlaybackRange(startTimeMs: number, endTimeMs: number, mode?: SeekMode) : Promise; + setPlaybackRange(startTimeMs: int, endTimeMs: int, mode?: SeekMode) : Promise; /** * Check whether the media stream currently being played by the player supports seek continuous. @@ -2353,13 +2645,14 @@ declare namespace media { /** * Get current playback position. - * @returns { number } return the time of current playback position - millisecond(ms) + * @returns { int } return the time of current playback position - millisecond(ms) * @throws { BusinessError } 5400102 - Operation not allowed. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - getPlaybackPosition() : number; + getPlaybackPosition() : int; /** * Enable or disable super-resolution dynamically. @@ -2373,7 +2666,8 @@ declare namespace media { * Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ setSuperResolution(enabled: boolean) : Promise; @@ -2381,8 +2675,8 @@ declare namespace media { * Set video window size for super-resolution. * Must enable super-resolution feature in {@link PlaybackStrategy} before calling {@link #prepare}. * See {@link #setPlaybackStrategy}, {@link #setMediaSource}. - * @param { number } width - width of the window. - * @param { number } height - height of the window. + * @param { int } width - width of the window. + * @param { int } height - height of the window. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @throws { BusinessError } 401 - Parameter error. Return by promise. @@ -2391,9 +2685,10 @@ declare namespace media { * Return by promise. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - setVideoWindowSize(width: number, height: number) : Promise; + setVideoWindowSize(width: int, height: int) : Promise; /** * Media URI. Mainstream media formats are supported. @@ -2528,7 +2823,8 @@ declare namespace media { * @type { ?audio.AudioEffectMode } * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ audioEffectMode ?: audio.AudioEffectMode; @@ -2686,7 +2982,7 @@ declare namespace media { * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player * will select the minimal and closest one from the available bitrate list. - * @param { number } bitrate - the playback bitrate must be expressed in bits per second. + * @param { int } bitrate - the playback bitrate must be expressed in bits per second. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 9 */ @@ -2696,13 +2992,14 @@ declare namespace media { * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player * will select the minimal and closest one from the available bitrate list. - * @param { number } bitrate - the playback bitrate must be expressed in bits per second. + * @param { int } bitrate - the playback bitrate must be expressed in bits per second. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - setBitrate(bitrate: number): void; + setBitrate(bitrate: int): void; /** * Set decryption session to codec module. @@ -2721,7 +3018,8 @@ declare namespace media { *
2. Incorrect parameter types. 3.Parameter verification failed. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ setDecryptionConfig(mediaKeySession: drm.MediaKeySession, secureVideoPath: boolean): void; @@ -2736,7 +3034,8 @@ declare namespace media { * @returns { Array } MediaKeySystemInfo with PSSH. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ getMediaKeySystemInfos(): Array; @@ -3327,8 +3626,37 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer * @crossplatform * @atomicservice - * @since 12 + * @since 12 + */ + /** + * Register listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupported format. + * @throws { BusinessError } 5411001 - IO can not find host. + * @throws { BusinessError } 5411002 - IO connection timeout. + * @throws { BusinessError } 5411003 - IO network abnormal. + * @throws { BusinessError } 5411004 - IO network unavailable. + * @throws { BusinessError } 5411005 - IO no permission. + * @throws { BusinessError } 5411006 - IO request denied. + * @throws { BusinessError } 5411007 - IO resource not found. + * @throws { BusinessError } 5411008 - IO SSL client cert needed. + * @throws { BusinessError } 5411009 - IO SSL connect fail. + * @throws { BusinessError } 5411010 - IO SSL server cert untrusted. + * @throws { BusinessError } 5411011 - IO unsupported request. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 14 */ + on(type: 'error', callback: ErrorCallback): void; /** * Register listens for playback error events. * @param { 'error' } type - Type of the playback error event to listen for. @@ -3355,9 +3683,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer * @crossplatform * @atomicservice - * @since arkts {'1.1':'14','1.2':'20'} - * @arkts 1.1&1.2 - * @permission + * @since 20 + * @arkts 1.2 */ on(type: 'error', callback: ErrorCallback): void; /** @@ -3373,6 +3700,16 @@ declare namespace media { * @atomicservice * @since 11 */ + /** + * Unregister listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'error', callback?: ErrorCallback): void; /** * Unregister listens for playback error events. * @param { 'error' } type - Type of the playback error event to listen for. @@ -3380,8 +3717,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVPlayer * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ off(type: 'error', callback?: ErrorCallback): void; @@ -3501,22 +3838,22 @@ declare namespace media { * Subscrips listener for audio playback amplitude update event. * In each event, an array of amplitude is reported, large index indicates closer to current time. * @param { 'amplitudeUpdate' } type - Type of the event to listen for. - * @param { Callback> } callback - Callback used to listen amplitude update event. + * @param { Callback> } callback - Callback used to listen amplitude update event. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since arkts {'1.1':'13','1.2':'20'} * @arkts 1.1&1.2 */ - on(type: 'amplitudeUpdate', callback: Callback>): void + on(type: 'amplitudeUpdate', callback: Callback>): void /** * UnSubscrips listener for audio playback amplitude update event * @param { 'amplitudeUpdate' } type - Type of the event to listen for. - * @param { Callback> } callback - Callback used to listen amplitude update event. + * @param { Callback> } callback - Callback used to listen amplitude update event. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since arkts {'1.1':'13','1.2':'20'} * @arkts 1.1&1.2 */ - off(type: 'amplitudeUpdate', callback?: Callback>): void + off(type: 'amplitudeUpdate', callback?: Callback>): void /** * Subscribes listener for video SEI message event, only for live video streaming. @@ -3600,41 +3937,47 @@ declare namespace media { * * @enum { string } * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ enum PlaybackInfoKey { /** * IP address of current network stream. * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ SERVER_IP_ADDRESS = 'server_ip_address', /** * Average download rate during playing except for suspend downloading. * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ AVG_DOWNLOAD_RATE = 'average_download_rate', /** * Current download rate of the last second except for suspend downloading. * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ DOWNLOAD_RATE = 'download_rate', /** * Boolean value, true for current is downloading, false for suspend downloading. * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ IS_DOWNLOADING = 'is_downloading', /** * Cached duration in milliseconds. * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ BUFFER_DURATION = 'buffer_duration', } @@ -3642,7 +3985,7 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 8 * @deprecated since 11 @@ -3743,14 +4086,14 @@ declare namespace media { /** * Enumerates buffering info type, for network playback. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 8 */ /** * Enumerates buffering info type, for network playback. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice @@ -3824,48 +4167,52 @@ declare namespace media { * and return the unique handle to the open resource. * @typedef { function } SourceOpenCallback * @param { MediaSourceLoadingRequest } request - open request parameters. - * @returns { number } - return the handle of current resource open request. + * @returns { long } - return the handle of current resource open request. * values less than or equal to zero mean failed. * - client should return immediately. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - type SourceOpenCallback = (request: MediaSourceLoadingRequest) => number; + type SourceOpenCallback = (request: MediaSourceLoadingRequest) => long; /** * Defines the SourceReadCallback function which is called by the service. Client should record the read requests * and push the data through the {@link #response} method of the request object when there is sufficient data. * @typedef { function } SourceReadCallback - * @param { number } uuid - label the resource handle. - * @param { number } requestedOffset - current media data position from the start of the source. - * @param { number } requestedLength - current request length. + * @param { long } uuid - label the resource handle. + * @param { long } requestedOffset - current media data position from the start of the source. + * @param { long } requestedLength - current request length. * - -1 means reaching the end of the source, need to inform the player * of the end of the push through the {@link #finishLoading} method. * @returns { void } - client should return immediately. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - type SourceReadCallback = (uuid: number, requestedOffset: number, requestedLength: number) => void; + type SourceReadCallback = (uuid: long, requestedOffset: long, requestedLength: long) => void; /** * Defines the SourceCloseCallback function which is called by the service. Client should release related resources. * @typedef { function } SourceCloseCallback - * @param { number } uuid - label the resource handle. + * @param { long } uuid - label the resource handle. * @returns { void } - client should return immediately. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - type SourceCloseCallback = (uuid: number) => void; + type SourceCloseCallback = (uuid: long) => void; /** * Media data loader. User can customize media data loader. * @typedef MediaSourceLoader * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ interface MediaSourceLoader { /** @@ -3873,7 +4220,8 @@ declare namespace media { * @type { SourceOpenCallback } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ open: SourceOpenCallback; @@ -3882,7 +4230,8 @@ declare namespace media { * @type { SourceReadCallback } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ read: SourceReadCallback; @@ -3891,24 +4240,27 @@ declare namespace media { * @type { SourceCloseCallback } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ close: SourceCloseCallback; } /** * Enumerates state change reason. - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ enum LoadingRequestError { /** * If reach the resource end, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_SUCCESS = 0, @@ -3916,7 +4268,8 @@ declare namespace media { * If resource not ready for access, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_NOT_READY = 1, @@ -3924,7 +4277,8 @@ declare namespace media { * If resource url not exist, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_NO_RESOURCE = 2, @@ -3932,7 +4286,8 @@ declare namespace media { * If the uuid of resource handle is valid, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_INVAID_HANDLE = 3, @@ -3940,7 +4295,8 @@ declare namespace media { * If client has no right to request the resource, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_ACCESS_DENIED = 4, @@ -3948,7 +4304,8 @@ declare namespace media { * If access time out, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_ACCESS_TIMEOUT = 5, @@ -3956,7 +4313,8 @@ declare namespace media { * If authorization failed, client should return. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ LOADING_ERROR_AUTHORIZE_FAILED = 6, } @@ -3986,7 +4344,8 @@ declare namespace media { * @type { ?Record } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ header?: Record; @@ -3995,36 +4354,52 @@ declare namespace media { * @param { number } uuid - label the resource handle. * @param { number } offset - current media data position from start of the source. * @param { ArrayBuffer } buffer - media data buffer which respond to the player. - * @returns { int } - accept bytes for current read. The value less than zero means failed. + * @returns { number } - accept bytes for current read. The value less than zero means failed. * - 2, means player need current data any more, the client should stop current read process. * - 3, means player buffer is full, the client should wait for next read. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since 18 */ - respondData(uuid: number, offset: number, buffer: ArrayBuffer): int; + respondData(uuid: number, offset: number, buffer: ArrayBuffer): number; + /** + * The interface for application used to send requested data to AVPlayer. + * @param { long } uuid - label the resource handle. + * @param { long } offset - current media data position from start of the source. + * @param { ArrayBuffer } buffer - media data buffer which respond to the player. + * @returns { int | undefined } - accept bytes for current read. The value less than zero means failed. + * - 2, means player need current data any more, the client should stop current read process. + * - 3, means player buffer is full, the client should wait for next read. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + respondData(uuid: long, offset: long, buffer: ArrayBuffer): int | undefined; /** * The interface for application used to send respond header to AVPlayer * should be called before calling the {@link #respondData()} for the first time. - * @param { number } uuid - label the resource handle. + * @param { long } uuid - label the resource handle. * @param { ?Record } [header] - header info in the http response. * @param { ?string } [redirectUrl] - redirect url from the http response if exist. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - respondHeader(uuid: number, header?: Record, redirectUrl?: string): void; + respondHeader(uuid: long, header?: Record, redirectUrl?: string): void; /** * The interface for application used to notify player current request state. - * @param { number } uuid - label the resource handle. + * @param { long } uuid - label the resource handle. * @param { LoadingRequestError } state - the request state. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - finishLoading(uuid: number, state: LoadingRequestError): void; + finishLoading(uuid: long, state: LoadingRequestError): void; } /** @@ -4048,33 +4423,33 @@ declare namespace media { /** * video width. - * @type { long } + * @type { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ - width: long; + width: int; /** * video height. - * @type { long } + * @type { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ - height: long; + height: int; /** * biterate of this mediaStream. - * @type { long } + * @type { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ - bitrate: long; + bitrate: int; } /** @@ -4083,7 +4458,8 @@ declare namespace media { * @typedef MediaSource * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ interface MediaSource { /** @@ -4091,7 +4467,8 @@ declare namespace media { * @param { AVMimeTypes } mimeType - for MediaSource define. see @ AVMimeTypes. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ setMimeType(mimeType: AVMimeTypes): void; @@ -4100,7 +4477,8 @@ declare namespace media { * @param { MediaSourceLoader } resourceLoader - callback function interface set for player use. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ setMediaResourceLoaderDelegate(resourceLoader: MediaSourceLoader): void; } @@ -4110,14 +4488,16 @@ declare namespace media { * @enum { string } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ enum AVMimeTypes { /** * Indicate current file is index file for hls Media. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ APPLICATION_M3U8 = 'application/m3u8', } @@ -4127,40 +4507,45 @@ declare namespace media { * @typedef PlaybackStrategy * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ interface PlaybackStrategy { /** * Choose a stream with width close to it. - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - preferredWidth?: number; + preferredWidth?: int; /** * Choose a stream with height close to it. - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - preferredHeight?: number; + preferredHeight?: int; /** * Choose a preferred buffer duration. - * @type { ?number } + * @type { ?int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - preferredBufferDuration?: number; + preferredBufferDuration?: int; /** * If true, the player should choose HDR stream if exist. * @type { ?boolean } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ preferredHdr?: boolean; @@ -4168,7 +4553,8 @@ declare namespace media { * mute the specified media stream when playing. * @type { ?MediaType } * @syscap SystemCapability.Multimedia.Media.Core - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ mutedMediaType?: MediaType; @@ -4177,7 +4563,8 @@ declare namespace media { * @type { ?string } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ preferredAudioLanguage?: string; @@ -4186,7 +4573,8 @@ declare namespace media { * @type { ?string } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ preferredSubtitleLanguage?: string; @@ -4195,18 +4583,20 @@ declare namespace media { * @type { ?boolean } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ showFirstFrameOnPrepare?: boolean; /** * Customize the buffering threshold for start or restart playing. The unit is second. - * @type { ?number } + * @type { ?double } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - preferredBufferDurationForPlaying?: number; + preferredBufferDurationForPlaying?: double; /** * Enable super-resolution feature. default is false. @@ -4214,19 +4604,21 @@ declare namespace media { * @type { ?boolean } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ enableSuperResolution?: boolean; /** * set max buffering threshold for liveStreaming or avplayer while change the speed. * It is recommended that the value be 2 seconds greater than the starting waterline. - * @type { ?number } + * @type { ?double } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ - thresholdForAutoQuickPlay?: number + thresholdForAutoQuickPlay?: double } /** @@ -4694,13 +5086,13 @@ declare namespace media { /** * Listens for playback error events. * @param { 'error' } type - Type of the playback error event to listen for. - * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @since 6 * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVPlayer#event:error */ - on(type: 'error', callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** @@ -4824,6 +5216,17 @@ declare namespace media { * @since 11 */ getAVRecorderConfig(callback: AsyncCallback): void; + /** + * Get AVRecorderConfig.it must be called after prepare. + * @param { AsyncCallback } callback - Callback used to return the input config in AVRecorderConfig. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 20 + * @arkts 1.2 + */ + getAVRecorderConfig(callback: AsyncCallback): void; /** * Get AVRecorderConfig.it must be called after prepare. @@ -4835,6 +5238,17 @@ declare namespace media { * @since 11 */ getAVRecorderConfig(): Promise; + /** + * Get AVRecorderConfig.it must be called after prepare. + * @returns { Promise } A Promise instance used to return the input config in AVRecorderConfig. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 20 + * @arkts 1.2 + */ + getAVRecorderConfig(): Promise; /** * Get input surface.it must be called between prepare completed and start. @@ -4843,10 +5257,20 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by callback. * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getInputSurface(callback: AsyncCallback): void; + /** + * Get input surface.it must be called between prepare completed and start. + * @param { AsyncCallback } callback - Callback used to return the input surface id in string. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 20 + * @arkts 1.2 + */ + getInputSurface(callback: AsyncCallback): void; /** * Get input surface. it must be called between prepare completed and start. @@ -4855,10 +5279,20 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getInputSurface(): Promise; + /** + * Get input surface. it must be called between prepare completed and start. + * @returns { Promise } A Promise instance used to return the input surface id in string. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 20 + * @arkts 1.2 + */ + getInputSurface(): Promise; /** * Get input meta surface for specified meta source type. it must be called between prepare completed and start. @@ -4875,13 +5309,30 @@ declare namespace media { * @since 12 */ getInputMetaSurface(type: MetaSourceType): Promise; + /** + * Get input meta surface for specified meta source type. it must be called between prepare completed and start. + * @param { MetaSourceType } type - Meta source type. + * @returns { Promise } A Promise instance used to return the input surface id in string. + * @throws { BusinessError } 202 - Called from Non-System applications. Return by promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getInputMetaSurface(type: MetaSourceType): Promise; /** * Check if the avrecorder has watermark capability. * @returns { Promise } A Promise instance used to return true or false when the function is finished. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @systemapi - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ isWatermarkSupported(): Promise; /** @@ -4893,12 +5344,13 @@ declare namespace media { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @systemapi - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ setWatermark(watermark: image.PixelMap, config: WatermarkConfig): Promise /** * Update the video orientation before recorder start. - * @param { number } rotation - Rotation angle, should be [0, 90, 180, 270]. + * @param { int } rotation - Rotation angle, should be [0, 90, 180, 270]. * @returns { Promise } A Promise instance used to return when the function is finished. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. 3.Parameter verification failed. @@ -4906,9 +5358,10 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - updateRotation(rotation: number): Promise; + updateRotation(rotation: int): Promise; /** * Start AVRecorder, it will to started state. @@ -4927,7 +5380,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ start(callback: AsyncCallback): void; @@ -4949,7 +5403,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ start(): Promise; @@ -5015,7 +5470,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ resume(callback: AsyncCallback): void; @@ -5037,7 +5493,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ resume(): Promise; @@ -5173,6 +5630,17 @@ declare namespace media { * @since 11 */ getCurrentAudioCapturerInfo(callback: AsyncCallback): void; + /** + * Get AudioCapturer info from current AVRecorder. + * @param { AsyncCallback } callback - A callback used to return AudioCapturerChangeInfo. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 20 + * @arkts 1.2 + */ + getCurrentAudioCapturerInfo(callback: AsyncCallback): void; /** * Get AudioCapturer info from current AVRecorder. @@ -5184,26 +5652,39 @@ declare namespace media { * @since 11 */ getCurrentAudioCapturerInfo(): Promise; + /** + * Get AudioCapturer info from current AVRecorder. + * @returns { Promise } A Promise instance used to return AudioCapturerChangeInfo. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 20 + * @arkts 1.2 + */ + getCurrentAudioCapturerInfo(): Promise; /** * Get max audio capturer amplitude from current AVRecorder. - * @param { AsyncCallback } callback - A callback used to return max Amplitude. + * @param { AsyncCallback } callback - A callback used to return max Amplitude. * @throws { BusinessError } 5400102 - Operation not allowed. * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ - getAudioCapturerMaxAmplitude(callback: AsyncCallback): void; + getAudioCapturerMaxAmplitude(callback: AsyncCallback): void; /** * Get max audio capturer amplitude from current AVRecorder. - * @returns { Promise } A Promise instance used to return max Amplitude. + * @returns { Promise } A Promise instance used to return max Amplitude. * @throws { BusinessError } 5400102 - Operation not allowed. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ - getAudioCapturerMaxAmplitude(): Promise; + getAudioCapturerMaxAmplitude(): Promise; /** * Get available encoder and encoder info for AVRecorder. @@ -5211,7 +5692,8 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ getAvailableEncoder(callback: AsyncCallback>): void; @@ -5221,7 +5703,8 @@ declare namespace media { * @throws { BusinessError } 5400102 - Operation not allowed. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 11 + * @since arkts {'1.1':'11','1.2':'20'} + * @arkts 1.1&1.2 */ getAvailableEncoder(): Promise>; @@ -5321,6 +5804,27 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @since 11 */ + /** + * Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the recorder error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupported format. + * @throws { BusinessError } 5400107 - Audio interrupted. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; /** * Listens for recording error events. * @param { 'error' } type - Type of the recording error event to listen for. @@ -5339,9 +5843,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - * @permission + * @since 20 + * @arkts 1.2 */ on(type: 'error', callback: ErrorCallback): void; @@ -5369,6 +5872,16 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @since 9 */ + /** + * Cancel Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the recorder error event. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'error', callback?: ErrorCallback): void; /** * Cancel Listens for recording error events. * @param { 'error' } type - Type of the recording error event to listen for. @@ -5376,8 +5889,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ off(type: 'error', callback?: ErrorCallback): void; @@ -5563,25 +6076,28 @@ declare namespace media { * @typedef WatermarkConfig * @syscap SystemCapability.Multimedia.Media.Core * @systemapi - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ interface WatermarkConfig { /** * Offset of the watermark to the top line of pixel. - * @type { number } + * @type { int } * @syscap SystemCapability.Multimedia.Media.Core * @systemapi - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ - top: number; + top: int; /** * Offset of the watermark to the left line of pixel. - * @type { number } + * @type { int } * @syscap SystemCapability.Multimedia.Media.Core * @systemapi - * @since 13 + * @since arkts {'1.1':'13','1.2':'20'} + * @arkts 1.1&1.2 */ - left: number; + left: int; } /** @@ -5708,7 +6224,7 @@ declare namespace media { * @param { AudioRecorderConfig } config - Recording parameters. * @throws { BusinessError } 201 - permission denied. * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @since 6 + * @since 12 * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVRecorder#prepare */ @@ -5784,13 +6300,13 @@ declare namespace media { /** * Listens for audio recording error events. * @param { 'error' } type - Type of the audio recording error event to listen for. - * @param { ErrorCallback } callback - Callback used to listen for the audio recording error event. + * @param { ErrorCallback } callback - Callback used to listen for the audio recording error event. * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @since 6 * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVRecorder#on */ - on(type: 'error', callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** @@ -5898,10 +6414,22 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getInputSurface(callback: AsyncCallback): void; + /** + * get input surface.it must be called between prepare completed and start. + * @param { AsyncCallback } callback - Callback used to return the input surface id in string. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400103 - I/O error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getInputSurface(callback: AsyncCallback): void; /** * get input surface. it must be called between prepare completed and start. * @returns { Promise } A Promise instance used to return the input surface id in string. @@ -5921,10 +6449,22 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getInputSurface(): Promise; + /** + * get input surface. it must be called between prepare completed and start. + * @returns { Promise } A Promise instance used to return the input surface id in string. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - I/O error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getInputSurface(): Promise; /** * Starts video recording. * @param { AsyncCallback } callback - A callback instance used to return when start completed. @@ -5944,7 +6484,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ start(callback: AsyncCallback): void; /** @@ -5966,7 +6507,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ start(): Promise; /** @@ -6034,7 +6576,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ resume(callback: AsyncCallback): void; /** @@ -6056,7 +6599,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ resume(): Promise; /** @@ -6205,7 +6749,6 @@ declare namespace media { */ /** * Listens for video recording error events. - * @permission * @param { 'error' } type - Type of the video recording error event to listen for. * @param { ErrorCallback } callback - Callback used to listen for the video recording error event. * @throws { BusinessError } 201 - permission denied. @@ -6217,6 +6760,20 @@ declare namespace media { * @since 12 */ on(type: 'error', callback: ErrorCallback): void; + /** + * Listens for video recording error events. + * @param { 'error' } type - Type of the video recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the video recording error event. + * @throws { BusinessError } 201 - permission denied. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400103 - I/O error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 20 + * @arkts 1.2 + */ + on(type: 'error', callback: ErrorCallback): void; /** * video recorder state. @@ -6243,14 +6800,14 @@ declare namespace media { /** * Enumerates playback speed. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @since 8 */ /** * Enumerates playback speed. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @crossplatform * @atomicservice @@ -6769,26 +7326,26 @@ declare namespace media { /** * Listens for playback error events. * @param { 'error' } type - Type of the playback error event to listen for. - * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @since 8 * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVPlayer#event:error */ - on(type: 'error', callback: ErrorCallback): void; + on(type: 'error', callback: ErrorCallback): void; } /** * Enumerates video scale type. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @since 9 */ /** * Enumerates video scale type. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @crossplatform * @atomicservice @@ -6838,14 +7395,14 @@ declare namespace media { /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 8 */ /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice @@ -6908,14 +7465,14 @@ declare namespace media { /** * Enumerates media data type. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 8 */ /** * Enumerates media data type. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since 11 @@ -6923,7 +7480,7 @@ declare namespace media { /** * Enumerates media data type. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice @@ -6984,14 +7541,14 @@ declare namespace media { /** * Enumerates media description key. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 8 */ /** * Enumerates media description key. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since 11 @@ -6999,7 +7556,7 @@ declare namespace media { /** * Enumerates media description key. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice @@ -7378,14 +7935,14 @@ declare namespace media { /** * Enumerates audio source type for recorder. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @since 9 */ /** * Enumerates audio source type for recorder. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @atomicservice @@ -7454,14 +8011,14 @@ declare namespace media { /** * Enumerates video source type for recorder. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @since 9 */ /** * Enumerates video source type for recorder. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform * @since arkts {'1.1':'12','1.2':'20'} @@ -7499,7 +8056,7 @@ declare namespace media { /** * Enumerates meta source type for recorder. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @systemapi * @since arkts {'1.1':'12','1.2':'20'} @@ -7519,7 +8076,7 @@ declare namespace media { /** * Enumerates mode of creating recorder file * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 @@ -7924,7 +8481,7 @@ declare namespace media { * @type { ?boolean } * @syscap SystemCapability.Multimedia.Media.AVRecorder * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ enableStableQualityMode?: boolean @@ -8032,26 +8589,25 @@ declare namespace media { * Mode of creating recorder file, details see @FileGenerationMode. * @type { ?FileGenerationMode } * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ fileGenerationMode?: FileGenerationMode; /** * 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. - * @type { ?int } + * @type { ?number } * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 * @deprecated since 12 * @useinstead ohos.multimedia.media/media.AVMetadata#videoOrientation */ - rotation?: int; + rotation?: number; /** * Geographical location information. * @type { ?Location } * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 * @deprecated since 12 * @useinstead ohos.multimedia.media/media.AVMetadata#location */ @@ -8060,14 +8616,16 @@ declare namespace media { * Set global metadata info. Details see @AVMetadata * @type { ?AVMetadata } * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ metadata?: AVMetadata; /** * Set the longest duration allowed for current recording. * @type { ?int } * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ maxDuration?: int; } @@ -8133,14 +8691,14 @@ declare namespace media { /** * Enumerates seek mode. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @since 8 */ /** * Enumerates seek mode. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice * @since 11 @@ -8148,7 +8706,7 @@ declare namespace media { /** * Enumerates seek mode. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice @@ -8222,11 +8780,12 @@ declare namespace media { /** * Enumerates switch mode. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ enum SwitchMode { /** @@ -8234,7 +8793,8 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ SMOOTH = 0, /** @@ -8242,14 +8802,16 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.Core * @crossplatform * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ SEGMENT = 1, /** * switch to the closest frame of the given timestamp. * @syscap SystemCapability.Multimedia.Media.Core * @atomicservice - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ CLOSEST = 2, } @@ -8428,21 +8990,24 @@ declare namespace media { /** * Enumerates AVScreenCaptureRecord preset types. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ enum AVScreenCaptureRecordPreset { /** * Screen record normal type, h264/aac mp4 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ SCREEN_RECORD_PRESET_H264_AAC_MP4 = 0, /** * Screen record high efficient type, h265/aac mp4 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ SCREEN_RECORD_PRESET_H265_AAC_MP4 = 1, } @@ -8450,21 +9015,24 @@ declare namespace media { /** * Enumerates fill modes of video stream in screen recording. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ enum AVScreenCaptureFillMode { /** * Keep the scale the same as that of the original image * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ PRESERVE_ASPECT_RATIO = 0, /** * Fit the configured width and height * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ SCALE_TO_FILL = 1, } @@ -8472,7 +9040,7 @@ declare namespace media { /** * Enumerates AVScreenCapture callback state type. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 @@ -8626,7 +9194,8 @@ declare namespace media { * Indicates AVScreenCaptureRecordPreset, details see @AVScreenCaptureRecordPreset * @type { ?AVScreenCaptureRecordPreset } * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ preset?: AVScreenCaptureRecordPreset; /** @@ -8641,7 +9210,8 @@ declare namespace media { * Indicates the fill mode of video, details see @AVScreenCaptureFillMode * @type { ?AVScreenCaptureFillMode } * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ fillMode?: AVScreenCaptureFillMode; } @@ -8665,7 +9235,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ init(config: AVScreenCaptureRecordConfig): Promise; @@ -8675,7 +9246,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ startRecording(): Promise; @@ -8685,20 +9257,22 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ stopRecording(): Promise; /** * Skip some windows' privacy mode of current app during the screen recording. - * @param { Array } windowIDs - windowID list to be skipped privacy mode . + * @param { Array } windowIDs - windowID list to be skipped privacy mode . * @returns { Promise } A Promise instance used to return when skipPrivacyMode completed. * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - skipPrivacyMode(windowIDs: Array): Promise; + skipPrivacyMode(windowIDs: Array): Promise; /** * Set microphone enable or disable. @@ -8707,7 +9281,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ setMicEnabled(enable: boolean): Promise; @@ -8732,6 +9307,17 @@ declare namespace media { */ on(type: 'stateChange', callback: Callback): void; + /** + * Listens for AVScreenCaptureRecord info callback. + * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return. + * @throws { BusinessError } 201 - permission denied. + * @throws { BusinessError } 5400103 - IO error. Return by ErrorCallback. + * @throws { BusinessError } 5400105 - Service died. Return by ErrorCallback. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; /** * Listens for AVScreenCaptureRecord info callback. * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for. @@ -8740,9 +9326,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by ErrorCallback. * @throws { BusinessError } 5400105 - Service died. Return by ErrorCallback. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 - * @permission + * @since 20 + * @arkts 1.2 */ on(type: 'error', callback: ErrorCallback): void; @@ -8756,13 +9341,21 @@ declare namespace media { */ off(type: 'stateChange', callback?: Callback): void; + /** + * Unregister listens for AVScreenCaptureRecord error callback. + * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + off(type: 'error', callback?: ErrorCallback): void; /** * Unregister listens for AVScreenCaptureRecord error callback. * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for. * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ off(type: 'error', callback?: ErrorCallback): void; } @@ -8862,11 +9455,12 @@ declare namespace media { /** * Destination media file descriptor. Mainstream media formats are supported. - * @type { number } + * @type { int } * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ - fdDst: number; + fdDst: int; /** * Prepares for transcoding. @@ -8889,7 +9483,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ start(): Promise; @@ -8912,7 +9507,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ resume(): Promise; @@ -8923,7 +9519,8 @@ declare namespace media { * @throws { BusinessError } 5400103 - IO error. Return by promise. * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 + * @since arkts {'1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ cancel(): Promise; @@ -8948,6 +9545,22 @@ declare namespace media { */ on(type:'complete', callback: Callback):void; + /** + * Register listener for trancoding error event. + * @param { 'error' } type - Type of the event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the error event. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupported format. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + on(type:'error', callback: ErrorCallback):void; /** * Register listener for trancoding error event. * @param { 'error' } type - Type of the event to listen for. @@ -8961,8 +9574,8 @@ declare namespace media { * @throws { BusinessError } 5400105 - Service died. * @throws { BusinessError } 5400106 - Unsupported format. * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ on(type:'error', callback: ErrorCallback):void; @@ -8986,13 +9599,21 @@ declare namespace media { */ off(type:'complete', callback?: Callback):void; + /** + * Unregister listener for trancoding error event. + * @param { 'error' } type - Type of the event to listen for. + * @param { ErrorCallback } [callback] - Callback used to listen for the error event. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + off(type:'error', callback?: ErrorCallback):void; /** * Unregister listener for trancoding error event. * @param { 'error' } type - Type of the event to listen for. * @param { ErrorCallback } [callback] - Callback used to listen for the error event. * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ off(type:'error', callback?: ErrorCallback):void; @@ -9010,7 +9631,7 @@ declare namespace media { /** * Enumerates event type of Screen Capture. * - * @enum { number } + * @enum { int } * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @systemapi * @since arkts {'1.1':'18','1.2':'20'} diff --git a/api/multimedia/soundPool.d.ts b/api/multimedia/soundPool.d.ts index 47c0c8c668495219f69f8017f26c2477ee4e7481..48a08faed61ab443acb56527788876374b38e044 100644 --- a/api/multimedia/soundPool.d.ts +++ b/api/multimedia/soundPool.d.ts @@ -94,7 +94,7 @@ export interface PlayParameters { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ -export interface SoundPool { +export declare interface SoundPool { /** * Load the sound from the specified path. * @@ -125,8 +125,8 @@ export interface SoundPool { * Load the sound from a FileDescriptor. * * @param {int} fd A FileDescriptor object - * @param {double} offset Offset to the start of the sound - * @param {double} length Length of the sound + * @param {long} offset Offset to the start of the sound + * @param {long} length Length of the sound * @param {AsyncCallback} callback Callback a sound ID. This value can be used to play or unload the sound. * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. * @throws { BusinessError } 5400103 - I/O error. Return by callback. @@ -135,13 +135,13 @@ export interface SoundPool { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ - load(fd: int, offset: double, length: double, callback: AsyncCallback): void; + load(fd: int, offset: long, length: long, callback: AsyncCallback): void; /** * Load the sound from a FileDescriptor. * * @param {int} fd A FileDescriptor object - * @param {double} offset Offset to the start of the sound - * @param {double} length Length of the sound + * @param {long} offset Offset to the start of the sound + * @param {long} length Length of the sound * @returns {Promise} Promise a sound ID. This value can be used to play or unload the sound. * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. * @throws { BusinessError } 5400103 - I/O error. Return by promise. @@ -150,7 +150,7 @@ export interface SoundPool { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ - load(fd: int, offset: double, length: double): Promise; + load(fd: int, offset: long, length: long): Promise; /** * Play a sound from a sound ID. * @@ -389,7 +389,8 @@ export interface SoundPool { * @param {'loadComplete'} type Type of the play finish event to listen for. * @param {Callback} callback Callback used to listen for load result event * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 10 + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 */ on(type: 'loadComplete', callback: Callback): void; /** @@ -397,7 +398,8 @@ export interface SoundPool { * * @param {'loadComplete'} type Type of the play finish event to listen for. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 10 + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 */ off(type: 'loadComplete'): void; /** @@ -409,7 +411,8 @@ export interface SoundPool { * @param {'playFinishedWithStreamId'} type name of the play finished event to listen for. * @param {Callback} callback Callback used to listen which stream id has finished playback. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ on(type: 'playFinishedWithStreamId', callback: Callback): void; /** @@ -417,7 +420,8 @@ export interface SoundPool { * * @param {'playFinishedWithStreamId'} type name of the play finished event to listen for. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 18 + * @since arkts {'1.1':'18','1.2':'20'} + * @arkts 1.1&1.2 */ off(type: 'playFinishedWithStreamId'): void; /** @@ -426,7 +430,8 @@ export interface SoundPool { * @param {'playFinished'} type Type of the play finish event to listen for. * @param {Callback} callback Callback used to listen for the play finish * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 10 + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 */ on(type: 'playFinished', callback: Callback): void; /** @@ -434,7 +439,8 @@ export interface SoundPool { * * @param {'playFinished'} type of the play finish event to listen for. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 10 + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 */ off(type: 'playFinished'): void; /** @@ -443,7 +449,8 @@ export interface SoundPool { * @param {'error'} type Type of the sound play error event to listen for. * @param {ErrorCallback} callback Callback used to listen for sound play error events. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 10 + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 */ on(type: 'error', callback: ErrorCallback): void; /** @@ -451,28 +458,9 @@ export interface SoundPool { * * @param {'error'} type Type of the sound play error event to listen for. * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since 10 + * @since arkts {'1.1':'10','1.2':'20'} + * @arkts 1.1&1.2 */ off(type: 'error'): void; - /** - * Register listens for events. - * - * @param {'playFinishedWithStreamId' | 'playFinished' | 'error' | 'loadComplete'} type name of the event to listen for. - * @param {Callback | Callback | ErrorCallback} callback Callback used to listen. - * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since arkts {'1.2':'20'} - * @arkts 1.2 - */ - on(type: 'playFinishedWithStreamId' | 'playFinished' | 'error' | 'loadComplete', - callback: Callback | Callback | ErrorCallback): void; - /** - * Cancel listening for event. - * - * @param {'playFinishedWithStreamId' | 'loadComplete' | 'playFinished' | 'error'} type name of the event to listen for. - * @syscap SystemCapability.Multimedia.Media.SoundPool - * @since arkts {'1.2':'20'} - * @arkts 1.2 - */ - off(type: 'playFinishedWithStreamId' | 'loadComplete' | 'playFinished' | 'error'): void; }