diff --git a/api/@ohos.multimedia.avsession.d.ets b/api/@ohos.multimedia.avsession.d.ets new file mode 100644 index 0000000000000000000000000000000000000000..830f9204beb3f98cfdf64fb14c7b20b5b40db23e --- /dev/null +++ b/api/@ohos.multimedia.avsession.d.ets @@ -0,0 +1,7685 @@ +/* +* Copyright (c) 2022-2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * @file + * @kit AVSessionKit + */ + +// import { ErrorCallback, AsyncCallback, Callback } from 'base'; +// import { WantAgent } from './@ohos.wantAgent'; +// import { KeyEvent } from './@ohos.multimodalInput.keyEvent'; +// import { ElementName } from './ElementName'; +// import {image} from './@ohos.multimedia.image'; +// import {audio} from './@ohos.multimedia.audio'; +// import {media} from './@ohos.multimedia.media'; +// import Context from './BaseContext'; + +/** + * @namespace avSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ +/** + * @namespace avSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + +declare namespace avSession { + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param { Context } context - The context of application + * @param { string } tag - A user-defined name for this session + * @param { AVSessionType } type - The type of session {@link AVSessionType} + * @param { AsyncCallback } callback - async callback for AVSession. + * @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.Core + * @since 10 + */ + function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void; + + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param { Context } context - The context of application + * @param { string } tag - A user-defined name for this session + * @param { AVSessionType } type - The type of session {@link AVSessionType} + * @returns { Promise } Promise for AVSession + * @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.Core + * @since 10 + */ + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param { Context } context - The context of application + * @param { string } tag - A user-defined name for this session + * @param { AVSessionType } type - The type of session {@link AVSessionType} + * @returns { Promise } Promise for AVSession + * @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.Core + * @atomicservice + * @since 12 + */ + function createAVSession(context: Context, tag: string, type: AVSessionType): Promise; + + /** + * Get all avsession descriptors of the system + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { AsyncCallback>> } callback - async callback for an array of AVSessionDescriptors. + * @throws { BusinessError } 201 - permission denied + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function getAllSessionDescriptors(callback: AsyncCallback>>): void; + + /** + * Get all avsession descriptors of the system + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @returns { Promise>> } Promise for an array of AVSessionDescriptors + * @throws { BusinessError } 201 - permission denied + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function getAllSessionDescriptors(): Promise>>; + + /** + * Get history avsession records. These sessions have been destroyed. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { number } maxSize - Specifies the maximum size of the returned value array. + * @param { AsyncCallback>> } callback - async callback for an array of AVSessionDescriptors. + * If provided '0' or not provided, the maximum value is determined by the system. + * @throws { BusinessError } 201 - permission denied + * @throws { BusinessError } 202 - Not System App + * @throws { BusinessError } 401 - parameter check failed. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi Hide this for inner system use + * @since 10 + */ + function getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback>>): void; + + /** + * Get history avsession records. These sessions have been destroyed. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { number } maxSize - Specifies the maximum size of the returned value array. + * If provided '0' or not provided, the maximum value is determined by the system. + * @returns { Promise>> } Promise for an array of AVSessionDescriptors + * @throws { BusinessError } 201 - permission denied + * @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 Hide this for inner system use + * @since 10 + */ + function getHistoricalSessionDescriptors(maxSize?: number): Promise>>; + + /** + * Get history play list information records. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { number } maxSize - Specifies the maximum size of the returned value array. + * @param { number } maxAppSize - Specifies the maximum app size of the returned value array. + * @param { AsyncCallback>> } callback - async callback for an array of AVQueueInfo. + * If provided '0' or not provided, the maximum value is determined by the system. + * @throws { BusinessError } 201 - permission denied + * @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 Hide this for inner system use + * @since 11 + */ + function getHistoricalAVQueueInfos(maxSize: number, maxAppSize: number, callback: AsyncCallback>>): void; + + /** + * Get history play list information records. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { number } maxSize - Specifies the maximum size of the returned value array. + * @param { number } maxAppSize - Specifies the maximum app size of the returned value array. + * @returns { Promise>> } Promise for an array of AVQueueInfo + * @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 Hide this for inner system use + * @since 11 + */ + function getHistoricalAVQueueInfos(maxSize: number, maxAppSize: number): Promise>>; + + /** + * Create an avsession controller + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { string } sessionId - Specifies the sessionId to create the controller. + * @param { AsyncCallback } callback - async callback for AVSessionController. + * If provided 'default', the system will create a default controller, Used to control the system default session + * @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 } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function createController(sessionId: string, callback: AsyncCallback): void; + + /** + * Create an avsession controller + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { string } sessionId - Specifies the sessionId to create the controller. + * If provided 'default', the system will create a default controller, Used to control the system default session + * @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 } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function createController(sessionId: string): Promise; + + /** + * Cast Audio to the remote devices or cast back local device + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { SessionToken | 'all' } session - Specifies the sessionId which to send to remote. + * @param { Array } audioDevices - Specifies the audio devices to cast. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * 'all' means cast all the media audio of this device to remote. + * @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 } 6600102 - The session does not exist. + * @throws { BusinessError } 6600104 - The remote session connection failed. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function castAudio(session: SessionToken | 'all', audioDevices: Array, callback: AsyncCallback): void; + + /** + * Cast Audio to the remote devices or cast back local device + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { SessionToken | 'all' } session - Specifies the sessionId which to send to remote. + * @param { Array } audioDevices - Specifies the audio devices to cast. + * @returns { Promise } void promise when executed successfully + * 'all' means cast all the media audio of this device to remote. + * @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 } 6600102 - The session does not exist. + * @throws { BusinessError } 6600104 - The remote session connection failed. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function castAudio(session: SessionToken | 'all', audioDevices: Array): Promise; + + /** + * Start an application for media playback. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { string } bundleName - Specifies the bundleName which to be started. + * @param { string } assetId - Specifies the assetId to be started. + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 201 - permission denied + * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. + * @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. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 11 + */ + function startAVPlayback(bundleName: string, assetId: string): Promise; + + /** + * Session token. Used to judge the legitimacy of the session. + * @typedef SessionToken + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + interface SessionToken { + /** + * The unique session id of the avsession object + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + sessionId: string; + + /** + * Process id of session + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + pid?: number; + + /** + * User id + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + uid?: number; + } + + /** + * Register session create callback + * @param { 'sessionCreate' } type - Registration Type, 'sessionCreate' + * @param { function } callback - Used to handle ('sessionCreate' command) + * @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 + * @since 9 + */ + function on(type: 'sessionCreate', callback: (session: AVSessionDescriptor) => void): void; + + /** + * Register session destroy callback + * @param { 'sessionDestroy' } type - Registration Type, 'sessionDestroy' + * @param { function } callback - Used to handle ('sessionDestroy' command) + * @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 + * @since 9 + */ + function on(type: 'sessionDestroy', callback: (session: AVSessionDescriptor) => void): void; + + /** + * Register top session changed callback + * @param { 'topSessionChange' } type - Registration Type, top priority session change, 'topSessionChange' + * @param { function } callback - Used to handle ('topSessionChange' command) + * @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 + * @since 9 + */ + function on(type: 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void; + + /** + * Unregister session create callback + * @param { 'sessionCreate' } type - Registration Type, session creation, 'sessionCreate' + * @param { function } callback - Used to unregister listener for ('sessionCreate') command + * @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 + * @since 9 + */ + function off(type: 'sessionCreate', callback?: (session: AVSessionDescriptor) => void): void; + + /** + * Unregister session destroy callback + * @param { 'sessionDestroy' } type - Registration Type, session deletion, 'sessionDestroy' + * @param { function } callback - Used to unregister listener for ('sessionDestroy') command + * @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 + * @since 9 + */ + function off(type: 'sessionDestroy', callback?: (session: AVSessionDescriptor) => void): void; + + /** + * Unregister top session changed callback + * @param { 'topSessionChange' } type - Registration Type, top priority session change, 'topSessionChange' + * @param { function } callback - Used to unregister listener for ('topSessionChange') command + * @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 + * @since 9 + */ + function off(type: 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void; + + /** + * Register Session service death callback, notifying the application to clean up resources. + * @param { 'sessionServiceDie' } type - Registration Type, 'sessionServiceDie' + * @param { function } callback - Used to handle ('sessionServiceDie') command. + * @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.Core + * @systemapi + * @since 9 + */ + function on(type: 'sessionServiceDie', callback: () => void): void; + + /** + * Unregister Session service death callback, notifying the application to clean up resources. + * @param { 'sessionServiceDie' } type - Registration Type, 'sessionServiceDie' + * @param { function } callback - Used to unregister listener for ('sessionServiceDie') command. + * @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.Core + * @systemapi + * @since 9 + */ + function off(type: 'sessionServiceDie', callback?: () => void): void; + + /** + * Send system media key event.The system automatically selects the recipient. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { KeyEvent } event - The key event to be sent + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @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 } 6600105 - Invalid session command. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void; + + /** + * Send system media key event.The system automatically selects the recipient. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { KeyEvent } event - The key event to be sent + * @returns { Promise } void promise when executed successfully + * @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 } 6600105 - Invalid session command. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function sendSystemAVKeyEvent(event: KeyEvent): Promise; + + /** + * Send system control command.The system automatically selects the recipient. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @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 } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback): void; + + /** + * Send system control command.The system automatically selects the recipient. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @returns { Promise } void promise when executed successfully + * @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 } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function sendSystemControlCommand(command: AVControlCommand): Promise; + + /** + * Define different protocol capability + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * Define different protocol capability + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + enum ProtocolType { + /** + * 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, + * including internal speakers or audio jack on the device itself, A2DP devices. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + TYPE_LOCAL = 0, + + /** + * Cast+ mirror capability + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + TYPE_CAST_PLUS_MIRROR = 1, + + /** + * The Cast+ Stream indicating the media is presenting on a different device + * the application need get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * The Cast+ Stream indicating the media is presenting on a different device + * the application need get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + TYPE_CAST_PLUS_STREAM = 2, + + /** + * The DLNA type indicates the device supports DLNA protocol, + * the application needs to get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + TYPE_DLNA = 4, + } + + /** + * Start device discovery. + * @param { AsyncCallback } callback a callback function + * @throws { BusinessError } 202 - Not System App. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function startCastDeviceDiscovery(callback: AsyncCallback): void; + + /** + * Start device discovery. + * @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} + * @param { AsyncCallback } callback a callback function + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function startCastDeviceDiscovery(filter: number, callback: AsyncCallback): void; + + /** + * Start device discovery. + * @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} + * @returns { Promise } Promise for the result + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + /** + * Start device discovery. + * @param { number } [filter] - device filter when discovering, can be an union of {@link ProtocolType} + * @param { Array } [drmSchemes] - filter drm-enabled devices which are represented by uuid. + * It is effective when protocol type is TYPE_CAST_PLUS_STREAM. + * @returns { Promise } Promise for the result + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 12 + */ + function startCastDeviceDiscovery(filter?: number, drmSchemes?: Array): Promise; + + /** + * Stop device discovery. + * @param { AsyncCallback } callback a callback function + * @throws { BusinessError } 202 - Not System App. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function stopCastDeviceDiscovery(callback: AsyncCallback): void; + + /** + * Stop device discovery. + * @returns { Promise } Promise for the result + * @throws { BusinessError } 202 - Not System App. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function stopCastDeviceDiscovery(): Promise; + + /** + * Enable or disable device to be discoverable, used at sink side. + * @param { boolean } enable true: can be discoverable, false: cannot be discoverable. + * @param { AsyncCallback } callback a callback function + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function setDiscoverable(enable: boolean, callback: AsyncCallback): void; + + /** + * Enable or disable device to be discoverable, used at sink side. + * @param { boolean } enable true: can be discoverable, false: cannot be discoverable. + * @returns { Promise } Promise for the result + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function setDiscoverable(enable: boolean): Promise; + + /** + * Register device discovery callback + * @param { 'deviceAvailable' } type Registration Type + * @param { function } callback Used to returns the device info + * @throws { BusinessError } 202 - Not System App. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function on(type: 'deviceAvailable', callback: (device: OutputDeviceInfo) => void): void; + + /** + * Unregister device discovery callback + * @param { 'deviceAvailable' } type Registration Type + * @param { function } callback Used to returns the device info + * @throws { BusinessError } 202 - Not System App. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function off(type: 'deviceAvailable', callback?: (device: OutputDeviceInfo) => void): void; + + /** + * Register device offline callback + * @param { 'deviceOffline' } type - Registration Type + * @param { function } callback - Used to returns the device info + * @throws { BusinessError } 202 - Not System App. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 11 + */ + function on(type: 'deviceOffline', callback: (deviceId: string) => void): void; + + /** + * Unregister device offline callback + * @param { 'deviceOffline' } type - Registration Type + * @param { function } callback - Used to returns the device info + * @throws { BusinessError } 202 - Not System App. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 11 + */ + function off(type: 'deviceOffline', callback?: (deviceId: string) => void): void; + + /** + * Register a callback to retrieve an avsession cast controller. + * This function can be used at both side to get the same controller to do the playback control. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { string } sessionId Specifies the sessionId to get controller. + * @param { AsyncCallback } callback - async callback for the AVCastController. + * @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} 6600102 - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function getAVCastController(sessionId: string, callback: AsyncCallback): void; + + /** + * Get the current session's remote controller client. + * If the avsession is not under casting state, the controller will return null. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { string } sessionId Specifies the sessionId to get controller. + * @returns { Promise } Promise for the AVCastController + * @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 - server exception + * @throws {BusinessError} 6600102 - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function getAVCastController(sessionId: string): Promise; + + /** + * Cast resource to remote device. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { SessionToken } session Specifies the sessionId which is to be casted. + * @param { OutputDeviceInfo } device Specifies the device to cast. + * @param { AsyncCallback } callback A callback instance used to return when start casting. + * @throws {BusinessError} 201 - permission denied + * @throws { BusinessError } 202 - Not System App. + * @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} 6600108 - Device connecting failed + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCallback): void; + + /** + * Cast resource to remote device. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param { SessionToken } session Specifies the sessionId which is to be casted. + * @param { OutputDeviceInfo } device Specifies the device to cast. + * @returns { Promise } Promise for the result + * @throws {BusinessError} 201 - permission denied + * @throws { BusinessError } 202 - Not System App. + * @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} 6600108 - Device connecting failed + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function startCasting(session: SessionToken, device: OutputDeviceInfo): Promise; + + /** + * Stop current cast and disconnect device connection. + * @param { SessionToken } session Specifies the sessionId which is to be stopped. + * @param { AsyncCallback } callback A callback instance used to return when cast stopped completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function stopCasting(session: SessionToken, callback: AsyncCallback): void; + + /** + * Stop current cast and disconnect device connection. + * @param { SessionToken } session Specifies the sessionId which is to be stopped. + * @returns { Promise } Promise for the result + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + function stopCasting(session: SessionToken): Promise; + + /** + * Begin to write device logs into a file descriptor for the purpose of problem locating. + * If the logs exceed max file size, no logs will be written and DEVICE_LOG_FULL event will be omitted. + * @param { string } url - The file descriptor to be written. + * @param { number } maxSize - The max size to be written in kilobyte. + * if not set, then written process will exit when there is no space to write. + * @returns { Promise } Promise for the result + * @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. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + function startDeviceLogging(url: string, maxSize?: number): Promise; + + /** + * Stop the current device written even the discovery is ongoing. + * @returns { Promise } Promise for the result + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + function stopDeviceLogging(): Promise; + + /** + * Register log event callback. + * @param { 'deviceLogEvent' } type - Command to register 'deviceLogEvent'. + * @param { Callback } callback - Used to handle ('deviceLogEvent') command + * @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. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + function on(type: 'deviceLogEvent', callback: Callback): void; + + /** + * UnRegister log event callback. + * @param { 'deviceLogEvent' } type - Command to register 'deviceLogEvent'. + * @param { Callback } callback - Used to handle ('deviceLogEvent') command + * @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. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + function off(type: 'deviceLogEvent', callback?: Callback): void; + + /** + * Enumerates device log event code. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + enum DeviceLogEventCode { + /** + * 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, + } + + /** + * Session type, support audio & video + * @typedef { 'audio' | 'video' } AVSessionType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Session type, support audio & video, voice_call + * @typedef { 'audio' | 'video' | 'voice_call' } AVSessionType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Session type supports audio & video, voice_call, video_call + * @typedef { 'audio' | 'video' | 'voice_call' | 'video_call' } AVSessionType + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + type AVSessionType = 'audio' | 'video' | 'voice_call' | 'video_call'; + + /** + * AVSession object. + * @interface AVSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * AVSession object. + * @interface AVSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + class AVSessionStringBindObject { + [key:string]:Object; + } + interface AVSession { + /** + * unique session Id + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * unique session Id + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + readonly sessionId: string; + + /** + * Get current session type + * @type { AVSessionType } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get current session type + * @type { AVSessionType } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + readonly sessionType: AVSessionType; + + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param { AVMetadata } data {@link AVMetadata} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVMetadata(data: AVMetadata, callback: AsyncCallback): void; + + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param { AVMetadata } data {@link AVMetadata} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param { AVMetadata } data {@link AVMetadata} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setAVMetadata(data: AVMetadata): Promise; + + /** + * Set the metadata related with current call. + * @param { CallMetadata } data - {@link CallMetadata} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setCallMetadata(data: CallMetadata, callback: AsyncCallback): void; + + /** + * Set the metadata related with current call. + * @param { CallMetadata } data - {@link CallMetadata} + * @returns { Promise } void promise when executed successfully + * @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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setCallMetadata(data: CallMetadata): Promise; + + /** + * Set the playback state of this session. + * @param { AVPlaybackState } state {@link AVPlaybackState} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void; + + /** + * Set the playback state of this session. + * @param { AVPlaybackState } state {@link AVPlaybackState} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the playback state of this session. + * @param { AVPlaybackState } state {@link AVPlaybackState} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setAVPlaybackState(state: AVPlaybackState): Promise; + + /** + * Set the call state of this session. + * @param { AVCallState } state - {@link AVCallState} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setAVCallState(state: AVCallState, callback: AsyncCallback): void; + + /** + * Set the call state of this session. + * @param { AVCallState } state - {@link AVCallState} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setAVCallState(state: AVCallState): Promise; + + /** + * Set the ability to start the session corresponding to + * @param { WantAgent } ability - The WantAgent for launch the ability + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void; + + /** + * Set the ability to start the session corresponding to + * @param { WantAgent } ability - The WantAgent for launch the ability + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the ability to start the session corresponding to + * @param { WantAgent } ability - The WantAgent for launch the ability + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setLaunchAbility(ability: WantAgent): Promise; + + /** + * Dispatch the session event of this session. + * @param { string } event - Session event name to dispatch + * @param { object } args - The parameters of session event + * @param { AsyncCallback} callback - The asyncCallback triggered when the command is executed successfully + * @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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + dispatchSessionEvent(event: string, args: AVSessionStringBindObject, callback: AsyncCallback): void; + + /** + * Dispatch the session event of this session. + * @param { string } event - Session event name to dispatch + * @param { object } args - The parameters of session event + * @returns { Promise } void promise when executed successfully + * @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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Dispatch the session event of this session. + * @param { string } event - Session event name to dispatch + * @param { object } args - The parameters of session event + * @returns { Promise } void promise when executed successfully + * @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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + dispatchSessionEvent(event: string, args: AVSessionStringBindObject): Promise; + + /** + * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. + * @param { Array } items - An array of the AVQueueItem + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVQueueItems(items: Array, callback: AsyncCallback): void; + + /** + * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. + * @param { Array } items - An array of the AVQueueItem + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. + * @param { Array } items - An array of the AVQueueItem + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setAVQueueItems(items: Array): Promise; + + /** + * Set the name of the playlist presented by this session. + * @param { string } title - The name of the playlist + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVQueueTitle(title: string, callback: AsyncCallback): void; + + /** + * Set the name of the playlist presented by this session. + * @param { string } title - The name of the playlist + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the name of the playlist presented by this session. + * @param { string } title - The name of the playlist + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setAVQueueTitle(title: string): Promise; + + /** + * Set the custom media packets for this session. + * @param { object } extras - The custom media packets + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setExtras(extras: AVSessionStringBindObject, callback: AsyncCallback): void; + + /** + * Set the custom media packets for this session. + * @param { object } extras - The custom media packets + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the custom media packets for this session. + * @param { object } extras - The custom media packets + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setExtras(extras: AVSessionStringBindObject): Promise; + + /** + * Get the current session's own controller + * @param { AsyncCallback } callback - async callback for the AVSessionController. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getController(callback: AsyncCallback): void; + + /** + * Get the current session's own controller + * @returns { Promise } Promise for the AVSessionController + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get the current session's own controller + * @returns { Promise } Promise for the AVSessionController + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getController(): Promise; + + /** + * Get the cast controller when the session is casted to remote device. + * If the avsession is not under casting state, the controller will return null. + * @param { AsyncCallback } callback - async callback for the AVCastController. + * @throws {BusinessError} 6600102 - The session does not exist + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + getAVCastController(callback: AsyncCallback): void; + + /** + * Get the cast controller when the session is casted to remote device. + * If the avsession is not under casting state, the controller will return null. + * @returns { Promise } Promise for the AVCastController + * @throws {BusinessError} 6600102 - The session does not exist + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Get the cast controller when the session is casted to remote device. + * If the avsession is not under casting state, the controller will return null. + * @returns { Promise } Promise for the AVCastController + * @throws {BusinessError} 6600102 - The session does not exist + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + getAVCastController(): Promise; + + /** + * Get output device information + * @param { AsyncCallback } callback - async callback for the OutputDeviceInfo. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDevice(callback: AsyncCallback): void; + + /** + * Get output device information + * @returns { Promise } Promise for the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get output device information + * @returns { Promise } Promise for the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getOutputDevice(): Promise; + + /** + * Get output device information + * @returns { OutputDeviceInfo } the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get output device information + * @returns { OutputDeviceInfo } the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getOutputDeviceSync(): OutputDeviceInfo; + + /** + * Get all the current virtual display information for extended display. + * @returns { Promise> } Promise for the CastDisplayInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + getAllCastDisplays(): Promise>; + + /** + * Register play command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'play' } type - Command to register 'play'. + * @param { function } callback - Used to handle ('play') command + * @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 + * @since 10 + */ + /** + * Register play command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'play' } type - Command to register 'play'. + * @param { function } callback - Used to handle ('play') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'play', callback: () => void): void; + + /** + * Register pause command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'pause' } type - Command to register 'pause'. + * @param { function } callback - Used to handle ('pause') command + * @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 + * @since 10 + */ + /** + * Register pause command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'pause' } type - Command to register 'pause'. + * @param { function } callback - Used to handle ('pause') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'pause', callback: () => void): void; + + /** + * Register stop command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'stop' } type - Command to register 'stop'. + * @param { function } callback - Used to handle ('stop') command + * @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 + * @since 10 + */ + /** + * Register stop command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'stop' } type - Command to register 'stop'. + * @param { function } callback - Used to handle ('stop') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'stop', callback: () => void): void; + + /** + * Register playNext command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playNext' } type - Command to register 'playNext'. + * @param { function } callback - Used to handle ('playNext') command + * @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 + * @since 10 + */ + /** + * Register playNext command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playNext' } type - Command to register 'playNext'. + * @param { function } callback - Used to handle ('playNext') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'playNext', callback: () => void): void; + + /** + * Register playPrevious command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playPrevious' } type - Command to register 'playPrevious'. + * @param { function } callback - Used to handle ('playPrevious') command + * @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 + * @since 10 + */ + /** + * Register playPrevious command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playPrevious' } type - Command to register 'playPrevious'. + * @param { function } callback - Used to handle ('playPrevious') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'playPrevious', callback: () => void): void; + + /** + * Register fastForward command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'fastForward' } type - Command to register 'fastForward'. + * @param { function } callback - Used to handle ('fastForward') command + * @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 + * @since 10 + */ + /** + * Register fastForward command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'fastForward' } type - Command to register 'fastForward'. + * @param { function } callback - Used to handle ('fastForward') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'fastForward', callback: (time ?: number) => void): void; + + /** + * Register rewind command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'rewind' } type - Command to register 'rewind'. + * @param { function } callback - Used to handle ('rewind') command + * @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 + * @since 10 + */ + /** + * Register rewind command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'rewind' } type - Command to register 'rewind'. + * @param { function } callback - Used to handle ('rewind') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'rewind', callback: (time ?: number) => void): void; + + /** + * Unregister play command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'play' } type - Command to register 'play'. + * @param { function } callback - Used to handle ('play') command + * @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 + * @since 10 + */ + /** + * Unregister play command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'play' } type - Command to register 'play'. + * @param { function } callback - Used to handle ('play') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'play', callback?: () => void): void; + + /** + * Unregister pause command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'pause' } type - Command to register 'pause'. + * @param { function } callback - Used to handle ('pause') command + * @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 + * @since 10 + */ + /** + * Unregister pause command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'pause' } type - Command to register 'pause'. + * @param { function } callback - Used to handle ('pause') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'pause', callback?: () => void): void; + + /** + * Unregister stop command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'stop' } type - Command to register 'stop'. + * @param { function } callback - Used to handle ('stop') command + * @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 + * @since 10 + */ + /** + * Unregister stop command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'stop' } type - Command to register 'stop'. + * @param { function } callback - Used to handle ('stop') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'stop', callback?: () => void): void; + + /** + * Unregister playNext command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Command to register 'playNext'. + * @param { function } callback - Used to handle ('playNext') command + * @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 + * @since 10 + */ + /** + * Unregister playNext command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Command to register 'playNext'. + * @param { function } callback - Used to handle ('playNext') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'playNext', callback?: () => void): void; + + /** + * Unregister playPrevious command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Command to register 'playPrevious'. + * @param { function } callback - Used to handle ('playPrevious') command + * @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 + * @since 10 + */ + /** + * Unregister playPrevious command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Command to register 'playPrevious'. + * @param { function } callback - Used to handle ('playPrevious') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'playPrevious', callback?: () => void): void; + + /** + * Unregister fastForward command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'fastForward' } type - Command to register 'fastForward'. + * @param { function } callback - Used to handle ('fastForward') command + * @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 + * @since 10 + */ + /** + * Unregister fastForward command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'fastForward' } type - Command to register 'fastForward'. + * @param { function } callback - Used to handle ('fastForward') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'fastForward', callback?: () => void): void; + + /** + * Unregister rewind command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'rewind' } type - Command to register 'rewind'. + * @param { function } callback - Used to handle ('rewind') command + * @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 + * @since 10 + */ + /** + * Unregister rewind command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'rewind' } type - Command to register 'rewind'. + * @param { function } callback - Used to handle ('rewind') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'rewind', callback?: () => void): void; + + /** + * Register playFromAssetId command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. + * @param { function } callback - Used to handle ('playFromAssetId') command + * @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 + * @since 11 + */ + /** + * Register playFromAssetId command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. + * @param { function } callback - Used to handle ('playFromAssetId') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'playFromAssetId', callback: (assetId: number) => void): void; + + /** + * Unregister playFromAssetId command callback. + * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. + * @param { function } callback - Used to handle ('playFromAssetId') command + * @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 + * @since 11 + */ + /** + * Unregister playFromAssetId command callback. + * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. + * @param { function } callback - Used to handle ('playFromAssetId') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'playFromAssetId', callback?: (assetId: number) => void): void; + + /** + * Register seek command callback + * @param { 'seek' } type - Registration Type 'seek' + * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) + * @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 + * @since 10 + */ + /** + * Register seek command callback + * @param { 'seek' } type - Registration Type 'seek' + * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'seek', callback: (time: number) => void): void; + + /** + * Unregister seek command callback + * @param { 'seek' } type - Registration Type 'seek' + * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) + * @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 + * @since 10 + */ + /** + * Unregister seek command callback + * @param { 'seek' } type - Registration Type 'seek' + * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'seek', callback?: (time: number) => void): void; + + /** + * Register setSpeed command callback + * @param { 'setSpeed' } type - Registration Type 'setSpeed' + * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value + * @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 + * @since 10 + */ + /** + * Register setSpeed command callback + * @param { 'setSpeed' } type - Registration Type 'setSpeed' + * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'setSpeed', callback: (speed: number) => void): void; + + /** + * Unregister setSpeed command callback + * @param { 'setSpeed' } type - Registration Type 'setSpeed' + * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value + * @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 + * @since 10 + */ + /** + * Unregister setSpeed command callback + * @param { 'setSpeed' } type - Registration Type 'setSpeed' + * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'setSpeed', callback?: (speed: number) => void): void; + + /** + * Register setLoopMode command callback + * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' + * @param { function } callback - Used to handle setLoopMode 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 + * @since 10 + */ + /** + * Register setLoopMode command callback + * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' + * @param { function } callback - Used to handle setLoopMode 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 + * @atomicservice + * @since 12 + */ + on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void; + + /** + * Unregister setLoopMode command callback + * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' + * @param { function } callback - Used to handle setLoopMode 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 + * @since 10 + */ + /** + * Unregister setLoopMode command callback + * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' + * @param { function } callback - Used to handle setLoopMode 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 + * @atomicservice + * @since 12 + */ + off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void; + + /** + * Register toggle favorite command callback + * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' + * @param { function } callback - Used to handle toggleFavorite command.The callback provides + * the assetId for which the favorite status needs to be switched. + * @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 + * @since 10 + */ + /** + * Register toggle favorite command callback + * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' + * @param { function } callback - Used to handle toggleFavorite command.The callback provides + * the assetId for which the favorite status needs to be switched. + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'toggleFavorite', callback: (assetId: string) => void): void; + + /** + * Unregister toggle favorite command callback + * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' + * @param { function } callback - Used to handle toggleFavorite command.The callback provides + * the assetId for which the favorite status needs to be switched. + * @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 + * @since 10 + */ + /** + * Unregister toggle favorite command callback + * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' + * @param { function } callback - Used to handle toggleFavorite command.The callback provides + * the assetId for which the favorite status needs to be switched. + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'toggleFavorite', callback?: (assetId: string) => void): void; + + /** + * Register media key handling callback + * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' + * @param { function } callback - Used to handle key events.The callback provides the KeyEvent + * @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 + * @since 10 + */ + /** + * Register media key handling callback + * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' + * @param { function } callback - Used to handle key events.The callback provides the KeyEvent + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void; + + /** + * Unregister media key handling callback + * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' + * @param { function } callback - Used to handle key events.The callback provides the KeyEvent + * @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 + * @since 10 + */ + /** + * Unregister media key handling callback + * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' + * @param { function } callback - Used to handle key events.The callback provides the KeyEvent + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void; + + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @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 + * @since 10 + */ + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @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 + * @since 10 + */ + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + + /** + * Register session custom command change callback + * @param { 'commonCommand' } type - Registration Type 'commonCommand' + * @param { function } callback - Used to handle event when the common command is received + * The callback provide the command name and command args + * @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 + * @since 10 + */ + /** + * Register session custom command change callback + * @param { 'commonCommand' } type - Registration Type 'commonCommand' + * @param { function } callback - Used to handle event when the common command is received + * The callback provide the command name and command args + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'commonCommand', callback: (command: string, args: AVSessionStringBindObject) => void): void; + + /** + * Unregister session custom command change callback + * @param { 'commonCommand' } type - Registration Type 'commonCommand' + * @param { function } callback - Used to cancel a specific listener + * The callback provide the command name and command args + * @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 + * @since 10 + */ + /** + * Unregister session custom command change callback + * @param { 'commonCommand' } type - Registration Type 'commonCommand' + * @param { function } callback - Used to cancel a specific listener + * The callback provide the command name and command args + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'commonCommand', callback?: (command: string, args: AVSessionStringBindObject) => void): void; + + /** + * Register the item to play from the playlist change callback + * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' + * @param { function } callback - Used to handle the item to be played. + * The callback provide the new device info {@link OutputDeviceInfo} + * @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 + * @since 10 + */ + /** + * Register the item to play from the playlist change callback + * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' + * @param { function } callback - Used to handle the item to be played. + * The callback provide the new device info {@link OutputDeviceInfo} + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'skipToQueueItem', callback: (itemId: number) => void): void; + + /** + * Unregister the item to play from the playlist change callback + * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' + * @param { function } callback - Used to handle the item to be played. + * The callback provide the new device info {@link OutputDeviceInfo} + * @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 + * @since 10 + */ + /** + * Unregister the item to play from the playlist change callback + * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' + * @param { function } callback - Used to handle the item to be played. + * The callback provide the new device info {@link OutputDeviceInfo} + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void; + + /** + * Register answer command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'answer' } type - Command to register 'answer'. + * @param { Callback } callback - Used to handle ('answer') command + * @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 + * @since 11 + */ + /** + * Register answer command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'answer' } type - Command to register 'answer'. + * @param { Callback } callback - Used to handle ('answer') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'answer', callback: Callback): void; + + /** + * Unregister answer command callback. + * @param { 'answer' } type - Command to register 'answer'. + * @param { Callback } callback - Used to handle ('answer') command + * @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 + * @since 11 + */ + /** + * Unregister answer command callback. + * @param { 'answer' } type - Command to register 'answer'. + * @param { Callback } callback - Used to handle ('answer') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'answer', callback?: Callback): void; + + /** + * Register hangUp command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'hangUp' } type - Command to register 'hangUp'. + * @param { Callback } callback - Used to handle ('hangUp') command + * @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 + * @since 11 + */ + /** + * Register hangUp command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'hangUp' } type - Command to register 'hangUp'. + * @param { Callback } callback - Used to handle ('hangUp') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'hangUp', callback: Callback): void; + + /** + * Unregister hangUp command callback. + * @param { 'hangUp' } type - Command to register 'hangUp'. + * @param { Callback } callback - Used to handle ('hangUp') command + * @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 + * @since 11 + */ + /** + * Unregister hangUp command callback. + * @param { 'hangUp' } type - Command to register 'hangUp'. + * @param { Callback } callback - Used to handle ('hangUp') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'hangUp', callback?: Callback): void; + + /** + * Register toggleCallMute command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. + * @param { Callback } callback - Used to handle ('toggleCallMute') command + * @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 + * @since 11 + */ + /** + * Register toggleCallMute command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. + * @param { Callback } callback - Used to handle ('toggleCallMute') command + * @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 + * @atomicservice + * @since 12 + */ + on(type: 'toggleCallMute', callback: Callback): void; + + /** + * Unregister toggleCallMute command callback. + * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. + * @param { Callback } callback - Used to handle ('toggleCallMute') command + * @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 + * @since 11 + */ + /** + * Unregister toggleCallMute command callback. + * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. + * @param { Callback } callback - Used to handle ('toggleCallMute') command + * @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 + * @atomicservice + * @since 12 + */ + off(type: 'toggleCallMute', callback?: Callback): void; + + /** + * Register listener for cast display information changed. + * @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for. + * @param { Callback } callback - Callback used to return cast display information. + * @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.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + on(type: 'castDisplayChange', callback: Callback): void; + + /** + * Unregister listener for cast display information changed. + * @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for. + * @param { Callback } callback - Callback used to return cast display information. + * @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.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + off(type: 'castDisplayChange', callback?: Callback): void; + + /** + * Stop current cast and disconnect device connection. + * @param { AsyncCallback } callback A callback instance used to return when cast stopped completed. + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + stopCasting(callback: AsyncCallback): void; + + /** + * Stop current cast and disconnect device connection. + * @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 + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + stopCasting(): Promise; + + /** + * Activate the session, indicating that the session can accept control commands + * @param { AsyncCallback } callback - The asyncCallback triggered when the session is activated. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + activate(callback: AsyncCallback): void; + + /** + * Activate the session, indicating that the session can accept control commands + * @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 + * @since 10 + */ + /** + * Activate the session, indicating that the session can accept control commands + * @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 + * @atomicservice + * @since 12 + */ + activate(): Promise; + + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @param { AsyncCallback } callback - The asyncCallback triggered when the session is deactivated. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + deactivate(callback: AsyncCallback): void; + + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deactivate(): Promise; + + /** + * Destroy this session, the server will clean up the session resources + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + destroy(callback: AsyncCallback): void; + + /** + * Destroy this session, the server will clean up the session resources + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Destroy this session, the server will clean up the session resources + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + destroy(): Promise; + } + + /** + * The type of control command + * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | + * 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute' } AVCastControlCommandType + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The type of control command + * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | + * 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute' } AVCastControlCommandType + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + type AVCastControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | + 'seek' | 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute'; + + /** + * The definition of command to be sent to the session + * @interface AVCastControlCommand + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The definition of command to be sent to the session + * @interface AVCastControlCommand + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + interface AVCastControlCommand { + /** + * The command value {@link AVCastControlCommandType} + * + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The command value {@link AVCastControlCommandType} + * @type { AVCastControlCommandType } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + command: AVCastControlCommandType; + + /** + * Parameter carried in the command. + * The seek command must carry the number parameter. + * The setVolume command must carry the number parameter. + * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. + * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. + * The setLoopMode command must carry the {@link LoopMode} parameter. + * Other commands do not need to carry parameters. + * @type { ?(media.PlaybackSpeed | number | string | LoopMode) } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Parameter carried in the command. + * The seek command must carry the number parameter. + * The setVolume command must carry the number parameter. + * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. + * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. + * The setLoopMode command must carry the {@link LoopMode} parameter. + * Other commands do not need to carry parameters. + * @type { ?(media.PlaybackSpeed | number | string | LoopMode) } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + parameter?: media.PlaybackSpeed | number | string | LoopMode; + } + + /** + * AVCastController definition used to implement a remote control when a cast is connected + * @interface AVCastController + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * AVCastController definition used to implement a remote control when a cast is connected + * @interface AVCastController + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + interface AVCastController { + /** + * Set a surface instance to display playing view, used at sink side. + * @param { string } surfaceId - surface id, video player will use this id get a surface instance. + * @param { AsyncCallback } callback - A callback instance used to return when set surface completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; + + /** + * Set a surface instance to display playing view, used at sink side. + * @param { string } surfaceId - surface id, video player will use this id get a surface instance. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + setDisplaySurface(surfaceId: string): Promise; + + /** + * Get the playback status of the current player + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVPlaybackState). + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + getAVPlaybackState(callback: AsyncCallback): void; + + /** + * Get the playback status of the current player + * @returns { Promise } (AVPlaybackState) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Get the playback status of the current player + * @returns { Promise } (AVPlaybackState) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + getAVPlaybackState(): Promise; + + /** + * Send control commands to remote player + * @param { AVCastControlCommand } command The command to be send. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600105 - Invalid session command + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + sendControlCommand(command: AVCastControlCommand, callback: AsyncCallback): void; + + /** + * Send control commands to remote player + * @param { AVCastControlCommand } command The command to be send. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600105 - Invalid session command + * @throws { BusinessError } 6600109 - The remote connection is not established + * @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. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600105 - Invalid session command + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + sendControlCommand(command: AVCastControlCommand): Promise; + + /** + * Play the current item, should contain mediaUri otherwise the playback will fail. + * @param { AVQueueItem } item media item info. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @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.AVCast + * @since 10 + */ + start(item: AVQueueItem, callback: AsyncCallback): void; + + /** + * Play the current item, should contain mediaUri otherwise the playback will fail. + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @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.AVCast + * @since 10 + */ + /** + * Play the current item, should contain mediaUri otherwise the playback will fail. + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @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.AVCast + * @atomicservice + * @since 12 + */ + start(item: AVQueueItem): Promise; + + /** + * Load the current item and mediaUri can be null, this is needed for sink media information displaying + * @param { AVQueueItem } item media item info. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @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.AVCast + * @since 10 + */ + prepare(item: AVQueueItem, callback: AsyncCallback): void; + + /** + * Load the current item and mediaUri can be null, this is needed for sink media information displaying + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @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.AVCast + * @since 10 + */ + /** + * Load the current item and mediaUri can be null, this is needed for sink media information displaying + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @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.AVCast + * @atomicservice + * @since 12 + */ + prepare(item: AVQueueItem): Promise; + + /** + * Get the current playing item + * @param { AsyncCallback } callback - The triggered asyncCallback. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + getCurrentItem(callback: AsyncCallback): void; + + /** + * Get the current playing item + * @returns { Promise } (AVQueueItem) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Get the current playing item + * @returns { Promise } (AVQueueItem) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + getCurrentItem(): Promise; + + /** + * Get commands supported by the current cast controller + * @param { AsyncCallback> } callback - The triggered asyncCallback when (getValidCommands). + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + getValidCommands(callback: AsyncCallback>): void; + + /** + * Get commands supported by the current cast controller + * @returns { Promise> } array of AVCastControlCommandType promise + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + getValidCommands(): Promise>; + + /** + * Process the response corresponding to the media key request obtained by the application. + * @param { string } assetId - The assetId of resource which provides the response. + * @param { Uint8Array } response - Response corresponding to the request. + * @returns { Promise } void promise when executed successfully + * @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 12 + */ + processMediaKeyResponse(assetId: string, response: Uint8Array): Promise; + + /** + * Destroy the controller + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + release(callback: AsyncCallback): void; + + /** + * Destroy the controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * Destroy the controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + release(): Promise; + + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @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.AVCast + * @since 10 + */ + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @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.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'playbackStateChange', filter: Array | 'all', callback: (state: AVPlaybackState) => void): void; + + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @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.AVCast + * @since 10 + */ + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @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.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void): void; + + /** + * Register listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @param { Callback } callback Callback used to listen for current item changed. + * @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.AVCast + * @since 10 + */ + /** + * Register listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @param { Callback } callback Callback used to listen for current item changed. + * @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.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'mediaItemChange', callback: Callback): void; + + /** + * Unregister listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @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.AVCast + * @since 10 + */ + /** + * Unregister listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @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.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'mediaItemChange'): void; + + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @param { Callback } callback - Used to handle 'playNext' command + * @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.AVCast + * @since 10 + */ + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @param { Callback } callback - Used to handle 'playNext' command + * @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.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'playNext', callback: Callback): void; + + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @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.AVCast + * @since 10 + */ + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @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.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'playNext'): void; + + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @param { Callback } callback - Used to handle 'playPrevious' command + * @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.AVCast + * @since 10 + */ + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @param { Callback } callback - Used to handle 'playPrevious' command + * @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.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'playPrevious', callback: Callback): void; + + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @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.AVCast + * @since 10 + */ + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @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.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'playPrevious'): void; + + /** + * Register requested playback command callback sent by remote side or media center. + * The AVQueueItem may include the requested assetId, starting position and other configurations. + * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. + * @param { Callback } callback - Used to handle 'requestPlay' command + * @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.AVCast + * @since 11 + */ + on(type: 'requestPlay', callback: Callback): void; + + /** + * Unregister requested playback command callback sent by remote side or media center. + * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. + * @param { Callback } callback - Used to handle 'requestPlay' command + * @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.AVCast + * @since 11 + */ + off(type: 'requestPlay', callback?: Callback): void; + + /** + * Register endOfStream state callback. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. + * @param { Callback } callback - Used to handle 'endOfStream' command + * @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.AVCast + * @since 11 + */ + on(type: 'endOfStream', callback: Callback): void; + + /** + * Unregister endOfStream state callback. + * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. + * @param { Callback } callback - Used to handle 'endOfStream' command + * @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.AVCast + * @since 11 + */ + off(type: 'endOfStream', callback?: Callback): void; + + /** + * Register listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @param { Callback } callback - Callback used to listen for the playback seekDone event. + * @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.AVCast + * @since 10 + */ + /** + * Register listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @param { Callback } callback - Callback used to listen for the playback seekDone event. + * @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.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'seekDone', callback: Callback): void; + + /** + * Unregister listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @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.AVCast + * @since 10 + */ + /** + * Unregister listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @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.AVCast + * @atomicservice + * @since 12 + */ + off(type: string): void; + + /** + * Register the valid commands of the casted session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { Callback> } callback - The callback used to handle the changes. + * The callback function provides an array of AVCastControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + on(type: 'validCommandChange', callback: Callback>); + + /** + * Unregister the valid commands of the casted session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { Callback> } callback - The callback used to handle the changes. + * The callback function provides an array of AVCastControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + off(type: 'validCommandChange', callback?: Callback>); + + /** + * Register listener for video size change event, used at remote side. + * @param { 'videoSizeChange' } type - Type of the 'videoSizeChange' to listen for. + * @param { function } callback - Callback used to return video size. + * @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.AVCast + * @since 12 + */ + on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void; + + /** + * Unregister listener for video size change event, used at remote side. + * @param { 'videoSizeChange' } type - Type of the 'videoSizeChange' to listen for. + * @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.AVCast + * @since 12 + */ + off(type: 'videoSizeChange'): void; + + /** + * Register listeners for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the playback error event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @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 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register listeners for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the playback error event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @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 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Unregister listens for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @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 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister listens for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @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 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'error'): void; + + /** + * Register listeners for cast control generic error events. + * @param { 'castControlGenericError' } type Type of the 'castControlGenericError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 6611000 - The error code for cast control is unspecified. + * @throws { BusinessError } 6611001 - An unspecified error occurs in the remote player. + * @throws { BusinessError } 6611002 - The playback position falls behind the live window. + * @throws { BusinessError } 6611003 - The process of cast control times out. + * @throws { BusinessError } 6611004 - The runtime check failed. + * @throws { BusinessError } 6611100 - Cross-device data transmission is locked. + * @throws { BusinessError } 6611101 - The specified seek mode is not supported. + * @throws { BusinessError } 6611102 - The position to seek to is out of the range of the media asset + * or the specified seek mode is not supported. + * @throws { BusinessError } 6611103 - The specified playback mode is not supported. + * @throws { BusinessError } 6611104 - The specified playback speed is not supported. + * @throws { BusinessError } 6611105 - The action failed because either the media source device or the media sink device has been revoked. + * @throws { BusinessError } 6611106 - The parameter is invalid, for example, the url is illegal to play. + * @throws { BusinessError } 6611107 - Allocation of memory failed. + * @throws { BusinessError } 6611108 - Operation is not allowed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + on(type: 'castControlGenericError', callback: ErrorCallback): void; + + /** + * Unregister listeners for cast control generic error events. + * @param { 'castControlGenericError' } type Type of the 'castControlGenericError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + off(type: 'castControlGenericError', callback?: ErrorCallback): void; + + /** + * Register listeners for cast control input/output error events. + * @param { 'castControlIoError' } type Type of the 'castControlIoError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 6612000 - An unspecified input/output error occurs. + * @throws { BusinessError } 6612001 - Network connection failure. + * @throws { BusinessError } 6612002 - Network timeout. + * @throws { BusinessError } 6612003 - Invalid "Content-Type" HTTP header. + * @throws { BusinessError } 6612004 - The HTTP server returns an unexpected HTTP response status code. + * @throws { BusinessError } 6612005 - The file does not exist. + * @throws { BusinessError } 6612006 - No permission is granted to perform the IO operation. + * @throws { BusinessError } 6612007 - Access to cleartext HTTP traffic is not allowed by the app's network security configuration. + * @throws { BusinessError } 6612008 - Reading data out of the data bound. + * @throws { BusinessError } 6612100 - The media does not contain any contents that can be played. + * @throws { BusinessError } 6612101 - The media cannot be read, for example, because of dust or scratches. + * @throws { BusinessError } 6612102 - This resource is already in use. + * @throws { BusinessError } 6612103 - The content using the validity interval has expired. + * @throws { BusinessError } 6612104 - Using the requested content to play is not allowed. + * @throws { BusinessError } 6612105 - The use of the allowed content cannot be verified. + * @throws { BusinessError } 6612106 - The number of times this content has been used as requested has reached the maximum allowed number of uses. + * @throws { BusinessError } 6612107 - An error occurs when sending packet from source device to sink device. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + on(type: 'castControlIoError', callback: ErrorCallback): void; + + /** + * Unregister listeners for cast control input/output error events. + * @param { 'castControlIoError' } type Type of the 'castControlIoError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + off(type: 'castControlIoError', callback?: ErrorCallback): void; + + /** + * Register listeners for cast control parsing error events. + * @param { 'castControlParsingError' } type Type of the 'castControlParsingError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 6613000 - Unspecified error related to content parsing. + * @throws { BusinessError } 6613001 - Parsing error associated with media container format bit streams. + * @throws { BusinessError } 6613002 - Parsing error associated with the media manifest. + * @throws { BusinessError } 6613003 - An error occurs when attempting to extract a file with an unsupported media container format + * or an unsupported media container feature. + * @throws { BusinessError } 6613004 - Unsupported feature in the media manifest. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + on(type: 'castControlParsingError', callback: ErrorCallback): void; + + /** + * Unregister listeners for cast control parsing error events. + * @param { 'castControlParsingError' } type Type of the 'castControlParsingError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + off(type: 'castControlParsingError', callback?: ErrorCallback): void; + + /** + * Register listeners for cast control decoding error events. + * @param { 'castControlDecodingError' } type Type of the 'castControlDecodingError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 6614000 - Unspecified decoding error. + * @throws { BusinessError } 6614001 - Decoder initialization failed. + * @throws { BusinessError } 6614002 - Decoder query failed. + * @throws { BusinessError } 6614003 - Decoding the media samples failed. + * @throws { BusinessError } 6614004 - The format of the content to decode exceeds the capabilities of the device. + * @throws { BusinessError } 6614005 - The format of the content to decode is not supported. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + on(type: 'castControlDecodingError', callback: ErrorCallback): void; + + /** + * Unregister listeners for cast control decoding error events. + * @param { 'castControlDecodingError' } type Type of the 'castControlDecodingError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + off(type: 'castControlDecodingError', callback?: ErrorCallback): void; + + /** + * Register listeners for cast control audio renderer error error events. + * @param { 'castControlAudioRendererError' } type Type of the 'castControlAudioRendererError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 6615000 - Unspecified errors related to the audio renderer. + * @throws { BusinessError } 6615001 - Initializing the audio renderer failed. + * @throws { BusinessError } 6615002 - The audio renderer fails to write data. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + on(type: 'castControlAudioRendererError', callback: ErrorCallback): void; + + /** + * Unregister listeners for cast control audio renderer error events. + * @param { 'castControlAudioRendererError' } type Type of the 'castControlAudioRendererError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + off(type: 'castControlAudioRendererError', callback?: ErrorCallback): void; + + /** + * Register listeners for cast control drm error events. + * @param { 'castControlDrmError' } type Type of the 'castControlDrmError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 6616000 - Unspecified error related to DRM. + * @throws { BusinessError } 6616001 - The chosen DRM protection scheme is not supported by the device. + * @throws { BusinessError } 6616002 - Device provisioning failed. + * @throws { BusinessError } 6616003 - The DRM-protected content to play is incompatible. + * @throws { BusinessError } 6616004 - Failed to obtain a license. + * @throws { BusinessError } 6616005 - The operation is disallowed by the license policy. + * @throws { BusinessError } 6616006 - An error occurs in the DRM system. + * @throws { BusinessError } 6616007 - The device has revoked DRM privileges. + * @throws { BusinessError } 6616008 - The DRM license being loaded into the open DRM session has expired. + * @throws { BusinessError } 6616100 - An error occurs when the DRM processes the key response. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + on(type: 'castControlDrmError', callback: ErrorCallback): void; + + /** + * Unregister listeners for cast control drm error events. + * @param { 'castControlDrmError' } type Type of the 'castControlDrmError' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the cast control error event. + * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + off(type: 'castControlDrmError', callback?: ErrorCallback): void; + + /** + * Register listener for drm key request. + * @param { 'keyRequest' } type - Type of the 'keyRequest' to listen for. + * @param { KeyRequestCallback } callback - Callback used to request drm key. + * @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.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'keyRequest', callback: KeyRequestCallback): void; + + /** + * Unregister listener for drm key request. + * @param { 'keyRequest' } type - Type of the 'keyRequest' to listen for. + * @param { KeyRequestCallback } callback - Callback used to request drm key. + * @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.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'keyRequest', callback?: KeyRequestCallback): void; + } + + /** + * The callback of key request. + * + * @typedef { function } KeyRequestCallback + * @param { string } assetId - request key for current assetId + * @param { Uint8Array } requestData - media key request data sent to media key server + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + type KeyRequestCallback = (assetId: string, requestData: Uint8Array) => void; + + /** + * Enumerates the cast display states. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + enum CastDisplayState { + /** + * Screen off. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + STATE_OFF = 1, + + /** + * Screen on. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + STATE_ON = 2, + } + + /** + * Define the information for extended display screen. + * @typedef CastDisplayInfo + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + interface CastDisplayInfo { + /** + * Display ID. + * The application can get more display information based on the same id from display interface. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + id: number; + + /** + * Display name. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + name: string; + + /** + * The state of display. + * @type { CastDisplayState } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + state: CastDisplayState; + + /** + * Display width, in pixels. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + width: number; + + /** + * Display height, in pixels. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @atomicservice + * @since 12 + */ + height: number; + } + + /** + * Define the device connection state. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Define the device connection state. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum ConnectionState { + /** + * A connection state indicating the device is in the process of connecting. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A connection state indicating the device is in the process of connecting. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + STATE_CONNECTING = 0, + + /** + * A connection state indicating the device is connected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A connection state indicating the device is connected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + STATE_CONNECTED = 1, + + /** + * The default connection state indicating the device is disconnected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The default connection state indicating the device is disconnected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + STATE_DISCONNECTED = 6, + } + + /** + * The pre-defined display tag by system. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + enum DisplayTag { + /** + * Indicate the AUDIO VIVID property of current media resource. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + TAG_AUDIO_VIVID = 1, + } + + /** + * The play list information definition. + * @interface AVQueueInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @systemapi + * @since 11 + */ + interface AVQueueInfo { + /** + * The bundle name of application which current play list belongs to. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @systemapi + * @since 11 + */ + bundleName: string; + + /** + * The name of play list + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @systemapi + * @since 11 + */ + avQueueName: string; + + /** + * The id of play list + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @systemapi + * @since 11 + */ + avQueueId: string; + + /** + * The artwork of play list, can be a {@link PixelMap} or a URI formatted string, + * @type { image.PixelMap | string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @systemapi + * @since 11 + */ + avQueueImage: image.PixelMap | string; + + /** + * The time when the user last played the playlist. + * The time format can be system, such as 1611081385000, it means 2021-01-20 02:36:25. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @systemapi + * @since 11 + */ + lastPlayedTime?: number; + } + + /** + * The metadata of the current media.Used to set the properties of the current media file + * @interface AVMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The metadata of the current media.Used to set the properties of the current media file + * @interface AVMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVMetadata { + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + assetId: string; + + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + title?: string; + + /** + * The artist of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The artist of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + artist?: string; + + /** + * The author of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The author of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + author?: string; + + /** + * The name of play list which current media belongs to + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + avQueueName?: string; + + /** + * The id of play list which current media belongs to, it should be an unique identifier in the application. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + avQueueId?: string; + + /** + * The artwork of play list as a {@link PixelMap} or an uri formatted String, + * @type { ?(image.PixelMap | string) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + avQueueImage?: image.PixelMap | string; + + /** + * The album of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The album of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + album?: string; + + /** + * The writer of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The writer of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + writer?: string; + + /** + * The composer of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + composer?: string; + + /** + * The duration of this media, used to automatically calculate playback position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The duration of this media, used to automatically calculate playback position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + duration?: number; + + /** + * The image of the media as a {@link PixelMap} or an uri formatted String, + * used to display in media center. + * @type { ?(image.PixelMap | string) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The image of the media as a {@link PixelMap} or an uri formatted String, + * used to display in media center. + * @type { ?(image.PixelMap | string) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaImage?: image.PixelMap | string; + + /** + * The publishDate of the media + * @type { ?Date } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + publishDate?: Date; + + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + subtitle?: string; + + /** + * The discription of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The discription of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + description?: string; + + /** + * The lyric of the media, it should be in standard lyric format + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + lyric?: string; + + /** + * The previous playable media id. + * Used to tell the controller if there is a previous playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The previous playable media id. + * Used to tell the controller if there is a previous playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + previousAssetId?: string; + + /** + * The next playable media id. + * Used to tell the controller if there is a next playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The next playable media id. + * Used to tell the controller if there is a next playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + nextAssetId?: string; + + /** + * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. + * See {@link ProtocolType} + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. + * See {@link ProtocolType} + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + filter?: number; + + /** + * The drm schemes supported by this session which are represented by uuid. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + drmSchemes?: Array; + + /** + * The supported skipIntervals when doing fast forward and rewind operation, the default is {@link SECONDS_15}. + * See {@link SkipIntervals} + * @type { ?SkipIntervals } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + skipIntervals?: SkipIntervals; + + /** + * The display tags supported by application to be displayed on media center + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + displayTags?: number; + } + + /** + * The description of the media for an item in the playlist of the session + * @interface AVMediaDescription + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The description of the media for an item in the playlist of the session + * @interface AVMediaDescription + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVMediaDescription { + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + assetId: string; + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + title?: string; + + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + subtitle?: string; + + /** + * The description of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The description of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + description?: string; + + /** + * The image of this media asset displayed in the media center. + * It can be a {@link PixelMap} or a URI formatted string, + * @type { ?(image.PixelMap | string) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The image of this media asset displayed in the media center. + * It can be a {@link PixelMap} or a URI formatted string, + * @type { ?(image.PixelMap | string) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaImage?: image.PixelMap | string; + /** + * Any additional attributes that can be represented as key-value pairs + * @type { ?object } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + extras?: AVSessionStringBindObject; + + /** + * The type of this media, such as video, audio and so on. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The type of this media, such as video, audio and so on. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaType?: string; + + /** + * The size of this media. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The size of this media. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaSize?: number; + + /** + * The album title of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The album title of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + albumTitle?: string; + + /** + * The album cover uri of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The album cover uri of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + albumCoverUri?: string; + + /** + * The lyric content of the media, it should be in standard lyric format + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The lyric content of the media, it should be in standard lyric format + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + lyricContent?: string; + + /** + * The lyric uri of the media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The lyric uri of the media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + lyricUri?: string; + + /** + * The artist of this media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The artist of this media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + artist?: string; + + /** + * The uri of the media, used to locate the media in some special cases + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The uri of the media, used to locate the media in some special cases + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaUri?: string; + + /** + * Media file descriptor. + * @type { ?media.AVFileDescriptor } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Media file descriptor. + * @type { ?media.AVFileDescriptor } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + fdSrc?: media.AVFileDescriptor; + + /** + * DataSource descriptor. The caller ensures the fileSize and callback are valid. + * @type { ?media.AVDataSrcDescriptor } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + dataSrc?: media.AVDataSrcDescriptor; + + /** + * The drm scheme supported by this resource which is represented by uuid. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + drmScheme?: string; + + /** + * The duration of this media + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The duration of this media + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + duration?: number; + + /** + * Media start position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Media start position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + startPosition?: number; + + /** + * Media credits position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Media credits position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + creditsPosition?: number; + + /** + * Application name. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Application name. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + appName?: string; + + /** + * The display tags supported by application to be displayed on media center + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The display tags supported by application to be displayed on media center + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + displayTags?: number; + } + + /** + * The item in the playlist of the session + * @interface AVQueueItem + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The item in the playlist of the session + * @interface AVQueueItem + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVQueueItem { + /** + * Sequence number of the item in the playlist. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Sequence number of the item in the playlist. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + itemId: number; + + /** + * The media description of the item in the playlist. + * @type { ?AVMediaDescription } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The media description of the item in the playlist. + * @type { ?AVMediaDescription } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + description?: AVMediaDescription; + } + + /** + * Used to indicate the playback state of the current media. + * If the playback state of the media changes, it needs to be updated synchronously + * @interface AVPlaybackState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Used to indicate the playback state of the current media. + * If the playback state of the media changes, it needs to be updated synchronously + * @interface AVPlaybackState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVPlaybackState { + /** + * Current playback state. See {@link PlaybackState} + * @type { ?PlaybackState } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback state. See {@link PlaybackState} + * @type { ?PlaybackState } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + state?: PlaybackState; + + /** + * Current playback speed + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback speed + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + speed?: number; + + /** + * Current playback position of this media. See {@link PlaybackPosition} + * @type { ?PlaybackPosition } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback position of this media. See {@link PlaybackPosition} + * @type { ?PlaybackPosition } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + position?: PlaybackPosition; + + /** + * The current buffered time, the maximum playable position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The current buffered time, the maximum playable position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + bufferedTime?: number; + + /** + * Current playback loop mode. See {@link LoopMode} + * @type { ?LoopMode } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback loop mode. See {@link LoopMode} + * @type { ?LoopMode } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + loopMode?: LoopMode; + + /** + * Current Favorite Status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current Favorite Status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + isFavorite?: boolean; + + /** + * Current active item id + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current active item id + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + activeItemId?: number; + + /** + * Current player volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current player volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + volume?: number; + + /** + * maximum volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * maximum volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + maxVolume?: number; + + /** + * Current muted status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Current muted status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + muted?: boolean; + + /** + * The duration of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + duration?: number; + + /** + * The video width of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The video width of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + videoWidth?: number; + + /** + * The video height of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The video height of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + videoHeight?: number; + + /** + * Current custom media packets + * @type { ?object } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current custom media packets + * @type { ?object } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + extras?: AVSessionStringBindObject; + } + + /** + * Playback position definition + * @interface PlaybackPosition + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Playback position definition + * @interface PlaybackPosition + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface PlaybackPosition { + /** + * Elapsed time(position) of this media set by the app. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Elapsed time(position) of this media set by the app. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + elapsedTime: number; + + /** + * Record the system time when elapsedTime is set. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Record the system time when elapsedTime is set. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + updateTime: number; + } + + /** + * The metadata of the current call. + * @interface CallMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The metadata of the current call. + * @typedef CallMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface CallMetadata { + /** + * The displayed user name of current call. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The displayed user name of current call. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + name?: string; + + /** + * The phone number of current call. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The phone number of current call. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + phoneNumber?: string; + + /** + * The displayed picture that represents a particular user. + * @type { ?image.PixelMap } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The displayed picture that represents a particular user. + * @type { ?image.PixelMap } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + avatar?: image.PixelMap; + } + + /** + * Used to indicate the call state of the current call. + * @interface AVCallState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Used to indicate the call state of the current call. + * @typedef AVCallState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVCallState { + /** + * Current call state. See {@link CallState} + * @type { CallState } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Current call state. See {@link CallState} + * @type { CallState } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + state: CallState; + + /** + * Current muted status. + * @type { boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Current muted status. + * @type { boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + muted: boolean; + } + + /** + * Enumeration of current call state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Enumeration of current call state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum CallState { + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_IDLE = 0, + + /** + * Incoming state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Incoming state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_INCOMING = 1, + + /** + * Active state in calling. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Active state in calling. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_ACTIVE = 2, + + /** + * Dialing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Dialing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_DIALING = 3, + + /** + * Waiting state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Waiting state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_WAITING = 4, + + /** + * Holding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Holding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_HOLDING = 5, + + /** + * Disconnecting state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Disconnecting state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + CALL_STATE_DISCONNECTING = 6, + } + + /** + * cast category indicating different playback scenes + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * cast category indicating different playback scenes + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + enum AVCastCategory { + /** + * 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, + * including internal speakers or audio jack on the device itself, A2DP devices. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + CATEGORY_LOCAL = 0, + + /** + * The remote category indicating the media is presenting on a remote device, + * the application needs to get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The remote category indicating the media is presenting on a remote device, + * the application needs to get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + CATEGORY_REMOTE = 1, + } + /** + * Device type definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device type definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum DeviceType { + /** + * A device type indicating the route is on internal speakers or audio jack on the device itself. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A device type indicating the route is on internal speakers or audio jack on the device itself. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_LOCAL = 0, + + /** + * A device type indicating the route is on a TV. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * A device type indicating the route is on a TV. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_TV = 2, + + /** + * A device type indicating the route is on a smart speaker. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * A device type indicating the route is on a smart speaker. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_SMART_SPEAKER = 3, + + /** + * A device type indicating the route is on a bluetooth device. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A device type indicating the route is on a bluetooth device. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_BLUETOOTH = 10, + } + + /** + * Device Information Definition + * @interface DeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device Information Definition + * @interface DeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface DeviceInfo { + /** + * The playback type supported by the device. See {@link AVCastCategory} + * @type { AVCastCategory } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The playback type supported by the device. See {@link AVCastCategory} + * @type { AVCastCategory } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + castCategory: AVCastCategory; + /** + * Audio device id.The length of the audioDeviceId array is greater than 1 + * if output to multiple devices at the same time. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Audio device id.The length of the audioDeviceId array is greater than 1 + * if output to multiple devices at the same time. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + + /** + * Device name. The length of the deviceName array is greater than 1 + * if output to multiple devices at the same time. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device name. The length of the deviceName array is greater than 1 + * if output to multiple devices at the same time. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deviceName: string; + + /** + * device type. + * @type { DeviceType } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * device type. + * @type { DeviceType } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deviceType: DeviceType; + + /** + * Device manufacturer. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + manufacturer?: string; + + /** + * Device model name. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + modelName?: string; + + /** + * Network id. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + networkId?: string; + + /** + * device ip address if available. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + ipAddress?: string; + + /** + * device provider which supplies the route capability. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 10 + */ + providerId?: number; + + /** + * The protocols supported by current device, can be union of {@link ProtocolType}. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * The protocols supported by current device, can be union of {@link ProtocolType}. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + supportedProtocols?: number; + + /** + * The drm capability supported by current device, each drm is represented by uuid. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + supportedDrmCapabilities?: Array; + + /** + * Define different authentication status. + * 0: Device not authenticated. + * 1: Device already authenticated. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 11 + */ + authenticationStatus?: number; + + /** + * Indicates the current device is legacy or not. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + isLegacy?: boolean; + + /** + * Medium types used to discover devices. + * 1: BLE + * 2: COAP + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @systemapi + * @since 13 + */ + mediumTypes?: number; + } + + /** + * Target Device Information Definition + * @interface OutputDeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Target Device Information Definition + * @interface OutputDeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface OutputDeviceInfo { + /** + * Arrays of device information + * @type { Array } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Arrays of device information + * @type { Array } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + devices: Array; + } + + /** + * Loop Play Mode Definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Loop Play Mode Definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum LoopMode { + /** + * The default mode is sequential playback + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The default mode is sequential playback + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_SEQUENCE = 0, + + /** + * Single loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Single loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_SINGLE = 1, + + /** + * List loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * List loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_LIST = 2, + + /** + * Shuffle playback mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Shuffle playback mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_SHUFFLE = 3, + + /** + * Custom playback mode supported by application + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Custom playback mode supported by application + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_CUSTOM = 4, + } + + /** + * Supported skip intervals definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + enum SkipIntervals { + /** + * 10 seconds + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + SECONDS_10 = 10, + /** + * 15 seconds + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + SECONDS_15 = 15, + /** + * 30 seconds + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + SECONDS_30 = 30, + } + + /** + * Definition of current playback state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Definition of current playback state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum PlaybackState { + /** + * Initial state. The initial state of media file + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Initial state. The initial state of media file + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_INITIAL = 0, + + /** + * Preparing state. Indicates that the media file is not ready to play, + * the media is loading or buffering + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Preparing state. Indicates that the media file is not ready to play, + * the media is loading or buffering + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_PREPARE = 1, + + /** + * Playing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Playing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_PLAY = 2, + + /** + * Paused state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Paused state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_PAUSE = 3, + + /** + * Fast forwarding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Fast forwarding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_FAST_FORWARD = 4, + + /** + * Rewinding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Rewinding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_REWIND = 5, + + /** + * Stopped state.The server will clear the media playback position and other information. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Stopped state.The server will clear the media playback position and other information. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_STOP = 6, + + /** + * Completed state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Completed state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_COMPLETED = 7, + + /** + * Released state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Released state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_RELEASED = 8, + + /** + * error state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * error state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_ERROR = 9, + + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_IDLE = 10, + + /** + * Buffering state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Buffering state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_BUFFERING = 11, + } + + /** + * The description of the session + * @interface AVSessionDescriptor + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + interface AVSessionDescriptor { + /** + * Unique ID of the session + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + sessionId: string; + + /** + * Session type, currently supports audio or video + * @type { AVSessionType } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + type: AVSessionType; + + /** + * The session tag set by the application + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + sessionTag: string; + + /** + * The elementName of the ability that created this session. See {@link ElementName} in bundle/elementName.d.ts + * @type { ElementName } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + elementName: ElementName; + + /** + * Session active state + * @type { boolean } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + isActive: boolean; + + /** + * Is it the top priority session + * @type { boolean } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + isTopSession: boolean; + + /** + * The current output device information. + * It will be undefined if this is a local session. + * @type { OutputDeviceInfo } + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + outputDevice: OutputDeviceInfo; + } + + /** + * Session controller,used to control media playback and get media information + * @interface AVSessionController + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Session controller,used to control media playback and get media information + * @typedef AVSessionController + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVSessionController { + /** + * Unique session Id + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unique session Id + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + readonly sessionId: string; + + /** + * Get the playback status of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVPlaybackState). + * @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.Core + * @since 10 + */ + getAVPlaybackState(callback: AsyncCallback): void; + + /** + * Get the playback status of the current session + * @returns { Promise } (AVPlaybackState) returned through promise + * @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.Core + * @since 10 + */ + /** + * Get the playback status of the current session + * @returns { Promise } (AVPlaybackState) returned through promise + * @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.Core + * @atomicservice + * @since 12 + */ + getAVPlaybackState(): Promise; + + /** + * Get the playback status of the current session + * @returns { AVPlaybackState } (AVPlaybackState) returned + * @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.Core + * @since 10 + */ + /** + * Get the playback status of the current session + * @returns { AVPlaybackState } (AVPlaybackState) returned + * @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.Core + * @atomicservice + * @since 12 + */ + getAVPlaybackStateSync(): AVPlaybackState; + + /** + * Get the metadata of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVMetadata). + * @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.Core + * @since 10 + */ + getAVMetadata(callback: AsyncCallback): void; + + /** + * Get the metadata of the current session + * @returns { Promise } (AVMetadata) returned through promise + * @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.Core + * @since 10 + */ + /** + * Get the metadata of the current session + * @returns { Promise } (AVMetadata) returned through promise + * @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.Core + * @atomicservice + * @since 12 + */ + getAVMetadata(): Promise; + + /** + * Get the metadata of the current session + * @returns { AVMetadata } (AVMetadata) returned + * @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.Core + * @since 10 + */ + /** + * Get the metadata of the current session + * @returns { AVMetadata } (AVMetadata) returned + * @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.Core + * @atomicservice + * @since 12 + */ + getAVMetadataSync(): AVMetadata; + + /** + * Get the call status of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVCallState). + * @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.Core + * @since 11 + */ + getAVCallState(callback: AsyncCallback): void; + + /** + * Get the call status of the current session + * @returns { Promise } (AVCallState) returned through promise + * @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.Core + * @since 11 + */ + getAVCallState(): Promise; + + /** + * Get the call metadata of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getCallMetadata). + * @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.Core + * @since 11 + */ + getCallMetadata(callback: AsyncCallback): void; + + /** + * Get the call metadata of the current session + * @returns { Promise } (CallMetadata) returned through promise + * @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.Core + * @since 11 + */ + getCallMetadata(): Promise; + + /** + * Get the name of the playlist of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVQueueTitle). + * @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.Core + * @since 10 + */ + getAVQueueTitle(callback: AsyncCallback): void; + + /** + * Get the name of the playlist of the current session + * @returns { Promise } (string) returned through promise + * @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.Core + * @since 10 + */ + /** + * Get the name of the playlist of the current session + * @returns { Promise } (string) returned through promise + * @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.Core + * @atomicservice + * @since 12 + */ + getAVQueueTitle(): Promise; + + /** + * Get the name of the playlist of the current session + * @returns { string } (string) returned + * @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.Core + * @since 10 + */ + /** + * Get the name of the playlist of the current session + * @returns { string } (string) returned + * @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.Core + * @atomicservice + * @since 12 + */ + getAVQueueTitleSync(): string; + + /** + * Get the playlist of the current session + * @param { AsyncCallback> } callback - The triggered asyncCallback when (getAVQueueItems). + * @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.Core + * @since 10 + */ + getAVQueueItems(callback: AsyncCallback>): void; + + /** + * Get the playlist of the current session + * @returns { Promise> } (Array) returned through promise + * @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.Core + * @since 10 + */ + /** + * Get the playlist of the current session + * @returns { Promise> } (Array) returned through promise + * @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.Core + * @atomicservice + * @since 12 + */ + getAVQueueItems(): Promise>; + + /** + * Get the playlist of the current session + * @returns { Array } (Array) returned + * @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.Core + * @since 10 + */ + /** + * Get the playlist of the current session + * @returns { Array } (Array) returned + * @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.Core + * @atomicservice + * @since 12 + */ + getAVQueueItemsSync(): Array; + + /** + * Set the item in the playlist to be played + * @param { number } itemId - The serial number of the item to be played + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + skipToQueueItem(itemId: number, callback: AsyncCallback): void; + + /** + * Set the item in the playlist to be played + * @param { number } itemId - The serial number of the item to be played + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the item in the playlist to be played + * @param { number } itemId - The serial number of the item to be played + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + skipToQueueItem(itemId: number): Promise; + + /** + * Get output device information + * @param { AsyncCallback } callback - The triggered asyncCallback when (getOutputDevice). + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDevice(callback: AsyncCallback): void; + + /** + * Get output device information + * @returns { Promise } (OutputDeviceInfo) returned through promise + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get output device information + * @returns { Promise } (OutputDeviceInfo) returned through promise + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getOutputDevice(): Promise; + + /** + * Get output device information + * @returns { OutputDeviceInfo } (OutputDeviceInfo) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get output device information + * @returns { OutputDeviceInfo } (OutputDeviceInfo) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getOutputDeviceSync(): OutputDeviceInfo; + + /** + * Send media key event to this session + * @param { KeyEvent } event - The KeyEvent + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600102 - The session does not exist. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @throws { BusinessError } 600105 - Invalid session command. + * @throws { BusinessError } 600106 - The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void; + + /** + * Send media key event to this session + * @param { KeyEvent } event - The KeyEvent + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600102 - The session does not exist. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @throws { BusinessError } 600105 - Invalid session command. + * @throws { BusinessError } 600106 - The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Send media key event to this session + * @param { KeyEvent } event - The KeyEvent + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600102 - The session does not exist. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @throws { BusinessError } 600105 - Invalid session command. + * @throws { BusinessError } 600106 - The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + sendAVKeyEvent(event: KeyEvent): Promise; + + /** + * Get the {@link WantAgent} of this session that can launch the session ability + * @param { AsyncCallback } callback - The asyncCallback triggered when getting the WantAgent. + * @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.Core + * @since 10 + */ + getLaunchAbility(callback: AsyncCallback): void; + + /** + * Get the {@link WantAgent} of this session that can launch the session ability + * @returns { Promise } WantAgent promise + * @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.Core + * @since 10 + */ + /** + * Get the {@link WantAgent} of this session that can launch the session ability + * @returns { Promise } WantAgent promise + * @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.Core + * @atomicservice + * @since 12 + */ + getLaunchAbility(): Promise; + + /** + * Get the adjusted playback position. The time automatically calculated by the system + * taking into account factors such as playback status, playback speed, and application update time. + * @returns { number } current playback position in ms.Note that the returns value of each call will be different. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get the adjusted playback position. The time automatically calculated by the system + * taking into account factors such as playback status, playback speed, and application update time. + * @returns { number } current playback position in ms.Note that the returns value of each call will be different. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getRealPlaybackPositionSync(): number; + + /** + * Check if the current session is active + * @param { AsyncCallback } callback - The triggered asyncCallback when (isActive). + * @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.Core + * @since 10 + */ + isActive(callback: AsyncCallback): void; + + /** + * Check if the current session is active + * @returns { Promise } boolean promise + * @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.Core + * @since 10 + */ + /** + * Check if the current session is active + * @returns { Promise } boolean promise + * @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.Core + * @atomicservice + * @since 12 + */ + isActive(): Promise; + + /** + * Check if the current session is active + * @returns { boolean } boolean + * @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.Core + * @since 10 + */ + /** + * Check if the current session is active + * @returns { boolean } boolean + * @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.Core + * @atomicservice + * @since 12 + */ + isActiveSync(): boolean; + + /** + * Destroy the server controller + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + destroy(callback: AsyncCallback): void; + + /** + * Destroy the server controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Destroy the server controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + destroy(): Promise; + + /** + * Get commands supported by the current session + * @param { AsyncCallback> } callback - The triggered asyncCallback when (getValidCommands). + * @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.Core + * @since 10 + */ + getValidCommands(callback: AsyncCallback>): void; + + /** + * Get commands supported by the current session + * @returns { Promise> } array of AVControlCommandType promise + * @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.Core + * @since 10 + */ + /** + * Get commands supported by the current session + * @returns { Promise> } array of AVControlCommandType promise + * @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.Core + * @atomicservice + * @since 12 + */ + getValidCommands(): Promise>; + + /** + * Get commands supported by the current session + * @returns {Array } array of AVControlCommandType + * @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.Core + * @since 10 + */ + /** + * Get commands supported by the current session + * @returns {Array } array of AVControlCommandType + * @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.Core + * @atomicservice + * @since 12 + */ + getValidCommandsSync(): Array; + + /** + * Send control commands to this session + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void; + + /** + * Send control commands to this session + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Send control commands to this session + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + sendControlCommand(command: AVControlCommand): Promise; + + /** + * Send common commands to this session + * @param { string } command - The command name to be sent. + * @param { object } args - The parameters of session event + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendCommonCommand(command: string, args: AVSessionStringBindObject, callback: AsyncCallback): void; + + /** + * Send common commands to this session + * @param { string } command - The command name to be sent. + * @param { object } args - The parameters of session event + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Send common commands to this session + * @param { string } command - The command name to be sent. + * @param { object } args - The parameters of session event + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + sendCommonCommand(command: string, args: AVSessionStringBindObject): Promise; + + /** + * Get custom media packets provided by the corresponding session + * @param { AsyncCallback<{[key: string]: Object}> } callback - The triggered asyncCallback when (getExtras). + * @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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getExtras(callback: AsyncCallback): void; + + /** + * Get custom media packets provided by the corresponding session + * @returns { Promise<{[key: string]: Object}> } the parameters of extras + * @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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get custom media packets provided by the corresponding session + * @returns { Promise<{[key: string]: Object}> } the parameters of extras + * @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. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getExtras(): Promise; + + /** + * Register metadata changed callback + * @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. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register metadata changed callback + * @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. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'metadataChange', filter: Array | 'all', callback: (data: AVMetadata) => void); + + /** + * Unregister metadata changed callback + * @param { 'metadataChange' } type + * @param { function } callback - The callback used to handle metadata changed event. + * The callback function provides the {@link AVMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister metadata changed callback + * @param { 'metadataChange' } type + * @param { function } callback - The callback used to handle metadata changed event. + * The callback function provides the {@link AVMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'metadataChange', callback?: (data: AVMetadata) => void); + + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'playbackStateChange', filter: Array | 'all', callback: (state: AVPlaybackState) => void); + + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void); + + /** + * Register call metadata changed callback + * @param { 'callMetadataChange' } type - 'callMetadataChange' + * @param { Array | 'all' } filter - The properties of {@link CallMetadata} that you cared about + * @param { Callback } callback - The callback used to handle call metadata changed event. + * The callback function provides the {@link CallMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Register call metadata changed callback + * @param { 'callMetadataChange' } type - 'callMetadataChange' + * @param { Array | 'all' } filter - The properties of {@link CallMetadata} that you cared about + * @param { Callback } callback - The callback used to handle call metadata changed event. + * The callback function provides the {@link CallMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'callMetadataChange', filter: Array | 'all', callback: Callback): void; + + /** + * Unregister call metadata changed callback + * @param { 'callMetadataChange' } type - 'callMetadataChange' + * @param { Callback } callback - The callback used to handle call metadata changed event. + * The callback function provides the {@link CallMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Unregister call metadata changed callback + * @param { 'callMetadataChange' } type - 'callMetadataChange' + * @param { Callback } callback - The callback used to handle call metadata changed event. + * The callback function provides the {@link CallMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'callMetadataChange', callback?: Callback): void; + + /** + * Register call state changed callback + * @param { 'callStateChange' } type - 'callStateChange' + * @param { Array | 'all' } filter - The properties of {@link AVCallState} that you cared about + * @param { Callback } callback - The callback used to handle call state changed event. + * The callback function provides the {@link AVCallState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Register call state changed callback + * @param { 'callStateChange' } type - 'callStateChange' + * @param { Array | 'all' } filter - The properties of {@link AVCallState} that you cared about + * @param { Callback } callback - The callback used to handle call state changed event. + * The callback function provides the {@link AVCallState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'callStateChange', filter: Array | 'all', callback: Callback): void; + + /** + * Unregister playback state changed callback + * @param { 'callStateChange' } type - 'callStateChange' + * @param { Callback } callback - The callback used to handle call state changed event. + * The callback function provides the {@link AVCallState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Unregister playback state changed callback + * @param { 'callStateChange' } type - 'callStateChange' + * @param { Callback } callback - The callback used to handle call state changed event. + * The callback function provides the {@link AVCallState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'callStateChange', callback?: Callback): void; + + /** + * Register current session destroyed callback + * @param { 'sessionDestroy' } type + * @param { function } callback - The callback used to handle current session destroyed event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register current session destroyed callback + * @param { 'sessionDestroy' } type + * @param { function } callback - The callback used to handle current session destroyed event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'sessionDestroy', callback: () => void); + + /** + * Unregister current session destroyed callback + * @param { 'sessionDestroy' } type - 'sessionDestroy' + * @param { function } callback - The callback used to handle current session destroyed event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister current session destroyed callback + * @param { 'sessionDestroy' } type - 'sessionDestroy' + * @param { function } callback - The callback used to handle current session destroyed event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'sessionDestroy', callback?: () => void); + + /** + * Register the active state of this session changed callback + * @param { 'activeStateChange' } type - 'activeStateChange' + * @param { function } callback - The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register the active state of this session changed callback + * @param { 'activeStateChange' } type - 'activeStateChange' + * @param { function } callback - The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'activeStateChange', callback: (isActive: boolean) => void); + + /** + * Unregister the active state of this session changed callback + * @param { 'activeStateChange' } type - 'activeStateChange' + * @param { function } callback - The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister the active state of this session changed callback + * @param { 'activeStateChange' } type - 'activeStateChange' + * @param { function } callback - The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'activeStateChange', callback?: (isActive: boolean) => void); + + /** + * Register the valid commands of the session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { function } callback - The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register the valid commands of the session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { function } callback - The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'validCommandChange', callback: (commands: Array) => void); + + /** + * Unregister the valid commands of the session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { function } callback - The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister the valid commands of the session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { function } callback - The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'validCommandChange', callback?: (commands: Array) => void); + + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + + /** + * Register session event callback + * @param { 'sessionEvent' } type - 'sessionEvent' + * @param { function } callback - The callback used to handle session event changed event. + * The callback function provides the event string and key-value pair parameters. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register session event callback + * @param { 'sessionEvent' } type - 'sessionEvent' + * @param { function } callback - The callback used to handle session event changed event. + * The callback function provides the event string and key-value pair parameters. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'sessionEvent', callback: (sessionEvent: string, args: AVSessionStringBindObject) => void): void; + + /** + * Unregister session event callback + * @param { 'sessionEvent' } type - 'sessionEvent' + * @param { function } callback - Used to cancel a specific listener + * The callback function provides the event string and key-value pair parameters. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister session event callback + * @param { 'sessionEvent' } type - 'sessionEvent' + * @param { function } callback - Used to cancel a specific listener + * The callback function provides the event string and key-value pair parameters. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'sessionEvent', callback?: (sessionEvent: string, args: AVSessionStringBindObject) => void): void; + + /** + * Register session playlist change callback + * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' + * @param { function } callback - Used to handle playlist changed. + * The callback provides the new array of AVQueueItem {@link AVQueueItem} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register session playlist change callback + * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' + * @param { function } callback - Used to handle playlist changed. + * The callback provides the new array of AVQueueItem {@link AVQueueItem} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'queueItemsChange', callback: (items: Array) => void): void; + + /** + * Unregister session playlist change callback + * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' + * @param { function } callback - Used to handle playlist changed. + * The callback provides the new array of AVQueueItem {@link AVQueueItem} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister session playlist change callback + * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' + * @param { function } callback - Used to handle playlist changed. + * The callback provides the new array of AVQueueItem {@link AVQueueItem} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'queueItemsChange', callback?: (items: Array) => void): void; + + /** + * Register the name of session playlist change callback + * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' + * @param { function } callback - Used to handle name of playlist changed. + * The callback provides the new name. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register the name of session playlist change callback + * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' + * @param { function } callback - Used to handle name of playlist changed. + * The callback provides the new name. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'queueTitleChange', callback: (title: string) => void): void; + + /** + * Unregister the name of session playlist change callback + * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' + * @param { function } callback - Used to handle name of playlist changed. + * The callback provides the new name. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister the name of session playlist change callback + * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' + * @param { function } callback - Used to handle name of playlist changed. + * The callback provides the new name. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'queueTitleChange', callback?: (title: string) => void): void; + + /** + * Register the custom media packets change callback + * @param { 'extrasChange' } type - Registration Type 'extrasChange' + * @param { function } callback - Used to handle custom media packets changed. + * The callback provides the new media packets. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register the custom media packets change callback + * @param { 'extrasChange' } type - Registration Type 'extrasChange' + * @param { function } callback - Used to handle custom media packets changed. + * The callback provides the new media packets. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'extrasChange', callback: (extras: AVSessionStringBindObject) => void): void; + + /** + * Unregister the custom media packets change callback + * @param { 'extrasChange' } type - Registration Type 'extrasChange' + * @param { function } callback - Used to handle custom media packets changed. + * The callback provides the new media packets. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister the custom media packets change callback + * @param { 'extrasChange' } type - Registration Type 'extrasChange' + * @param { function } callback - Used to handle custom media packets changed. + * The callback provides the new media packets. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'extrasChange', callback?: (extras: AVSessionStringBindObject) => 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 + */ + type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | + 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute'; + + /** + * The definition of command to be sent to the session + * @interface AVControlCommand + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The definition of command to be sent to the session + * @typedef AVControlCommand + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVControlCommand { + /** + * The command value {@link AVControlCommandType} + * @type { AVControlCommandType } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The command value {@link AVControlCommandType} + * @type { AVControlCommandType } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + command: AVControlCommandType; + + /** + * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} + * seek command requires a number parameter + * setSpeed command requires a number parameter + * setLoopMode command requires a {@link LoopMode} parameter. + * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter + * other commands need no parameter + * @type { ?(LoopMode | string | number) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} + * seek command requires a number parameter + * setSpeed command requires a number parameter + * setLoopMode command requires a {@link LoopMode} parameter. + * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter + * other commands need no parameter + * @type { ?(LoopMode | string | number) } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + parameter?: LoopMode | string | number; + } + + /** + * Enumerates ErrorCode types, returns in BusinessError.code. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Enumerates ErrorCode types, returns in BusinessError.code. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum AVSessionErrorCode { + /** + * Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_SERVICE_EXCEPTION = 6600101, + + /** + * The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_SESSION_NOT_EXIST = 6600102, + + /** + * The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_CONTROLLER_NOT_EXIST = 6600103, + + /** + * The remote session connection failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The remote session connection failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_REMOTE_CONNECTION_ERR = 6600104, + + /** + * Invalid session command. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Invalid session command. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_COMMAND_INVALID = 6600105, + + /** + * The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_SESSION_INACTIVE = 6600106, + + /** + * Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_MESSAGE_OVERLOAD = 6600107, + + /** + * Device connecting failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device connecting failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_DEVICE_CONNECTION_FAILED = 6600108, + + /** + * The remote connection is not established. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The remote connection is not established. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_REMOTE_CONNECTION_NOT_EXIST = 6600109, + + /** + * The error code for cast control is unspecified. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_UNSPECIFIED = 6611000, + + /** + * An unspecified error occurs in the remote player. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_REMOTE_ERROR = 6611001, + + /** + * The playback position falls behind the live window. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_BEHIND_LIVE_WINDOW = 6611002, + + /** + * The process of cast control times out. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_TIMEOUT = 6611003, + + /** + * The runtime check failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_RUNTIME_CHECK_FAILED = 6611004, + + /** + * Cross-device data transmission is locked. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PLAYER_NOT_WORKING = 6611100, + + /** + * The specified seek mode is not supported. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_SEEK_MODE_UNSUPPORTED = 6611101, + + /** + * The position to seek to is out of the range of the media asset or the specified seek mode is not supported. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_ILLEGAL_SEEK_TARGET = 6611102, + + /** + * The specified playback mode is not supported. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PLAY_MODE_UNSUPPORTED = 6611103, + + /** + * The specified playback speed is not supported. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PLAY_SPEED_UNSUPPORTED = 6611104, + + /** + * The action failed because either the media source device or the media sink device has been revoked. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DEVICE_MISSING = 6611105, + + /** + * The parameter is invalid, for example, the url is illegal to play. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_INVALID_PARAM = 6611106, + + /** + * Allocation of memory failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_NO_MEMORY = 6611107, + + /** + * Operation is not allowed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_OPERATION_NOT_ALLOWED = 6611108, + + /** + * An unspecified input/output error occurs. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_UNSPECIFIED = 6612000, + + /** + * Network connection failure. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_FAILED = 6612001, + + /** + * Network timeout. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_TIMEOUT = 6612002, + + /** + * Invalid "Content-Type" HTTP header. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_INVALID_HTTP_CONTENT_TYPE = 6612003, + + /** + * The HTTP server returns an unexpected HTTP response status code. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_BAD_HTTP_STATUS = 6612004, + + /** + * The file does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_FILE_NOT_FOUND = 6612005, + + /** + * No permission is granted to perform the IO operation. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_NO_PERMISSION = 6612006, + + /** + * Access to cleartext HTTP traffic is not allowed by the app's network security configuration. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_CLEARTEXT_NOT_PERMITTED = 6612007, + + /** + * Reading data out of the data bound. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_READ_POSITION_OUT_OF_RANGE = 6612008, + + /** + * The media does not contain any contents that can be played. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_NO_CONTENTS = 6612100, + + /** + * The media cannot be read, for example, because of dust or scratches. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_READ_ERROR = 6612101, + + /** + * This resource is already in use. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_CONTENT_BUSY = 6612102, + + /** + * The content using the validity interval has expired. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_CONTENT_EXPIRED = 6612103, + + /** + * Using the requested content to play is not allowed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_USE_FORBIDDEN = 6612104, + + /** + * The use of the allowed content cannot be verified. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_NOT_VERIFIED = 6612105, + + /** + * The number of times this content has been used as requested has reached the maximum allowed number of uses. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_EXHAUSTED_ALLOWED_USES = 6612106, + + /** + * An error occurs when sending packet from source device to sink device. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_IO_NETWORK_PACKET_SENDING_FAILED = 6612107, + + /** + * Unspecified error related to content parsing. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PARSING_UNSPECIFIED = 6613000, + + /** + * Parsing error associated with media container format bit streams. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_MALFORMED = 6613001, + + /** + * Parsing error associated with the media manifest. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_MALFORMED = 6613002, + + /** + * An error occurs when attempting to extract a file with an unsupported media container format + * or an unsupported media container feature. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_UNSUPPORTED = 6613003, + + /** + * Unsupported feature in the media manifest. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_UNSUPPORTED = 6613004, + + /** + * Unspecified decoding error. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DECODING_UNSPECIFIED = 6614000, + + /** + * Decoder initialization failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DECODING_INIT_FAILED = 6614001, + + /** + * Decoder query failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DECODING_QUERY_FAILED = 6614002, + + /** + * Decoding the media samples failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DECODING_FAILED = 6614003, + + /** + * The format of the content to decode exceeds the capabilities of the device. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DECODING_FORMAT_EXCEEDS_CAPABILITIES = 6614004, + + /** + * The format of the content to decode is not supported. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DECODING_FORMAT_UNSUPPORTED = 6614005, + + /** + * Unspecified errors related to the audio renderer. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_UNSPECIFIED = 6615000, + + /** + * Initializing the audio renderer failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_INIT_FAILED = 6615001, + + /** + * The audio renderer fails to write data. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_WRITE_FAILED = 6615002, + + /** + * Unspecified error related to DRM. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_UNSPECIFIED = 6616000, + + /** + * The chosen DRM protection scheme is not supported by the device. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_SCHEME_UNSUPPORTED = 6616001, + + /** + * Device provisioning failed. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_PROVISIONING_FAILED = 6616002, + + /** + * The DRM-protected content to play is incompatible. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_CONTENT_ERROR = 6616003, + + /** + * Failed to obtain a license. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_LICENSE_ACQUISITION_FAILED = 6616004, + + /** + * The operation is disallowed by the license policy. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_DISALLOWED_OPERATION = 6616005, + + /** + * An error occurs in the DRM system. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_SYSTEM_ERROR = 6616006, + + /** + * The device has revoked DRM privileges. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_DEVICE_REVOKED = 6616007, + + /** + * The DRM license being loaded into the open DRM session has expired. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_LICENSE_EXPIRED = 6616008, + + /** + * An error occurs when the DRM processes the key response. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 13 + */ + ERR_CODE_CAST_CONTROL_DRM_PROVIDE_KEY_RESPONSE_ERROR = 6616100, + } +} + +export default avSession;