From 8dbd9b48190ab7df93da4320c8dd55466690ce89 Mon Sep 17 00:00:00 2001 From: ccfriend Date: Thu, 12 Jun 2025 09:58:09 +0800 Subject: [PATCH] =?UTF-8?q?4k=E6=8A=95=E5=B1=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ccfriend --- api/@ohos.multimedia.avsession.d.ts | 453 ++++++++++++++++++---------- 1 file changed, 298 insertions(+), 155 deletions(-) diff --git a/api/@ohos.multimedia.avsession.d.ts b/api/@ohos.multimedia.avsession.d.ts index 822492c7bf..6b328764b4 100644 --- a/api/@ohos.multimedia.avsession.d.ts +++ b/api/@ohos.multimedia.avsession.d.ts @@ -40,7 +40,6 @@ import type hdrCapability from './@ohos.graphics.hdrCapability'; * @atomicservice * @since 12 */ - declare namespace avSession { /** * Create an AVSession instance. An ability can only create one AVSession @@ -95,7 +94,7 @@ declare namespace avSession { * @since 9 */ function getAllSessionDescriptors(callback: AsyncCallback>>): void; - + /** * Get all avsession descriptors of the system * @permission ohos.permission.MANAGE_MEDIA_RESOURCES @@ -276,6 +275,8 @@ declare namespace avSession { * @returns { Promise> } Promise for AVSessionController. * @throws { BusinessError } 201 - permission denied * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. * @throws { BusinessError } 6600101 - Session service exception. * @throws { BusinessError } 6600109 - The remote connection is not established. * @syscap SystemCapability.Multimedia.AVSession.Manager @@ -441,6 +442,8 @@ declare namespace avSession { * @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type * @param { Callback> } callback - The callback will return remote changed AVSessionController. * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. * @throws { BusinessError } 6600101 - Session service exception. * @syscap SystemCapability.Multimedia.AVSession.Manager * @systemapi @@ -454,6 +457,8 @@ declare namespace avSession { * @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type * @param { Callback> } callback - The callback will return remote changed AVSessionController. * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. * @throws { BusinessError } 6600101 - Session service exception. * @syscap SystemCapability.Multimedia.AVSession.Manager * @systemapi @@ -546,13 +551,13 @@ declare namespace avSession { */ enum ProtocolType { /** - * The default cast type "local", media can be routed on the same device, + * The default cast type "local", media can be routed on the same device, * including internal speakers or audio jack on the device itself, A2DP devices. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @since 11 */ /** - * The default cast type "local", media can be routed on the same device, + * The default cast type "local", media can be routed on the same device, * including internal speakers or audio jack on the device itself, A2DP devices. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice @@ -598,7 +603,7 @@ declare namespace avSession { * @atomicservice * @since 20 */ - TYPE_CAST_PLUS_AUDIO = 8, + TYPE_HIGH_DEFINITION_AUDIO = 8 } /** @@ -631,7 +636,7 @@ declare namespace avSession { * @systemapi * @since 18 */ - TYPE_SESSION_MIGRATE_OUT = 2, + TYPE_SESSION_MIGRATE_OUT = 2 } /** @@ -949,20 +954,20 @@ declare namespace avSession { */ enum DeviceLogEventCode { /** - * Log is full. - * @syscap SystemCapability.Multimedia.AVSession.AVCast - * @systemapi - * @since 13 - */ + * Log is full. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ DEVICE_LOG_FULL = 1, /** - * Log is written with exception, such as the fd cannot be written and so on. - * @syscap SystemCapability.Multimedia.AVSession.AVCast - * @systemapi - * @since 13 - */ - DEVICE_LOG_EXCEPTION = 2, + * Log is written with exception, such as the fd cannot be written and so on. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + DEVICE_LOG_EXCEPTION = 2 } /** @@ -1941,8 +1946,6 @@ declare namespace avSession { * @syscap SystemCapability.Multimedia.AVSession.Core * @atomicservice * @since 12 - * @deprecated since 20 - * @useinstead ohos.multimedia.avsession.AVSessoin#on */ on(type: 'playFromAssetId', callback: (assetId: number) => void): void; @@ -1968,35 +1971,9 @@ declare namespace avSession { * @syscap SystemCapability.Multimedia.AVSession.Core * @atomicservice * @since 12 - * @deprecated since 20 - * @useinstead ohos.multimedia.avsession.AVSessoin#off */ off(type: 'playFromAssetId', callback?: (assetId: number) => void): void; - /** - * Subscribes to playWithAssetId events. - * @param { 'playWithAssetId' } type - Event type. - * @param { Callback } callback - Callback used to handle the 'playWithAssetId' command. - * @throws { BusinessError } 6600101 - Session service exception. - * @throws { BusinessError } 6600102 - The session does not exist. - * @syscap SystemCapability.Multimedia.AVSession.Core - * @atomicservice - * @since 20 - */ - on(type: 'playWithAssetId', callback: Callback): void; - - /** - * Unsubscribes to playWithAssetId events. - * @param { 'playWithAssetId' } type - Event type. - * @param { Callback } callback - Callback used to handle the 'playWithAssetId' command. - * @throws { BusinessError } 6600101 - Session service exception. - * @throws { BusinessError } 6600102 - The session does not exist. - * @syscap SystemCapability.Multimedia.AVSession.Core - * @atomicservice - * @since 20 - */ - off(type: 'playWithAssetId', callback?: Callback): void; - /** * Register seek command callback * @param { 'seek' } type - Registration Type 'seek' @@ -2151,7 +2128,9 @@ declare namespace avSession { * Register setTargetLoopMode command callback * Application should change playmode to the loopmode which is requested. * @param { 'setTargetLoopMode' } type - Registration Type 'setTargetLoopMode' - * @param { Callback } callback - Used to handle setTargetLoopMode command.The callback provides the {@link LoopMode} + * @param { function } callback - Used to handle setTargetLoopMode command.The callback provides the {@link LoopMode} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. * @throws { BusinessError } 6600101 - Session service exception. * @throws { BusinessError } 6600102 - The session does not exist. * @syscap SystemCapability.Multimedia.AVSession.Core @@ -2163,7 +2142,9 @@ declare namespace avSession { /** * Unregister setTargetLoopMode command callback * @param { 'setTargetLoopMode' } type - Registration Type 'setTargetLoopMode' - * @param { Callback } callback - Used to handle setTargetLoopMode command.The callback provides the {@link LoopMode} + * @param { function } callback - Used to handle setTargetLoopMode command.The callback provides the {@link LoopMode} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. * @throws { BusinessError } 6600101 - Session service exception. * @throws { BusinessError } 6600102 - The session does not exist. * @syscap SystemCapability.Multimedia.AVSession.Core @@ -2626,6 +2607,45 @@ declare namespace avSession { */ off(type: 'castDisplayChange', callback?: Callback): void; + /** + * Register listener for custom data sent from remote device. + * @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for. + * @param { Callback } callback - Callback used to retrieve custom data. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + on(type: 'customDataChange', callback: Callback): void; + + /** + * Unsubscribes from custom data changes. + * @param { 'customDataChange' } type Custom data type. + * @param { Callback } [callback] Callback used to return the custom data. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + off(type: 'customDataChange', callback?: Callback): void; + + /** + * Sends custom data to a remote device. + * @param { ExtraInfo } data Custom data populated by the application. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + sendCustomData(data: ExtraInfo): Promise; + /** * Stop current cast and disconnect device connection. * @param { AsyncCallback } callback A callback instance used to return when cast stopped completed. @@ -2637,14 +2657,14 @@ declare namespace avSession { /** * Stop current cast and disconnect device connection. - * @returns { Promise } void result promise when executed successfully + * @returns { Promise } void result promise when executed successfully * @throws { BusinessError } 6600109 - The remote connection is not established * @syscap SystemCapability.Multimedia.AVSession.AVCast * @since 10 */ /** * Stop current cast and disconnect device connection. - * @returns { Promise } void result promise when executed successfully + * @returns { Promise } void result promise when executed successfully * @throws { BusinessError } 6600109 - The remote connection is not established * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice @@ -2664,7 +2684,7 @@ declare namespace avSession { /** * Activate the session, indicating that the session can accept control commands - * @returns { Promise } void result promise when executed successfully + * @returns { Promise } void result promise when executed successfully * @throws { BusinessError } 6600101 - Session service exception. * @throws { BusinessError } 6600102 - The session does not exist. * @syscap SystemCapability.Multimedia.AVSession.Core @@ -2672,7 +2692,7 @@ declare namespace avSession { */ /** * Activate the session, indicating that the session can accept control commands - * @returns { Promise } void result promise when executed successfully + * @returns { Promise } void result promise when executed successfully * @throws { BusinessError } 6600101 - Session service exception. * @throws { BusinessError } 6600102 - The session does not exist. * @syscap SystemCapability.Multimedia.AVSession.Core @@ -2774,7 +2794,7 @@ declare namespace avSession { interface AVCastControlCommand { /** * The command value {@link AVCastControlCommandType} - * + * * @syscap SystemCapability.Multimedia.AVSession.AVCast * @since 10 */ @@ -2889,7 +2909,7 @@ declare namespace avSession { * @throws { BusinessError } 6600101 - Session service exception * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ getSupportedDecoders(): Promise>; @@ -2897,10 +2917,12 @@ declare namespace avSession { * Get recommended resolution of remote player based on each decoder. * @param { DecoderType } decoderType - The decoder type. * @returns { Promise } ResolutionLevel returned through promise + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. * @throws { BusinessError } 6600101 - Session service exception * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ getRecommendedResolutionLevel(decoderType: DecoderType): Promise; @@ -2910,7 +2932,7 @@ declare namespace avSession { * @throws { BusinessError } 6600101 - Session service exception * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ getSupportedHdrCapabilities(): Promise>; @@ -2920,7 +2942,7 @@ declare namespace avSession { * @throws { BusinessError } 6600101 - Session service exception * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ getSupportedPlaySpeeds(): Promise>; @@ -2950,7 +2972,7 @@ declare namespace avSession { * @syscap SystemCapability.Multimedia.AVSession.AVCast * @since 10 */ - /** + /** * Send control commands to remote player * @param { AVCastControlCommand } command The command to be send. * @returns { Promise } Promise used to return the result. @@ -3099,6 +3121,18 @@ declare namespace avSession { */ processMediaKeyResponse(assetId: string, response: Uint8Array): Promise; + /** + * Sends custom data to a remote device. + * @param { ExtraInfo } data Custom data populated by the application. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + sendCustomData(data: ExtraInfo): Promise; + /** * Destroy the controller * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. @@ -3756,6 +3790,30 @@ declare namespace avSession { * @since 12 */ off(type: 'keyRequest', callback?: KeyRequestCallback): void; + + /** + * Register listener for custom data sent from remote device. + * @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for. + * @param { Callback } callback - Callback used to retrieve custom data. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + on(type: 'customDataChange', callback: Callback): void; + + /** + * Unregister listener for custom data sent from remote device. + * @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for. + * @param { Callback } [callback] - Callback used to retrieve custom data. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + off(type: 'customDataChange', callback?: Callback): void; } /** @@ -3819,26 +3877,6 @@ declare namespace avSession { off(type: 'pickerStateChange', callback?: Callback) : void; } - /** - * Audio capabilities. - * - * @typedef AudioCapabilities - * @syscap SystemCapability.Multimedia.AVSession.AVCast - * @atomicservice - * @since 20 - */ - interface AudioCapabilities { - /** - * Audio stream information. - * @type { Array } - * @readonly - * @syscap SystemCapability.Multimedia.AVSession.AVCast - * @atomicservice - * @since 20 - */ - readonly streamInfos: Array; - } - /** * An option to make different picker usage * @@ -3897,7 +3935,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - STATE_ON = 2, + STATE_ON = 2 } /** @@ -3955,6 +3993,27 @@ declare namespace avSession { height: number; } + /** + * Audio capabilities. + * + * @typedef AudioCapabilities + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + */ + interface AudioCapabilities { + + /** + * Audio stream information. + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + */ + readonly streamInfo: Array; + } + /** * Define the device connection state. * @enum { number } @@ -4006,7 +4065,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - STATE_DISCONNECTED = 6, + STATE_DISCONNECTED = 6 } /** @@ -4021,7 +4080,7 @@ declare namespace avSession { * @syscap SystemCapability.Multimedia.AVSession.Core * @since 11 */ - TAG_AUDIO_VIVID = 1, + TAG_AUDIO_VIVID = 1 } /** @@ -4029,14 +4088,14 @@ declare namespace avSession { * @enum { string } * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ enum DecoderType { /** * Defination of avc codec type. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ OH_AVCODEC_MIMETYPE_VIDEO_AVC = "video/avc", @@ -4044,7 +4103,7 @@ declare namespace avSession { * Defination of hevc codec type. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ OH_AVCODEC_MIMETYPE_VIDEO_HEVC = "video/hevc", @@ -4052,9 +4111,9 @@ declare namespace avSession { * Defination of audio vivid codec type. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ - OH_AVCODEC_MIMETYPE_AUDIO_VIVID = "audio/av3a", + OH_AVCODEC_MIMETYPE_AUDIO_VIVID = "audio/av3a" } /** @@ -4062,14 +4121,14 @@ declare namespace avSession { * @enum { number } * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ enum ResolutionLevel { /** * Defination of 480P which typically resolution is 640*480. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ RESOLUTION_480P = 0, @@ -4077,7 +4136,7 @@ declare namespace avSession { * Defination of 720P which typically resolution is 1280*720. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ RESOLUTION_720P = 1, @@ -4085,7 +4144,7 @@ declare namespace avSession { * Defination of 1080P which typically resolution is 1920*1080. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ RESOLUTION_1080P = 2, @@ -4093,7 +4152,7 @@ declare namespace avSession { * Defination of 2K which typically resolution is 2560*1440. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ RESOLUTION_2K = 3, @@ -4101,9 +4160,9 @@ declare namespace avSession { * Defination of 4K which typically resolution is 4096*3840. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice - * @since 19 + * @since 18 */ - RESOLUTION_4K = 4, + RESOLUTION_4K = 4 } /** @@ -4389,7 +4448,7 @@ declare namespace avSession { * @type { ?string } * @syscap SystemCapability.Multimedia.AVSession.Core * @atomicservice - * @since 17 + * @since 18 */ singleLyricText?: string; @@ -4559,6 +4618,7 @@ declare namespace avSession { * @since 12 */ mediaImage?: image.PixelMap | string; + /** * Any additional attributes that can be represented as key-value pairs * @type { ?object } @@ -4711,9 +4771,10 @@ declare namespace avSession { dataSrc?: media.AVDataSrcDescriptor; /** - * Pcm source type. The app should send pcm data directly to the system. - * @type { ?boolean} + * Source type that supports PCM casting. The application can send PCM data directly to the system through audio APIs, without using AVSession to set data. + * @type Boolean type. The value true means that PCM casting is supported. * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice * @since 20 */ pcmSrc?: boolean; @@ -4800,6 +4861,34 @@ declare namespace avSession { * @since 12 */ displayTags?: number; + + /** + * The initial speed of this media + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 20 + */ + speed?: number; + + /** + * Speeds supported. + * @type { ?Array } Speeds supported. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 20 + */ + supportedSpeeds?: Array; + + /** + * Custom data sent by the application to the receiver during casting. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + customData?: string; } /** @@ -5320,7 +5409,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - CALL_STATE_DISCONNECTING = 6, + CALL_STATE_DISCONNECTING = 6 } /** @@ -5338,13 +5427,13 @@ declare namespace avSession { */ enum AVCastCategory { /** - * The default cast type "local", media can be routed on the same device, + * The default cast type "local", media can be routed on the same device, * including internal speakers or audio jack on the device itself, A2DP devices. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @since 10 */ /** - * The default cast type "local", media can be routed on the same device, + * The default cast type "local", media can be routed on the same device, * including internal speakers or audio jack on the device itself, A2DP devices. * @syscap SystemCapability.Multimedia.AVSession.AVCast * @atomicservice @@ -5365,7 +5454,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - CATEGORY_REMOTE = 1, + CATEGORY_REMOTE = 1 } /** * Device type definition @@ -5431,7 +5520,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - DEVICE_TYPE_BLUETOOTH = 10, + DEVICE_TYPE_BLUETOOTH = 10 } /** @@ -5508,9 +5597,20 @@ declare namespace avSession { * @syscap SystemCapability.Multimedia.AVSession.Core * @atomicservice * @since 12 + * @deprecated since 20 + * @useinstead avSession.DeviceInfo#remoteDeviceType */ deviceType: DeviceType; + /** + * Remote device type, including +8 and +N device types. + * + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 20 + */ + remoteDeviceType?: number; + /** * Device manufacturer. * @type { ?string } @@ -5580,6 +5680,16 @@ declare namespace avSession { */ supportedDrmCapabilities?: Array; + /** + * Whether the device supports pull-end playback, including a collection of pull-end client IDs. + * @type { ?Array } Bundle names of pull-end clients. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + supportedPullClients?: Array; + /** * Define different authentication status. * 0: Device not authenticated. @@ -5612,10 +5722,10 @@ declare namespace avSession { mediumTypes?: number; /** - * When the device protocol is {@link ProtocolType.TYPE_HIGH_DEFINITION_AUDIO}, - * the device audio capabilities will be presented to let application choose proper resource to play. - * @type { ?AudioCapabilities } + * Audio capabilities supported by the device. + * @type { ?AudioCapabilities } Audio capabilities supported by the device. * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice * @since 20 */ audioCapabilities?: AudioCapabilities; @@ -5728,7 +5838,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - LOOP_MODE_CUSTOM = 4, + LOOP_MODE_CUSTOM = 4 } /** @@ -5755,7 +5865,7 @@ declare namespace avSession { * @syscap SystemCapability.Multimedia.AVSession.Core * @since 11 */ - SECONDS_30 = 30, + SECONDS_30 = 30 } /** @@ -5928,7 +6038,7 @@ declare namespace avSession { * @atomicservice * @since 12 */ - PLAYBACK_STATE_BUFFERING = 11, + PLAYBACK_STATE_BUFFERING = 11 } /** @@ -6774,6 +6884,8 @@ declare namespace avSession { * Get extra information for remote device, such as volume level, connected devices. * @param { string } extraEvent - the event name to get * @returns { Promise } the value returned for such event + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. * @throws { BusinessError } 6600101 - Session service exception. * @throws { BusinessError } 6600102 - The session does not exist. * @throws { BusinessError } 6600103 - The session controller does not exist. @@ -6785,7 +6897,7 @@ declare namespace avSession { /** * Register metadata changed callback - * @param { 'metadataChange' } type + * @param { 'metadataChange' } type * @param { Array | 'all' } filter - The properties of {@link AVMetadata} that you cared about * @param { function } callback - The callback used to handle metadata changed event. * The callback function provides the {@link AVMetadata} parameter. @@ -6799,7 +6911,7 @@ declare namespace avSession { */ /** * Register metadata changed callback - * @param { 'metadataChange' } type + * @param { 'metadataChange' } type * @param { Array | 'all' } filter - The properties of {@link AVMetadata} that you cared about * @param { function } callback - The callback used to handle metadata changed event. * The callback function provides the {@link AVMetadata} parameter. @@ -7442,52 +7554,47 @@ declare namespace avSession { * @since 12 */ off(type: 'extrasChange', callback?: (extras: {[key: string]: Object}) => void): void; - } - /** - * The type of control command - * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | - * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' } AVControlCommandType - * @syscap SystemCapability.Multimedia.AVSession.Core - * @since 10 - */ - /** - * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' - * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | - * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | - * 'toggleCallMute' } AVControlCommandType - * @syscap SystemCapability.Multimedia.AVSession.Core - * @since 11 - */ - /** - * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' - * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | - * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | - * 'toggleCallMute' } AVControlCommandType - * @syscap SystemCapability.Multimedia.AVSession.Core - * @atomicservice - * @since 12 - */ - /** - * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' - * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | - * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | - * 'toggleCallMute' | 'setTargetLoopMode' } AVControlCommandType - * @syscap SystemCapability.Multimedia.AVSession.Core - * @atomicservice - * @since 18 - */ - /** - * The type of control command, add new support 'playWithAssetId' - * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | - * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'playWithAssetId' | 'answer' | 'hangUp' | - * 'toggleCallMute' | 'setTargetLoopMode' } AVControlCommandType - * @syscap SystemCapability.Multimedia.AVSession.Core - * @atomicservice - * @since 20 - */ - type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | - 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'playWithAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' | 'setTargetLoopMode'; + /** + * Send custom data to this avsession. + * @param { ExtraInfo } data - The custom data populated by application. + * @returns { Promise } void result promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + sendCustomData(data: ExtraInfo): Promise; + + /** + * Register listener for custom data. + * @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for. + * @param { Callback } callback - Callback used to retrieve custom data. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + on(type: 'customDataChange', callback: Callback): void; + + /** + * Unregister listener for custom data. + * @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for. + * @param { Callback } [callback] - Callback used to retrieve custom data. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ + off(type: 'customDataChange', callback?: Callback): void; + } /** * The definition of command to be sent to the session @@ -8114,8 +8221,44 @@ declare namespace avSession { * @atomicservice * @since 13 */ - ERR_CODE_CAST_CONTROL_DRM_PROVIDE_KEY_RESPONSE_ERROR = 6616100, + ERR_CODE_CAST_CONTROL_DRM_PROVIDE_KEY_RESPONSE_ERROR = 6616100 } + + /** + * The type of control command + * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | + * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' } AVControlCommandType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' + * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | + * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | + * 'toggleCallMute' } AVControlCommandType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' + * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | + * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | + * 'toggleCallMute' } AVControlCommandType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + /** + * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' + * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | + * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | + * 'toggleCallMute' | 'setTargetLoopMode' } AVControlCommandType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 18 + */ + type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | + 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' | 'setTargetLoopMode'; } -export default avSession; +export default avSession; \ No newline at end of file -- Gitee