* 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 type { ErrorCallback, AsyncCallback, Callback } from './@ohos.base';
import { WantAgent } from './@ohos.app.ability.wantAgent';
import { KeyEvent } from './@ohos.multimodalInput.keyEvent';
import { ElementName } from './bundleManager/ElementName';
import image from './@ohos.multimedia.image';
import audio from './@ohos.multimedia.audio';
import { AVCastPickerState, AVCastPickerColorMode, AVCastPickerStyle } from './@ohos.multimedia.avCastPickerParam';
import type media from './@ohos.multimedia.media';
import type Context from './application/BaseContext';
import type hdrCapability from './@ohos.graphics.hdrCapability';
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 9 dynamic
* @since 23 static
*/
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<AVSession> } 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 dynamic
* @since 23 static
*/
function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession>): 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<AVSession> } 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]
* @since 10 dynamic
* @since 23 static
*/
function createAVSession(context: Context, tag: string, type: AVSessionType): Promise<AVSession>;
* Get an AVSession instance if already created.
*
* @param { Context } context - The context of application
* @returns { Promise<AVSession> } Promise for AVSession
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
function getAVSession(context: Context): Promise<AVSession>;
* Get all avsession descriptors of the system
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { AsyncCallback<Array<Readonly<AVSessionDescriptor>>> } 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 dynamic
* @since 23 static
*/
function getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void;
* Get all avsession descriptors which can be shown on system entrance.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES [since 9 - 22]
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES or ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC [since 23]
* @returns { Promise<Array<Readonly<AVSessionDescriptor>>> } Promise for an array of AVSessionDescriptors
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App. [since 9 - 22]
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
function getAllSessionDescriptors(): Promise<Array<Readonly<AVSessionDescriptor>>>;
* Get session descriptors of the system based on different session category.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { SessionCategory } category - Specifies the category of AVSession.
* @returns { Promise<Array<Readonly<AVSessionDescriptor>>> } 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 22 dynamic
* @since 24 static
*/
function getSessionDescriptors(category: SessionCategory): Promise<Array<Readonly<AVSessionDescriptor>>>;
* Get history avsession records. These sessions have been destroyed.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { int } maxSize - Specifies the maximum size of the returned value array.
* @param { AsyncCallback<Array<Readonly<AVSessionDescriptor>>> } 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 dynamic
* @since 23 static
*/
function getHistoricalSessionDescriptors(maxSize: int, callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void;
* Get history avsession records. These sessions have been destroyed.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { int } 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<Array<Readonly<AVSessionDescriptor>>> } 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 dynamic
* @since 23 static
*/
function getHistoricalSessionDescriptors(maxSize?: int): Promise<Array<Readonly<AVSessionDescriptor>>>;
* Get history play list information records.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { int } maxSize - Specifies the maximum size of the returned value array.
* @param { int } maxAppSize - Specifies the maximum app size of the returned value array.
* @param { AsyncCallback<Array<Readonly<AVQueueInfo>>> } 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 dynamic
* @since 23 static
*/
function getHistoricalAVQueueInfos(maxSize: int, maxAppSize: int, callback: AsyncCallback<Array<Readonly<AVQueueInfo>>>): void;
* Get history play list information records.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { int } maxSize - Specifies the maximum size of the returned value array.
* @param { int } maxAppSize - Specifies the maximum app size of the returned value array.
* @returns { Promise<Array<Readonly<AVQueueInfo>>> } 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 dynamic
* @since 23 static
*/
function getHistoricalAVQueueInfos(maxSize: int, maxAppSize: int): Promise<Array<Readonly<AVQueueInfo>>>;
* Create an avsession controller
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { string } sessionId - Specifies the sessionId to create the controller.
* @param { AsyncCallback<AVSessionController> } 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 dynamic
* @since 23 static
*/
function createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void;
* Create an avsession controller
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES [since 9 - 22]
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES or ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC [since 23]
* @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<AVSessionController> } Promise for AVSessionController
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 202 - Not System App. [since 9 - 22]
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
function createController(sessionId: string): Promise<AVSessionController>;
* 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<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast.
* @param { AsyncCallback<void> } 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 dynamic
*/
function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void;
* Cast Audio to the remote devices or cast back local device
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { SessionToken } session - Specifies the sessionId which to send to remote.
* @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast.
* @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @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 23 static
*/
function castAudioSession(session: SessionToken, audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): 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<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast.
* @returns { Promise<void> } 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 dynamic
*/
function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>): Promise<void>;
* Cast Audio to the remote devices or cast back local device
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { SessionToken } session - Specifies the sessionId which to send to remote.
* @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast.
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @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 23 static
*/
function castAudioSession(session: SessionToken, audioDevices: Array<audio.AudioDeviceDescriptor>): Promise<void>;
* Cast all the media audio to the remote devices or cast back local device
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast.
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @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 23 static
*/
function castAudioSessionAll(audioDevices: Array<audio.AudioDeviceDescriptor>): Promise<void>;
* 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> } 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 dynamic
* @since 23 static
*/
function startAVPlayback(bundleName: string, assetId: string): Promise<void>;
* Start an application for media playback with command info.
*
* @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.
* @param { CommandInfo } info - Specifies the specified command information.
* @returns { Promise<void> } 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 } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 22 dynamic
* @since 24 static
*/
function startAVPlayback(bundleName: string, assetId: string, info: CommandInfo): Promise<void>;
* Get distributed avsession controller
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { DistributedSessionType } distributedSessionType - Specifies the distributed session type.
* @returns { Promise<Array<AVSessionController>> } Promise for AVSessionController.
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600109 - The remote connection is not established.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
* @since 23 static
*/
function getDistributedSessionController(distributedSessionType: DistributedSessionType): Promise<Array<AVSessionController>>;
* Session category for different scenes.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 22 dynamic
* @since 24 static
*/
enum SessionCategory {
* The active session category which can be shown on system control entrance.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 22 dynamic
* @since 24 static
*/
CATEGORY_ACTIVE = 1,
* The session category which is partially integrated with AVSession function.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 22 dynamic
* @since 24 static
*/
CATEGORY_NOT_ACTIVE = 2,
* The all session category including all the applications using AVSession.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 22 dynamic
* @since 24 static
*/
CATEGORY_ALL = 3,
* The session category for HiPlay casting AVSession.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @stagemodelonly
* @since 24 dynamic&static
*/
CATEGORY_HIPLAY = 4,
}
* Whether desktop lyric feature is supported.
*
* @returns { Promise<boolean> } - result returned to indicate desktop lyric is supported.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
function isDesktopLyricSupported(): Promise<boolean>;
* Desktop lyric state definition.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
interface DesktopLyricState {
* Desktop lyric lock state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
isLocked: boolean;
}
* Session token. Used to judge the legitimacy of the session.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 9 dynamic
* @since 23 static
*/
interface SessionToken {
* The unique session id of the avsession object
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 9 dynamic
* @since 23 static
*/
sessionId: string;
* Process id of session
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 9 dynamic
* @since 23 static
*/
pid?: long;
* User id
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 9 dynamic
* @since 23 static
*/
uid?: long;
}
* 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 dynamic
*/
function on(type: 'sessionCreate', callback: (session: AVSessionDescriptor) => void): void;
* Register session create callback
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC
* @param { Callback<AVSessionDescriptor> } callback - Used to handle ('sessionCreate' command)
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @since 23 dynamic&static
*/
function onSessionCreate(callback: Callback<AVSessionDescriptor>): 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 dynamic
*/
function on(type: 'sessionDestroy', callback: (session: AVSessionDescriptor) => void): void;
* Register session destroy callback
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC
* @param { Callback<AVSessionDescriptor> } callback - Used to handle ('sessionDestroy' command)
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @since 23 dynamic&static
*/
function onSessionDestroy(callback: Callback<AVSessionDescriptor>): 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 dynamic
*/
function on(type: 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void;
* Register top session changed callback
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC
* @param { Callback<AVSessionDescriptor> } callback - Used to handle ('topSessionChange' command)
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @since 23 dynamic&static
*/
function onTopSessionChange(callback: Callback<AVSessionDescriptor>): 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 dynamic
*/
function off(type: 'sessionCreate', callback?: (session: AVSessionDescriptor) => void): void;
* Unregister session create callback
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC
* @param { Callback<AVSessionDescriptor> } [callback] - Used to unregister listener for ('sessionCreate') command
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @since 23 dynamic&static
*/
function offSessionCreate(callback?: Callback<AVSessionDescriptor>): void;
* Register active session changed callback.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { Callback<Array<AVSessionDescriptor>> } callback - Used to handle activeSessionChange event
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 23 dynamic&static
*/
function onActiveSessionChanged(callback: Callback<Array<AVSessionDescriptor>>): void;
* Unregister active session changed callback.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { Callback<Array<AVSessionDescriptor>> } [callback] - Used to handle activeSessionChange event
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 23 dynamic&static
*/
function offActiveSessionChanged(callback?: Callback<Array<AVSessionDescriptor>>): 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 dynamic
*/
function off(type: 'sessionDestroy', callback?: (session: AVSessionDescriptor) => void): void;
* Unregister session destroy callback
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC
* @param { Callback<AVSessionDescriptor> } [callback] - Used to unregister listener for ('sessionDestroy') command
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @since 23 dynamic&static
*/
function offSessionDestroy(callback?: Callback<AVSessionDescriptor>): 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 dynamic
*/
function off(type: 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;
* Unregister top session changed callback
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES_FOR_PUBLIC
* @param { Callback<AVSessionDescriptor> } [callback] - Used to unregister listener for ('topSessionChange') command
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @since 23 dynamic&static
*/
function offTopSessionChange(callback?: Callback<AVSessionDescriptor>): 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 dynamic
*/
function on(type: 'sessionServiceDie', callback: () => void): void;
* Register Session service death callback, notifying the application to clean up resources.
*
* @param { NoParamCallback } callback - Used to handle ('sessionServiceDie') command.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 23 static
*/
function onSessionServiceDie(callback: NoParamCallback): 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 dynamic
*/
function off(type: 'sessionServiceDie', callback?: () => void): void;
* Unregister Session service death callback, notifying the application to clean up resources.
*
* @param { NoParamCallback } [callback] - Used to unregister listener for ('sessionServiceDie') command.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 23 static
*/
function offSessionServiceDie(callback?: NoParamCallback): void;
* Register distributed session changed callback
*
* @param { 'distributedSessionChange' } type - Registration Type, distributed session change
* @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type
* @param { Callback<Array<AVSessionController>> } callback - The callback will return remote changed
* AVSessionController.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
*/
function on(type: 'distributedSessionChange', distributedSessionType: DistributedSessionType, callback: Callback<Array<AVSessionController>>): void;
* Register distributed session changed callback
*
* @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type
* @param { Callback<Array<AVSessionController>> } callback - The callback will return
* remote changed AVSessionController.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 23 static
*/
function onDistributedSessionChange(distributedSessionType: DistributedSessionType, callback: Callback<Array<AVSessionController>>): void;
* Unregister distributed session changed callback
*
* @param { 'distributedSessionChange' } type - Registration Type, distributed session change
* @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type
* @param { Callback<Array<AVSessionController>> } callback - The callback will return remote changed
* AVSessionController.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
*/
function off(type: 'distributedSessionChange', distributedSessionType: DistributedSessionType, callback?: Callback<Array<AVSessionController>>): void;
* Unregister distributed session changed callback
*
* @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type
* @param { Callback<Array<AVSessionController>> } [callback] - The callback will return
* remote changed AVSessionController.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 23 static
*/
function offDistributedSessionChange(distributedSessionType: DistributedSessionType, callback?: Callback<Array<AVSessionController>>): 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<void> } 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 dynamic
* @since 23 static
*/
function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<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
* @returns { Promise<void> } 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 dynamic
* @since 23 static
*/
function sendSystemAVKeyEvent(event: KeyEvent): Promise<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}
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): 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> } 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 dynamic
* @since 23 static
*/
function sendSystemControlCommand(command: AVControlCommand): Promise<void>;
* Send system control command. The system automatically selects the recipient.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { string } command - The command name to be sent.
* @param { ExtraInfo } args - The parameters of command info
* @returns { Promise<string> } callback info for sync command
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @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
* @stagemodelonly
* @since 24 dynamic&static
*/
function sendSystemCommonCommand(command: string, args: ExtraInfo): Promise<string>;
* Defines the basic callback.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
type NoParamCallback = () => void;
* Defines the callback type including two parameters.
*
* @param { T } data1
* @param { G } data2
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
type TwoParamCallback<T, G> = (data1: T, data2: G) => void;
* Define different protocol capability
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
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
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
TYPE_LOCAL = 0,
* Cast+ mirror capability
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
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
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
TYPE_DLNA = 4,
* This type indicates the device supports audio casting with high definition to get a better sound quality.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
TYPE_CAST_PLUS_AUDIO = 8,
}
* Define different distributed session type
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
* @since 23 static
*/
enum DistributedSessionType {
* Remote session sensed from remote device.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
* @since 23 static
*/
TYPE_SESSION_REMOTE = 0,
* Migrated session from remote device to this device.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
* @since 23 static
*/
TYPE_SESSION_MIGRATE_IN = 1,
* Migrated session from this device to remote device.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 18 dynamic
* @since 23 static
*/
TYPE_SESSION_MIGRATE_OUT = 2,
}
* Start device discovery.
*
* @param { AsyncCallback<void> } callback a callback function
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
function startCastDeviceDiscovery(callback: AsyncCallback<void>): void;
* Start device discovery.
*
* @param { int } filter device filter when discovering, can be an union of {@link ProtocolType}
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
function startCastDeviceDiscovery(filter: int, callback: AsyncCallback<void>): void;
* Start device discovery.
*
* @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} [since 10 - 11]
* @param { int } [filter] - device filter when discovering, can be an union of {@link ProtocolType} [since 12]
* @param { Array<string> } [drmSchemes] - filter drm-enabled devices which are represented by uuid.
* It is effective when protocol type is TYPE_CAST_PLUS_STREAM. [since 12]
* @returns { Promise<void> } Promise for the result
* @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified.
* 2.Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 202 - Not System App. [since 12]
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
function startCastDeviceDiscovery(filter?: int, drmSchemes?: Array<string>): Promise<void>;
* Stop device discovery.
*
* @param { AsyncCallback<void> } callback a callback function
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
function stopCastDeviceDiscovery(callback: AsyncCallback<void>): void;
* Stop device discovery.
*
* @returns { Promise<void> } Promise for the result
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
function stopCastDeviceDiscovery(): Promise<void>;
* Enable or disable device to be discoverable, used at sink side.
*
* @param { boolean } enable true: can be discoverable, false: cannot be discoverable.
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
function setDiscoverable(enable: boolean, callback: AsyncCallback<void>): 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<void> } 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 dynamic
* @since 23 static
*/
function setDiscoverable(enable: boolean): Promise<void>;
* 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 dynamic
*/
function on(type: 'deviceAvailable', callback: (device: OutputDeviceInfo) => void): void;
* Register device discovery callback
*
* @param { Callback<OutputDeviceInfo> } callback Used to returns the device info
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function onDeviceAvailable(callback: Callback<OutputDeviceInfo>): 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 dynamic
*/
function off(type: 'deviceAvailable', callback?: (device: OutputDeviceInfo) => void): void;
* Unregister device discovery callback
*
* @param { Callback<OutputDeviceInfo> } [callback] - Used to returns the device info
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function offDeviceAvailable(callback?: Callback<OutputDeviceInfo>): 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 dynamic
*/
function on(type: 'deviceOffline', callback: (deviceId: string) => void): void;
* Register device offline callback
*
* @param { Callback<string> } callback - Used to returns the device info
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function onDeviceOffline(callback: Callback<string>): 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 dynamic
*/
function off(type: 'deviceOffline', callback?: (deviceId: string) => void): void;
* Unregister device offline callback
*
* @param { Callback<string> } [callback] - Used to returns the device info
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function offDeviceOffline(callback?: Callback<string>): 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<AVCastController> } 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 dynamic
*/
function getAVCastController(sessionId: string, callback: AsyncCallback<AVCastController>): 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<AVCastController | undefined> } callback - async callback for the AVCastController.
* @throws {BusinessError} 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws {BusinessError} 6600101 - Session service exception.
* @throws {BusinessError} 6600102 - session does not exist
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function getAVCastController(sessionId: string, callback: AsyncCallback<AVCastController | undefined>): 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<AVCastController> } 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 dynamic
*/
function getAVCastController(sessionId: string): Promise<AVCastController>;
* Get the current session's remote controller client.
* If the avsession is not under casting state, the controller will return undefined.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { string } sessionId Specifies the sessionId to get controller.
* @returns { Promise<AVCastController | undefined> } Promise for the AVCastController
* @throws {BusinessError} 201 - permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws {BusinessError} 6600101 - server exception
* @throws {BusinessError} 6600102 - session does not exist
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function getAVCastController(sessionId: string): Promise<AVCastController | undefined>;
* 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<void> } 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 dynamic
* @since 23 static
*/
function startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCallback<void>): 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<void> } 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 dynamic
* @since 23 static
*/
function startCasting(session: SessionToken, device: OutputDeviceInfo): Promise<void>;
* Stop current cast and disconnect device connection.
*
* @param { SessionToken } session Specifies the sessionId which is to be stopped.
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
function stopCasting(session: SessionToken, callback: AsyncCallback<void>): void;
* Stop current cast and disconnect device connection.
*
* @param { SessionToken } session Specifies the sessionId which is to be stopped.
* @returns { Promise<void> } 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 dynamic
* @since 23 static
*/
function stopCasting(session: SessionToken): Promise<void>;
* 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 { int } 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<void> } 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 dynamic
* @since 23 static
*/
function startDeviceLogging(url: string, maxSize?: int): Promise<void>;
* Stop the current device written even the discovery is ongoing.
*
* @returns { Promise<void> } 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 dynamic
* @since 23 static
*/
function stopDeviceLogging(): Promise<void>;
* Register log event callback.
*
* @param { 'deviceLogEvent' } type - Command to register 'deviceLogEvent'.
* @param { Callback<DeviceLogEventCode> } 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 dynamic
*/
function on(type: 'deviceLogEvent', callback: Callback<DeviceLogEventCode>): void;
* Register log event callback.
*
* @param { Callback<DeviceLogEventCode> } callback - Used to handle ('deviceLogEvent') command
* @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 23 static
*/
function onDeviceLogEvent(callback: Callback<DeviceLogEventCode>): void;
* UnRegister log event callback.
*
* @param { 'deviceLogEvent' } type - Command to register 'deviceLogEvent'.
* @param { Callback<DeviceLogEventCode> } 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 dynamic
*/
function off(type: 'deviceLogEvent', callback?: Callback<DeviceLogEventCode>): void;
* UnRegister log event callback.
*
* @param { Callback<DeviceLogEventCode> } [callback] - Used to handle ('deviceLogEvent') command
* @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 23 static
*/
function offDeviceLogEvent(callback?: Callback<DeviceLogEventCode>): void;
* Enumerates device log event code.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 13 dynamic
* @since 23 static
*/
enum DeviceLogEventCode {
* Log is full.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
DEVICE_LOG_EXCEPTION = 2,
}
* Device state used to describe states including discovery, authentication and other scenes.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
* @since 23 static
*/
interface DeviceState {
* Unique device descriptor.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
* @since 23 static
*/
readonly deviceId: string;
* Device connection state.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
* @since 23 static
*/
readonly deviceState: int;
* Reason for connection failure, for example, user cancellation and timeout.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
* @since 23 static
*/
readonly reasonCode: int;
* System radar error code returned by cast+services.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
* @since 23 static
*/
readonly radarErrorCode: int;
}
* Registers a system callback for the device connection phase.
* The callback includes information such as error codes, connection status, radar errors, and user behavior codes.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { 'deviceStateChanged' } type - Event type.
* @param { Callback<DeviceState> } callback - Callback used to return the device information.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
*/
function on(type: 'deviceStateChanged', callback: Callback<DeviceState>): void;
* Registers a system callback for the device connection phase.
* The callback includes information such as error codes, connection status, radar errors, and user behavior codes.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { Callback<DeviceState> } callback - Callback used to return the device information.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function onDeviceStateChanged(callback: Callback<DeviceState>): void;
* Unregisters a system callback for the device connection phase.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { 'deviceStateChanged' } type - Event type.
* @param { Callback<DeviceState> } [callback] - Callback used to return the device information.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 20 dynamic
*/
function off(type: 'deviceStateChanged', callback?: Callback<DeviceState>): void;
* Unregisters a system callback for the device connection phase.
*
* @permission ohos.permission.MANAGE_MEDIA_RESOURCES
* @param { Callback<DeviceState> } [callback] - Callback used to return the device information.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not System App.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 23 static
*/
function offDeviceStateChanged(callback?: Callback<DeviceState>): void;
* Register system common event callback
*
* @param { EventProcess } callback - Used to handle event when the common command is received
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @stagemodelonly
* @since 24 dynamic&static
*/
function onSystemCommonEvent(callback: EventProcess): void;
* Unregister system common event callback
*
* @param { EventProcess } [callback] - Used to handle event when the common command is received
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @stagemodelonly
* @since 24 dynamic&static
*/
function offSystemCommonEvent(callback?: EventProcess): void;
* Session type supports audio & video, voice_call, video_call, photo
*
* @unionmember { 'audio' } audio type [since 10]
* @unionmember { 'video' } video type [since 10]
* @unionmember { 'voice_call' } voice call type [since 11]
* @unionmember { 'video_call' } video call type [since 12]
* @unionmember { 'photo' } photo type [since 22]
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
type AVSessionType = 'audio' | 'video' | 'voice_call' | 'video_call' | 'photo';
* The general process funcation with an event and arguments.
*
* @param { string } event - request event
* @param { Record<string, Object> } args - arguments associated with event
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
* @since 26.1.0 dynamic
*/
type EventProcess = (event: string, args: Record<string, Object>) => void;
* The connection event supplied by system to indicate device state and information.
*
* @param { ConnectionState } state - device connection state
* @param { OutputDeviceInfo } device - device information
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
type ConnectionEvent = (state: ConnectionState, device: OutputDeviceInfo) => void;
* The video size event.
*
* @param { int } width - video width
* @param { int } height - video height
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
type VideoSizeEvent = (width: int, height: int) => void;
* AVSession object.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVSession {
* unique session Id
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
readonly sessionId: string;
* Get current session type
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
readonly sessionType: AVSessionType;
* Current session tag.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
readonly sessionTag: string;
* 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<void> } 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 dynamic
* @since 23 static
*/
setAVMetadata(data: AVMetadata, callback: AsyncCallback<void>): 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> } 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]
* @since 10 dynamic
* @since 23 static
*/
setAVMetadata(data: AVMetadata): Promise<void>;
* Set the metadata related with current call.
*
* @param { CallMetadata } data - {@link CallMetadata}
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
setCallMetadata(data: CallMetadata, callback: AsyncCallback<void>): void;
* Set the metadata related with current call.
*
* @param { CallMetadata } data - {@link CallMetadata}
* @returns { Promise<void> } 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 dynamic
* @since 23 static
*/
setCallMetadata(data: CallMetadata): Promise<void>;
* Set the playback state of this session.
*
* @param { AVPlaybackState } state {@link AVPlaybackState}
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void>): void;
* Set the playback state of this session.
*
* @param { AVPlaybackState } state {@link AVPlaybackState}
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
setAVPlaybackState(state: AVPlaybackState): Promise<void>;
* Set the call state of this session.
*
* @param { AVCallState } state - {@link AVCallState}
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
setAVCallState(state: AVCallState, callback: AsyncCallback<void>): void;
* Set the call state of this session.
*
* @param { AVCallState } state - {@link AVCallState}
* @returns { Promise<void> } 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 dynamic
* @since 23 static
*/
setAVCallState(state: AVCallState): Promise<void>;
* Set the ability to start the session corresponding to
*
* @param { WantAgent } ability - The WantAgent for launch the ability
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void>): void;
* Set the ability to start the session corresponding to
*
* @param { WantAgent } ability - The WantAgent for launch the ability
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
setLaunchAbility(ability: WantAgent): Promise<void>;
* 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<void>} 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
* @FaAndStageModel
* @since 10 dynamic
*/
dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback<void>): void;
* Dispatch the session event of this session.
*
* @param { string } event - Session event name to dispatch
* @param { Record<string, Object> } args - The parameters of session event
* @param { AsyncCallback<void> } 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
* @stagemodelonly
* @since 23 static
*/
dispatchSessionEvent(event: string, args: Record<string, Object>, callback: AsyncCallback<void>): 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> } 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise<void>;
* Dispatch the session event of this session.
*
* @param { string } event - Session event name to dispatch
* @param { Record<string, Object> } args - The parameters of session event
* @returns { Promise<void> } 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 23 static
*/
dispatchSessionEvent(event: string, args: Record<string, Object>): Promise<void>;
* Set the playlist of queueItem. Identifies the content of the playlist presented by this session.
*
* @param { Array<AVQueueItem> } items - An array of the AVQueueItem
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
setAVQueueItems(items: Array<AVQueueItem>, callback: AsyncCallback<void>): void;
* Set the playlist of queueItem. Identifies the content of the playlist presented by this session.
*
* @param { Array<AVQueueItem> } items - An array of the AVQueueItem
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
setAVQueueItems(items: Array<AVQueueItem>): Promise<void>;
* Set the name of the playlist presented by this session.
*
* @param { string } title - The name of the playlist
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
setAVQueueTitle(title: string, callback: AsyncCallback<void>): void;
* Set the name of the playlist presented by this session.
*
* @param { string } title - The name of the playlist
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
setAVQueueTitle(title: string): Promise<void>;
* Set the custom media packets for this session.
*
* @param { object } extras - The custom media packets
* @param { AsyncCallback<void> } 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
* @FaAndStageModel
* @since 10 dynamic
*/
setExtras(extras: {[key: string]: Object}, callback: AsyncCallback<void>): void;
* Set the custom media packets for this session.
*
* @param { Record<string, Object> } extras - The custom media packets
* @param { AsyncCallback<void> } 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
* @stagemodelonly
* @since 23 static
*/
setExtras(extras: Record<string, Object>, callback: AsyncCallback<void>): void;
* Set the custom media packets for this session.
*
* @param { object } extras - The custom media packets
* @returns { Promise<void> } 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
setExtras(extras: {[key: string]: Object}): Promise<void>;
* Set the custom media packets for this session.
*
* @param { Record<string, Object> } extras - The custom media packets
* @returns { Promise<void> } 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 23 static
*/
setExtras(extras: Record<string, Object>): Promise<void>;
* Set supported speeds supplied by application.
*
* @param { Array<double> } speeds - supported speeds
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
setSupportedPlaySpeeds(speeds: Array<double>): Promise<void>;
* Set supported loop modes supplied by application.
*
* @param { Array<LoopMode> } loopModes - supported loop modes
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
setSupportedLoopModes(loopModes: Array<LoopMode>): Promise<void>;
* Enable desktop lyric for this session.
*
* @param { boolean } enable - The enable status indicating to using system desktop lyric feature or not
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
enableDesktopLyric(enable: boolean): Promise<void>;
* Set desktop lyric visible state for this session.
*
* @param { boolean } visible - make desktop lyric window visible or not
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
setDesktopLyricVisible(visible: boolean): Promise<void>;
* Query desktop lyric visible state for this session.
*
* @returns { Promise<boolean> } return desktop lyric visible state
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
isDesktopLyricVisible(): Promise<boolean>;
* Register desktop lyric visible state change callback.
*
* @param { Callback<boolean> } callback - a callback to receive desktop lyric window visible state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
onDesktopLyricVisibilityChanged(callback: Callback<boolean>): void;
* Unregister desktop lyric visible state change callback.
*
* @param { Callback<boolean> } [callback] - a callback to receive desktop lyric window visible state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
offDesktopLyricVisibilityChanged(callback?: Callback<boolean>): void;
* Set desktop lyric state such as lock state for this session.
*
* @param { DesktopLyricState } state - The desktop lyric state
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
setDesktopLyricState(state: DesktopLyricState): Promise<void>;
* Get desktop lyric state such as lock state for this session.
*
* @returns { Promise<DesktopLyricState> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
getDesktopLyricState(): Promise<DesktopLyricState>;
* Register desktop lyric state changed callback.
*
* @param { Callback<DesktopLyricState> } callback - a callback to receive desktop lyric state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
onDesktopLyricStateChanged(callback: Callback<DesktopLyricState>): void;
* Unregister desktop lyric state changed callback.
*
* @param { Callback<DesktopLyricState> } [callback] - a callback to receive desktop lyric state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
offDesktopLyricStateChanged(callback?: Callback<DesktopLyricState>): void;
* Set the background playback mode.
* It is recommended that you associate it with the background playback switch in the app.
* If not set, the default value for 'audio' session is {@link ENABLE_BACKGROUND_PLAY} and
* the default value for 'video' session is {@link DISENABLE_BACKGROUND_PLAY}.
*
* @param { BackgroundPlayMode } mode - Background play mode
* @returns { Promise<void> } void promise when executed successfully.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 24 dynamic&static
*/
setBackgroundPlayMode(mode: BackgroundPlayMode): Promise<void>;
* Set media control types that can be displayed on the media center.
*
* @param { Array<AVMediaCenterControlType> } type - The control types that can be displayed on the media center.
* If the priority of control type is not set, the media center will display based on {@link AVSessionType}.
* The control type set must be registered by {@link on}, the media center prioritizes displaying
* the set control type.
* @returns { Promise<void> } void promise when executed successfully.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
setMediaCenterControlType(type: Array<AVMediaCenterControlType>): Promise<void>;
* Get the current session's own controller
*
* @param { AsyncCallback<AVSessionController> } 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 dynamic
* @since 23 static
*/
getController(callback: AsyncCallback<AVSessionController>): void;
* Get the current session's own controller
*
* @returns { Promise<AVSessionController> } 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]
* @since 10 dynamic
* @since 23 static
*/
getController(): Promise<AVSessionController>;
* 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<AVCastController> } 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 dynamic
*/
getAVCastController(callback: AsyncCallback<AVCastController>): 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 undefined.
*
* @param { AsyncCallback<AVCastController | undefined> } 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 23 static
*/
getAVCastController(callback: AsyncCallback<AVCastController | undefined>): 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<AVCastController> } 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]
* @since 10 dynamic
*/
getAVCastController(): Promise<AVCastController>;
* Get the cast controller when the session is casted to remote device.
* If the avsession is not under casting state, the controller will return undefined.
*
* @returns { Promise<AVCastController | undefined> } 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 23 static
*/
getAVCastController(): Promise<AVCastController | undefined>;
* Get output device information
*
* @param { AsyncCallback<OutputDeviceInfo> } 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 dynamic
* @since 23 static
*/
getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void;
* Get output device information
*
* @returns { Promise<OutputDeviceInfo> } 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]
* @since 10 dynamic
* @since 23 static
*/
getOutputDevice(): Promise<OutputDeviceInfo>;
* 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]
* @since 10 dynamic
* @since 23 static
*/
getOutputDeviceSync(): OutputDeviceInfo;
* Get all the current virtual display information for extended display.
*
* @returns { Promise<Array<CastDisplayInfo>> } 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 dynamic
* @since 23 static
*/
getAllCastDisplays(): Promise<Array<CastDisplayInfo>>;
* 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]
* @since 10 dynamic
*/
on(type: 'play', callback: () => void): void;
* Register play command callback.
* The application will receive {@link CommandInfo} from a controller.
*
* @param { Callback<CommandInfo> } callback - Used to handle ('play') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
onPlay(callback: Callback<CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'pause', 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 { NoParamCallback } callback - Used to handle ('pause') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onPause(callback: NoParamCallback): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'stop', 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 { NoParamCallback } callback - Used to handle ('stop') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onStop(callback: NoParamCallback): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'playNext', callback: () => void): void;
* Register playNext command callback.
* The application will receive {@link CommandInfo} from a controller.
*
* @param { Callback<CommandInfo> } callback - Used to handle ('playNext') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
onPlayNext(callback: Callback<CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'playPrevious', callback: () => void): void;
* Register playPrevious command callback.
* The application will receive {@link CommandInfo} from a controller.
*
* @param { Callback<CommandInfo> } callback - Used to handle ('playPrevious') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 22 dynamic
* @since 23 static
*/
onPlayPrevious(callback: Callback<CommandInfo>): 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, described by milliseconds.
* @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]
* @since 10 dynamic
*/
on(type: 'fastForward', callback: (time ?: long) => void): void;
* Register fastForward command callback.
* The application will receive forward time and {@link CommandInfo} from a controller.
*
* @param { TwoParamCallback<long, CommandInfo> } callback - Used to handle ('fastForward') command, described by
* milliseconds.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
onFastForward(callback: TwoParamCallback<long, CommandInfo>): 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, described by milliseconds.
* @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]
* @since 10 dynamic
*/
on(type: 'rewind', callback: (time ?: long) => void): void;
* Register rewind command callback.
* The application will receive rewind time and {@link CommandInfo} from a controller.
*
* @param { TwoParamCallback<long, CommandInfo> } callback - Used to handle ('rewind') command, described by
* milliseconds.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
onRewind(callback: TwoParamCallback<long, CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'play', callback?: () => void): void;
* Unregister play command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { Callback<CommandInfo> } [callback] - Used to handle ('play') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
offPlay(callback?: Callback<CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'pause', callback?: () => void): void;
* Unregister pause command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { NoParamCallback } [callback] - Used to handle ('pause') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offPause(callback?: NoParamCallback): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'stop', callback?: () => void): void;
* Unregister stop command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { NoParamCallback } [callback] - Used to handle ('stop') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offStop(callback?: NoParamCallback): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'playNext', callback?: () => void): void;
* Unregister playNext command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { Callback<CommandInfo> } [callback] - Used to handle ('playNext') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
offPlayNext(callback?: Callback<CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'playPrevious', callback?: () => void): void;
* Unregister playPrevious command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { Callback<CommandInfo> } [callback] - Used to handle ('playPrevious') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
offPlayPrevious(callback?: Callback<CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'fastForward', callback?: () => void): void;
* Unregister fastForward command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { TwoParamCallback<long, CommandInfo> } [callback] - Used to handle ('fastForward') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
offFastForward(callback?: TwoParamCallback<long, CommandInfo>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'rewind', callback?: () => void): void;
* Unregister rewind command callback.
* When canceling the callback, need to update the supported commands list.
*
* @param { TwoParamCallback<long, CommandInfo> } [callback] - Used to handle ('rewind') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
offRewind(callback?: TwoParamCallback<long, CommandInfo>): 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
* @atomicservice [since 12]
* @since 11 dynamiconly
* @deprecated since 20
* @useinstead ohos.multimedia.avsession.AVSession#on
*/
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
* @atomicservice [since 12]
* @since 11 dynamiconly
* @deprecated since 20
* @useinstead ohos.multimedia.avsession.AVSession#off
*/
off(type: 'playFromAssetId', callback?: (assetId: number) => void): void;
* Subscribes to playWithAssetId events.
*
* @param { 'playWithAssetId' } type - Event type.
* @param { Callback<string> } callback - Callback used to handle the 'playWithAssetId' command.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 20 dynamic
*/
on(type: 'playWithAssetId', callback: Callback<string>): void;
* Subscribes to playWithAssetId events.
*
* @param { Callback<string> } callback - Callback used to handle the 'playWithAssetId' command.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onPlayWithAssetId(callback: Callback<string>): void;
* Unsubscribes from playWithAssetId events.
*
* @param { 'playWithAssetId' } type - Event type.
* @param { Callback<string> } callback - Callback used to handle the 'playWithAssetId' command.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 20 dynamic
*/
off(type: 'playWithAssetId', callback?: Callback<string>): void;
* Unsubscribes from playWithAssetId events.
*
* @param { Callback<string> } [callback] - Callback used to handle the 'playWithAssetId' command.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 23 static
*/
offPlayWithAssetId(callback?: Callback<string>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'seek', callback: (time: long) => void): void;
* Register seek command callback
*
* @param { Callback<long> } callback - Used to handle seek command.The callback provides the seek time(ms)
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 23 static
*/
onSeek(callback: Callback<long>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'seek', callback?: (time: long) => void): void;
* Unregister seek command callback
*
* @param { Callback<long> } [callback] - Used to handle seek command.The callback provides the seek time(ms)
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSeek(callback?: Callback<long>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'setSpeed', callback: (speed: double) => void): void;
* Register setSpeed command callback
*
* @param { Callback<double> } callback - Used to handle setSpeed command.The callback provides the speed value
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onSetSpeed(callback: Callback<double>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'setSpeed', callback?: (speed: double) => void): void;
* Unregister setSpeed command callback
*
* @param { Callback<double> } [callback] - Used to handle setSpeed command.The callback provides the speed value
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSetSpeed(callback?: Callback<double>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;
* Register setLoopMode command callback
*
* @param { Callback<LoopMode> } callback - Used to handle setLoopMode command.The callback provides the {@link
* LoopMode}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onSetLoopMode(callback: Callback<LoopMode>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;
* Unregister setLoopMode command callback
*
* @param { Callback<LoopMode> } [callback] - Used to handle setLoopMode command.
* The callback provides the {@link LoopMode}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSetLoopMode(callback?: Callback<LoopMode>): void;
* Register setTargetLoopMode command callback
* Application should change playmode to the loopmode which is requested.
*
* @param { 'setTargetLoopMode' } type - Registration Type 'setTargetLoopMode'
* @param { Callback<LoopMode> } callback - Used to handle setTargetLoopMode command.The callback provides the {@
* link LoopMode}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 18 dynamic
*/
on(type: 'setTargetLoopMode', callback: Callback<LoopMode>): void;
* Register setTargetLoopMode command callback
* Application should change playmode to the loopmode which is requested.
*
* @param { Callback<LoopMode> } callback - Used to handle setTargetLoopMode command.
* The callback provides the {@link LoopMode}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onSetTargetLoopMode(callback: Callback<LoopMode>): void;
* Unregister setTargetLoopMode command callback
*
* @param { 'setTargetLoopMode' } type - Registration Type 'setTargetLoopMode'
* @param { Callback<LoopMode> } callback - Used to handle setTargetLoopMode command.The callback provides the {@
* link LoopMode}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 18 dynamic
*/
off(type: 'setTargetLoopMode', callback?: Callback<LoopMode>): void;
* Unregister setTargetLoopMode command callback
*
* @param { Callback<LoopMode> } [callback] - Used to handle setTargetLoopMode command.
* The callback provides the {@link LoopMode}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSetTargetLoopMode(callback?: Callback<LoopMode>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'toggleFavorite', callback: (assetId: string) => void): void;
* Register toggle favorite command callback
*
* @param { Callback<string> } callback - Used to handle toggleFavorite command.The callback provides
* the assetId for which the favorite status needs to be switched.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onToggleFavorite(callback: Callback<string>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;
* Unregister toggle favorite command callback
*
* @param { Callback<string> } [callback] - Used to handle toggleFavorite command.The callback provides
* the assetId for which the favorite status needs to be switched.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offToggleFavorite(callback?: Callback<string>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;
* Register media key handling callback
*
* @param { Callback<KeyEvent> } callback - Used to handle key events.The callback provides the KeyEvent
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onHandleKeyEvent(callback: Callback<KeyEvent>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;
* Unregister media key handling callback
*
* @param { Callback<KeyEvent> } [callback] - Used to handle key events.The callback provides the KeyEvent
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offHandleKeyEvent(callback?: Callback<KeyEvent>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void;
* Register session output device change callback
*
* @param { ConnectionEvent } callback - Used to handle output device changed.
* The callback provide the new device info {@link OutputDeviceInfo}
* and related connection state {@link ConnectionState}.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onOutputDeviceChange(callback: ConnectionEvent): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void;
* Unregister session output device change callback
*
* @param { ConnectionEvent } [callback] - Used to handle output device changed.
* The callback provide the new device info {@link OutputDeviceInfo}
* and related connection state {@link ConnectionState}.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offOutputDeviceChange(callback?: ConnectionEvent): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Object}) => void): void;
* Register session custom command change callback
*
* @param { EventProcess } callback - Used to handle event when the common command is received
* The callback provide the command name and command args
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onCommonCommand(callback: EventProcess): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'commonCommand', callback?: (command: string, args: {[key: string]: Object}) => void): void;
* Unregister session custom command change callback
*
* @param { EventProcess } [callback] - Used to cancel a specific listener
* The callback provide the command name and command args
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offCommonCommand(callback?: EventProcess): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'skipToQueueItem', callback: (itemId: int) => void): void;
* Register the item to play from the playlist change callback
*
* @param { Callback<int> } callback - Used to handle the item to be played.
* The callback provide the new device info {@link OutputDeviceInfo}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onSkipToQueueItem(callback: Callback<int>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'skipToQueueItem', callback?: (itemId: int) => void): void;
* Unregister the item to play from the playlist change callback
*
* @param { Callback<int> } [callback] - Used to handle the item to be played.
* The callback provide the new device info {@link OutputDeviceInfo}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSkipToQueueItem(callback?: Callback<int>): 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<void> } 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]
* @since 11 dynamic
*/
on(type: 'answer', callback: Callback<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 { NoParamCallback } callback - Used to handle ('answer') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onAnswer(callback: NoParamCallback): void;
* Unregister answer command callback.
*
* @param { 'answer' } type - Command to register 'answer'.
* @param { Callback<void> } 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]
* @since 11 dynamic
*/
off(type: 'answer', callback?: Callback<void>): void;
* Unregister answer command callback.
*
* @param { NoParamCallback } [callback] - Used to handle ('answer') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offAnswer(callback?: NoParamCallback): 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<void> } 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]
* @since 11 dynamic
*/
on(type: 'hangUp', callback: Callback<void>): 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 { NoParamCallback } callback - Used to handle ('hangUp') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onHangUp(callback: NoParamCallback): void;
* Unregister hangUp command callback.
*
* @param { 'hangUp' } type - Command to register 'hangUp'.
* @param { Callback<void> } 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]
* @since 11 dynamic
*/
off(type: 'hangUp', callback?: Callback<void>): void;
* Unregister hangUp command callback.
*
* @param { NoParamCallback } [callback] - Used to handle ('hangUp') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offHangUp(callback?: NoParamCallback): 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<void> } 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]
* @since 11 dynamic
*/
on(type: 'toggleCallMute', callback: Callback<void>): 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 { NoParamCallback } callback - Used to handle ('toggleCallMute') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onToggleCallMute(callback: NoParamCallback): void;
* Unregister toggleCallMute command callback.
*
* @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'.
* @param { Callback<void> } 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]
* @since 11 dynamic
*/
off(type: 'toggleCallMute', callback?: Callback<void>): void;
* Unregister toggleCallMute command callback.
*
* @param { NoParamCallback } [callback] - Used to handle ('toggleCallMute') command
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offToggleCallMute(callback?: NoParamCallback): void;
* Register listener for cast display information changed.
*
* @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for.
* @param { Callback<CastDisplayInfo> } 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 dynamic
*/
on(type: 'castDisplayChange', callback: Callback<CastDisplayInfo>): void;
* Register listener for cast display information changed.
*
* @param { Callback<CastDisplayInfo> } callback - Callback used to return cast display information.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @since 23 static
*/
onCastDisplayChange(callback: Callback<CastDisplayInfo>): void;
* Unregister listener for cast display information changed.
*
* @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for.
* @param { Callback<CastDisplayInfo> } 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 dynamic
*/
off(type: 'castDisplayChange', callback?: Callback<CastDisplayInfo>): void;
* Unregister listener for cast display information changed.
*
* @param { Callback<CastDisplayInfo> } [callback] - Callback used to return cast display information.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @since 23 static
*/
offCastDisplayChange(callback?: Callback<CastDisplayInfo>): void;
* Register listener for custom data sent from remote device.
*
* @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for.
* @param { Callback<Record<string, Object>> } callback - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
*/
on(type: 'customDataChange', callback: Callback<Record<string, Object>>): void;
* Register listener for custom data sent from remote device.
*
* @param { Callback<Record<string, Object>> } callback - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onCustomDataChange(callback: Callback<Record<string, Object>>): void;
* Unsubscribes from custom data changes.
*
* @param { 'customDataChange' } type Custom data type.
* @param { Callback<Record<string, Object>> } [callback] Callback used to return the custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
*/
off(type: 'customDataChange', callback?: Callback<Record<string, Object>>): void;
* Unsubscribes from custom data changes.
*
* @param { Callback<Record<string, Object>> } [callback] - Callback used to return the custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCustomDataChange(callback?: Callback<Record<string, Object>>): void;
* Sends custom data to a remote device.
*
* @param { Record<string, Object> } data Custom data populated by the application.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 6600101 - Session service exception.
* You are advised to:1.Scheduled retry.2.Destroy the current session or session controller and re-create it.
* @throws { BusinessError } 6600102 - The session does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
sendCustomData(data: Record<string, Object>): Promise<void>;
* Stop current cast and disconnect device connection.
*
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
stopCasting(callback: AsyncCallback<void>): void;
* Stop current cast and disconnect device connection.
*
* @returns { Promise<void> } void result promise when executed successfully
* @throws { BusinessError } 6600109 - The remote connection is not established.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
stopCasting(): Promise<void>;
* Activate the session, indicating that the session can accept control commands
*
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
activate(callback: AsyncCallback<void>): void;
* Activate the session, indicating that the session can accept control commands
*
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
activate(): Promise<void>;
* Deactivate the session, indicating that the session not ready to accept control commands
*
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
deactivate(callback: AsyncCallback<void>): void;
* Deactivate the session, indicating that the session not ready to accept control commands
*
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
deactivate(): Promise<void>;
* Destroy this session, the server will clean up the session resources
*
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
destroy(callback: AsyncCallback<void>): void;
* Destroy this session, the server will clean up the session resources
*
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
destroy(): Promise<void>;
}
* The type of control command
*
* @unionmember { 'play' } Play the current media. [since 10]
* @unionmember { 'pause' } Pause the current media. [since 10]
* @unionmember { 'stop' } Stop the current media. [since 10]
* @unionmember { 'playNext' } Play the next media in the queue. [since 10]
* @unionmember { 'playPrevious' } Play the previous media in the queue. [since 10]
* @unionmember { 'fastForward' } Fast forward the current media. [since 10]
* @unionmember { 'rewind' } Rewind the current media. [since 10]
* @unionmember { 'seek' } Seek to a specific position in the media. [since 10]
* @unionmember { 'setVolume' } Adjust volume for the media. [since 10]
* @unionmember { 'setSpeed' } Set the playback speed.. [since 10]
* @unionmember { 'setLoopMode' } Set the loop mode for the media. [since 10]
* @unionmember { 'toggleFavorite' } Toggle the favorite status of the current media. [since 10]
* @unionmember { 'toggleMute' } Toggle the mute status of the media. [since 10]
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
type AVCastControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' |
'seek' | 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute';
* The definition of cast command to be sent to the session
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVCastControlCommand {
* The command value {@link AVCastControlCommandType}
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
parameter?: media.PlaybackSpeed | double | string | LoopMode;
}
* AVCastController definition used to implement a remote control when a cast is connected
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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<void> } 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 dynamic
* @since 23 static
*/
setDisplaySurface(surfaceId: string, callback: AsyncCallback<void>): 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<void> } 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 dynamic
* @since 23 static
*/
setDisplaySurface(surfaceId: string): Promise<void>;
* Get the playback status of the current player
*
* @param { AsyncCallback<AVPlaybackState> } callback - The triggered asyncCallback when (getAVPlaybackState).
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 10 dynamic
* @since 23 static
*/
getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void;
* Get the playback status of the current player
*
* @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
getAVPlaybackState(): Promise<AVPlaybackState>;
* Get supported decoders of remote player.
*
* @returns { Promise<Array<DecoderType>> } (DecoderType) returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
getSupportedDecoders(): Promise<Array<DecoderType>>;
* Get recommended resolution of remote player based on each decoder.
*
* @param { DecoderType } decoderType - The decoder type.
* @returns { Promise<ResolutionLevel> } ResolutionLevel returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
getRecommendedResolutionLevel(decoderType: DecoderType): Promise<ResolutionLevel>;
* Get supported hdr capabilities of remote player.
*
* @returns { Promise<Array<hdrCapability.HDRFormat>> } HDRFormat returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
getSupportedHdrCapabilities(): Promise<Array<hdrCapability.HDRFormat>>;
* Get supported speed of remote player.
*
* @returns { Promise<Array<double>> } supported speed returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
getSupportedPlaySpeeds(): Promise<Array<double>>;
* Send control commands to remote player
*
* @param { AVCastControlCommand } command The command to be send.
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
sendControlCommand(command: AVCastControlCommand, callback: AsyncCallback<void>): void;
* Send control commands to remote player
*
* @param { AVCastControlCommand } command The command to be send.
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
sendControlCommand(command: AVCastControlCommand): Promise<void>;
* Play the current item, should contain mediaUri otherwise the playback will fail.
*
* @param { AVQueueItem } item media item info.
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
start(item: AVQueueItem, callback: AsyncCallback<void>): void;
* Play the current item, should contain mediaUri otherwise the playback will fail.
*
* @param { AVQueueItem } item media item info.
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
start(item: AVQueueItem): Promise<void>;
* 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<void> } 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 dynamic
* @since 23 static
*/
prepare(item: AVQueueItem, callback: AsyncCallback<void>): 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<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
prepare(item: AVQueueItem): Promise<void>;
* Get the current playing item
*
* @param { AsyncCallback<AVQueueItem> } callback - The triggered asyncCallback.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 10 dynamic
* @since 23 static
*/
getCurrentItem(callback: AsyncCallback<AVQueueItem>): void;
* Get the current playing item
*
* @returns { Promise<AVQueueItem> } (AVQueueItem) returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
getCurrentItem(): Promise<AVQueueItem>;
* Get commands supported by the current cast controller
*
* @param { AsyncCallback<Array<AVCastControlCommandType>> } callback - The triggered asyncCallback when (
* getValidCommands).
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 11 dynamic
* @since 23 static
*/
getValidCommands(callback: AsyncCallback<Array<AVCastControlCommandType>>): void;
* Get commands supported by the current cast controller
*
* @returns { Promise<Array<AVCastControlCommandType>> } array of AVCastControlCommandType promise
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 11 dynamic
* @since 23 static
*/
getValidCommands(): Promise<Array<AVCastControlCommandType>>;
* 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> } 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 dynamic
* @since 23 static
*/
processMediaKeyResponse(assetId: string, response: Uint8Array): Promise<void>;
* Sends custom data to a remote device.
*
* @param { Record<string, Object> } data Custom data populated by the application.
* @returns { Promise<void> } Promise that returns no value.
* @throws { BusinessError } 6600101 - Session service exception.
* You are advised to:1.Scheduled retry.2.Destroy the current session or session controller and re-create it.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
sendCustomData(data: Record<string, Object>): Promise<void>;
* Destroy the controller
*
* @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 11 dynamic
* @since 23 static
*/
release(callback: AsyncCallback<void>): void;
* Destroy the controller
*
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
release(): Promise<void>;
* Register playback state changed callback
*
* @param { 'playbackStateChange' } type
* @param { Array<keyof AVPlaybackState> | '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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void): void;
* Register playback state changed callback
*
* @param { Array<string> } filter - The properties of {@link AVPlaybackState} that you cared about
* @param { Callback<AVPlaybackState> } callback - The callback used to handle playback state changed event.
* The callback function provides the {@link AVPlaybackState} parameter.
* @throws { BusinessError } 6600101 - Session service exception. 1. Required parameters are missing.
* 2. Provided parameters have invalid types.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onPlaybackStateChange(filter: Array<string>, callback: Callback<AVPlaybackState>): void;
* Registers a callback to be invoked whenever the playback state changes
*
* @param { Callback<AVPlaybackState> } callback - The callback used to handle playback state changed event.
* The callback function provides the {@link AVPlaybackState} parameter.
* @throws { BusinessError } 6600101 - Session service exception. 1. Required parameters are missing.
* 2. Provided parameters have invalid types.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onPlaybackStateChangeAll(callback: Callback<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.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void): void;
* Unregister playback state changed callback
*
* @param { Callback<AVPlaybackState> } [callback] - The callback used to handle playback state changed event.
* The callback function provides the {@link AVPlaybackState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offPlaybackStateChange(callback?: Callback<AVPlaybackState>): void;
* Register listener for current media item playback events.
*
* @param { 'mediaItemChange' } type Type of the playback event to listen for.
* @param { Callback<AVQueueItem> } 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]
* @since 10 dynamic
*/
on(type: 'mediaItemChange', callback: Callback<AVQueueItem>): void;
* Register listener for current media item playback events.
*
* @param { Callback<AVQueueItem> } callback Callback used to listen for current item changed.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onMediaItemChange(callback: Callback<AVQueueItem>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'mediaItemChange'): void;
* Unregister listener for current media item playback events.
*
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offMediaItemChange(): 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<void> } 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]
* @since 10 dynamic
*/
on(type: 'playNext', callback: Callback<void>): 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 { NoParamCallback } callback - Used to handle 'playNext' command
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onPlayNext(callback: NoParamCallback): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'playNext'): void;
* Unregister playback command callback sent by remote side or media center.
* When canceling the callback, need to update the supported commands list.
*
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offPlayNext(): 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<void> } 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]
* @since 10 dynamic
*/
on(type: 'playPrevious', callback: Callback<void>): 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 { NoParamCallback } callback - Used to handle 'playPrevious' command
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onPlayPrevious(callback: NoParamCallback): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'playPrevious'): void;
* Unregister playback command callback sent by remote side or media center.
* When canceling the callback, need to update the supported commands list.
*
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offPlayPrevious(): 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<AVQueueItem> } 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 dynamic
*/
on(type: 'requestPlay', callback: Callback<AVQueueItem>): 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 { Callback<AVQueueItem> } callback - Used to handle 'requestPlay' command
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onRequestPlay(callback: Callback<AVQueueItem>): 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<AVQueueItem> } 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 dynamic
*/
off(type: 'requestPlay', callback?: Callback<AVQueueItem>): void;
* Unregister requested playback command callback sent by remote side or media center.
*
* @param { Callback<AVQueueItem> } [callback] - Used to handle 'requestPlay' command
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offRequestPlay(callback?: Callback<AVQueueItem>): 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<void> } 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 dynamic
*/
on(type: 'endOfStream', callback: Callback<void>): void;
* Register endOfStream state callback.
* Application needs update the new media resource when receive these commands by using playItem.
*
* @param { NoParamCallback } callback - Used to handle 'endOfStream' command
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onEndOfStream(callback: NoParamCallback): void;
* Unregister endOfStream state callback.
*
* @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for.
* @param { Callback<void> } 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 dynamic
*/
off(type: 'endOfStream', callback?: Callback<void>): void;
* Unregister endOfStream state callback.
*
* @param { NoParamCallback } [callback] - Used to handle 'endOfStream' command
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offEndOfStream(callback?: NoParamCallback): void;
* Register listens for playback events.
*
* @param { 'seekDone' } type - Type of the 'seekDone' to listen for.
* @param { Callback<int> } 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]
* @since 10 dynamic
*/
on(type: 'seekDone', callback: Callback<int>): void;
* Register listens for playback events.
*
* @param { Callback<int> } callback - Callback used to listen for the playback seekDone event.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onSeekDone(callback: Callback<int>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'seekDone'): void;
* Unregister listens for playback events.
*
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offSeekDone(): void;
* Register the valid commands of the casted session changed callback
*
* @param { 'validCommandChange' } type - 'validCommandChange'
* @param { Callback<Array<AVCastControlCommandType>> } 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
* @FaAndStageModel
* @since 11 dynamic
*/
on(type: 'validCommandChange', callback: Callback<Array<AVCastControlCommandType>>);
* Register the valid commands of the casted session changed callback
*
* @param { Callback<Array<AVCastControlCommandType>> } callback - The callback used to handle the changes.
* The callback function provides an array of AVCastControlCommandType.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onValidCommandChange(callback: Callback<Array<AVCastControlCommandType>>): void;
* Unregister the valid commands of the casted session changed callback
*
* @param { 'validCommandChange' } type - 'validCommandChange'
* @param { Callback<Array<AVCastControlCommandType>> } 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
* @FaAndStageModel
* @since 11 dynamic
*/
off(type: 'validCommandChange', callback?: Callback<Array<AVCastControlCommandType>>);
* Unregister the valid commands of the casted session changed callback
*
* @param { Callback<Array<AVCastControlCommandType>> } [callback] - The callback used to handle the changes.
* The callback function provides an array of AVCastControlCommandType.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offValidCommandChange(callback?: Callback<Array<AVCastControlCommandType>>): void;
* 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 dynamic
*/
on(type: 'videoSizeChange', callback: (width: int, height: int) => void): void;
* Register listener for video size change event, used at remote side.
*
* @param { VideoSizeEvent } callback - Callback used to return video size.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onVideoSizeChange(callback: VideoSizeEvent): 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 dynamic
*/
off(type: 'videoSizeChange'): void;
* Unregister listener for video size change event, used at remote side.
*
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offVideoSizeChange(): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'error', callback: ErrorCallback): void;
* Register listeners for playback error events.
*
* @param { ErrorCallback } callback Callback used to listen for the playback error event.
* @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 23 static
*/
onError(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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'error'): void;
* Unregister listens for playback error events.
*
* @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 23 static
*/
offError(): 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 dynamic
*/
on(type: 'castControlGenericError', callback: ErrorCallback): void;
* Register listeners for cast control generic error events.
*
* @param { ErrorCallback } callback Callback used to listen for the cast control error event.
* @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
* @since 23 static
*/
onCastControlGenericError(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 dynamic
*/
off(type: 'castControlGenericError', callback?: ErrorCallback): void;
* Unregister listeners for cast control generic error events.
*
* @param { ErrorCallback } [callback] - Callback used to listen for the cast control error event.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCastControlGenericError(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 dynamic
*/
on(type: 'castControlIoError', callback: ErrorCallback): void;
* Register listeners for cast control input/output error events.
*
* @param { ErrorCallback } callback Callback used to listen for the cast control error event.
* @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
* @since 23 static
*/
onCastControlIoError(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 dynamic
*/
off(type: 'castControlIoError', callback?: ErrorCallback): void;
* Unregister listeners for cast control input/output error events.
*
* @param { ErrorCallback } [callback] - Callback used to listen for the cast control error event.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCastControlIoError(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 dynamic
*/
on(type: 'castControlParsingError', callback: ErrorCallback): void;
* Register listeners for cast control parsing error events.
*
* @param { ErrorCallback } callback Callback used to listen for the cast control error event.
* @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
* @since 23 static
*/
onCastControlParsingError(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 dynamic
*/
off(type: 'castControlParsingError', callback?: ErrorCallback): void;
* Unregister listeners for cast control parsing error events.
*
* @param { ErrorCallback } [callback] - Callback used to listen for the cast control error event.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCastControlParsingError(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 dynamic
*/
on(type: 'castControlDecodingError', callback: ErrorCallback): void;
* Register listeners for cast control decoding error events.
*
* @param { ErrorCallback } callback Callback used to listen for the cast control error event.
* @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
* @since 23 static
*/
onCastControlDecodingError(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 dynamic
*/
off(type: 'castControlDecodingError', callback?: ErrorCallback): void;
* Unregister listeners for cast control decoding error events.
*
* @param { ErrorCallback } [callback] - Callback used to listen for the cast control error event.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCastControlDecodingError(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 dynamic
*/
on(type: 'castControlAudioRendererError', callback: ErrorCallback): void;
* Register listeners for cast control audio renderer error error events.
*
* @param { ErrorCallback } callback Callback used to listen for the cast control error event.
* @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
* @since 23 static
*/
onCastControlAudioRendererError(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 dynamic
*/
off(type: 'castControlAudioRendererError', callback?: ErrorCallback): void;
* Unregister listeners for cast control audio renderer error events.
*
* @param { ErrorCallback } [callback] - Callback used to listen for the cast control error event.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCastControlAudioRendererError(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 dynamic
*/
on(type: 'castControlDrmError', callback: ErrorCallback): void;
* Register listeners for cast control drm error events.
*
* @param { ErrorCallback } callback Callback used to listen for the cast control error event.
* @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
* @since 23 static
*/
onCastControlDrmError(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 dynamic
*/
off(type: 'castControlDrmError', callback?: ErrorCallback): void;
* Unregister listeners for cast control drm error events.
*
* @param { ErrorCallback } [callback] - Callback used to listen for the cast control error event.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCastControlDrmError(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 dynamic
*/
on(type: 'keyRequest', callback: KeyRequestCallback): void;
* Register listener for drm key request.
*
* @param { KeyRequestCallback } callback - Callback used to request drm key.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onKeyRequest(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 dynamic
*/
off(type: 'keyRequest', callback?: KeyRequestCallback): void;
* Unregister listener for drm key request.
*
* @param { KeyRequestCallback } [callback] - Callback used to request drm key.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offKeyRequest(callback?: KeyRequestCallback): void;
* Register listener for custom data sent from remote device.
*
* @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for.
* @param { Callback<Record<string, Object>> } callback - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
*/
on(type: 'customDataChange', callback: Callback<Record<string, Object>>): void;
* Register listener for custom data sent from remote device.
*
* @param { Callback<Record<string, Object>> } callback - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onCustomDataChange(callback: Callback<Record<string, Object>>): void;
* Unregister listener for custom data sent from remote device.
*
* @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for.
* @param { Callback<Record<string, Object>> } [callback] - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
*/
off(type: 'customDataChange', callback?: Callback<Record<string, Object>>): void;
* Unregister listener for custom data sent from remote device.
*
* @param { Callback<Record<string, Object>> } [callback] - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCustomDataChange(callback?: Callback<Record<string, Object>>): void;
}
* A helper to enable a picker to select output devices
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 14 dynamic
* @since 23 static
*/
class AVCastPickerHelper {
* The constructor used to create a AVCastPickerHelper object.
*
* @param { Context } context - represents the context.
* @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 14 dynamic
* @since 23 static
*/
constructor(context: Context);
* Pull up the avcastpicker based on the options.
*
* @param { AVCastPickerOptions } [options] - represents the options provided to the picker.
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified.
* 2.Incorrect parameter types.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 14 dynamic
* @since 23 static
*/
select(options?: AVCastPickerOptions): Promise<void>;
* Reset audio device to be default set by the platform which is used for communication use cases
* including voice or video calls.
* For example, the audio output device will be switched to earpiece for voice call and
* to speaker for video call on phone.
*
* @returns { Promise<void> } void promise when executed successfully
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 21 dynamic
* @since 24 static
*/
resetCommunicationDevice(): Promise<void>;
* Register picker state change callback.
*
* @param { 'pickerStateChange' } type - 'pickerStateChange'
* @param { Callback<AVCastPickerState> } callback - The callback used to handle picker state changed 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 14 dynamic
*/
on(type: 'pickerStateChange', callback: Callback<AVCastPickerState>) : void;
* Register picker state change callback.
*
* @param { Callback<AVCastPickerState> } callback - The callback used to handle picker state changed event.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onPickerStateChange(callback: Callback<AVCastPickerState>) : void;
* Unregister picker state change callback.
*
* @param { 'pickerStateChange' } type - 'pickerStateChange'
* @param { Callback<AVCastPickerState> } callback - The callback used to handle picker state changed 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 14 dynamic
*/
off(type: 'pickerStateChange', callback?: Callback<AVCastPickerState>) : void;
* Unregister picker state change callback.
*
* @param { Callback<AVCastPickerState> } [callback] - The callback used to handle picker state changed event.
* @throws { BusinessError } 6600101 - Session service exception.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offPickerStateChange(callback?: Callback<AVCastPickerState>) : void;
}
* Audio capabilities.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
interface AudioCapabilities {
* Audio stream information.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
readonly streamInfos: Array<audio.AudioStreamInfo>;
}
* Position definition of one component on which the menu will bind and popup.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
interface MenuPosition {
* Coordinate x of the position of the component, uint is vp.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
x: int;
* Coordinate y of the position of the component, uint is vp.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
y: int;
* Component width, uint is vp.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
width: int;
* Component height, uint is vp.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 22 dynamic
* @since 24 static
*/
height: int;
}
* An option to make different picker usage
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 14 dynamic
* @since 23 static
*/
interface AVCastPickerOptions {
* Indicates current session type to show different picker ui.
* If not set, default value is 'audio'.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 14 dynamic
* @since 23 static
*/
sessionType?: AVSessionType;
* Set the picker style.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 22 dynamic
* @since 24 static
*/
pickerStyle?: AVCastPickerStyle;
* Set the popup menu position if pickerstyple is set to STYLE_MENU.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 22 dynamic
* @since 24 static
*/
menuPosition?: MenuPosition;
}
* The callback of key request.
*
* @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 dynamic
* @since 23 static
*/
type KeyRequestCallback = (assetId: string, requestData: Uint8Array) => void;
* Enumerates the cast display states.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
enum CastDisplayState {
* Screen off.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
STATE_OFF = 1,
* Screen on.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
STATE_ON = 2,
}
* Define the information for extended display screen.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
interface CastDisplayInfo {
* Display ID.
* The application can get more display information based on the same id from display interface.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
id: long;
* Display name.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
name: string;
* The state of display.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
state: CastDisplayState;
* Display width, in pixels.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
width: int;
* Display height, in pixels.
*
* @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
height: int;
}
* Define the device connection state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
enum ConnectionState {
* A connection state indicating the device is in the process of connecting.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
STATE_CONNECTING = 0,
* A connection state indicating the device is connected.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
STATE_CONNECTED = 1,
* The default connection state indicating the device is disconnected.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
STATE_DISCONNECTED = 6,
* Authenticating with a remote device.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
STATE_AUTHENTICATING = 10,
* Mirroring to the stream.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
STATE_MIRROR_TO_STREAM = 11,
* Streaming to the mirror.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
STATE_STREAM_TO_MIRROR = 12
}
* The pre-defined display tag by system.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
enum DisplayTag {
* Indicate the AUDIO VIVID property of current media resource.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
TAG_AUDIO_VIVID = 1
}
* The defination of decoder type.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
enum DecoderType {
* Defination of avc codec type.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
OH_AVCODEC_MIMETYPE_VIDEO_AVC = 'video/avc',
* Defination of hevc codec type.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
OH_AVCODEC_MIMETYPE_VIDEO_HEVC = 'video/hevc',
* Defination of audio vivid codec type.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
OH_AVCODEC_MIMETYPE_AUDIO_VIVID = 'audio/av3a'
}
* The defination of suggested resolution.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
enum ResolutionLevel {
* Defination of 480P which typically resolution is 640*480.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
RESOLUTION_480P = 0,
* Defination of 720P which typically resolution is 1280*720.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
RESOLUTION_720P = 1,
* Defination of 1080P which typically resolution is 1920*1080.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
RESOLUTION_1080P = 2,
* Defination of 2K which typically resolution is 2560*1440.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
RESOLUTION_2K = 3,
* Defination of 4K which typically resolution is 4096*3840.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 19 dynamic
* @since 23 static
*/
RESOLUTION_4K = 4
}
* The play list information definition.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
interface AVQueueInfo {
* The bundle name of application which current play list belongs to.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
bundleName: string;
* The name of play list
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
avQueueName: string;
* The id of play list
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
avQueueId: string;
* The artwork of play list, can be a {@link PixelMap} or a URI formatted string,
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
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.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
lastPlayedTime?: long;
}
* Define some common extra keys used in different scenarios.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
enum ExtraKey {
* Set required abilities to the system.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
REQUIRE_ABILITY_LIST = 'requireAbilityList',
* Informs the system that the app supports URL casting.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
SUPPORT_URL_CASTING = 'url-cast',
* Inform the system that the live view card should be hidden on the keyguard.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
LIVE_VIEW_HIDDEN_WHEN_KEYGUARD = 'hw_live_view_hidden_when_keyguard',
* Key for DLNA CurrentURIMetadata extra parameter.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DLNA_CURRENT_URI_METADATA = 'CurrentURIMetadata',
* Key for DLNA DIDL-Lite extra parameter.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DLNA_DIDL_LITE = 'DIDL-Lite'
}
* The metadata of the current media.Used to set the properties of the current media file
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVMetadata {
* Unique ID used to represent this media.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
assetId: string;
* The title of this media, for display in media center.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
title?: string;
* The artist of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
artist?: string;
* The author of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
author?: string;
* The name of play list which current media belongs to
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 12 dynamic
* @since 23 static
*/
avQueueName?: string;
* The id of play list which current media belongs to, it should be an unique identifier in the application.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
avQueueId?: string;
* The artwork of play list as a {@link PixelMap} or an uri formatted String,
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
avQueueImage?: image.PixelMap | string;
* The album of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
album?: string;
* The writer of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
writer?: string;
* The composer of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 10 dynamic
* @since 23 static
*/
composer?: string;
* The duration of this media, used to automatically calculate playback position, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
duration?: long;
* The image of the media as a {@link PixelMap} or an uri formatted String,
* used to display in media center.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
mediaImage?: image.PixelMap | string;
* The image of the bundle icon as a {@link PixelMap}, no need to be set by application.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 18 dynamic
* @since 23 static
*/
readonly bundleIcon?: image.PixelMap;
* The publishDate of the media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 10 dynamic
* @since 23 static
*/
publishDate?: Date;
* The subtitle of the media, used for display
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
subtitle?: string;
* The description of the media, used for display
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
description?: string;
* The lyric of the media, it should be in standard lyric format
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 10 dynamic
* @since 23 static
*/
lyric?: string;
* The single lyric text of the media, not including time prefix
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 17 dynamic
* @since 23 static
*/
singleLyricText?: string;
* The previous playable media id.
* Used to tell the controller if there is a previous playable media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
previousAssetId?: string;
* The next playable media id.
* Used to tell the controller if there is a next playable media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
nextAssetId?: string;
* The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}.
* See {@link ProtocolType}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
filter?: int;
* The drm schemes supported by this session which are represented by uuid.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 12 dynamic
* @since 23 static
*/
drmSchemes?: Array<string>;
* The supported skipIntervals when doing fast forward and rewind operation, the default is {@link SECONDS_15}.
* See {@link SkipIntervals}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
skipIntervals?: SkipIntervals;
* The display tags supported by application to be displayed on media center
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
displayTags?: int;
* The supported skipIntervals when doing rewind operation, the default is {@link SECONDS_15}.
* The system will use this value for rewind skip intervals instead of {@link skipIntervals}.
* If not set, the rewind skip intervals still use {@link skipIntervals}.
* See {@link SkipIntervals}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
rewindSkipIntervals?: SkipIntervals;
* The supported skipIntervals when doing fast forward operation, the default is {@link SECONDS_15}.
* The system will use this value for fastforward skip intervals instead of {@link skipIntervals}.
* If not set, the fast forward skip intervals still use {@link skipIntervals}.
* See {@link SkipIntervals}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
fastForwardSkipIntervals?: SkipIntervals;
}
* The description of the media for an item in the playlist of the session
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVMediaDescription {
* Unique ID used to represent this media.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
assetId: string;
* The title of this media, for display in media center.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
title?: string;
* The subtitle of the media, used for display
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
subtitle?: string;
* The description of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
description?: string;
* The image of this media asset displayed in the media center.
* It can be a {@link PixelMap} or a URI formatted string,
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
mediaImage?: image.PixelMap | string;
* Any additional attributes that can be represented as key-value pairs
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @FaAndStageModel
* @since 10 dynamic
*/
extras?: {[key: string]: Object};
* Any additional attributes that can be represented as key-value pairs
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
extras?: Record<string, Object>;
* The type of this media, such as video, audio and so on.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
mediaType?: string;
* The size of this media.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
mediaSize?: int;
* The album title of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
albumTitle?: string;
* The album cover uri of this media
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
albumCoverUri?: string;
* The lyric content of the media, it should be in standard lyric format
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
lyricContent?: string;
* The lyric uri of the media.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
lyricUri?: string;
* The artist of this media.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
artist?: string;
* The uri of the media, used to locate the media in some special cases
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
mediaUri?: string;
* Media file descriptor.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
fdSrc?: media.AVFileDescriptor;
* DataSource descriptor. The caller ensures the fileSize and callback are valid.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 12 dynamic
* @since 23 static
*/
dataSrc?: media.AVDataSrcDescriptor;
* Source type that supports PCM casting.
* The application can send PCM data directly to the system through audio APIs, without using AVSession to set data.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
pcmSrc?: boolean;
* The drm scheme supported by this resource which is represented by uuid.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 12 dynamic
* @since 23 static
*/
drmScheme?: string;
* The duration of this media, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
duration?: int;
* Media start position, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
startPosition?: int;
* Media credits position, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
creditsPosition?: int;
* Application name.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
appName?: string;
* The display tags supported by application to be displayed on media center
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
displayTags?: int;
* Custom data sent by the application to the receiver during casting.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
launchClientData?: string;
}
* The item in the playlist of the session
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVQueueItem {
* Sequence number of the item in the playlist.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
itemId: int;
* The media description of the item in the playlist.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVPlaybackState {
* Current playback state. See {@link PlaybackState}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
state?: PlaybackState;
* Current playback speed
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
speed?: double;
* Current playback position of this media. See {@link PlaybackPosition}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
position?: PlaybackPosition;
* The current buffered time, the maximum playable position, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
bufferedTime?: long;
* Current playback loop mode. See {@link LoopMode}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
loopMode?: LoopMode;
* Current Favorite Status
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
isFavorite?: boolean;
* Current active item id
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
activeItemId?: int;
* Current player volume
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
volume?: int;
* maximum volume
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
maxVolume?: int;
* Current muted status
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
muted?: boolean;
* The duration of this media asset, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
duration?: int;
* The video width of this media asset.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
videoWidth?: int;
* The video height of this media asset.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
videoHeight?: int;
* Current custom media packets
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
extras?: {[key: string]: Object};
* Current custom media packets
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 23 static
*/
extras?: Record<string, Object>;
}
* Playback position definition
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface PlaybackPosition {
* Elapsed time(position) of this media set by the app, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
elapsedTime: long;
* Record the system time when elapsedTime is set, described by milliseconds.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
updateTime: long;
}
* The metadata of the current call.
*
* @interface CallMetadata [since 11 - 11]
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
interface CallMetadata {
* The displayed user name of current call.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
name?: string;
* The phone number of current call.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
phoneNumber?: string;
* The displayed picture that represents a particular user.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
avatar?: image.PixelMap;
}
* Used to indicate the call state of the current call.
*
* @interface AVCallState [since 11 - 11]
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
interface AVCallState {
* Current call state. See {@link CallState}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
state: CallState;
* Current muted status.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
muted: boolean;
}
* Enumeration of current call state
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
enum CallState {
* Idle state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_IDLE = 0,
* Incoming state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_INCOMING = 1,
* Active state in calling.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_ACTIVE = 2,
* Dialing state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_DIALING = 3,
* Waiting state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_WAITING = 4,
* Holding state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_HOLDING = 5,
* Disconnecting state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
CALL_STATE_DISCONNECTING = 6,
}
* cast category indicating different playback scenes
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
CATEGORY_REMOTE = 1,
}
* Device type definition
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
enum DeviceType {
* 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]
* @since 10 dynamic
* @since 23 static
*/
DEVICE_TYPE_LOCAL = 0,
* A device type indicating the route is on a TV.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
DEVICE_TYPE_TV = 2,
* A device type indicating the route is on a smart speaker.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
DEVICE_TYPE_SMART_SPEAKER = 3,
* The device type is a car.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DEVICE_TYPE_CAR = 4,
* The device type is a pad.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DEVICE_TYPE_PAD = 6,
* A default device which supports Cast+ Stream protocol.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DEVICE_TYPE_DEFAULT_CAST_PLUS_STREAM = 7,
* The device type is a 2in1.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DEVICE_TYPE_2IN1 = 8,
* A device type indicating the route is on a bluetooth device.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
DEVICE_TYPE_BLUETOOTH = 10,
* The device which supports HiPlay protocol.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
DEVICE_TYPE_HIPLAY = 15,
}
* HiPlay Device Information Definition
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 24 dynamic&static
*/
interface HiPlayDeviceInfo {
* HiPlay device supports cast mode.
* when device both support device level cast and app level cast, support cast mode is DEVICE_LEVEL_CAST|
* APP_LEVEL_CAST
* 1: DEVICE_LEVEL_CAST
* 2: APP_LEVEL_CAST
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 24 dynamic&static
*/
supportCastMode?: int;
* HiPlay device cast mode.
* 1: DEVICE_LEVEL_CAST
* 2: APP_LEVEL_CAST
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 24 dynamic&static
*/
castMode?: int;
* HiPlay device current cast uid.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @stagemodelonly
* @atomicservice
* @since 24 dynamic&static
*/
castUid?: int;
}
* Device Information Definition
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface DeviceInfo {
* The playback type supported by the device. See {@link AVCastCategory}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
castCategory: AVCastCategory;
* Audio device id.The length of the audioDeviceId array is greater than 1
* if output to multiple devices at the same time.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
deviceId: string;
* Device name. The length of the deviceName array is greater than 1
* if output to multiple devices at the same time.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
deviceName: string;
* device type.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
deviceType: DeviceType;
* Device manufacturer.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
manufacturer?: string;
* Device model name.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
modelName?: string;
* Network id.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 13 dynamic
* @since 23 static
*/
networkId?: string;
* device ip address if available.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
ipAddress?: string;
* device provider which supplies the route capability.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 10 dynamic
* @since 23 static
*/
providerId?: int;
* The protocols supported by current device, can be union of {@link ProtocolType}.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
supportedProtocols?: int;
* The drm capability supported by current device, each drm is represented by uuid.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 12 dynamic
* @since 23 static
*/
supportedDrmCapabilities?: Array<string>;
* Whether the device supports pull-end playback, including a collection of pull-end client IDs.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
supportedPullClients?: Array<int>;
* Define different authentication status.
* 0: Device not authenticated.
* 1: Device already authenticated.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 11 dynamic
* @since 23 static
*/
authenticationStatus?: int;
* Indicates the current device is legacy or not.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 13 dynamic
* @since 23 static
*/
isLegacy?: boolean;
* Medium types used to discover devices.
* 1: BLE
* 2: COAP
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @since 13 dynamic
* @since 23 static
*/
mediumTypes?: int;
* Audio capabilities supported by the device.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
audioCapabilities?: AudioCapabilities;
* HiPlayDeviceInfo is used to obtain device-specific information for HiPlay.
* transmit info during casting.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @systemapi
* @stagemodelonly
* @since 24 dynamic&static
*/
hiPlayDeviceInfo?: HiPlayDeviceInfo;
}
* Target Device Information Definition
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface OutputDeviceInfo {
* Arrays of device information
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
devices: Array<DeviceInfo>;
}
* Loop Play Mode Definition
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
enum LoopMode {
* The default mode is sequential playback
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
LOOP_MODE_SEQUENCE = 0,
* Single loop mode
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
LOOP_MODE_SINGLE = 1,
* List loop mode
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
LOOP_MODE_LIST = 2,
* Shuffle playback mode
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
LOOP_MODE_SHUFFLE = 3,
* Custom playback mode supported by application
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
LOOP_MODE_CUSTOM = 4
}
* Supported skip intervals definition
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
enum SkipIntervals {
* 10 seconds
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
SECONDS_10 = 10,
* 15 seconds
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
SECONDS_15 = 15,
* 30 seconds
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 11 dynamic
* @since 23 static
*/
SECONDS_30 = 30,
}
* Supported background play mode definitions.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 24 dynamic&static
*/
enum BackgroundPlayMode {
* Enable background playback
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 24 dynamic&static
*/
ENABLE_BACKGROUND_PLAY = 0,
* Disable background playback
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 24 dynamic&static
*/
DISABLE_BACKGROUND_PLAY = 1
}
* Definition of current playback state
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
enum PlaybackState {
* Initial state. The initial state of media file
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_PREPARE = 1,
* Playing state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_PLAY = 2,
* Paused state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_PAUSE = 3,
* Fast forwarding state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_FAST_FORWARD = 4,
* Rewinding state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_REWIND = 5,
* Stopped state.The server will clear the media playback position and other information.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_STOP = 6,
* Completed state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_COMPLETED = 7,
* Released state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_RELEASED = 8,
* error state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
PLAYBACK_STATE_ERROR = 9,
* Idle state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
PLAYBACK_STATE_IDLE = 10,
* Buffering state.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 11 dynamic
* @since 23 static
*/
PLAYBACK_STATE_BUFFERING = 11
}
* The description of the session
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
interface AVSessionDescriptor {
* Unique ID of the session
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
sessionId: string;
* Session type, currently supports audio or video
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
type: AVSessionType;
* The session tag set by the application
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
sessionTag: string;
* The elementName of the ability that created this session. See {@link ElementName} in bundle/elementName.d.ts
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
elementName: ElementName;
* Session active state
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
isActive: boolean;
* Is it the top priority session
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi [since 9 - 22]
* @publicapi [since 23]
* @since 9 dynamic
* @since 23 static
*/
isTopSession: boolean;
* The current output device information.
* It will be undefined if this is a local session.
*
* @syscap SystemCapability.Multimedia.AVSession.Manager
* @systemapi
* @since 9 dynamic
* @since 23 static
*/
outputDevice: OutputDeviceInfo;
}
* The extra info object.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 18 dynamic
*/
type ExtraInfo = {[key: string]: Object; }
* The extra info object.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
type ExtraInfo = Record<string, Object>;
* Session controller,used to control media playback and get media information
*
* @interface AVSessionController [since 10 - 11]
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVSessionController {
* Unique session Id
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
readonly sessionId: string;
* Get the playback status of the current session
*
* @param { AsyncCallback<AVPlaybackState> } 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 dynamic
* @since 23 static
*/
getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void;
* Get the playback status of the current session
*
* @returns { Promise<AVPlaybackState> } (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]
* @since 10 dynamic
* @since 23 static
*/
getAVPlaybackState(): Promise<AVPlaybackState>;
* 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]
* @since 10 dynamic
* @since 23 static
*/
getAVPlaybackStateSync(): AVPlaybackState;
* Get the metadata of the current session
*
* @param { AsyncCallback<AVMetadata> } 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 dynamic
* @since 23 static
*/
getAVMetadata(callback: AsyncCallback<AVMetadata>): void;
* Get the metadata of the current session
*
* @returns { Promise<AVMetadata> } (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]
* @since 10 dynamic
* @since 23 static
*/
getAVMetadata(): Promise<AVMetadata>;
* 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]
* @since 10 dynamic
* @since 23 static
*/
getAVMetadataSync(): AVMetadata;
* Get the call status of the current session
*
* @param { AsyncCallback<AVCallState> } 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 dynamic
* @since 23 static
*/
getAVCallState(callback: AsyncCallback<AVCallState>): void;
* Get the call status of the current session
*
* @returns { Promise<AVCallState> } (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 dynamic
* @since 23 static
*/
getAVCallState(): Promise<AVCallState>;
* Get the call metadata of the current session
*
* @param { AsyncCallback<CallMetadata> } 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 dynamic
* @since 23 static
*/
getCallMetadata(callback: AsyncCallback<CallMetadata>): void;
* Get the call metadata of the current session
*
* @returns { Promise<CallMetadata> } (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 dynamic
* @since 23 static
*/
getCallMetadata(): Promise<CallMetadata>;
* Get the name of the playlist of the current session
*
* @param { AsyncCallback<string> } 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 dynamic
* @since 23 static
*/
getAVQueueTitle(callback: AsyncCallback<string>): void;
* Get the name of the playlist of the current session
*
* @returns { Promise<string> } (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]
* @since 10 dynamic
* @since 23 static
*/
getAVQueueTitle(): Promise<string>;
* 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]
* @since 10 dynamic
* @since 23 static
*/
getAVQueueTitleSync(): string;
* Get the playlist of the current session
*
* @param { AsyncCallback<Array<AVQueueItem>> } 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 dynamic
* @since 23 static
*/
getAVQueueItems(callback: AsyncCallback<Array<AVQueueItem>>): void;
* Get the playlist of the current session
*
* @returns { Promise<Array<AVQueueItem>> } (Array<AVQueueItem>) 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]
* @since 10 dynamic
* @since 23 static
*/
getAVQueueItems(): Promise<Array<AVQueueItem>>;
* Get the playlist of the current session
*
* @returns { Array<AVQueueItem> } (Array<AVQueueItem>) 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]
* @since 10 dynamic
* @since 23 static
*/
getAVQueueItemsSync(): Array<AVQueueItem>;
* Set the item in the playlist to be played
*
* @param { int } itemId - The serial number of the item to be played
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
skipToQueueItem(itemId: int, callback: AsyncCallback<void>): void;
* Set the item in the playlist to be played
*
* @param { int } itemId - The serial number of the item to be played
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
skipToQueueItem(itemId: int): Promise<void>;
* Get output device information
*
* @param { AsyncCallback<OutputDeviceInfo> } 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 dynamic
* @since 23 static
*/
getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void;
* Get output device information
*
* @returns { Promise<OutputDeviceInfo> } (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]
* @since 10 dynamic
* @since 23 static
*/
getOutputDevice(): Promise<OutputDeviceInfo>;
* 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]
* @since 10 dynamic
* @since 23 static
*/
getOutputDeviceSync(): OutputDeviceInfo;
* Get supported speeds supplied by application.
*
* @returns { Promise<Array<double>> } Promise that returns no value.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
getSupportedPlaySpeeds(): Promise<Array<double>>;
* Get supported loop modes supplied by application.
*
* @returns { Promise<Array<LoopMode>> } supported loop modes returned through promise
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
getSupportedLoopModes(): Promise<Array<LoopMode>>;
* Send media key event to this session
*
* @param { KeyEvent } event - The KeyEvent
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void;
* Send media key event to this session
*
* @param { KeyEvent } event - The KeyEvent
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
sendAVKeyEvent(event: KeyEvent): Promise<void>;
* Get the {@link WantAgent} of this session that can launch the session ability
*
* @param { AsyncCallback<WantAgent> } 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 dynamic
* @since 23 static
*/
getLaunchAbility(callback: AsyncCallback<WantAgent>): void;
* Get the {@link WantAgent} of this session that can launch the session ability
*
* @returns { Promise<WantAgent> } 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]
* @since 10 dynamic
* @since 23 static
*/
getLaunchAbility(): Promise<WantAgent>;
* 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 { long } 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]
* @since 10 dynamic
* @since 23 static
*/
getRealPlaybackPositionSync(): long;
* Check if the current session is active
*
* @param { AsyncCallback<boolean> } 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 dynamic
* @since 23 static
*/
isActive(callback: AsyncCallback<boolean>): void;
* Check if the current session is active
*
* @returns { Promise<boolean> } 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]
* @since 10 dynamic
* @since 23 static
*/
isActive(): Promise<boolean>;
* 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]
* @since 10 dynamic
* @since 23 static
*/
isActiveSync(): boolean;
* Destroy the server controller
*
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
destroy(callback: AsyncCallback<void>): void;
* Destroy the server controller
*
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
destroy(): Promise<void>;
* Get commands supported by the current session
*
* @param { AsyncCallback<Array<AVControlCommandType>> } 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 dynamic
* @since 23 static
*/
getValidCommands(callback: AsyncCallback<Array<AVControlCommandType>>): void;
* Get commands supported by the current session
*
* @returns { Promise<Array<AVControlCommandType>> } 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]
* @since 10 dynamic
* @since 23 static
*/
getValidCommands(): Promise<Array<AVControlCommandType>>;
* Get commands supported by the current session
*
* @returns {Array<AVControlCommandType> } 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]
* @since 10 dynamic
* @since 23 static
*/
getValidCommandsSync(): Array<AVControlCommandType>;
* Send control commands to this session
*
* @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand}
* @param { AsyncCallback<void> } 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 dynamic
* @since 23 static
*/
sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void;
* Send control commands to this session
*
* @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand}
* @returns { Promise<void> } 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]
* @since 10 dynamic
* @since 23 static
*/
sendControlCommand(command: AVControlCommand): Promise<void>;
* 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<void> } 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
* @FaAndStageModel
* @since 10 dynamic
*/
sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback<void>): void;
* Send common commands to this session
*
* @param { string } command - The command name to be sent.
* @param { Record<string, Object> } args - The parameters of session event
* @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @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
* @stagemodelonly
* @since 23 static
*/
sendCommonCommand(command: string, args: Record<string, Object>, callback: AsyncCallback<void>): 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> } 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
sendCommonCommand(command: string, args: {[key: string]: Object}): Promise<void>;
* Send common commands to this session
*
* @param { string } command - The command name to be sent.
* @param { Record<string, Object> } args - The parameters of session event
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @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 23 static
*/
sendCommonCommand(command: string, args: Record<string, Object>): Promise<void>;
* 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
* @FaAndStageModel
* @since 10 dynamic
*/
getExtras(callback: AsyncCallback<{[key: string]: Object}>): void;
* Get custom media packets provided by the corresponding session
*
* @param { AsyncCallback<Record<string, Object>> } callback - The triggered asyncCallback when (getExtras).
* @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 23 static
*/
getExtras(callback: AsyncCallback<Record<string, Object>>): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
getExtras(): Promise<{[key: string]: Object}>;
* Get custom media packets provided by the corresponding session
*
* @returns { Promise<Record<string, Object>> } the parameters of extras
* @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 23 static
*/
getExtras(): Promise<Record<string, Object>>;
* Get extra information for remote device, such as volume level, connected devices.
*
* @param { string } extraEvent - the event name to get
* @returns { Promise<ExtraInfo> } the value returned for such event
* @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.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 18 dynamic
* @since 23 static
*/
getExtrasWithEvent(extraEvent: string): Promise<ExtraInfo>;
* Query desktop lyric enabled state for this session.
*
* @returns { Promise<boolean> } return the enabled status
* @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 } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
isDesktopLyricEnabled(): Promise<boolean>;
* Register desktop lyric enable state change callback.
*
* @param { Callback<boolean> } callback - a callback to receive desktop lyric enable state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
onDesktopLyricEnabled(callback: Callback<boolean>): void;
* Unregister desktop lyric enable state change callback.
*
* @param { Callback<boolean> } [callback] - a callback to receive desktop lyric enable state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
offDesktopLyricEnabled(callback?: Callback<boolean>): void;
* Set desktop lyric visible state for this session.
*
* @param { boolean } visible - make desktop lyric window visible or not
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
setDesktopLyricVisible(visible: boolean): Promise<void>;
* Query desktop lyric visible state for this session.
*
* @returns { Promise<boolean> } return desktop lyric visible state
* @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 } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
isDesktopLyricVisible(): Promise<boolean>;
* Register desktop lyric visible state change callback.
*
* @param { Callback<boolean> } callback - a callback to receive desktop lyric window visible state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
onDesktopLyricVisibilityChanged(callback: Callback<boolean>): void;
* Unregister desktop lyric visible state change callback.
*
* @param { Callback<boolean> } [callback] - a callback to receive desktop lyric window visible state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
offDesktopLyricVisibilityChanged(callback?: Callback<boolean>): void;
* Set desktop lyric state such as lock state for this session.
*
* @param { DesktopLyricState } state - The desktop lyric state
* @returns { Promise<void> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
setDesktopLyricState(state: DesktopLyricState): Promise<void>;
* Get desktop lyric state such as lock state for this session.
*
* @returns { Promise<DesktopLyricState> } void promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @throws { BusinessError } 6600110 - The desktop lyrics feature of this application is not enabled.
* @throws { BusinessError } 6600111 - The desktop lyrics feature is not supported.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
getDesktopLyricState(): Promise<DesktopLyricState>;
* Register desktop lyric state changed callback.
*
* @param { Callback<DesktopLyricState> } callback - a callback to receive desktop lyric state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
onDesktopLyricStateChanged(callback: Callback<DesktopLyricState>): void;
* Unregister desktop lyric state changed callback.
*
* @param { Callback<DesktopLyricState> } [callback] - a callback to receive desktop lyric state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 23 dynamic&static
*/
offDesktopLyricStateChanged(callback?: Callback<DesktopLyricState>): void;
* Get media control type that the can be displayed on the media center.
*
* @returns { Promise<Array<AVMediaCenterControlType>> } The control types that the app sets to be displayed
* on the media center. The default value is empty, indicating that the types of the customized
* display control is not set.
* @param { Callback<DesktopLyricState> } callback - a callback to receive desktop lyric state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
getMediaCenterControlType(): Promise<Array<AVMediaCenterControlType>>;
* Register media center control type changed callback.
*
* @param { Callback<Array<AVMediaCenterControlType>> } callback - Callback to receive the changed control types.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
onMediaCenterControlTypeChanged(callback: Callback<Array<AVMediaCenterControlType>>): void;
* Unregister media center control type changed callback.
*
* @param { Callback<Array<AVMediaCenterControlType>> } [callback] - Callback to receive the changed control types.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
offMediaCenterControlTypeChanged(callback?: Callback<Array<AVMediaCenterControlType>>): void;
* Register metadata changed callback
*
* @param { 'metadataChange' } type
* @param { Array<keyof AVMetadata> | '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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'metadataChange', filter: Array<keyof AVMetadata> | 'all', callback: (data: AVMetadata) => void);
* Register metadata changed callback
*
* @param { Array<string> } filter - The properties of {@link AVMetadata} that you cared about
* @param { Callback<AVMetadata> } 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 } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onMetadataChange(filter: Array<string>, callback: Callback<AVMetadata>): void;
* Registers a callback to be invoked whenever any metadata changes
*
* @param { Callback<AVMetadata> } 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 } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onMetadataChangeAll(callback: Callback<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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'metadataChange', callback?: (data: AVMetadata) => void);
* Unregister metadata changed callback
*
* @param { Callback<AVMetadata> } [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 } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offMetadataChange(callback?: Callback<AVMetadata>): void;
* Register playback state changed callback
*
* @param { 'playbackStateChange' } type
* @param { Array<keyof AVPlaybackState> | '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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void);
* Register playback state changed callback
*
* @param { Array<string> } filter - The properties of {@link AVPlaybackState}
* that you cared about
* @param { Callback<AVPlaybackState> } callback - The callback used to handle playback state changed event.
* The callback function provides the {@link AVPlaybackState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onPlaybackStateChange(filter: Array<string>, callback: Callback<AVPlaybackState>): void;
* Registers a callback to be invoked whenever the playback state changes
*
* @param { Callback<AVPlaybackState> } callback - The callback used to handle playback state changed event.
* The callback function provides the {@link AVPlaybackState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onPlaybackStateChangeAll(callback: Callback<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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);
* Unregister playback state changed callback
*
* @param { Callback<AVPlaybackState> } [callback] - The callback used to handle playback state changed event.
* The callback function provides the {@link AVPlaybackState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offPlaybackStateChange(callback?: Callback<AVPlaybackState>): void;
* Register call metadata changed callback
*
* @param { 'callMetadataChange' } type - 'callMetadataChange'
* @param { Array<keyof CallMetadata> | 'all' } filter - The properties of {@link CallMetadata} that you cared about
* @param { Callback<CallMetadata> } 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 11 dynamic
*/
on(type: 'callMetadataChange', filter: Array<keyof CallMetadata> | 'all', callback: Callback<CallMetadata>): void;
* Register call metadata changed callback
*
* @param { Array<string> } filter - The properties of {@link CallMetadata} that you cared about
* @param { Callback<CallMetadata> } 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 } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onCallMetadataChange(filter: Array<string>, callback: Callback<CallMetadata>): void;
* Registers a callback for all call metadata changes
*
* @param { Callback<CallMetadata> } 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 } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onCallMetadataChangeAll(callback: Callback<CallMetadata>): void;
* Unregister call metadata changed callback
*
* @param { 'callMetadataChange' } type - 'callMetadataChange'
* @param { Callback<CallMetadata> } 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]
* @since 11 dynamic
*/
off(type: 'callMetadataChange', callback?: Callback<CallMetadata>): void;
* Unregister call metadata changed callback
*
* @param { Callback<CallMetadata> } [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 } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offCallMetadataChange(callback?: Callback<CallMetadata>): void;
* Register call state changed callback
*
* @param { 'callStateChange' } type - 'callStateChange'
* @param { Array<keyof AVCallState> | 'all' } filter - The properties of {@link AVCallState} that you cared about
* @param { Callback<AVCallState> } 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 11 dynamic
*/
on(type: 'callStateChange', filter: Array<keyof AVCallState> | 'all', callback: Callback<AVCallState>): void;
* Register call state changed callback
*
* @param { Array<string> } filter - The properties of {@link AVCallState} that you cared about
* @param { Callback<AVCallState> } callback - The callback used to handle call state changed event.
* The callback function provides the {@link AVCallState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onCallStateChange(filter: Array<string>, callback: Callback<AVCallState>): void;
* Register a callback for all call attribute changes
*
* @param { Callback<AVCallState> } callback - The callback used to handle call state changed event.
* The callback function provides the {@link AVCallState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onCallStateChangeAll(callback: Callback<AVCallState>): void;
* Unregister playback state changed callback
*
* @param { 'callStateChange' } type - 'callStateChange'
* @param { Callback<AVCallState> } 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]
* @since 11 dynamic
*/
off(type: 'callStateChange', callback?: Callback<AVCallState>): void;
* Unregister playback state changed callback
*
* @param { Callback<AVCallState> } [callback] - The callback used to handle call state changed event.
* The callback function provides the {@link AVCallState} parameter.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offCallStateChange(callback?: Callback<AVCallState>): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'sessionDestroy', callback: () => void);
* Register current session destroyed callback
*
* @param { NoParamCallback } callback - The callback used to handle current session destroyed event.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onSessionDestroy(callback: NoParamCallback): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'sessionDestroy', callback?: () => void);
* Unregister current session destroyed callback
*
* @param { NoParamCallback } [callback] - The callback used to handle current session destroyed event.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSessionDestroy(callback?: NoParamCallback): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'activeStateChange', callback: (isActive: boolean) => void);
* Register the active state of this session changed callback
*
* @param { Callback<boolean> } callback - The callback used to handle the active state of this session changed
* event.
* The callback function provides the changed session state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onActiveStateChange(callback: Callback<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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'activeStateChange', callback?: (isActive: boolean) => void);
* Unregister the active state of this session changed callback
*
* @param { Callback<boolean> } [callback] - The callback used to handle the active state of this session changed
* event.
* The callback function provides the changed session state.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offActiveStateChange(callback?: Callback<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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'validCommandChange', callback: (commands: Array<AVControlCommandType>) => void);
* Register the valid commands of the session changed callback
*
* @param { Callback<Array<AVControlCommandType>> } callback - The callback used to handle the changes.
* The callback function provides an array of AVControlCommandType.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onValidCommandChange(callback: Callback<Array<AVControlCommandType>>): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'validCommandChange', callback?: (commands: Array<AVControlCommandType>) => void);
* Unregister the valid commands of the session changed callback
*
* @param { Callback<Array<AVControlCommandType>> } [callback] - The callback used to handle the changes.
* The callback function provides an array of AVControlCommandType.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offValidCommandChange(callback?: Callback<Array<AVControlCommandType>>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void;
* Register session output device change callback
*
* @param { ConnectionEvent } callback - Used to handle output device changed.
* The callback provide the new device info {@link OutputDeviceInfo}
* and related connection state {@link ConnectionState}.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onOutputDeviceChange(callback: ConnectionEvent): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void;
* Unregister session output device change callback
*
* @param { ConnectionEvent } [callback] - Used to handle output device changed.
* The callback provide the new device info {@link OutputDeviceInfo}
* and related connection state {@link ConnectionState}.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offOutputDeviceChange(callback?: ConnectionEvent): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key: string]: Object}) => void): void;
* Register session event callback
*
* @param { EventProcess } callback - The callback used to handle session event changed event.
* The callback function provides the event string and key-value pair parameters.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onSessionEvent(callback: EventProcess): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key: string]: Object}) => void): void;
* Unregister session event callback
*
* @param { EventProcess } [callback] - Used to cancel a specific listener
* The callback function provides the event string and key-value pair parameters.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offSessionEvent(callback?: EventProcess): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'queueItemsChange', callback: (items: Array<AVQueueItem>) => void): void;
* Register session playlist change callback
*
* @param { Callback<Array<AVQueueItem>> } callback - Used to handle playlist changed.
* The callback provides the new array of AVQueueItem {@link AVQueueItem}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onQueueItemsChange(callback: Callback<Array<AVQueueItem>>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'queueItemsChange', callback?: (items: Array<AVQueueItem>) => void): void;
* Unregister session playlist change callback
*
* @param { Callback<Array<AVQueueItem>> } [callback] - Used to handle playlist changed.
* The callback provides the new array of AVQueueItem {@link AVQueueItem}
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice
* @since 23 static
*/
offQueueItemsChange(callback?: Callback<Array<AVQueueItem>>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'queueTitleChange', callback: (title: string) => void): void;
* Register the name of session playlist change callback
*
* @param { Callback<string> } callback - Used to handle name of playlist changed.
* The callback provides the new name.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onQueueTitleChange(callback: Callback<string>): 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
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'queueTitleChange', callback?: (title: string) => void): void;
* Unregister the name of session playlist change callback
*
* @param { Callback<string> } [callback] - Used to handle name of playlist changed.
* The callback provides the new name.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offQueueTitleChange(callback?: Callback<string>): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
on(type: 'extrasChange', callback: (extras: {[key: string]: Object}) => void): void;
* Register the custom media packets change callback
*
* @param { Callback<Record<string, Object>> } callback - Used to handle custom media packets changed.
* The callback provides the new media packets.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
onExtrasChange(callback: Callback<Record<string, Object>>): 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
* @FaAndStageModel
* @atomicservice [since 12]
* @since 10 dynamic
*/
off(type: 'extrasChange', callback?: (extras: {[key: string]: Object}) => void): void;
* Unregister the custom media packets change callback
*
* @param { Callback<Record<string, Object>> } [callback] - Used to handle custom media packets changed.
* The callback provides the new media packets.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 23 static
*/
offExtrasChange(callback?: Callback<Record<string, Object>>): void;
* Send custom data to this avsession.
*
* @param { Record<string, Object> } data - The custom data populated by application.
* @returns { Promise<void> } void result promise when executed successfully
* @throws { BusinessError } 6600101 - Session service exception.
* You are advised to:1.Scheduled retry.2.Destroy the current session or session controller and re-create it.
* @throws { BusinessError } 6600102 - The session does not exist.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
* @since 23 static
*/
sendCustomData(data: Record<string, Object>): Promise<void>;
* Register listener for custom data.
*
* @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for.
* @param { Callback<Record<string, Object>> } callback - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
*/
on(type: 'customDataChange', callback: Callback<Record<string, Object>>): void;
* Register listener for custom data.
*
* @param { Callback<Record<string, Object>> } callback - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
onCustomDataChange(callback: Callback<Record<string, Object>>): void;
* Unregister listener for custom data.
*
* @param { 'customDataChange' } type - Type of the 'customDataChange' to listen for.
* @param { Callback<Record<string, Object>> } [callback] - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 20 dynamic
*/
off(type: 'customDataChange', callback?: Callback<Record<string, Object>>): void;
* Unregister listener for custom data.
*
* @param { Callback<Record<string, Object>> } [callback] - Callback used to retrieve custom data.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @since 23 static
*/
offCustomDataChange(callback?: Callback<Record<string, Object>>): void;
* Register listener for supported play speeds.
*
* @param { Callback<Array<double>> } callback - Callback used to retrieve supported play speeds.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
onSupportedPlaySpeedsChange(callback: Callback<Array<double>>): void;
* Unregister listener for supported play speeds.
*
* @param { Callback<Array<double>> } [callback] - Callback used to retrieve supported play speeds.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
offSupportedPlaySpeedsChange(callback?: Callback<Array<double>>): void;
* Register listener for supported loop modes.
*
* @param { Callback<Array<LoopMode>> } callback - Callback used to retrieve supported loop modes.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
onSupportedLoopModesChange(callback: Callback<Array<LoopMode>>): void;
* Unregister listener for supported loop modes.
*
* @param { Callback<Array<double>> } [callback] - Callback used to retrieve supported loop modes.
* @throws { BusinessError } 6600101 - Session service exception.
* @throws { BusinessError } 6600103 - The session controller does not exist.
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 26.0.0 dynamic&static
*/
offSupportedLoopModesChange(callback?: Callback<Array<LoopMode>>): void;
}
* The type of control command.
*
* @unionmember { 'play' } Play the current media. [since 10]
* @unionmember { 'pause' } Pause the current media. [since 10]
* @unionmember { 'stop' } Stop the current media. [since 10]
* @unionmember { 'playNext' } Play the next media in the queue. [since 10]
* @unionmember { 'playPrevious' } Play the previous media in the queue. [since 10]
* @unionmember { 'fastForward' } Fast forward the current media. [since 10]
* @unionmember { 'rewind' } Rewind the current media. [since 10]
* @unionmember { 'seek' } Seek to a specific position in the media. [since 10]
* @unionmember { 'setSpeed' } Set the playback speed. [since 10]
* @unionmember { 'setLoopMode' } Set the loop mode for the media. [since 10]
* @unionmember { 'toggleFavorite' } Toggle the favorite status of the current media. [since 10]
* @unionmember { 'playFromAssetId' } Play media specified by an asset ID. [since 11]
* @unionmember { 'playWithAssetId' } Play media with an asset ID (dynamic support). [since 20]
* @unionmember { 'answer' } Answer an incoming call. [since 11]
* @unionmember { 'hangUp' } Hang up the current call. [since 11]
* @unionmember { 'toggleCallMute' } Toggle the mute status of the call. [since 11]
* @unionmember { 'setTargetLoopMode' } Set the target loop mode. [since 18]
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' |
'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'playWithAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' | 'setTargetLoopMode';
* The type of media center control command, which can be used to determine the button displayed on the media center.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 26.0.0 dynamic&static
*/
type AVMediaCenterControlType = 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'setSpeed' | 'setLoopMode' |
'toggleFavorite';
* The definition of command to be sent to the session
*
* @interface AVControlCommand [since 10 - 11]
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
interface AVControlCommand {
* The command value {@link AVControlCommandType}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
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) } [since 10 - 11]
* @type { ?(LoopMode | string | double) } [since 12]
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
parameter?: LoopMode | string | double;
* The command value {@link CommandInfo}
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
commandInfo?: CommandInfo;
}
* The definition of command information to be sent to the session
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
interface CommandInfo {
* Caller bundle name.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
callerBundleName?: string;
* Caller module name.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
callerModuleName?: string;
* Caller device id.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
callerDeviceId?: string;
* Caller type.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
callerType?: CallerType;
}
* Enumerates CallerType including caller source type.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
enum CallerType {
* The control command comes from cast service.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
TYPE_CAST = 'cast',
* The control command comes from bluetooth.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
TYPE_BLUETOOTH = 'bluetooth',
* The control command comes from nearlink device.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @since 22 dynamic
* @since 23 static
*/
TYPE_NEARLINK = 'nearlink',
* The control command comes from an application.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @since 22 dynamic
* @since 23 static
*/
TYPE_APP = 'app',
}
* Enumerates ErrorCode types, returns in BusinessError.code.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
enum AVSessionErrorCode {
* Session service exception.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_SERVICE_EXCEPTION = 6600101,
* The session does not exist.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_SESSION_NOT_EXIST = 6600102,
* The session controller does not exist.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_CONTROLLER_NOT_EXIST = 6600103,
* The remote session connection failed.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_REMOTE_CONNECTION_ERR = 6600104,
* Invalid session command.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_COMMAND_INVALID = 6600105,
* The session is not activated.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_SESSION_INACTIVE = 6600106,
* Too many commands or events.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_MESSAGE_OVERLOAD = 6600107,
* Device connecting failed.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_DEVICE_CONNECTION_FAILED = 6600108,
* The remote connection is not established.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @atomicservice [since 12]
* @since 10 dynamic
* @since 23 static
*/
ERR_CODE_REMOTE_CONNECTION_NOT_EXIST = 6600109,
* The desktop lyrics feature of this application is not enabled.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 23 dynamic&static
*/
ERR_CODE_DESKTOP_LYRIC_NOT_ENABLED = 6600110,
* The desktop lyrics feature is not supported.
*
* @syscap SystemCapability.Multimedia.AVSession.Core
* @stagemodelonly
* @atomicservice
* @since 23 dynamic&static
*/
ERR_CODE_DESKTOP_LYRIC_NOT_SUPPORTED = 6600111,
* The error code for cast control is unspecified.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_UNSPECIFIED = 6611000,
* An unspecified error occurs in the remote player.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_REMOTE_ERROR = 6611001,
* The playback position falls behind the live window.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_BEHIND_LIVE_WINDOW = 6611002,
* The process of cast control times out.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_TIMEOUT = 6611003,
* The runtime check failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_RUNTIME_CHECK_FAILED = 6611004,
* Cross-device data transmission is locked.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_PLAYER_NOT_WORKING = 6611100,
* The specified seek mode is not supported.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_ILLEGAL_SEEK_TARGET = 6611102,
* The specified playback mode is not supported.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_PLAY_MODE_UNSUPPORTED = 6611103,
* The specified playback speed is not supported.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_INVALID_PARAM = 6611106,
* Allocation of memory failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_NO_MEMORY = 6611107,
* Operation is not allowed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_OPERATION_NOT_ALLOWED = 6611108,
* An unspecified input/output error occurs.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_UNSPECIFIED = 6612000,
* Network connection failure.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_FAILED = 6612001,
* Network timeout.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_TIMEOUT = 6612002,
* Invalid "Content-Type" HTTP header.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_BAD_HTTP_STATUS = 6612004,
* The file does not exist.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_CLEARTEXT_NOT_PERMITTED = 6612007,
* Reading data out of the data bound.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_READ_ERROR = 6612101,
* This resource is already in use.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_CONTENT_BUSY = 6612102,
* The content using the validity interval has expired.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_IO_NETWORK_PACKET_SENDING_FAILED = 6612107,
* Unspecified error related to content parsing.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_PARSING_UNSPECIFIED = 6613000,
* Parsing error associated with media container format bit streams.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_MALFORMED = 6613001,
* Parsing error associated with the media manifest.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_UNSUPPORTED = 6613003,
* Unsupported feature in the media manifest.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_UNSUPPORTED = 6613004,
* Unspecified decoding error.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DECODING_UNSPECIFIED = 6614000,
* Decoder initialization failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DECODING_INIT_FAILED = 6614001,
* Decoder query failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DECODING_QUERY_FAILED = 6614002,
* Decoding the media samples failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DECODING_FORMAT_UNSUPPORTED = 6614005,
* Unspecified errors related to the audio renderer.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_UNSPECIFIED = 6615000,
* Initializing the audio renderer failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_INIT_FAILED = 6615001,
* The audio renderer fails to write data.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_WRITE_FAILED = 6615002,
* Unspecified error related to DRM.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DRM_SCHEME_UNSUPPORTED = 6616001,
* Device provisioning failed.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DRM_PROVISIONING_FAILED = 6616002,
* The DRM-protected content to play is incompatible.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DRM_CONTENT_ERROR = 6616003,
* Failed to obtain a license.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DRM_DISALLOWED_OPERATION = 6616005,
* An error occurs in the DRM system.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DRM_SYSTEM_ERROR = 6616006,
* The device has revoked DRM privileges.
*
* @syscap SystemCapability.Multimedia.AVSession.AVCast
* @atomicservice
* @since 13 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
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 dynamic
* @since 23 static
*/
ERR_CODE_CAST_CONTROL_DRM_PROVIDE_KEY_RESPONSE_ERROR = 6616100,
}
}
export default avSession;