1/* 2* Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16/** 17 * @file 18 * @kit AVSessionKit 19 */ 20 21import type { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; 22import { WantAgent } from './@ohos.wantAgent'; 23import { KeyEvent } from './@ohos.multimodalInput.keyEvent'; 24import { ElementName } from './bundleManager/ElementName'; 25import image from './@ohos.multimedia.image'; 26import audio from './@ohos.multimedia.audio'; 27import { AVCastPickerState, AVCastPickerColorMode } from './@ohos.multimedia.avCastPickerParam'; 28import type media from './@ohos.multimedia.media'; 29import type Context from './application/BaseContext'; 30 31/** 32 * @namespace avSession 33 * @syscap SystemCapability.Multimedia.AVSession.Core 34 * @since 9 35 */ 36/** 37 * @namespace avSession 38 * @syscap SystemCapability.Multimedia.AVSession.Core 39 * @atomicservice 40 * @since 12 41 */ 42 43declare namespace avSession { 44 /** 45 * Create an AVSession instance. An ability can only create one AVSession 46 * @param { Context } context - The context of application 47 * @param { string } tag - A user-defined name for this session 48 * @param { AVSessionType } type - The type of session {@link AVSessionType} 49 * @param { AsyncCallback<AVSession> } callback - async callback for AVSession. 50 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 51 * 2.Parameter verification failed. 52 * @throws { BusinessError } 6600101 - Session service exception. 53 * @syscap SystemCapability.Multimedia.AVSession.Core 54 * @since 10 55 */ 56 function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession>): void; 57 58 /** 59 * Create an AVSession instance. An ability can only create one AVSession 60 * @param { Context } context - The context of application 61 * @param { string } tag - A user-defined name for this session 62 * @param { AVSessionType } type - The type of session {@link AVSessionType} 63 * @returns { Promise<AVSession> } Promise for AVSession 64 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 65 * 2.Parameter verification failed. 66 * @throws { BusinessError } 6600101 - Session service exception. 67 * @syscap SystemCapability.Multimedia.AVSession.Core 68 * @since 10 69 */ 70 /** 71 * Create an AVSession instance. An ability can only create one AVSession 72 * @param { Context } context - The context of application 73 * @param { string } tag - A user-defined name for this session 74 * @param { AVSessionType } type - The type of session {@link AVSessionType} 75 * @returns { Promise<AVSession> } Promise for AVSession 76 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 77 * 2.Parameter verification failed. 78 * @throws { BusinessError } 6600101 - Session service exception. 79 * @syscap SystemCapability.Multimedia.AVSession.Core 80 * @atomicservice 81 * @since 12 82 */ 83 function createAVSession(context: Context, tag: string, type: AVSessionType): Promise<AVSession>; 84 85 /** 86 * Get all avsession descriptors of the system 87 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 88 * @param { AsyncCallback<Array<Readonly<AVSessionDescriptor>>> } callback - async callback for an array of AVSessionDescriptors. 89 * @throws { BusinessError } 201 - permission denied 90 * @throws { BusinessError } 202 - Not System App. 91 * @throws { BusinessError } 6600101 - Session service exception. 92 * @syscap SystemCapability.Multimedia.AVSession.Manager 93 * @systemapi 94 * @since 9 95 */ 96 function getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void; 97 98 /** 99 * Get all avsession descriptors of the system 100 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 101 * @returns { Promise<Array<Readonly<AVSessionDescriptor>>> } Promise for an array of AVSessionDescriptors 102 * @throws { BusinessError } 201 - permission denied 103 * @throws { BusinessError } 202 - Not System App. 104 * @throws { BusinessError } 6600101 - Session service exception. 105 * @syscap SystemCapability.Multimedia.AVSession.Manager 106 * @systemapi 107 * @since 9 108 */ 109 function getAllSessionDescriptors(): Promise<Array<Readonly<AVSessionDescriptor>>>; 110 111 /** 112 * Get history avsession records. These sessions have been destroyed. 113 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 114 * @param { number } maxSize - Specifies the maximum size of the returned value array. 115 * @param { AsyncCallback<Array<Readonly<AVSessionDescriptor>>> } callback - async callback for an array of AVSessionDescriptors. 116 * If provided '0' or not provided, the maximum value is determined by the system. 117 * @throws { BusinessError } 201 - permission denied 118 * @throws { BusinessError } 202 - Not System App 119 * @throws { BusinessError } 401 - parameter check failed. Possible causes: 1.Mandatory parameters are left unspecified. 120 * 2.Incorrect parameter types. 121 * @throws { BusinessError } 6600101 - Session service exception. 122 * @syscap SystemCapability.Multimedia.AVSession.Manager 123 * @systemapi Hide this for inner system use 124 * @since 10 125 */ 126 function getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void; 127 128 /** 129 * Get history avsession records. These sessions have been destroyed. 130 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 131 * @param { number } maxSize - Specifies the maximum size of the returned value array. 132 * If provided '0' or not provided, the maximum value is determined by the system. 133 * @returns { Promise<Array<Readonly<AVSessionDescriptor>>> } Promise for an array of AVSessionDescriptors 134 * @throws { BusinessError } 201 - permission denied 135 * @throws { BusinessError } 202 - Not System App 136 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 137 * 2.Incorrect parameter types. 138 * @throws { BusinessError } 6600101 - Session service exception. 139 * @syscap SystemCapability.Multimedia.AVSession.Manager 140 * @systemapi Hide this for inner system use 141 * @since 10 142 */ 143 function getHistoricalSessionDescriptors(maxSize?: number): Promise<Array<Readonly<AVSessionDescriptor>>>; 144 145 /** 146 * Get history play list information records. 147 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 148 * @param { number } maxSize - Specifies the maximum size of the returned value array. 149 * @param { number } maxAppSize - Specifies the maximum app size of the returned value array. 150 * @param { AsyncCallback<Array<Readonly<AVQueueInfo>>> } callback - async callback for an array of AVQueueInfo. 151 * If provided '0' or not provided, the maximum value is determined by the system. 152 * @throws { BusinessError } 201 - permission denied 153 * @throws { BusinessError } 202 - Not System App. 154 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 155 * 2.Incorrect parameter types. 156 * @throws { BusinessError } 6600101 - Session service exception. 157 * @syscap SystemCapability.Multimedia.AVSession.Manager 158 * @systemapi Hide this for inner system use 159 * @since 11 160 */ 161 function getHistoricalAVQueueInfos(maxSize: number, maxAppSize: number, callback: AsyncCallback<Array<Readonly<AVQueueInfo>>>): void; 162 163 /** 164 * Get history play list information records. 165 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 166 * @param { number } maxSize - Specifies the maximum size of the returned value array. 167 * @param { number } maxAppSize - Specifies the maximum app size of the returned value array. 168 * @returns { Promise<Array<Readonly<AVQueueInfo>>> } Promise for an array of AVQueueInfo 169 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 170 * 2.Incorrect parameter types. 171 * @throws { BusinessError } 6600101 - Session service exception. 172 * @syscap SystemCapability.Multimedia.AVSession.Manager 173 * @systemapi Hide this for inner system use 174 * @since 11 175 */ 176 function getHistoricalAVQueueInfos(maxSize: number, maxAppSize: number): Promise<Array<Readonly<AVQueueInfo>>>; 177 178 /** 179 * Create an avsession controller 180 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 181 * @param { string } sessionId - Specifies the sessionId to create the controller. 182 * @param { AsyncCallback<AVSessionController> } callback - async callback for AVSessionController. 183 * If provided 'default', the system will create a default controller, Used to control the system default session 184 * @throws { BusinessError } 201 - permission denied 185 * @throws { BusinessError } 202 - Not System App. 186 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 187 * 2.Parameter verification failed. 188 * @throws { BusinessError } 6600101 - Session service exception. 189 * @throws { BusinessError } 6600102 - The session does not exist. 190 * @syscap SystemCapability.Multimedia.AVSession.Manager 191 * @systemapi 192 * @since 9 193 */ 194 function createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void; 195 196 /** 197 * Create an avsession controller 198 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 199 * @param { string } sessionId - Specifies the sessionId to create the controller. 200 * If provided 'default', the system will create a default controller, Used to control the system default session 201 * @returns { Promise<AVSessionController> } Promise for AVSessionController 202 * @throws { BusinessError } 201 - permission denied 203 * @throws { BusinessError } 202 - Not System App. 204 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 205 * 2.Parameter verification failed. 206 * @throws { BusinessError } 6600101 - Session service exception. 207 * @throws { BusinessError } 6600102 - The session does not exist. 208 * @syscap SystemCapability.Multimedia.AVSession.Manager 209 * @systemapi 210 * @since 9 211 */ 212 function createController(sessionId: string): Promise<AVSessionController>; 213 214 /** 215 * Cast Audio to the remote devices or cast back local device 216 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 217 * @param { SessionToken | 'all' } session - Specifies the sessionId which to send to remote. 218 * @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast. 219 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 220 * 'all' means cast all the media audio of this device to remote. 221 * @throws { BusinessError } 201 - permission denied 222 * @throws { BusinessError } 202 - Not System App. 223 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 224 * 2.Parameter verification failed. 225 * @throws { BusinessError } 6600101 - Session service exception. 226 * @throws { BusinessError } 6600102 - The session does not exist. 227 * @throws { BusinessError } 6600104 - The remote session connection failed. 228 * @syscap SystemCapability.Multimedia.AVSession.Manager 229 * @systemapi 230 * @since 9 231 */ 232 function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void; 233 234 /** 235 * Cast Audio to the remote devices or cast back local device 236 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 237 * @param { SessionToken | 'all' } session - Specifies the sessionId which to send to remote. 238 * @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast. 239 * @returns { Promise<void> } void promise when executed successfully 240 * 'all' means cast all the media audio of this device to remote. 241 * @throws { BusinessError } 201 - permission denied 242 * @throws { BusinessError } 202 - Not System App. 243 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 244 * 2.Parameter verification failed. 245 * @throws { BusinessError } 6600101 - Session service exception. 246 * @throws { BusinessError } 6600102 - The session does not exist. 247 * @throws { BusinessError } 6600104 - The remote session connection failed. 248 * @syscap SystemCapability.Multimedia.AVSession.Manager 249 * @systemapi 250 * @since 9 251 */ 252 function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>): Promise<void>; 253 254 /** 255 * Start an application for media playback. 256 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 257 * @param { string } bundleName - Specifies the bundleName which to be started. 258 * @param { string } assetId - Specifies the assetId to be started. 259 * @returns { Promise<void> } void promise when executed successfully 260 * @throws { BusinessError } 201 - permission denied 261 * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. 262 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 263 * 2.Incorrect parameter types. 3.Parameter verification failed. 264 * @throws { BusinessError } 6600101 - Session service exception. 265 * @syscap SystemCapability.Multimedia.AVSession.Manager 266 * @systemapi 267 * @since 11 268 */ 269 function startAVPlayback(bundleName: string, assetId: string): Promise<void>; 270 271 /** 272 * Get distributed avsession controller 273 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 274 * @param { DistributedSessionType } distributedSessionType - Specifies the distributed session type. 275 * @returns { Promise<Array<AVSessionController>> } Promise for AVSessionController. 276 * @throws { BusinessError } 201 - permission denied 277 * @throws { BusinessError } 202 - Not System App. 278 * @throws { BusinessError } 6600101 - Session service exception. 279 * @throws { BusinessError } 6600109 - The remote connection is not established. 280 * @syscap SystemCapability.Multimedia.AVSession.Manager 281 * @systemapi 282 * @since 18 283 */ 284 function getDistributedSessionController(distributedSessionType: DistributedSessionType): Promise<Array<AVSessionController>>; 285 286 /** 287 * Session token. Used to judge the legitimacy of the session. 288 * @typedef SessionToken 289 * @syscap SystemCapability.Multimedia.AVSession.Manager 290 * @systemapi 291 * @since 9 292 */ 293 interface SessionToken { 294 /** 295 * The unique session id of the avsession object 296 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 297 * @type { string } 298 * @syscap SystemCapability.Multimedia.AVSession.Manager 299 * @systemapi 300 * @since 9 301 */ 302 sessionId: string; 303 304 /** 305 * Process id of session 306 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 307 * @type { ?number } 308 * @syscap SystemCapability.Multimedia.AVSession.Manager 309 * @systemapi 310 * @since 9 311 */ 312 pid?: number; 313 314 /** 315 * User id 316 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 317 * @type { ?number } 318 * @syscap SystemCapability.Multimedia.AVSession.Manager 319 * @systemapi 320 * @since 9 321 */ 322 uid?: number; 323 } 324 325 /** 326 * Register session create callback 327 * @param { 'sessionCreate' } type - Registration Type, 'sessionCreate' 328 * @param { function } callback - Used to handle ('sessionCreate' command) 329 * @throws { BusinessError } 202 - Not System App. 330 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 331 * 2.Incorrect parameter types. 332 * @throws { BusinessError } 6600101 - Session service exception. 333 * @syscap SystemCapability.Multimedia.AVSession.Manager 334 * @systemapi 335 * @since 9 336 */ 337 function on(type: 'sessionCreate', callback: (session: AVSessionDescriptor) => void): void; 338 339 /** 340 * Register session destroy callback 341 * @param { 'sessionDestroy' } type - Registration Type, 'sessionDestroy' 342 * @param { function } callback - Used to handle ('sessionDestroy' command) 343 * @throws { BusinessError } 202 - Not System App. 344 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 345 * 2.Incorrect parameter types. 346 * @throws { BusinessError } 6600101 - Session service exception. 347 * @syscap SystemCapability.Multimedia.AVSession.Manager 348 * @systemapi 349 * @since 9 350 */ 351 function on(type: 'sessionDestroy', callback: (session: AVSessionDescriptor) => void): void; 352 353 /** 354 * Register top session changed callback 355 * @param { 'topSessionChange' } type - Registration Type, top priority session change, 'topSessionChange' 356 * @param { function } callback - Used to handle ('topSessionChange' command) 357 * @throws { BusinessError } 202 - Not System App. 358 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 359 * 2.Incorrect parameter types. 360 * @throws { BusinessError } 6600101 - Session service exception. 361 * @syscap SystemCapability.Multimedia.AVSession.Manager 362 * @systemapi 363 * @since 9 364 */ 365 function on(type: 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void; 366 367 /** 368 * Unregister session create callback 369 * @param { 'sessionCreate' } type - Registration Type, session creation, 'sessionCreate' 370 * @param { function } callback - Used to unregister listener for ('sessionCreate') command 371 * @throws { BusinessError } 202 - Not System App. 372 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 373 * 2.Incorrect parameter types. 374 * @throws { BusinessError } 6600101 - Session service exception. 375 * @syscap SystemCapability.Multimedia.AVSession.Manager 376 * @systemapi 377 * @since 9 378 */ 379 function off(type: 'sessionCreate', callback?: (session: AVSessionDescriptor) => void): void; 380 381 /** 382 * Unregister session destroy callback 383 * @param { 'sessionDestroy' } type - Registration Type, session deletion, 'sessionDestroy' 384 * @param { function } callback - Used to unregister listener for ('sessionDestroy') command 385 * @throws { BusinessError } 202 - Not System App. 386 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 387 * 2.Incorrect parameter types. 388 * @throws { BusinessError } 6600101 - Session service exception. 389 * @syscap SystemCapability.Multimedia.AVSession.Manager 390 * @systemapi 391 * @since 9 392 */ 393 function off(type: 'sessionDestroy', callback?: (session: AVSessionDescriptor) => void): void; 394 395 /** 396 * Unregister top session changed callback 397 * @param { 'topSessionChange' } type - Registration Type, top priority session change, 'topSessionChange' 398 * @param { function } callback - Used to unregister listener for ('topSessionChange') command 399 * @throws { BusinessError } 202 - Not System App. 400 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 401 * 2.Incorrect parameter types. 402 * @throws { BusinessError } 6600101 - Session service exception. 403 * @syscap SystemCapability.Multimedia.AVSession.Manager 404 * @systemapi 405 * @since 9 406 */ 407 function off(type: 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void; 408 409 /** 410 * Register Session service death callback, notifying the application to clean up resources. 411 * @param { 'sessionServiceDie' } type - Registration Type, 'sessionServiceDie' 412 * @param { function } callback - Used to handle ('sessionServiceDie') command. 413 * @throws { BusinessError } 202 - Not System App. 414 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 415 * 2.Incorrect parameter types. 416 * @throws { BusinessError } 6600101 - Session service exception. 417 * @syscap SystemCapability.Multimedia.AVSession.Core 418 * @systemapi 419 * @since 9 420 */ 421 function on(type: 'sessionServiceDie', callback: () => void): void; 422 423 /** 424 * Unregister Session service death callback, notifying the application to clean up resources. 425 * @param { 'sessionServiceDie' } type - Registration Type, 'sessionServiceDie' 426 * @param { function } callback - Used to unregister listener for ('sessionServiceDie') command. 427 * @throws { BusinessError } 202 - Not System App. 428 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 429 * 2.Incorrect parameter types. 430 * @throws { BusinessError } 6600101 - Session service exception. 431 * @syscap SystemCapability.Multimedia.AVSession.Core 432 * @systemapi 433 * @since 9 434 */ 435 function off(type: 'sessionServiceDie', callback?: () => void): void; 436 437 /** 438 * Register distributed session changed callback 439 * @param { 'distributedSessionChange' } type - Registration Type, distributed session change 440 * @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type 441 * @param { Callback<Array<AVSessionController>> } callback - The callback will return remote changed AVSessionController. 442 * @throws { BusinessError } 202 - Not System App. 443 * @throws { BusinessError } 6600101 - Session service exception. 444 * @syscap SystemCapability.Multimedia.AVSession.Manager 445 * @systemapi 446 * @since 18 447 */ 448 function on(type: 'distributedSessionChange', distributedSessionType: DistributedSessionType, callback: Callback<Array<AVSessionController>>): void; 449 450 /** 451 * Unregister distributed session changed callback 452 * @param { 'distributedSessionChange' } type - Registration Type, distributed session change 453 * @param { DistributedSessionType } distributedSessionType - Indicates the distributed session type 454 * @param { Callback<Array<AVSessionController>> } callback - The callback will return remote changed AVSessionController. 455 * @throws { BusinessError } 202 - Not System App. 456 * @throws { BusinessError } 6600101 - Session service exception. 457 * @syscap SystemCapability.Multimedia.AVSession.Manager 458 * @systemapi 459 * @since 18 460 */ 461 function off(type: 'distributedSessionChange', distributedSessionType: DistributedSessionType, callback?: Callback<Array<AVSessionController>>): void; 462 463 /** 464 * Send system media key event.The system automatically selects the recipient. 465 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 466 * @param { KeyEvent } event - The key event to be sent 467 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 468 * @throws { BusinessError } 201 - permission denied 469 * @throws { BusinessError } 202 - Not System App. 470 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 471 * 2.Parameter verification failed. 472 * @throws { BusinessError } 6600101 - Session service exception. 473 * @throws { BusinessError } 6600105 - Invalid session command. 474 * @syscap SystemCapability.Multimedia.AVSession.Manager 475 * @systemapi 476 * @since 9 477 */ 478 function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void; 479 480 /** 481 * Send system media key event.The system automatically selects the recipient. 482 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 483 * @param { KeyEvent } event - The key event to be sent 484 * @returns { Promise<void> } void promise when executed successfully 485 * @throws { BusinessError } 201 - permission denied 486 * @throws { BusinessError } 202 - Not System App. 487 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 488 * 2.Parameter verification failed. 489 * @throws { BusinessError } 6600101 - Session service exception. 490 * @throws { BusinessError } 6600105 - Invalid session command. 491 * @syscap SystemCapability.Multimedia.AVSession.Manager 492 * @systemapi 493 * @since 9 494 */ 495 function sendSystemAVKeyEvent(event: KeyEvent): Promise<void>; 496 497 /** 498 * Send system control command.The system automatically selects the recipient. 499 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 500 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 501 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 502 * @throws { BusinessError } 201 - permission denied 503 * @throws { BusinessError } 202 - Not System App. 504 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 505 * 2.Parameter verification failed. 506 * @throws { BusinessError } 6600101 - Session service exception. 507 * @throws { BusinessError } 6600105 - Invalid session command. 508 * @throws { BusinessError } 6600107 - Too many commands or events. 509 * @syscap SystemCapability.Multimedia.AVSession.Manager 510 * @systemapi 511 * @since 9 512 */ 513 function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void; 514 515 /** 516 * Send system control command.The system automatically selects the recipient. 517 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 518 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 519 * @returns { Promise<void> } void promise when executed successfully 520 * @throws { BusinessError } 201 - permission denied 521 * @throws { BusinessError } 202 - Not System App. 522 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 523 * 2.Parameter verification failed. 524 * @throws { BusinessError } 6600101 - Session service exception. 525 * @throws { BusinessError } 6600105 - Invalid session command. 526 * @throws { BusinessError } 6600107 - Too many commands or events. 527 * @syscap SystemCapability.Multimedia.AVSession.Manager 528 * @systemapi 529 * @since 9 530 */ 531 function sendSystemControlCommand(command: AVControlCommand): Promise<void>; 532 533 /** 534 * Define different protocol capability 535 * @enum { number } 536 * @syscap SystemCapability.Multimedia.AVSession.AVCast 537 * @since 11 538 */ 539 /** 540 * Define different protocol capability 541 * @enum { number } 542 * @syscap SystemCapability.Multimedia.AVSession.AVCast 543 * @atomicservice 544 * @since 12 545 */ 546 enum ProtocolType { 547 /** 548 * The default cast type "local", media can be routed on the same device, 549 * including internal speakers or audio jack on the device itself, A2DP devices. 550 * @syscap SystemCapability.Multimedia.AVSession.AVCast 551 * @since 11 552 */ 553 /** 554 * The default cast type "local", media can be routed on the same device, 555 * including internal speakers or audio jack on the device itself, A2DP devices. 556 * @syscap SystemCapability.Multimedia.AVSession.AVCast 557 * @atomicservice 558 * @since 12 559 */ 560 TYPE_LOCAL = 0, 561 562 /** 563 * Cast+ mirror capability 564 * @syscap SystemCapability.Multimedia.AVSession.AVCast 565 * @systemapi 566 * @since 10 567 */ 568 TYPE_CAST_PLUS_MIRROR = 1, 569 570 /** 571 * The Cast+ Stream indicating the media is presenting on a different device 572 * the application need get an AVCastController to control remote playback. 573 * @syscap SystemCapability.Multimedia.AVSession.AVCast 574 * @since 11 575 */ 576 /** 577 * The Cast+ Stream indicating the media is presenting on a different device 578 * the application need get an AVCastController to control remote playback. 579 * @syscap SystemCapability.Multimedia.AVSession.AVCast 580 * @atomicservice 581 * @since 12 582 */ 583 TYPE_CAST_PLUS_STREAM = 2, 584 585 /** 586 * The DLNA type indicates the device supports DLNA protocol, 587 * the application needs to get an AVCastController to control remote playback. 588 * @syscap SystemCapability.Multimedia.AVSession.AVCast 589 * @atomicservice 590 * @since 12 591 */ 592 TYPE_DLNA = 4, 593 } 594 595 /** 596 * Define different distributed session type 597 * @enum { number } 598 * @syscap SystemCapability.Multimedia.AVSession.Manager 599 * @systemapi 600 * @since 18 601 */ 602 enum DistributedSessionType { 603 /** 604 * Remote session sensed from remote device. 605 * @syscap SystemCapability.Multimedia.AVSession.Manager 606 * @systemapi 607 * @since 18 608 */ 609 TYPE_SESSION_REMOTE = 0, 610 611 /** 612 * Migrated session from remote device to this device. 613 * @syscap SystemCapability.Multimedia.AVSession.Manager 614 * @systemapi 615 * @since 18 616 */ 617 TYPE_SESSION_MIGRATE_IN = 1, 618 619 /** 620 * Migrated session from this device to remote device. 621 * @syscap SystemCapability.Multimedia.AVSession.Manager 622 * @systemapi 623 * @since 18 624 */ 625 TYPE_SESSION_MIGRATE_OUT = 2, 626 } 627 628 /** 629 * Start device discovery. 630 * @param { AsyncCallback<void> } callback a callback function 631 * @throws { BusinessError } 202 - Not System App. 632 * @syscap SystemCapability.Multimedia.AVSession.AVCast 633 * @systemapi 634 * @since 10 635 */ 636 function startCastDeviceDiscovery(callback: AsyncCallback<void>): void; 637 638 /** 639 * Start device discovery. 640 * @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} 641 * @param { AsyncCallback<void> } callback a callback function 642 * @throws { BusinessError } 202 - Not System App. 643 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 644 * 2.Parameter verification failed. 645 * @syscap SystemCapability.Multimedia.AVSession.AVCast 646 * @systemapi 647 * @since 10 648 */ 649 function startCastDeviceDiscovery(filter: number, callback: AsyncCallback<void>): void; 650 651 /** 652 * Start device discovery. 653 * @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} 654 * @returns { Promise<void> } Promise for the result 655 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 656 * 2.Parameter verification failed. 657 * @syscap SystemCapability.Multimedia.AVSession.AVCast 658 * @systemapi 659 * @since 10 660 */ 661 /** 662 * Start device discovery. 663 * @param { number } [filter] - device filter when discovering, can be an union of {@link ProtocolType} 664 * @param { Array<string> } [drmSchemes] - filter drm-enabled devices which are represented by uuid. 665 * It is effective when protocol type is TYPE_CAST_PLUS_STREAM. 666 * @returns { Promise<void> } Promise for the result 667 * @throws { BusinessError } 202 - Not System App. 668 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 669 * 2.Incorrect parameter types. 3.Parameter verification failed. 670 * @syscap SystemCapability.Multimedia.AVSession.AVCast 671 * @systemapi 672 * @since 12 673 */ 674 function startCastDeviceDiscovery(filter?: number, drmSchemes?: Array<string>): Promise<void>; 675 676 /** 677 * Stop device discovery. 678 * @param { AsyncCallback<void> } callback a callback function 679 * @throws { BusinessError } 202 - Not System App. 680 * @syscap SystemCapability.Multimedia.AVSession.AVCast 681 * @systemapi 682 * @since 10 683 */ 684 function stopCastDeviceDiscovery(callback: AsyncCallback<void>): void; 685 686 /** 687 * Stop device discovery. 688 * @returns { Promise<void> } Promise for the result 689 * @throws { BusinessError } 202 - Not System App. 690 * @syscap SystemCapability.Multimedia.AVSession.AVCast 691 * @systemapi 692 * @since 10 693 */ 694 function stopCastDeviceDiscovery(): Promise<void>; 695 696 /** 697 * Enable or disable device to be discoverable, used at sink side. 698 * @param { boolean } enable true: can be discoverable, false: cannot be discoverable. 699 * @param { AsyncCallback<void> } callback a callback function 700 * @throws { BusinessError } 202 - Not System App. 701 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 702 * 2.Parameter verification failed. 703 * @syscap SystemCapability.Multimedia.AVSession.AVCast 704 * @systemapi 705 * @since 10 706 */ 707 function setDiscoverable(enable: boolean, callback: AsyncCallback<void>): void; 708 709 /** 710 * Enable or disable device to be discoverable, used at sink side. 711 * @param { boolean } enable true: can be discoverable, false: cannot be discoverable. 712 * @returns { Promise<void> } Promise for the result 713 * @throws { BusinessError } 202 - Not System App. 714 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 715 * 2.Parameter verification failed. 716 * @syscap SystemCapability.Multimedia.AVSession.AVCast 717 * @systemapi 718 * @since 10 719 */ 720 function setDiscoverable(enable: boolean): Promise<void>; 721 722 /** 723 * Register device discovery callback 724 * @param { 'deviceAvailable' } type Registration Type 725 * @param { function } callback Used to returns the device info 726 * @throws { BusinessError } 202 - Not System App. 727 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 728 * 2.Incorrect parameter types. 729 * @syscap SystemCapability.Multimedia.AVSession.AVCast 730 * @systemapi 731 * @since 10 732 */ 733 function on(type: 'deviceAvailable', callback: (device: OutputDeviceInfo) => void): void; 734 735 /** 736 * Unregister device discovery callback 737 * @param { 'deviceAvailable' } type Registration Type 738 * @param { function } callback Used to returns the device info 739 * @throws { BusinessError } 202 - Not System App. 740 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 741 * 2.Incorrect parameter types. 742 * @syscap SystemCapability.Multimedia.AVSession.AVCast 743 * @systemapi 744 * @since 10 745 */ 746 function off(type: 'deviceAvailable', callback?: (device: OutputDeviceInfo) => void): void; 747 748 /** 749 * Register device offline callback 750 * @param { 'deviceOffline' } type - Registration Type 751 * @param { function } callback - Used to returns the device info 752 * @throws { BusinessError } 202 - Not System App. 753 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 754 * 2.Incorrect parameter types. 755 * @syscap SystemCapability.Multimedia.AVSession.AVCast 756 * @systemapi 757 * @since 11 758 */ 759 function on(type: 'deviceOffline', callback: (deviceId: string) => void): void; 760 761 /** 762 * Unregister device offline callback 763 * @param { 'deviceOffline' } type - Registration Type 764 * @param { function } callback - Used to returns the device info 765 * @throws { BusinessError } 202 - Not System App. 766 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 767 * 2.Incorrect parameter types. 768 * @syscap SystemCapability.Multimedia.AVSession.AVCast 769 * @systemapi 770 * @since 11 771 */ 772 function off(type: 'deviceOffline', callback?: (deviceId: string) => void): void; 773 774 /** 775 * Register a callback to retrieve an avsession cast controller. 776 * This function can be used at both side to get the same controller to do the playback control. 777 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 778 * @param { string } sessionId Specifies the sessionId to get controller. 779 * @param { AsyncCallback<AVCastController> } callback - async callback for the AVCastController. 780 * @throws {BusinessError} 201 - permission denied 781 * @throws { BusinessError } 202 - Not System App. 782 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 783 * 2.Parameter verification failed. 784 * @throws {BusinessError} 6600101 - Session service exception 785 * @throws {BusinessError} 6600102 - session does not exist 786 * @syscap SystemCapability.Multimedia.AVSession.AVCast 787 * @systemapi 788 * @since 10 789 */ 790 function getAVCastController(sessionId: string, callback: AsyncCallback<AVCastController>): void; 791 792 /** 793 * Get the current session's remote controller client. 794 * If the avsession is not under casting state, the controller will return null. 795 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 796 * @param { string } sessionId Specifies the sessionId to get controller. 797 * @returns { Promise<AVCastController> } Promise for the AVCastController 798 * @throws {BusinessError} 201 - permission denied 799 * @throws { BusinessError } 202 - Not System App. 800 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 801 * 2.Parameter verification failed. 802 * @throws {BusinessError} 6600101 - server exception 803 * @throws {BusinessError} 6600102 - session does not exist 804 * @syscap SystemCapability.Multimedia.AVSession.AVCast 805 * @systemapi 806 * @since 10 807 */ 808 function getAVCastController(sessionId: string): Promise<AVCastController>; 809 810 /** 811 * Cast resource to remote device. 812 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 813 * @param { SessionToken } session Specifies the sessionId which is to be casted. 814 * @param { OutputDeviceInfo } device Specifies the device to cast. 815 * @param { AsyncCallback<void> } callback A callback instance used to return when start casting. 816 * @throws {BusinessError} 201 - permission denied 817 * @throws { BusinessError } 202 - Not System App. 818 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 819 * 2.Incorrect parameter types. 3.Parameter verification failed. 820 * @throws {BusinessError} 6600101 - Session service exception 821 * @throws {BusinessError} 6600108 - Device connecting failed 822 * @syscap SystemCapability.Multimedia.AVSession.AVCast 823 * @systemapi 824 * @since 10 825 */ 826 function startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCallback<void>): void; 827 828 /** 829 * Cast resource to remote device. 830 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 831 * @param { SessionToken } session Specifies the sessionId which is to be casted. 832 * @param { OutputDeviceInfo } device Specifies the device to cast. 833 * @returns { Promise<void> } Promise for the result 834 * @throws {BusinessError} 201 - permission denied 835 * @throws { BusinessError } 202 - Not System App. 836 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 837 * 2.Incorrect parameter types. 3.Parameter verification failed. 838 * @throws {BusinessError} 6600101 - Session service exception 839 * @throws {BusinessError} 6600108 - Device connecting failed 840 * @syscap SystemCapability.Multimedia.AVSession.AVCast 841 * @systemapi 842 * @since 10 843 */ 844 function startCasting(session: SessionToken, device: OutputDeviceInfo): Promise<void>; 845 846 /** 847 * Stop current cast and disconnect device connection. 848 * @param { SessionToken } session Specifies the sessionId which is to be stopped. 849 * @param { AsyncCallback<void> } callback A callback instance used to return when cast stopped completed. 850 * @throws { BusinessError } 202 - Not System App. 851 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 852 * 2.Incorrect parameter types. 3.Parameter verification failed. 853 * @throws { BusinessError } 6600109 - The remote connection is not established 854 * @syscap SystemCapability.Multimedia.AVSession.AVCast 855 * @systemapi 856 * @since 10 857 */ 858 function stopCasting(session: SessionToken, callback: AsyncCallback<void>): void; 859 860 /** 861 * Stop current cast and disconnect device connection. 862 * @param { SessionToken } session Specifies the sessionId which is to be stopped. 863 * @returns { Promise<void> } Promise for the result 864 * @throws { BusinessError } 202 - Not System App. 865 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 866 * 2.Incorrect parameter types. 3.Parameter verification failed. 867 * @throws { BusinessError } 6600109 - The remote connection is not established 868 * @syscap SystemCapability.Multimedia.AVSession.AVCast 869 * @systemapi 870 * @since 10 871 */ 872 function stopCasting(session: SessionToken): Promise<void>; 873 874 /** 875 * Begin to write device logs into a file descriptor for the purpose of problem locating. 876 * If the logs exceed max file size, no logs will be written and DEVICE_LOG_FULL event will be omitted. 877 * @param { string } url - The file descriptor to be written. 878 * @param { number } maxSize - The max size to be written in kilobyte. 879 * if not set, then written process will exit when there is no space to write. 880 * @returns { Promise<void> } Promise for the result 881 * @throws { BusinessError } 202 - Not System App. 882 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 883 * 2. Incorrect parameter types. 884 * @throws { BusinessError } 6600101 - Session service exception. 885 * @throws { BusinessError } 6600102 - The session does not exist. 886 * @syscap SystemCapability.Multimedia.AVSession.AVCast 887 * @systemapi 888 * @since 13 889 */ 890 function startDeviceLogging(url: string, maxSize?: number): Promise<void>; 891 892 /** 893 * Stop the current device written even the discovery is ongoing. 894 * @returns { Promise<void> } Promise for the result 895 * @throws { BusinessError } 202 - Not System App. 896 * @throws { BusinessError } 6600101 - Session service exception. 897 * @throws { BusinessError } 6600102 - The session does not exist. 898 * @syscap SystemCapability.Multimedia.AVSession.AVCast 899 * @systemapi 900 * @since 13 901 */ 902 function stopDeviceLogging(): Promise<void>; 903 904 /** 905 * Register log event callback. 906 * @param { 'deviceLogEvent' } type - Command to register 'deviceLogEvent'. 907 * @param { Callback<DeviceLogEventCode> } callback - Used to handle ('deviceLogEvent') command 908 * @throws { BusinessError } 202 - Not System App. 909 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 910 * 2. Incorrect parameter types. 911 * @throws { BusinessError } 6600101 - Session service exception. 912 * @throws { BusinessError } 6600102 - The session does not exist. 913 * @syscap SystemCapability.Multimedia.AVSession.AVCast 914 * @systemapi 915 * @since 13 916 */ 917 function on(type: 'deviceLogEvent', callback: Callback<DeviceLogEventCode>): void; 918 919 /** 920 * UnRegister log event callback. 921 * @param { 'deviceLogEvent' } type - Command to register 'deviceLogEvent'. 922 * @param { Callback<DeviceLogEventCode> } callback - Used to handle ('deviceLogEvent') command 923 * @throws { BusinessError } 202 - Not System App. 924 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 925 * 2. Incorrect parameter types. 926 * @throws { BusinessError } 6600101 - Session service exception. 927 * @throws { BusinessError } 6600102 - The session does not exist. 928 * @syscap SystemCapability.Multimedia.AVSession.AVCast 929 * @systemapi 930 * @since 13 931 */ 932 function off(type: 'deviceLogEvent', callback?: Callback<DeviceLogEventCode>): void; 933 934 /** 935 * Enumerates device log event code. 936 * @enum { number } 937 * @syscap SystemCapability.Multimedia.AVSession.AVCast 938 * @systemapi 939 * @since 13 940 */ 941 enum DeviceLogEventCode { 942 /** 943 * Log is full. 944 * @syscap SystemCapability.Multimedia.AVSession.AVCast 945 * @systemapi 946 * @since 13 947 */ 948 DEVICE_LOG_FULL = 1, 949 950 /** 951 * Log is written with exception, such as the fd cannot be written and so on. 952 * @syscap SystemCapability.Multimedia.AVSession.AVCast 953 * @systemapi 954 * @since 13 955 */ 956 DEVICE_LOG_EXCEPTION = 2, 957 } 958 959 /** 960 * Session type, support audio & video 961 * @typedef { 'audio' | 'video' } AVSessionType 962 * @syscap SystemCapability.Multimedia.AVSession.Core 963 * @since 10 964 */ 965 /** 966 * Session type, support audio & video, voice_call 967 * @typedef { 'audio' | 'video' | 'voice_call' } AVSessionType 968 * @syscap SystemCapability.Multimedia.AVSession.Core 969 * @since 11 970 */ 971 /** 972 * Session type supports audio & video, voice_call, video_call 973 * @typedef { 'audio' | 'video' | 'voice_call' | 'video_call' } AVSessionType 974 * @syscap SystemCapability.Multimedia.AVSession.Core 975 * @atomicservice 976 * @since 12 977 */ 978 type AVSessionType = 'audio' | 'video' | 'voice_call' | 'video_call'; 979 980 /** 981 * AVSession object. 982 * @interface AVSession 983 * @syscap SystemCapability.Multimedia.AVSession.Core 984 * @since 10 985 */ 986 /** 987 * AVSession object. 988 * @interface AVSession 989 * @syscap SystemCapability.Multimedia.AVSession.Core 990 * @atomicservice 991 * @since 12 992 */ 993 interface AVSession { 994 /** 995 * unique session Id 996 * @syscap SystemCapability.Multimedia.AVSession.Core 997 * @since 10 998 */ 999 /** 1000 * unique session Id 1001 * @type { string } 1002 * @readonly 1003 * @syscap SystemCapability.Multimedia.AVSession.Core 1004 * @atomicservice 1005 * @since 12 1006 */ 1007 readonly sessionId: string; 1008 1009 /** 1010 * Get current session type 1011 * @type { AVSessionType } 1012 * @syscap SystemCapability.Multimedia.AVSession.Core 1013 * @since 10 1014 */ 1015 /** 1016 * Get current session type 1017 * @type { AVSessionType } 1018 * @readonly 1019 * @syscap SystemCapability.Multimedia.AVSession.Core 1020 * @atomicservice 1021 * @since 12 1022 */ 1023 readonly sessionType: AVSessionType; 1024 1025 /** 1026 * Set the metadata of this session. 1027 * In addition to the required properties, users can fill in partially supported properties 1028 * @param { AVMetadata } data {@link AVMetadata} 1029 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1030 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1031 * 2.Parameter verification failed. 1032 * @throws { BusinessError } 6600101 - Session service exception. 1033 * @throws { BusinessError } 6600102 - The session does not exist. 1034 * @syscap SystemCapability.Multimedia.AVSession.Core 1035 * @since 10 1036 */ 1037 setAVMetadata(data: AVMetadata, callback: AsyncCallback<void>): void; 1038 1039 /** 1040 * Set the metadata of this session. 1041 * In addition to the required properties, users can fill in partially supported properties 1042 * @param { AVMetadata } data {@link AVMetadata} 1043 * @returns { Promise<void> } void promise when executed successfully 1044 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1045 * 2.Parameter verification failed. 1046 * @throws { BusinessError } 6600101 - Session service exception. 1047 * @throws { BusinessError } 6600102 - The session does not exist. 1048 * @syscap SystemCapability.Multimedia.AVSession.Core 1049 * @since 10 1050 */ 1051 /** 1052 * Set the metadata of this session. 1053 * In addition to the required properties, users can fill in partially supported properties 1054 * @param { AVMetadata } data {@link AVMetadata} 1055 * @returns { Promise<void> } void promise when executed successfully 1056 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1057 * 2.Parameter verification failed. 1058 * @throws { BusinessError } 6600101 - Session service exception. 1059 * @throws { BusinessError } 6600102 - The session does not exist. 1060 * @syscap SystemCapability.Multimedia.AVSession.Core 1061 * @atomicservice 1062 * @since 12 1063 */ 1064 setAVMetadata(data: AVMetadata): Promise<void>; 1065 1066 /** 1067 * Set the metadata related with current call. 1068 * @param { CallMetadata } data - {@link CallMetadata} 1069 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1070 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1071 * 2.Incorrect parameter types. 3.Parameter verification failed. 1072 * @throws { BusinessError } 6600101 - Session service exception. 1073 * @throws { BusinessError } 6600102 - The session does not exist. 1074 * @syscap SystemCapability.Multimedia.AVSession.Core 1075 * @since 11 1076 */ 1077 setCallMetadata(data: CallMetadata, callback: AsyncCallback<void>): void; 1078 1079 /** 1080 * Set the metadata related with current call. 1081 * @param { CallMetadata } data - {@link CallMetadata} 1082 * @returns { Promise<void> } void promise when executed successfully 1083 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1084 * 2.Incorrect parameter types. 3.Parameter verification failed. 1085 * @throws { BusinessError } 6600101 - Session service exception. 1086 * @throws { BusinessError } 6600102 - The session does not exist. 1087 * @syscap SystemCapability.Multimedia.AVSession.Core 1088 * @since 11 1089 */ 1090 setCallMetadata(data: CallMetadata): Promise<void>; 1091 1092 /** 1093 * Set the playback state of this session. 1094 * @param { AVPlaybackState } state {@link AVPlaybackState} 1095 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1096 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1097 * 2.Parameter verification failed. 1098 * @throws { BusinessError } 6600101 - Session service exception. 1099 * @throws { BusinessError } 6600102 - The session does not exist. 1100 * @syscap SystemCapability.Multimedia.AVSession.Core 1101 * @since 10 1102 */ 1103 setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void>): void; 1104 1105 /** 1106 * Set the playback state of this session. 1107 * @param { AVPlaybackState } state {@link AVPlaybackState} 1108 * @returns { Promise<void> } void promise when executed successfully 1109 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1110 * 2.Parameter verification failed. 1111 * @throws { BusinessError } 6600101 - Session service exception. 1112 * @throws { BusinessError } 6600102 - The session does not exist. 1113 * @syscap SystemCapability.Multimedia.AVSession.Core 1114 * @since 10 1115 */ 1116 /** 1117 * Set the playback state of this session. 1118 * @param { AVPlaybackState } state {@link AVPlaybackState} 1119 * @returns { Promise<void> } void promise when executed successfully 1120 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1121 * 2.Parameter verification failed. 1122 * @throws { BusinessError } 6600101 - Session service exception. 1123 * @throws { BusinessError } 6600102 - The session does not exist. 1124 * @syscap SystemCapability.Multimedia.AVSession.Core 1125 * @atomicservice 1126 * @since 12 1127 */ 1128 setAVPlaybackState(state: AVPlaybackState): Promise<void>; 1129 1130 /** 1131 * Set the call state of this session. 1132 * @param { AVCallState } state - {@link AVCallState} 1133 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1134 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1135 * 2.Parameter verification failed. 1136 * @throws { BusinessError } 6600101 - Session service exception. 1137 * @throws { BusinessError } 6600102 - The session does not exist. 1138 * @syscap SystemCapability.Multimedia.AVSession.Core 1139 * @since 11 1140 */ 1141 setAVCallState(state: AVCallState, callback: AsyncCallback<void>): void; 1142 1143 /** 1144 * Set the call state of this session. 1145 * @param { AVCallState } state - {@link AVCallState} 1146 * @returns { Promise<void> } void promise when executed successfully 1147 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1148 * 2.Parameter verification failed. 1149 * @throws { BusinessError } 6600101 - Session service exception. 1150 * @throws { BusinessError } 6600102 - The session does not exist. 1151 * @syscap SystemCapability.Multimedia.AVSession.Core 1152 * @since 11 1153 */ 1154 setAVCallState(state: AVCallState): Promise<void>; 1155 1156 /** 1157 * Set the ability to start the session corresponding to 1158 * @param { WantAgent } ability - The WantAgent for launch the ability 1159 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1160 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1161 * 2.Parameter verification failed. 1162 * @throws { BusinessError } 6600101 - Session service exception. 1163 * @throws { BusinessError } 6600102 - The session does not exist. 1164 * @syscap SystemCapability.Multimedia.AVSession.Core 1165 * @since 10 1166 */ 1167 setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void>): void; 1168 1169 /** 1170 * Set the ability to start the session corresponding to 1171 * @param { WantAgent } ability - The WantAgent for launch the ability 1172 * @returns { Promise<void> } void promise when executed successfully 1173 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1174 * 2.Parameter verification failed. 1175 * @throws { BusinessError } 6600101 - Session service exception. 1176 * @throws { BusinessError } 6600102 - The session does not exist. 1177 * @syscap SystemCapability.Multimedia.AVSession.Core 1178 * @since 10 1179 */ 1180 /** 1181 * Set the ability to start the session corresponding to 1182 * @param { WantAgent } ability - The WantAgent for launch the ability 1183 * @returns { Promise<void> } void promise when executed successfully 1184 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1185 * 2.Parameter verification failed. 1186 * @throws { BusinessError } 6600101 - Session service exception. 1187 * @throws { BusinessError } 6600102 - The session does not exist. 1188 * @syscap SystemCapability.Multimedia.AVSession.Core 1189 * @atomicservice 1190 * @since 12 1191 */ 1192 setLaunchAbility(ability: WantAgent): Promise<void>; 1193 1194 /** 1195 * Dispatch the session event of this session. 1196 * @param { string } event - Session event name to dispatch 1197 * @param { object } args - The parameters of session event 1198 * @param { AsyncCallback<void>} callback - The asyncCallback triggered when the command is executed successfully 1199 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1200 * 2.Incorrect parameter types. 3.Parameter verification failed. 1201 * @throws { BusinessError } 6600101 - Session service exception. 1202 * @throws { BusinessError } 6600102 - The session does not exist. 1203 * @syscap SystemCapability.Multimedia.AVSession.Core 1204 * @since 10 1205 */ 1206 dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback<void>): void; 1207 1208 /** 1209 * Dispatch the session event of this session. 1210 * @param { string } event - Session event name to dispatch 1211 * @param { object } args - The parameters of session event 1212 * @returns { Promise<void> } void promise when executed successfully 1213 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1214 * 2.Incorrect parameter types. 3.Parameter verification failed. 1215 * @throws { BusinessError } 6600101 - Session service exception. 1216 * @throws { BusinessError } 6600102 - The session does not exist. 1217 * @syscap SystemCapability.Multimedia.AVSession.Core 1218 * @since 10 1219 */ 1220 /** 1221 * Dispatch the session event of this session. 1222 * @param { string } event - Session event name to dispatch 1223 * @param { object } args - The parameters of session event 1224 * @returns { Promise<void> } void promise when executed successfully 1225 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1226 * 2.Incorrect parameter types. 3.Parameter verification failed. 1227 * @throws { BusinessError } 6600101 - Session service exception. 1228 * @throws { BusinessError } 6600102 - The session does not exist. 1229 * @syscap SystemCapability.Multimedia.AVSession.Core 1230 * @atomicservice 1231 * @since 12 1232 */ 1233 dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise<void>; 1234 1235 /** 1236 * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. 1237 * @param { Array<AVQueueItem> } items - An array of the AVQueueItem 1238 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 1239 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1240 * 2.Parameter verification failed. 1241 * @throws { BusinessError } 6600101 - Session service exception. 1242 * @throws { BusinessError } 6600102 - The session does not exist. 1243 * @syscap SystemCapability.Multimedia.AVSession.Core 1244 * @since 10 1245 */ 1246 setAVQueueItems(items: Array<AVQueueItem>, callback: AsyncCallback<void>): void; 1247 1248 /** 1249 * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. 1250 * @param { Array<AVQueueItem> } items - An array of the AVQueueItem 1251 * @returns { Promise<void> } void promise when executed successfully 1252 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1253 * 2.Parameter verification failed. 1254 * @throws { BusinessError } 6600101 - Session service exception. 1255 * @throws { BusinessError } 6600102 - The session does not exist. 1256 * @syscap SystemCapability.Multimedia.AVSession.Core 1257 * @since 10 1258 */ 1259 /** 1260 * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. 1261 * @param { Array<AVQueueItem> } items - An array of the AVQueueItem 1262 * @returns { Promise<void> } void promise when executed successfully 1263 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1264 * 2.Parameter verification failed. 1265 * @throws { BusinessError } 6600101 - Session service exception. 1266 * @throws { BusinessError } 6600102 - The session does not exist. 1267 * @syscap SystemCapability.Multimedia.AVSession.Core 1268 * @atomicservice 1269 * @since 12 1270 */ 1271 setAVQueueItems(items: Array<AVQueueItem>): Promise<void>; 1272 1273 /** 1274 * Set the name of the playlist presented by this session. 1275 * @param { string } title - The name of the playlist 1276 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 1277 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1278 * 2.Parameter verification failed. 1279 * @throws { BusinessError } 6600101 - Session service exception. 1280 * @throws { BusinessError } 6600102 - The session does not exist. 1281 * @syscap SystemCapability.Multimedia.AVSession.Core 1282 * @since 10 1283 */ 1284 setAVQueueTitle(title: string, callback: AsyncCallback<void>): void; 1285 1286 /** 1287 * Set the name of the playlist presented by this session. 1288 * @param { string } title - The name of the playlist 1289 * @returns { Promise<void> } void promise when executed successfully 1290 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1291 * 2.Parameter verification failed. 1292 * @throws { BusinessError } 6600101 - Session service exception. 1293 * @throws { BusinessError } 6600102 - The session does not exist. 1294 * @syscap SystemCapability.Multimedia.AVSession.Core 1295 * @since 10 1296 */ 1297 /** 1298 * Set the name of the playlist presented by this session. 1299 * @param { string } title - The name of the playlist 1300 * @returns { Promise<void> } void promise when executed successfully 1301 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1302 * 2.Parameter verification failed. 1303 * @throws { BusinessError } 6600101 - Session service exception. 1304 * @throws { BusinessError } 6600102 - The session does not exist. 1305 * @syscap SystemCapability.Multimedia.AVSession.Core 1306 * @atomicservice 1307 * @since 12 1308 */ 1309 setAVQueueTitle(title: string): Promise<void>; 1310 1311 /** 1312 * Set the custom media packets for this session. 1313 * @param { object } extras - The custom media packets 1314 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 1315 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1316 * 2.Parameter verification failed. 1317 * @throws { BusinessError } 6600101 - Session service exception. 1318 * @throws { BusinessError } 6600102 - The session does not exist. 1319 * @syscap SystemCapability.Multimedia.AVSession.Core 1320 * @since 10 1321 */ 1322 setExtras(extras: {[key: string]: Object}, callback: AsyncCallback<void>): void; 1323 1324 /** 1325 * Set the custom media packets for this session. 1326 * @param { object } extras - The custom media packets 1327 * @returns { Promise<void> } void promise when executed successfully 1328 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1329 * 2.Parameter verification failed. 1330 * @throws { BusinessError } 6600101 - Session service exception. 1331 * @throws { BusinessError } 6600102 - The session does not exist. 1332 * @syscap SystemCapability.Multimedia.AVSession.Core 1333 * @since 10 1334 */ 1335 /** 1336 * Set the custom media packets for this session. 1337 * @param { object } extras - The custom media packets 1338 * @returns { Promise<void> } void promise when executed successfully 1339 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1340 * 2.Parameter verification failed. 1341 * @throws { BusinessError } 6600101 - Session service exception. 1342 * @throws { BusinessError } 6600102 - The session does not exist. 1343 * @syscap SystemCapability.Multimedia.AVSession.Core 1344 * @atomicservice 1345 * @since 12 1346 */ 1347 setExtras(extras: {[key: string]: Object}): Promise<void>; 1348 1349 /** 1350 * Get the current session's own controller 1351 * @param { AsyncCallback<AVSessionController> } callback - async callback for the AVSessionController. 1352 * @throws { BusinessError } 6600101 - Session service exception. 1353 * @throws { BusinessError } 6600102 - The session does not exist. 1354 * @syscap SystemCapability.Multimedia.AVSession.Core 1355 * @since 10 1356 */ 1357 getController(callback: AsyncCallback<AVSessionController>): void; 1358 1359 /** 1360 * Get the current session's own controller 1361 * @returns { Promise<AVSessionController> } Promise for the AVSessionController 1362 * @throws { BusinessError } 6600101 - Session service exception. 1363 * @throws { BusinessError } 6600102 - The session does not exist. 1364 * @syscap SystemCapability.Multimedia.AVSession.Core 1365 * @since 10 1366 */ 1367 /** 1368 * Get the current session's own controller 1369 * @returns { Promise<AVSessionController> } Promise for the AVSessionController 1370 * @throws { BusinessError } 6600101 - Session service exception. 1371 * @throws { BusinessError } 6600102 - The session does not exist. 1372 * @syscap SystemCapability.Multimedia.AVSession.Core 1373 * @atomicservice 1374 * @since 12 1375 */ 1376 getController(): Promise<AVSessionController>; 1377 1378 /** 1379 * Get the cast controller when the session is casted to remote device. 1380 * If the avsession is not under casting state, the controller will return null. 1381 * @param { AsyncCallback<AVCastController> } callback - async callback for the AVCastController. 1382 * @throws {BusinessError} 6600102 - The session does not exist 1383 * @throws {BusinessError} 6600109 - The remote connection is not established 1384 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1385 * @since 10 1386 */ 1387 getAVCastController(callback: AsyncCallback<AVCastController>): void; 1388 1389 /** 1390 * Get the cast controller when the session is casted to remote device. 1391 * If the avsession is not under casting state, the controller will return null. 1392 * @returns { Promise<AVCastController> } Promise for the AVCastController 1393 * @throws {BusinessError} 6600102 - The session does not exist 1394 * @throws {BusinessError} 6600109 - The remote connection is not established 1395 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1396 * @since 10 1397 */ 1398 /** 1399 * Get the cast controller when the session is casted to remote device. 1400 * If the avsession is not under casting state, the controller will return null. 1401 * @returns { Promise<AVCastController> } Promise for the AVCastController 1402 * @throws {BusinessError} 6600102 - The session does not exist 1403 * @throws {BusinessError} 6600109 - The remote connection is not established 1404 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1405 * @atomicservice 1406 * @since 12 1407 */ 1408 getAVCastController(): Promise<AVCastController>; 1409 1410 /** 1411 * Get output device information 1412 * @param { AsyncCallback<OutputDeviceInfo> } callback - async callback for the OutputDeviceInfo. 1413 * @throws { BusinessError } 6600101 - Session service exception. 1414 * @throws { BusinessError } 6600102 - The session does not exist. 1415 * @syscap SystemCapability.Multimedia.AVSession.Core 1416 * @since 10 1417 */ 1418 getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void; 1419 1420 /** 1421 * Get output device information 1422 * @returns { Promise<OutputDeviceInfo> } Promise for the OutputDeviceInfo 1423 * @throws { BusinessError } 6600101 - Session service exception. 1424 * @throws { BusinessError } 6600102 - The session does not exist. 1425 * @syscap SystemCapability.Multimedia.AVSession.Core 1426 * @since 10 1427 */ 1428 /** 1429 * Get output device information 1430 * @returns { Promise<OutputDeviceInfo> } Promise for the OutputDeviceInfo 1431 * @throws { BusinessError } 6600101 - Session service exception. 1432 * @throws { BusinessError } 6600102 - The session does not exist. 1433 * @syscap SystemCapability.Multimedia.AVSession.Core 1434 * @atomicservice 1435 * @since 12 1436 */ 1437 getOutputDevice(): Promise<OutputDeviceInfo>; 1438 1439 /** 1440 * Get output device information 1441 * @returns { OutputDeviceInfo } the OutputDeviceInfo 1442 * @throws { BusinessError } 6600101 - Session service exception. 1443 * @throws { BusinessError } 6600102 - The session does not exist. 1444 * @syscap SystemCapability.Multimedia.AVSession.Core 1445 * @since 10 1446 */ 1447 /** 1448 * Get output device information 1449 * @returns { OutputDeviceInfo } the OutputDeviceInfo 1450 * @throws { BusinessError } 6600101 - Session service exception. 1451 * @throws { BusinessError } 6600102 - The session does not exist. 1452 * @syscap SystemCapability.Multimedia.AVSession.Core 1453 * @atomicservice 1454 * @since 12 1455 */ 1456 getOutputDeviceSync(): OutputDeviceInfo; 1457 1458 /** 1459 * Get all the current virtual display information for extended display. 1460 * @returns { Promise<Array<CastDisplayInfo>> } Promise for the CastDisplayInfo 1461 * @throws { BusinessError } 6600101 - Session service exception. 1462 * @throws { BusinessError } 6600102 - The session does not exist. 1463 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 1464 * @atomicservice 1465 * @since 12 1466 */ 1467 getAllCastDisplays(): Promise<Array<CastDisplayInfo>>; 1468 1469 /** 1470 * Register play command callback. 1471 * As long as it is registered, it means that the ability supports this command. 1472 * If you cancel the callback, you need to call off {@link off} 1473 * When canceling the callback, need to update the supported commands list. 1474 * Each playback command only supports registering one callback, 1475 * and the new callback will replace the previous one. 1476 * @param { 'play' } type - Command to register 'play'. 1477 * @param { function } callback - Used to handle ('play') command 1478 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1479 * 2.Incorrect parameter types. 1480 * @throws { BusinessError } 6600101 - Session service exception. 1481 * @throws { BusinessError } 6600102 - The session does not exist. 1482 * @syscap SystemCapability.Multimedia.AVSession.Core 1483 * @since 10 1484 */ 1485 /** 1486 * Register play command callback. 1487 * As long as it is registered, it means that the ability supports this command. 1488 * If you cancel the callback, you need to call off {@link off} 1489 * When canceling the callback, need to update the supported commands list. 1490 * Each playback command only supports registering one callback, 1491 * and the new callback will replace the previous one. 1492 * @param { 'play' } type - Command to register 'play'. 1493 * @param { function } callback - Used to handle ('play') command 1494 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1495 * 2.Incorrect parameter types. 1496 * @throws { BusinessError } 6600101 - Session service exception. 1497 * @throws { BusinessError } 6600102 - The session does not exist. 1498 * @syscap SystemCapability.Multimedia.AVSession.Core 1499 * @atomicservice 1500 * @since 12 1501 */ 1502 on(type: 'play', callback: () => void): void; 1503 1504 /** 1505 * Register pause command callback. 1506 * As long as it is registered, it means that the ability supports this command. 1507 * If you cancel the callback, you need to call off {@link off} 1508 * When canceling the callback, need to update the supported commands list. 1509 * Each playback command only supports registering one callback, 1510 * and the new callback will replace the previous one. 1511 * @param { 'pause' } type - Command to register 'pause'. 1512 * @param { function } callback - Used to handle ('pause') command 1513 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1514 * 2.Incorrect parameter types. 1515 * @throws { BusinessError } 6600101 - Session service exception. 1516 * @throws { BusinessError } 6600102 - The session does not exist. 1517 * @syscap SystemCapability.Multimedia.AVSession.Core 1518 * @since 10 1519 */ 1520 /** 1521 * Register pause command callback. 1522 * As long as it is registered, it means that the ability supports this command. 1523 * If you cancel the callback, you need to call off {@link off} 1524 * When canceling the callback, need to update the supported commands list. 1525 * Each playback command only supports registering one callback, 1526 * and the new callback will replace the previous one. 1527 * @param { 'pause' } type - Command to register 'pause'. 1528 * @param { function } callback - Used to handle ('pause') command 1529 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1530 * 2.Incorrect parameter types. 1531 * @throws { BusinessError } 6600101 - Session service exception. 1532 * @throws { BusinessError } 6600102 - The session does not exist. 1533 * @syscap SystemCapability.Multimedia.AVSession.Core 1534 * @atomicservice 1535 * @since 12 1536 */ 1537 on(type: 'pause', callback: () => void): void; 1538 1539 /** 1540 * Register stop command callback. 1541 * As long as it is registered, it means that the ability supports this command. 1542 * If you cancel the callback, you need to call off {@link off} 1543 * When canceling the callback, need to update the supported commands list. 1544 * Each playback command only supports registering one callback, 1545 * and the new callback will replace the previous one. 1546 * @param { 'stop' } type - Command to register 'stop'. 1547 * @param { function } callback - Used to handle ('stop') command 1548 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1549 * 2.Incorrect parameter types. 1550 * @throws { BusinessError } 6600101 - Session service exception. 1551 * @throws { BusinessError } 6600102 - The session does not exist. 1552 * @syscap SystemCapability.Multimedia.AVSession.Core 1553 * @since 10 1554 */ 1555 /** 1556 * Register stop command callback. 1557 * As long as it is registered, it means that the ability supports this command. 1558 * If you cancel the callback, you need to call off {@link off} 1559 * When canceling the callback, need to update the supported commands list. 1560 * Each playback command only supports registering one callback, 1561 * and the new callback will replace the previous one. 1562 * @param { 'stop' } type - Command to register 'stop'. 1563 * @param { function } callback - Used to handle ('stop') command 1564 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1565 * 2.Incorrect parameter types. 1566 * @throws { BusinessError } 6600101 - Session service exception. 1567 * @throws { BusinessError } 6600102 - The session does not exist. 1568 * @syscap SystemCapability.Multimedia.AVSession.Core 1569 * @atomicservice 1570 * @since 12 1571 */ 1572 on(type: 'stop', callback: () => void): void; 1573 1574 /** 1575 * Register playNext command callback. 1576 * As long as it is registered, it means that the ability supports this command. 1577 * If you cancel the callback, you need to call off {@link off} 1578 * When canceling the callback, need to update the supported commands list. 1579 * Each playback command only supports registering one callback, 1580 * and the new callback will replace the previous one. 1581 * @param { 'playNext' } type - Command to register 'playNext'. 1582 * @param { function } callback - Used to handle ('playNext') command 1583 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1584 * 2.Incorrect parameter types. 1585 * @throws { BusinessError } 6600101 - Session service exception. 1586 * @throws { BusinessError } 6600102 - The session does not exist. 1587 * @syscap SystemCapability.Multimedia.AVSession.Core 1588 * @since 10 1589 */ 1590 /** 1591 * Register playNext command callback. 1592 * As long as it is registered, it means that the ability supports this command. 1593 * If you cancel the callback, you need to call off {@link off} 1594 * When canceling the callback, need to update the supported commands list. 1595 * Each playback command only supports registering one callback, 1596 * and the new callback will replace the previous one. 1597 * @param { 'playNext' } type - Command to register 'playNext'. 1598 * @param { function } callback - Used to handle ('playNext') command 1599 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1600 * 2.Incorrect parameter types. 1601 * @throws { BusinessError } 6600101 - Session service exception. 1602 * @throws { BusinessError } 6600102 - The session does not exist. 1603 * @syscap SystemCapability.Multimedia.AVSession.Core 1604 * @atomicservice 1605 * @since 12 1606 */ 1607 on(type: 'playNext', callback: () => void): void; 1608 1609 /** 1610 * Register playPrevious command callback. 1611 * As long as it is registered, it means that the ability supports this command. 1612 * If you cancel the callback, you need to call off {@link off} 1613 * When canceling the callback, need to update the supported commands list. 1614 * Each playback command only supports registering one callback, 1615 * and the new callback will replace the previous one. 1616 * @param { 'playPrevious' } type - Command to register 'playPrevious'. 1617 * @param { function } callback - Used to handle ('playPrevious') command 1618 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1619 * 2.Incorrect parameter types. 1620 * @throws { BusinessError } 6600101 - Session service exception. 1621 * @throws { BusinessError } 6600102 - The session does not exist. 1622 * @syscap SystemCapability.Multimedia.AVSession.Core 1623 * @since 10 1624 */ 1625 /** 1626 * Register playPrevious command callback. 1627 * As long as it is registered, it means that the ability supports this command. 1628 * If you cancel the callback, you need to call off {@link off} 1629 * When canceling the callback, need to update the supported commands list. 1630 * Each playback command only supports registering one callback, 1631 * and the new callback will replace the previous one. 1632 * @param { 'playPrevious' } type - Command to register 'playPrevious'. 1633 * @param { function } callback - Used to handle ('playPrevious') command 1634 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1635 * 2.Incorrect parameter types. 1636 * @throws { BusinessError } 6600101 - Session service exception. 1637 * @throws { BusinessError } 6600102 - The session does not exist. 1638 * @syscap SystemCapability.Multimedia.AVSession.Core 1639 * @atomicservice 1640 * @since 12 1641 */ 1642 on(type: 'playPrevious', callback: () => void): void; 1643 1644 /** 1645 * Register fastForward command callback. 1646 * As long as it is registered, it means that the ability supports this command. 1647 * If you cancel the callback, you need to call off {@link off} 1648 * When canceling the callback, need to update the supported commands list. 1649 * Each playback command only supports registering one callback, 1650 * and the new callback will replace the previous one. 1651 * @param { 'fastForward' } type - Command to register 'fastForward'. 1652 * @param { function } callback - Used to handle ('fastForward') command 1653 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1654 * 2.Incorrect parameter types. 1655 * @throws { BusinessError } 6600101 - Session service exception. 1656 * @throws { BusinessError } 6600102 - The session does not exist. 1657 * @syscap SystemCapability.Multimedia.AVSession.Core 1658 * @since 10 1659 */ 1660 /** 1661 * Register fastForward command callback. 1662 * As long as it is registered, it means that the ability supports this command. 1663 * If you cancel the callback, you need to call off {@link off} 1664 * When canceling the callback, need to update the supported commands list. 1665 * Each playback command only supports registering one callback, 1666 * and the new callback will replace the previous one. 1667 * @param { 'fastForward' } type - Command to register 'fastForward'. 1668 * @param { function } callback - Used to handle ('fastForward') command 1669 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1670 * 2.Incorrect parameter types. 1671 * @throws { BusinessError } 6600101 - Session service exception. 1672 * @throws { BusinessError } 6600102 - The session does not exist. 1673 * @syscap SystemCapability.Multimedia.AVSession.Core 1674 * @atomicservice 1675 * @since 12 1676 */ 1677 on(type: 'fastForward', callback: (time ?: number) => void): void; 1678 1679 /** 1680 * Register rewind command callback. 1681 * As long as it is registered, it means that the ability supports this command. 1682 * If you cancel the callback, you need to call off {@link off} 1683 * When canceling the callback, need to update the supported commands list. 1684 * Each playback command only supports registering one callback, 1685 * and the new callback will replace the previous one. 1686 * @param { 'rewind' } type - Command to register 'rewind'. 1687 * @param { function } callback - Used to handle ('rewind') command 1688 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1689 * 2.Incorrect parameter types. 1690 * @throws { BusinessError } 6600101 - Session service exception. 1691 * @throws { BusinessError } 6600102 - The session does not exist. 1692 * @syscap SystemCapability.Multimedia.AVSession.Core 1693 * @since 10 1694 */ 1695 /** 1696 * Register rewind command callback. 1697 * As long as it is registered, it means that the ability supports this command. 1698 * If you cancel the callback, you need to call off {@link off} 1699 * When canceling the callback, need to update the supported commands list. 1700 * Each playback command only supports registering one callback, 1701 * and the new callback will replace the previous one. 1702 * @param { 'rewind' } type - Command to register 'rewind'. 1703 * @param { function } callback - Used to handle ('rewind') command 1704 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1705 * 2.Incorrect parameter types. 1706 * @throws { BusinessError } 6600101 - Session service exception. 1707 * @throws { BusinessError } 6600102 - The session does not exist. 1708 * @syscap SystemCapability.Multimedia.AVSession.Core 1709 * @atomicservice 1710 * @since 12 1711 */ 1712 on(type: 'rewind', callback: (time ?: number) => void): void; 1713 1714 /** 1715 * Unregister play command callback. 1716 * When canceling the callback, need to update the supported commands list. 1717 * @param { 'play' } type - Command to register 'play'. 1718 * @param { function } callback - Used to handle ('play') command 1719 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1720 * 2.Incorrect parameter types. 1721 * @throws { BusinessError } 6600101 - Session service exception. 1722 * @throws { BusinessError } 6600102 - The session does not exist. 1723 * @syscap SystemCapability.Multimedia.AVSession.Core 1724 * @since 10 1725 */ 1726 /** 1727 * Unregister play command callback. 1728 * When canceling the callback, need to update the supported commands list. 1729 * @param { 'play' } type - Command to register 'play'. 1730 * @param { function } callback - Used to handle ('play') command 1731 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1732 * 2.Incorrect parameter types. 1733 * @throws { BusinessError } 6600101 - Session service exception. 1734 * @throws { BusinessError } 6600102 - The session does not exist. 1735 * @syscap SystemCapability.Multimedia.AVSession.Core 1736 * @atomicservice 1737 * @since 12 1738 */ 1739 off(type: 'play', callback?: () => void): void; 1740 1741 /** 1742 * Unregister pause command callback. 1743 * When canceling the callback, need to update the supported commands list. 1744 * @param { 'pause' } type - Command to register 'pause'. 1745 * @param { function } callback - Used to handle ('pause') command 1746 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1747 * 2.Incorrect parameter types. 1748 * @throws { BusinessError } 6600101 - Session service exception. 1749 * @throws { BusinessError } 6600102 - The session does not exist. 1750 * @syscap SystemCapability.Multimedia.AVSession.Core 1751 * @since 10 1752 */ 1753 /** 1754 * Unregister pause command callback. 1755 * When canceling the callback, need to update the supported commands list. 1756 * @param { 'pause' } type - Command to register 'pause'. 1757 * @param { function } callback - Used to handle ('pause') command 1758 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1759 * 2.Incorrect parameter types. 1760 * @throws { BusinessError } 6600101 - Session service exception. 1761 * @throws { BusinessError } 6600102 - The session does not exist. 1762 * @syscap SystemCapability.Multimedia.AVSession.Core 1763 * @atomicservice 1764 * @since 12 1765 */ 1766 off(type: 'pause', callback?: () => void): void; 1767 1768 /** 1769 * Unregister stop command callback. 1770 * When canceling the callback, need to update the supported commands list. 1771 * @param { 'stop' } type - Command to register 'stop'. 1772 * @param { function } callback - Used to handle ('stop') command 1773 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1774 * 2.Incorrect parameter types. 1775 * @throws { BusinessError } 6600101 - Session service exception. 1776 * @throws { BusinessError } 6600102 - The session does not exist. 1777 * @syscap SystemCapability.Multimedia.AVSession.Core 1778 * @since 10 1779 */ 1780 /** 1781 * Unregister stop command callback. 1782 * When canceling the callback, need to update the supported commands list. 1783 * @param { 'stop' } type - Command to register 'stop'. 1784 * @param { function } callback - Used to handle ('stop') command 1785 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1786 * 2.Incorrect parameter types. 1787 * @throws { BusinessError } 6600101 - Session service exception. 1788 * @throws { BusinessError } 6600102 - The session does not exist. 1789 * @syscap SystemCapability.Multimedia.AVSession.Core 1790 * @atomicservice 1791 * @since 12 1792 */ 1793 off(type: 'stop', callback?: () => void): void; 1794 1795 /** 1796 * Unregister playNext command callback. 1797 * When canceling the callback, need to update the supported commands list. 1798 * @param { 'playNext' } type - Command to register 'playNext'. 1799 * @param { function } callback - Used to handle ('playNext') command 1800 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1801 * 2.Incorrect parameter types. 1802 * @throws { BusinessError } 6600101 - Session service exception. 1803 * @throws { BusinessError } 6600102 - The session does not exist. 1804 * @syscap SystemCapability.Multimedia.AVSession.Core 1805 * @since 10 1806 */ 1807 /** 1808 * Unregister playNext command callback. 1809 * When canceling the callback, need to update the supported commands list. 1810 * @param { 'playNext' } type - Command to register 'playNext'. 1811 * @param { function } callback - Used to handle ('playNext') command 1812 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1813 * 2.Incorrect parameter types. 1814 * @throws { BusinessError } 6600101 - Session service exception. 1815 * @throws { BusinessError } 6600102 - The session does not exist. 1816 * @syscap SystemCapability.Multimedia.AVSession.Core 1817 * @atomicservice 1818 * @since 12 1819 */ 1820 off(type: 'playNext', callback?: () => void): void; 1821 1822 /** 1823 * Unregister playPrevious command callback. 1824 * When canceling the callback, need to update the supported commands list. 1825 * @param { 'playPrevious' } type - Command to register 'playPrevious'. 1826 * @param { function } callback - Used to handle ('playPrevious') command 1827 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1828 * 2.Incorrect parameter types. 1829 * @throws { BusinessError } 6600101 - Session service exception. 1830 * @throws { BusinessError } 6600102 - The session does not exist. 1831 * @syscap SystemCapability.Multimedia.AVSession.Core 1832 * @since 10 1833 */ 1834 /** 1835 * Unregister playPrevious command callback. 1836 * When canceling the callback, need to update the supported commands list. 1837 * @param { 'playPrevious' } type - Command to register 'playPrevious'. 1838 * @param { function } callback - Used to handle ('playPrevious') command 1839 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1840 * 2.Incorrect parameter types. 1841 * @throws { BusinessError } 6600101 - Session service exception. 1842 * @throws { BusinessError } 6600102 - The session does not exist. 1843 * @syscap SystemCapability.Multimedia.AVSession.Core 1844 * @atomicservice 1845 * @since 12 1846 */ 1847 off(type: 'playPrevious', callback?: () => void): void; 1848 1849 /** 1850 * Unregister fastForward command callback. 1851 * When canceling the callback, need to update the supported commands list. 1852 * @param { 'fastForward' } type - Command to register 'fastForward'. 1853 * @param { function } callback - Used to handle ('fastForward') command 1854 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1855 * 2.Incorrect parameter types. 1856 * @throws { BusinessError } 6600101 - Session service exception. 1857 * @throws { BusinessError } 6600102 - The session does not exist. 1858 * @syscap SystemCapability.Multimedia.AVSession.Core 1859 * @since 10 1860 */ 1861 /** 1862 * Unregister fastForward command callback. 1863 * When canceling the callback, need to update the supported commands list. 1864 * @param { 'fastForward' } type - Command to register 'fastForward'. 1865 * @param { function } callback - Used to handle ('fastForward') command 1866 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1867 * 2.Incorrect parameter types. 1868 * @throws { BusinessError } 6600101 - Session service exception. 1869 * @throws { BusinessError } 6600102 - The session does not exist. 1870 * @syscap SystemCapability.Multimedia.AVSession.Core 1871 * @atomicservice 1872 * @since 12 1873 */ 1874 off(type: 'fastForward', callback?: () => void): void; 1875 1876 /** 1877 * Unregister rewind command callback. 1878 * When canceling the callback, need to update the supported commands list. 1879 * @param { 'rewind' } type - Command to register 'rewind'. 1880 * @param { function } callback - Used to handle ('rewind') command 1881 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1882 * 2.Incorrect parameter types. 1883 * @throws { BusinessError } 6600101 - Session service exception. 1884 * @throws { BusinessError } 6600102 - The session does not exist. 1885 * @syscap SystemCapability.Multimedia.AVSession.Core 1886 * @since 10 1887 */ 1888 /** 1889 * Unregister rewind command callback. 1890 * When canceling the callback, need to update the supported commands list. 1891 * @param { 'rewind' } type - Command to register 'rewind'. 1892 * @param { function } callback - Used to handle ('rewind') command 1893 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1894 * 2.Incorrect parameter types. 1895 * @throws { BusinessError } 6600101 - Session service exception. 1896 * @throws { BusinessError } 6600102 - The session does not exist. 1897 * @syscap SystemCapability.Multimedia.AVSession.Core 1898 * @atomicservice 1899 * @since 12 1900 */ 1901 off(type: 'rewind', callback?: () => void): void; 1902 1903 /** 1904 * Register playFromAssetId command callback. 1905 * As long as it is registered, it means that the ability supports this command. 1906 * If you cancel the callback, you need to call off {@link off} 1907 * When canceling the callback, need to update the supported commands list. 1908 * Each playback command only supports registering one callback, 1909 * and the new callback will replace the previous one. 1910 * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. 1911 * @param { function } callback - Used to handle ('playFromAssetId') command 1912 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1913 * 2.Incorrect parameter types. 1914 * @throws { BusinessError } 6600101 - Session service exception. 1915 * @throws { BusinessError } 6600102 - The session does not exist. 1916 * @syscap SystemCapability.Multimedia.AVSession.Core 1917 * @since 11 1918 */ 1919 /** 1920 * Register playFromAssetId command callback. 1921 * As long as it is registered, it means that the ability supports this command. 1922 * If you cancel the callback, you need to call off {@link off} 1923 * When canceling the callback, need to update the supported commands list. 1924 * Each playback command only supports registering one callback, 1925 * and the new callback will replace the previous one. 1926 * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. 1927 * @param { function } callback - Used to handle ('playFromAssetId') command 1928 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1929 * 2.Incorrect parameter types. 1930 * @throws { BusinessError } 6600101 - Session service exception. 1931 * @throws { BusinessError } 6600102 - The session does not exist. 1932 * @syscap SystemCapability.Multimedia.AVSession.Core 1933 * @atomicservice 1934 * @since 12 1935 */ 1936 on(type: 'playFromAssetId', callback: (assetId: number) => void): void; 1937 1938 /** 1939 * Unregister playFromAssetId command callback. 1940 * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. 1941 * @param { function } callback - Used to handle ('playFromAssetId') command 1942 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1943 * 2.Incorrect parameter types. 1944 * @throws { BusinessError } 6600101 - Session service exception. 1945 * @throws { BusinessError } 6600102 - The session does not exist. 1946 * @syscap SystemCapability.Multimedia.AVSession.Core 1947 * @since 11 1948 */ 1949 /** 1950 * Unregister playFromAssetId command callback. 1951 * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. 1952 * @param { function } callback - Used to handle ('playFromAssetId') command 1953 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1954 * 2.Incorrect parameter types. 1955 * @throws { BusinessError } 6600101 - Session service exception. 1956 * @throws { BusinessError } 6600102 - The session does not exist. 1957 * @syscap SystemCapability.Multimedia.AVSession.Core 1958 * @atomicservice 1959 * @since 12 1960 */ 1961 off(type: 'playFromAssetId', callback?: (assetId: number) => void): void; 1962 1963 /** 1964 * Register seek command callback 1965 * @param { 'seek' } type - Registration Type 'seek' 1966 * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) 1967 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1968 * 2.Incorrect parameter types. 1969 * @throws { BusinessError } 6600101 - Session service exception. 1970 * @throws { BusinessError } 6600102 - The session does not exist. 1971 * @syscap SystemCapability.Multimedia.AVSession.Core 1972 * @since 10 1973 */ 1974 /** 1975 * Register seek command callback 1976 * @param { 'seek' } type - Registration Type 'seek' 1977 * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) 1978 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1979 * 2.Incorrect parameter types. 1980 * @throws { BusinessError } 6600101 - Session service exception. 1981 * @throws { BusinessError } 6600102 - The session does not exist. 1982 * @syscap SystemCapability.Multimedia.AVSession.Core 1983 * @atomicservice 1984 * @since 12 1985 */ 1986 on(type: 'seek', callback: (time: number) => void): void; 1987 1988 /** 1989 * Unregister seek command callback 1990 * @param { 'seek' } type - Registration Type 'seek' 1991 * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) 1992 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 1993 * 2.Incorrect parameter types. 1994 * @throws { BusinessError } 6600101 - Session service exception. 1995 * @throws { BusinessError } 6600102 - The session does not exist. 1996 * @syscap SystemCapability.Multimedia.AVSession.Core 1997 * @since 10 1998 */ 1999 /** 2000 * Unregister seek command callback 2001 * @param { 'seek' } type - Registration Type 'seek' 2002 * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) 2003 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2004 * 2.Incorrect parameter types. 2005 * @throws { BusinessError } 6600101 - Session service exception. 2006 * @throws { BusinessError } 6600102 - The session does not exist. 2007 * @syscap SystemCapability.Multimedia.AVSession.Core 2008 * @atomicservice 2009 * @since 12 2010 */ 2011 off(type: 'seek', callback?: (time: number) => void): void; 2012 2013 /** 2014 * Register setSpeed command callback 2015 * @param { 'setSpeed' } type - Registration Type 'setSpeed' 2016 * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value 2017 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2018 * 2.Incorrect parameter types. 2019 * @throws { BusinessError } 6600101 - Session service exception. 2020 * @throws { BusinessError } 6600102 - The session does not exist. 2021 * @syscap SystemCapability.Multimedia.AVSession.Core 2022 * @since 10 2023 */ 2024 /** 2025 * Register setSpeed command callback 2026 * @param { 'setSpeed' } type - Registration Type 'setSpeed' 2027 * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value 2028 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2029 * 2.Incorrect parameter types. 2030 * @throws { BusinessError } 6600101 - Session service exception. 2031 * @throws { BusinessError } 6600102 - The session does not exist. 2032 * @syscap SystemCapability.Multimedia.AVSession.Core 2033 * @atomicservice 2034 * @since 12 2035 */ 2036 on(type: 'setSpeed', callback: (speed: number) => void): void; 2037 2038 /** 2039 * Unregister setSpeed command callback 2040 * @param { 'setSpeed' } type - Registration Type 'setSpeed' 2041 * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value 2042 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2043 * 2.Incorrect parameter types. 2044 * @throws { BusinessError } 6600101 - Session service exception. 2045 * @throws { BusinessError } 6600102 - The session does not exist. 2046 * @syscap SystemCapability.Multimedia.AVSession.Core 2047 * @since 10 2048 */ 2049 /** 2050 * Unregister setSpeed command callback 2051 * @param { 'setSpeed' } type - Registration Type 'setSpeed' 2052 * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value 2053 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2054 * 2.Incorrect parameter types. 2055 * @throws { BusinessError } 6600101 - Session service exception. 2056 * @throws { BusinessError } 6600102 - The session does not exist. 2057 * @syscap SystemCapability.Multimedia.AVSession.Core 2058 * @atomicservice 2059 * @since 12 2060 */ 2061 off(type: 'setSpeed', callback?: (speed: number) => void): void; 2062 2063 /** 2064 * Register setLoopMode command callback 2065 * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' 2066 * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} 2067 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2068 * 2.Incorrect parameter types. 2069 * @throws { BusinessError } 6600101 - Session service exception. 2070 * @throws { BusinessError } 6600102 - The session does not exist. 2071 * @syscap SystemCapability.Multimedia.AVSession.Core 2072 * @since 10 2073 */ 2074 /** 2075 * Register setLoopMode command callback 2076 * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' 2077 * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} 2078 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2079 * 2.Incorrect parameter types. 2080 * @throws { BusinessError } 6600101 - Session service exception. 2081 * @throws { BusinessError } 6600102 - The session does not exist. 2082 * @syscap SystemCapability.Multimedia.AVSession.Core 2083 * @atomicservice 2084 * @since 12 2085 */ 2086 on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void; 2087 2088 /** 2089 * Unregister setLoopMode command callback 2090 * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' 2091 * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} 2092 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2093 * 2.Incorrect parameter types. 2094 * @throws { BusinessError } 6600101 - Session service exception. 2095 * @throws { BusinessError } 6600102 - The session does not exist. 2096 * @syscap SystemCapability.Multimedia.AVSession.Core 2097 * @since 10 2098 */ 2099 /** 2100 * Unregister setLoopMode command callback 2101 * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' 2102 * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} 2103 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2104 * 2.Incorrect parameter types. 2105 * @throws { BusinessError } 6600101 - Session service exception. 2106 * @throws { BusinessError } 6600102 - The session does not exist. 2107 * @syscap SystemCapability.Multimedia.AVSession.Core 2108 * @atomicservice 2109 * @since 12 2110 */ 2111 off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void; 2112 2113 /** 2114 * Register setTargetLoopMode command callback 2115 * Application should change playmode to the loopmode which is requested. 2116 * @param { 'setTargetLoopMode' } type - Registration Type 'setTargetLoopMode' 2117 * @param { Callback<LoopMode> } callback - Used to handle setTargetLoopMode command.The callback provides the {@link LoopMode} 2118 * @throws { BusinessError } 6600101 - Session service exception. 2119 * @throws { BusinessError } 6600102 - The session does not exist. 2120 * @syscap SystemCapability.Multimedia.AVSession.Core 2121 * @atomicservice 2122 * @since 18 2123 */ 2124 on(type: 'setTargetLoopMode', callback: Callback<LoopMode>): void; 2125 2126 /** 2127 * Unregister setTargetLoopMode command callback 2128 * @param { 'setTargetLoopMode' } type - Registration Type 'setTargetLoopMode' 2129 * @param { Callback<LoopMode> } callback - Used to handle setTargetLoopMode command.The callback provides the {@link LoopMode} 2130 * @throws { BusinessError } 6600101 - Session service exception. 2131 * @throws { BusinessError } 6600102 - The session does not exist. 2132 * @syscap SystemCapability.Multimedia.AVSession.Core 2133 * @atomicservice 2134 * @since 18 2135 */ 2136 off(type: 'setTargetLoopMode', callback?: Callback<LoopMode>): void; 2137 2138 /** 2139 * Register toggle favorite command callback 2140 * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' 2141 * @param { function } callback - Used to handle toggleFavorite command.The callback provides 2142 * the assetId for which the favorite status needs to be switched. 2143 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2144 * 2.Incorrect parameter types. 2145 * @throws { BusinessError } 6600101 - Session service exception. 2146 * @throws { BusinessError } 6600102 - The session does not exist. 2147 * @syscap SystemCapability.Multimedia.AVSession.Core 2148 * @since 10 2149 */ 2150 /** 2151 * Register toggle favorite command callback 2152 * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' 2153 * @param { function } callback - Used to handle toggleFavorite command.The callback provides 2154 * the assetId for which the favorite status needs to be switched. 2155 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2156 * 2.Incorrect parameter types. 2157 * @throws { BusinessError } 6600101 - Session service exception. 2158 * @throws { BusinessError } 6600102 - The session does not exist. 2159 * @syscap SystemCapability.Multimedia.AVSession.Core 2160 * @atomicservice 2161 * @since 12 2162 */ 2163 on(type: 'toggleFavorite', callback: (assetId: string) => void): void; 2164 2165 /** 2166 * Unregister toggle favorite command callback 2167 * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' 2168 * @param { function } callback - Used to handle toggleFavorite command.The callback provides 2169 * the assetId for which the favorite status needs to be switched. 2170 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2171 * 2.Incorrect parameter types. 2172 * @throws { BusinessError } 6600101 - Session service exception. 2173 * @throws { BusinessError } 6600102 - The session does not exist. 2174 * @syscap SystemCapability.Multimedia.AVSession.Core 2175 * @since 10 2176 */ 2177 /** 2178 * Unregister toggle favorite command callback 2179 * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' 2180 * @param { function } callback - Used to handle toggleFavorite command.The callback provides 2181 * the assetId for which the favorite status needs to be switched. 2182 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2183 * 2.Incorrect parameter types. 2184 * @throws { BusinessError } 6600101 - Session service exception. 2185 * @throws { BusinessError } 6600102 - The session does not exist. 2186 * @syscap SystemCapability.Multimedia.AVSession.Core 2187 * @atomicservice 2188 * @since 12 2189 */ 2190 off(type: 'toggleFavorite', callback?: (assetId: string) => void): void; 2191 2192 /** 2193 * Register media key handling callback 2194 * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' 2195 * @param { function } callback - Used to handle key events.The callback provides the KeyEvent 2196 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2197 * 2.Incorrect parameter types. 2198 * @throws { BusinessError } 6600101 - Session service exception. 2199 * @throws { BusinessError } 6600102 - The session does not exist. 2200 * @syscap SystemCapability.Multimedia.AVSession.Core 2201 * @since 10 2202 */ 2203 /** 2204 * Register media key handling callback 2205 * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' 2206 * @param { function } callback - Used to handle key events.The callback provides the KeyEvent 2207 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2208 * 2.Incorrect parameter types. 2209 * @throws { BusinessError } 6600101 - Session service exception. 2210 * @throws { BusinessError } 6600102 - The session does not exist. 2211 * @syscap SystemCapability.Multimedia.AVSession.Core 2212 * @atomicservice 2213 * @since 12 2214 */ 2215 on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void; 2216 2217 /** 2218 * Unregister media key handling callback 2219 * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' 2220 * @param { function } callback - Used to handle key events.The callback provides the KeyEvent 2221 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2222 * 2.Incorrect parameter types. 2223 * @throws { BusinessError } 6600101 - Session service exception. 2224 * @throws { BusinessError } 6600102 - The session does not exist. 2225 * @syscap SystemCapability.Multimedia.AVSession.Core 2226 * @since 10 2227 */ 2228 /** 2229 * Unregister media key handling callback 2230 * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' 2231 * @param { function } callback - Used to handle key events.The callback provides the KeyEvent 2232 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2233 * 2.Incorrect parameter types. 2234 * @throws { BusinessError } 6600101 - Session service exception. 2235 * @throws { BusinessError } 6600102 - The session does not exist. 2236 * @syscap SystemCapability.Multimedia.AVSession.Core 2237 * @atomicservice 2238 * @since 12 2239 */ 2240 off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void; 2241 2242 /** 2243 * Register session output device change callback 2244 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 2245 * @param { function } callback - Used to handle output device changed. 2246 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 2247 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2248 * 2.Incorrect parameter types. 2249 * @throws { BusinessError } 6600101 - Session service exception 2250 * @throws { BusinessError } 6600102 - The session does not exist 2251 * @syscap SystemCapability.Multimedia.AVSession.Core 2252 * @since 10 2253 */ 2254 /** 2255 * Register session output device change callback 2256 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 2257 * @param { function } callback - Used to handle output device changed. 2258 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 2259 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2260 * 2.Incorrect parameter types. 2261 * @throws { BusinessError } 6600101 - Session service exception 2262 * @throws { BusinessError } 6600102 - The session does not exist 2263 * @syscap SystemCapability.Multimedia.AVSession.Core 2264 * @atomicservice 2265 * @since 12 2266 */ 2267 on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 2268 2269 /** 2270 * Unregister session output device change callback 2271 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 2272 * @param { function } callback - Used to handle output device changed. 2273 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 2274 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2275 * 2.Incorrect parameter types. 2276 * @throws { BusinessError } 6600101 - Session service exception 2277 * @throws { BusinessError } 6600102 - The session does not exist 2278 * @syscap SystemCapability.Multimedia.AVSession.Core 2279 * @since 10 2280 */ 2281 /** 2282 * Unregister session output device change callback 2283 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 2284 * @param { function } callback - Used to handle output device changed. 2285 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 2286 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2287 * 2.Incorrect parameter types. 2288 * @throws { BusinessError } 6600101 - Session service exception 2289 * @throws { BusinessError } 6600102 - The session does not exist 2290 * @syscap SystemCapability.Multimedia.AVSession.Core 2291 * @atomicservice 2292 * @since 12 2293 */ 2294 off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 2295 2296 /** 2297 * Register session custom command change callback 2298 * @param { 'commonCommand' } type - Registration Type 'commonCommand' 2299 * @param { function } callback - Used to handle event when the common command is received 2300 * The callback provide the command name and command args 2301 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2302 * 2.Incorrect parameter types. 2303 * @throws { BusinessError } 6600101 - Session service exception. 2304 * @throws { BusinessError } 6600102 - The session does not exist. 2305 * @syscap SystemCapability.Multimedia.AVSession.Core 2306 * @since 10 2307 */ 2308 /** 2309 * Register session custom command change callback 2310 * @param { 'commonCommand' } type - Registration Type 'commonCommand' 2311 * @param { function } callback - Used to handle event when the common command is received 2312 * The callback provide the command name and command args 2313 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2314 * 2.Incorrect parameter types. 2315 * @throws { BusinessError } 6600101 - Session service exception. 2316 * @throws { BusinessError } 6600102 - The session does not exist. 2317 * @syscap SystemCapability.Multimedia.AVSession.Core 2318 * @atomicservice 2319 * @since 12 2320 */ 2321 on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Object}) => void): void; 2322 2323 /** 2324 * Unregister session custom command change callback 2325 * @param { 'commonCommand' } type - Registration Type 'commonCommand' 2326 * @param { function } callback - Used to cancel a specific listener 2327 * The callback provide the command name and command args 2328 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2329 * 2.Incorrect parameter types. 2330 * @throws { BusinessError } 6600101 - Session service exception. 2331 * @throws { BusinessError } 6600102 - The session does not exist. 2332 * @syscap SystemCapability.Multimedia.AVSession.Core 2333 * @since 10 2334 */ 2335 /** 2336 * Unregister session custom command change callback 2337 * @param { 'commonCommand' } type - Registration Type 'commonCommand' 2338 * @param { function } callback - Used to cancel a specific listener 2339 * The callback provide the command name and command args 2340 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2341 * 2.Incorrect parameter types. 2342 * @throws { BusinessError } 6600101 - Session service exception. 2343 * @throws { BusinessError } 6600102 - The session does not exist. 2344 * @syscap SystemCapability.Multimedia.AVSession.Core 2345 * @atomicservice 2346 * @since 12 2347 */ 2348 off(type: 'commonCommand', callback?: (command: string, args: {[key: string]: Object}) => void): void; 2349 2350 /** 2351 * Register the item to play from the playlist change callback 2352 * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' 2353 * @param { function } callback - Used to handle the item to be played. 2354 * The callback provide the new device info {@link OutputDeviceInfo} 2355 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2356 * 2.Incorrect parameter types. 2357 * @throws { BusinessError } 6600101 - Session service exception. 2358 * @throws { BusinessError } 6600102 - The session does not exist. 2359 * @syscap SystemCapability.Multimedia.AVSession.Core 2360 * @since 10 2361 */ 2362 /** 2363 * Register the item to play from the playlist change callback 2364 * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' 2365 * @param { function } callback - Used to handle the item to be played. 2366 * The callback provide the new device info {@link OutputDeviceInfo} 2367 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2368 * 2.Incorrect parameter types. 2369 * @throws { BusinessError } 6600101 - Session service exception. 2370 * @throws { BusinessError } 6600102 - The session does not exist. 2371 * @syscap SystemCapability.Multimedia.AVSession.Core 2372 * @atomicservice 2373 * @since 12 2374 */ 2375 on(type: 'skipToQueueItem', callback: (itemId: number) => void): void; 2376 2377 /** 2378 * Unregister the item to play from the playlist change callback 2379 * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' 2380 * @param { function } callback - Used to handle the item to be played. 2381 * The callback provide the new device info {@link OutputDeviceInfo} 2382 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2383 * 2.Incorrect parameter types. 2384 * @throws { BusinessError } 6600101 - Session service exception. 2385 * @throws { BusinessError } 6600102 - The session does not exist. 2386 * @syscap SystemCapability.Multimedia.AVSession.Core 2387 * @since 10 2388 */ 2389 /** 2390 * Unregister the item to play from the playlist change callback 2391 * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' 2392 * @param { function } callback - Used to handle the item to be played. 2393 * The callback provide the new device info {@link OutputDeviceInfo} 2394 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2395 * 2.Incorrect parameter types. 2396 * @throws { BusinessError } 6600101 - Session service exception. 2397 * @throws { BusinessError } 6600102 - The session does not exist. 2398 * @syscap SystemCapability.Multimedia.AVSession.Core 2399 * @atomicservice 2400 * @since 12 2401 */ 2402 off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void; 2403 2404 /** 2405 * Register answer command callback. 2406 * As long as it is registered, it means that the ability supports this command. 2407 * If you cancel the callback, you need to call off {@link off} 2408 * @param { 'answer' } type - Command to register 'answer'. 2409 * @param { Callback<void> } callback - Used to handle ('answer') command 2410 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2411 * 2.Incorrect parameter types. 2412 * @throws { BusinessError } 6600101 - Session service exception. 2413 * @throws { BusinessError } 6600102 - The session does not exist. 2414 * @syscap SystemCapability.Multimedia.AVSession.Core 2415 * @since 11 2416 */ 2417 /** 2418 * Register answer command callback. 2419 * As long as it is registered, it means that the ability supports this command. 2420 * If you cancel the callback, you need to call off {@link off} 2421 * @param { 'answer' } type - Command to register 'answer'. 2422 * @param { Callback<void> } callback - Used to handle ('answer') command 2423 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2424 * 2.Incorrect parameter types. 2425 * @throws { BusinessError } 6600101 - Session service exception. 2426 * @throws { BusinessError } 6600102 - The session does not exist. 2427 * @syscap SystemCapability.Multimedia.AVSession.Core 2428 * @atomicservice 2429 * @since 12 2430 */ 2431 on(type: 'answer', callback: Callback<void>): void; 2432 2433 /** 2434 * Unregister answer command callback. 2435 * @param { 'answer' } type - Command to register 'answer'. 2436 * @param { Callback<void> } callback - Used to handle ('answer') command 2437 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2438 * 2.Incorrect parameter types. 2439 * @throws { BusinessError } 6600101 - Session service exception. 2440 * @throws { BusinessError } 6600102 - The session does not exist. 2441 * @syscap SystemCapability.Multimedia.AVSession.Core 2442 * @since 11 2443 */ 2444 /** 2445 * Unregister answer command callback. 2446 * @param { 'answer' } type - Command to register 'answer'. 2447 * @param { Callback<void> } callback - Used to handle ('answer') command 2448 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2449 * 2.Incorrect parameter types. 2450 * @throws { BusinessError } 6600101 - Session service exception. 2451 * @throws { BusinessError } 6600102 - The session does not exist. 2452 * @syscap SystemCapability.Multimedia.AVSession.Core 2453 * @atomicservice 2454 * @since 12 2455 */ 2456 off(type: 'answer', callback?: Callback<void>): void; 2457 2458 /** 2459 * Register hangUp command callback. 2460 * As long as it is registered, it means that the ability supports this command. 2461 * If you cancel the callback, you need to call off {@link off} 2462 * @param { 'hangUp' } type - Command to register 'hangUp'. 2463 * @param { Callback<void> } callback - Used to handle ('hangUp') command 2464 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2465 * 2.Incorrect parameter types. 2466 * @throws { BusinessError } 6600101 - Session service exception. 2467 * @throws { BusinessError } 6600102 - The session does not exist. 2468 * @syscap SystemCapability.Multimedia.AVSession.Core 2469 * @since 11 2470 */ 2471 /** 2472 * Register hangUp command callback. 2473 * As long as it is registered, it means that the ability supports this command. 2474 * If you cancel the callback, you need to call off {@link off} 2475 * @param { 'hangUp' } type - Command to register 'hangUp'. 2476 * @param { Callback<void> } callback - Used to handle ('hangUp') command 2477 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2478 * 2.Incorrect parameter types. 2479 * @throws { BusinessError } 6600101 - Session service exception. 2480 * @throws { BusinessError } 6600102 - The session does not exist. 2481 * @syscap SystemCapability.Multimedia.AVSession.Core 2482 * @atomicservice 2483 * @since 12 2484 */ 2485 on(type: 'hangUp', callback: Callback<void>): void; 2486 2487 /** 2488 * Unregister hangUp command callback. 2489 * @param { 'hangUp' } type - Command to register 'hangUp'. 2490 * @param { Callback<void> } callback - Used to handle ('hangUp') command 2491 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2492 * 2.Incorrect parameter types. 2493 * @throws { BusinessError } 6600101 - Session service exception. 2494 * @throws { BusinessError } 6600102 - The session does not exist. 2495 * @syscap SystemCapability.Multimedia.AVSession.Core 2496 * @since 11 2497 */ 2498 /** 2499 * Unregister hangUp command callback. 2500 * @param { 'hangUp' } type - Command to register 'hangUp'. 2501 * @param { Callback<void> } callback - Used to handle ('hangUp') command 2502 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2503 * 2.Incorrect parameter types. 2504 * @throws { BusinessError } 6600101 - Session service exception. 2505 * @throws { BusinessError } 6600102 - The session does not exist. 2506 * @syscap SystemCapability.Multimedia.AVSession.Core 2507 * @atomicservice 2508 * @since 12 2509 */ 2510 off(type: 'hangUp', callback?: Callback<void>): void; 2511 2512 /** 2513 * Register toggleCallMute command callback. 2514 * As long as it is registered, it means that the ability supports this command. 2515 * If you cancel the callback, you need to call off {@link off} 2516 * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. 2517 * @param { Callback<void> } callback - Used to handle ('toggleCallMute') command 2518 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2519 * 2.Incorrect parameter types. 2520 * @throws { BusinessError } 6600101 - Session service exception. 2521 * @throws { BusinessError } 6600102 - The session does not exist. 2522 * @syscap SystemCapability.Multimedia.AVSession.Core 2523 * @since 11 2524 */ 2525 /** 2526 * Register toggleCallMute command callback. 2527 * As long as it is registered, it means that the ability supports this command. 2528 * If you cancel the callback, you need to call off {@link off} 2529 * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. 2530 * @param { Callback<void> } callback - Used to handle ('toggleCallMute') command 2531 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2532 * 2.Incorrect parameter types. 2533 * @throws { BusinessError } 6600101 - Session service exception. 2534 * @throws { BusinessError } 6600102 - The session does not exist. 2535 * @syscap SystemCapability.Multimedia.AVSession.Core 2536 * @atomicservice 2537 * @since 12 2538 */ 2539 on(type: 'toggleCallMute', callback: Callback<void>): void; 2540 2541 /** 2542 * Unregister toggleCallMute command callback. 2543 * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. 2544 * @param { Callback<void> } callback - Used to handle ('toggleCallMute') command 2545 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified.2.Incorrect parameter types. 2546 * @throws { BusinessError } 6600101 - Session service exception. 2547 * @throws { BusinessError } 6600102 - The session does not exist. 2548 * @syscap SystemCapability.Multimedia.AVSession.Core 2549 * @since 11 2550 */ 2551 /** 2552 * Unregister toggleCallMute command callback. 2553 * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. 2554 * @param { Callback<void> } callback - Used to handle ('toggleCallMute') command 2555 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified.2.Incorrect parameter types. 2556 * @throws { BusinessError } 6600101 - Session service exception. 2557 * @throws { BusinessError } 6600102 - The session does not exist. 2558 * @syscap SystemCapability.Multimedia.AVSession.Core 2559 * @atomicservice 2560 * @since 12 2561 */ 2562 off(type: 'toggleCallMute', callback?: Callback<void>): void; 2563 2564 /** 2565 * Register listener for cast display information changed. 2566 * @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for. 2567 * @param { Callback<CastDisplayInfo> } callback - Callback used to return cast display information. 2568 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2569 * 2.Incorrect parameter types. 2570 * @throws { BusinessError } 6600101 - Session service exception 2571 * @throws { BusinessError } 6600102 - The session does not exist 2572 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 2573 * @atomicservice 2574 * @since 12 2575 */ 2576 on(type: 'castDisplayChange', callback: Callback<CastDisplayInfo>): void; 2577 2578 /** 2579 * Unregister listener for cast display information changed. 2580 * @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for. 2581 * @param { Callback<CastDisplayInfo> } callback - Callback used to return cast display information. 2582 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2583 * 2.Incorrect parameter types. 2584 * @throws { BusinessError } 6600101 - Session service exception 2585 * @throws { BusinessError } 6600102 - The session does not exist 2586 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 2587 * @atomicservice 2588 * @since 12 2589 */ 2590 off(type: 'castDisplayChange', callback?: Callback<CastDisplayInfo>): void; 2591 2592 /** 2593 * Stop current cast and disconnect device connection. 2594 * @param { AsyncCallback<void> } callback A callback instance used to return when cast stopped completed. 2595 * @throws { BusinessError } 6600109 - The remote connection is not established 2596 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2597 * @since 10 2598 */ 2599 stopCasting(callback: AsyncCallback<void>): void; 2600 2601 /** 2602 * Stop current cast and disconnect device connection. 2603 * @returns { Promise<void> } void result promise when executed successfully 2604 * @throws { BusinessError } 6600109 - The remote connection is not established 2605 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2606 * @since 10 2607 */ 2608 /** 2609 * Stop current cast and disconnect device connection. 2610 * @returns { Promise<void> } void result promise when executed successfully 2611 * @throws { BusinessError } 6600109 - The remote connection is not established 2612 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2613 * @atomicservice 2614 * @since 12 2615 */ 2616 stopCasting(): Promise<void>; 2617 2618 /** 2619 * Activate the session, indicating that the session can accept control commands 2620 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the session is activated. 2621 * @throws { BusinessError } 6600101 - Session service exception. 2622 * @throws { BusinessError } 6600102 - The session does not exist. 2623 * @syscap SystemCapability.Multimedia.AVSession.Core 2624 * @since 10 2625 */ 2626 activate(callback: AsyncCallback<void>): void; 2627 2628 /** 2629 * Activate the session, indicating that the session can accept control commands 2630 * @returns { Promise<void> } void result promise when executed successfully 2631 * @throws { BusinessError } 6600101 - Session service exception. 2632 * @throws { BusinessError } 6600102 - The session does not exist. 2633 * @syscap SystemCapability.Multimedia.AVSession.Core 2634 * @since 10 2635 */ 2636 /** 2637 * Activate the session, indicating that the session can accept control commands 2638 * @returns { Promise<void> } void result promise when executed successfully 2639 * @throws { BusinessError } 6600101 - Session service exception. 2640 * @throws { BusinessError } 6600102 - The session does not exist. 2641 * @syscap SystemCapability.Multimedia.AVSession.Core 2642 * @atomicservice 2643 * @since 12 2644 */ 2645 activate(): Promise<void>; 2646 2647 /** 2648 * Deactivate the session, indicating that the session not ready to accept control commands 2649 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the session is deactivated. 2650 * @throws { BusinessError } 6600101 - Session service exception. 2651 * @throws { BusinessError } 6600102 - The session does not exist. 2652 * @syscap SystemCapability.Multimedia.AVSession.Core 2653 * @since 10 2654 */ 2655 deactivate(callback: AsyncCallback<void>): void; 2656 2657 /** 2658 * Deactivate the session, indicating that the session not ready to accept control commands 2659 * @returns { Promise<void> } void promise when executed successfully 2660 * @throws { BusinessError } 6600101 - Session service exception. 2661 * @throws { BusinessError } 6600102 - The session does not exist. 2662 * @syscap SystemCapability.Multimedia.AVSession.Core 2663 * @since 10 2664 */ 2665 /** 2666 * Deactivate the session, indicating that the session not ready to accept control commands 2667 * @returns { Promise<void> } void promise when executed successfully 2668 * @throws { BusinessError } 6600101 - Session service exception. 2669 * @throws { BusinessError } 6600102 - The session does not exist. 2670 * @syscap SystemCapability.Multimedia.AVSession.Core 2671 * @atomicservice 2672 * @since 12 2673 */ 2674 deactivate(): Promise<void>; 2675 2676 /** 2677 * Destroy this session, the server will clean up the session resources 2678 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 2679 * @throws { BusinessError } 6600101 - Session service exception. 2680 * @throws { BusinessError } 6600102 - The session does not exist. 2681 * @syscap SystemCapability.Multimedia.AVSession.Core 2682 * @since 10 2683 */ 2684 destroy(callback: AsyncCallback<void>): void; 2685 2686 /** 2687 * Destroy this session, the server will clean up the session resources 2688 * @returns { Promise<void> } void promise when executed successfully 2689 * @throws { BusinessError } 6600101 - Session service exception. 2690 * @throws { BusinessError } 6600102 - The session does not exist. 2691 * @syscap SystemCapability.Multimedia.AVSession.Core 2692 * @since 10 2693 */ 2694 /** 2695 * Destroy this session, the server will clean up the session resources 2696 * @returns { Promise<void> } void promise when executed successfully 2697 * @throws { BusinessError } 6600101 - Session service exception. 2698 * @throws { BusinessError } 6600102 - The session does not exist. 2699 * @syscap SystemCapability.Multimedia.AVSession.Core 2700 * @atomicservice 2701 * @since 12 2702 */ 2703 destroy(): Promise<void>; 2704 } 2705 2706 /** 2707 * The type of control command 2708 * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 2709 * 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute' } AVCastControlCommandType 2710 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2711 * @since 10 2712 */ 2713 /** 2714 * The type of control command 2715 * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 2716 * 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute' } AVCastControlCommandType 2717 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2718 * @atomicservice 2719 * @since 12 2720 */ 2721 type AVCastControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 2722 'seek' | 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute'; 2723 2724 /** 2725 * The definition of command to be sent to the session 2726 * @interface AVCastControlCommand 2727 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2728 * @since 10 2729 */ 2730 /** 2731 * The definition of command to be sent to the session 2732 * @interface AVCastControlCommand 2733 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2734 * @atomicservice 2735 * @since 12 2736 */ 2737 interface AVCastControlCommand { 2738 /** 2739 * The command value {@link AVCastControlCommandType} 2740 * 2741 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2742 * @since 10 2743 */ 2744 /** 2745 * The command value {@link AVCastControlCommandType} 2746 * @type { AVCastControlCommandType } 2747 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2748 * @atomicservice 2749 * @since 12 2750 */ 2751 command: AVCastControlCommandType; 2752 2753 /** 2754 * Parameter carried in the command. 2755 * The seek command must carry the number parameter. 2756 * The setVolume command must carry the number parameter. 2757 * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. 2758 * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. 2759 * The setLoopMode command must carry the {@link LoopMode} parameter. 2760 * Other commands do not need to carry parameters. 2761 * @type { ?(media.PlaybackSpeed | number | string | LoopMode) } 2762 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2763 * @since 10 2764 */ 2765 /** 2766 * Parameter carried in the command. 2767 * The seek command must carry the number parameter. 2768 * The setVolume command must carry the number parameter. 2769 * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. 2770 * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. 2771 * The setLoopMode command must carry the {@link LoopMode} parameter. 2772 * Other commands do not need to carry parameters. 2773 * @type { ?(media.PlaybackSpeed | number | string | LoopMode) } 2774 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2775 * @atomicservice 2776 * @since 12 2777 */ 2778 parameter?: media.PlaybackSpeed | number | string | LoopMode; 2779 } 2780 2781 /** 2782 * AVCastController definition used to implement a remote control when a cast is connected 2783 * @interface AVCastController 2784 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2785 * @since 10 2786 */ 2787 /** 2788 * AVCastController definition used to implement a remote control when a cast is connected 2789 * @interface AVCastController 2790 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2791 * @atomicservice 2792 * @since 12 2793 */ 2794 interface AVCastController { 2795 /** 2796 * Set a surface instance to display playing view, used at sink side. 2797 * @param { string } surfaceId - surface id, video player will use this id get a surface instance. 2798 * @param { AsyncCallback<void> } callback - A callback instance used to return when set surface completed. 2799 * @throws { BusinessError } 202 - Not System App. 2800 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2801 * 2.Parameter verification failed. 2802 * @throws { BusinessError } 6600109 - The remote connection is not established 2803 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2804 * @systemapi 2805 * @since 10 2806 */ 2807 setDisplaySurface(surfaceId: string, callback: AsyncCallback<void>): void; 2808 2809 /** 2810 * Set a surface instance to display playing view, used at sink side. 2811 * @param { string } surfaceId - surface id, video player will use this id get a surface instance. 2812 * @returns { Promise<void> } Promise used to return the result. 2813 * @throws { BusinessError } 202 - Not System App. 2814 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2815 * 2.Parameter verification failed. 2816 * @throws { BusinessError } 6600109 - The remote connection is not established 2817 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2818 * @systemapi 2819 * @since 10 2820 */ 2821 setDisplaySurface(surfaceId: string): Promise<void>; 2822 2823 /** 2824 * Get the playback status of the current player 2825 * @param { AsyncCallback<AVPlaybackState> } callback - The triggered asyncCallback when (getAVPlaybackState). 2826 * @throws { BusinessError } 6600101 - Session service exception 2827 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2828 * @since 10 2829 */ 2830 getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void; 2831 2832 /** 2833 * Get the playback status of the current player 2834 * @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise 2835 * @throws { BusinessError } 6600101 - Session service exception 2836 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2837 * @since 10 2838 */ 2839 /** 2840 * Get the playback status of the current player 2841 * @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise 2842 * @throws { BusinessError } 6600101 - Session service exception 2843 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2844 * @atomicservice 2845 * @since 12 2846 */ 2847 getAVPlaybackState(): Promise<AVPlaybackState>; 2848 2849 /** 2850 * Send control commands to remote player 2851 * @param { AVCastControlCommand } command The command to be send. 2852 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 2853 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2854 * 2.Parameter verification failed. 2855 * @throws { BusinessError } 6600101 - Session service exception 2856 * @throws { BusinessError } 6600105 - Invalid session command 2857 * @throws { BusinessError } 6600109 - The remote connection is not established 2858 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2859 * @since 10 2860 */ 2861 sendControlCommand(command: AVCastControlCommand, callback: AsyncCallback<void>): void; 2862 2863 /** 2864 * Send control commands to remote player 2865 * @param { AVCastControlCommand } command The command to be send. 2866 * @returns { Promise<void> } Promise used to return the result. 2867 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2868 * 2.Parameter verification failed. 2869 * @throws { BusinessError } 6600101 - Session service exception 2870 * @throws { BusinessError } 6600105 - Invalid session command 2871 * @throws { BusinessError } 6600109 - The remote connection is not established 2872 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2873 * @since 10 2874 */ 2875 /** 2876 * Send control commands to remote player 2877 * @param { AVCastControlCommand } command The command to be send. 2878 * @returns { Promise<void> } Promise used to return the result. 2879 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2880 * 2.Parameter verification failed. 2881 * @throws { BusinessError } 6600101 - Session service exception 2882 * @throws { BusinessError } 6600105 - Invalid session command 2883 * @throws { BusinessError } 6600109 - The remote connection is not established 2884 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2885 * @atomicservice 2886 * @since 12 2887 */ 2888 sendControlCommand(command: AVCastControlCommand): Promise<void>; 2889 2890 /** 2891 * Play the current item, should contain mediaUri otherwise the playback will fail. 2892 * @param { AVQueueItem } item media item info. 2893 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 2894 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2895 * 2.Parameter verification failed. 2896 * @throws {BusinessError} 6600101 - Session service exception 2897 * @throws {BusinessError} 6600109 - The remote connection is not established 2898 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2899 * @since 10 2900 */ 2901 start(item: AVQueueItem, callback: AsyncCallback<void>): void; 2902 2903 /** 2904 * Play the current item, should contain mediaUri otherwise the playback will fail. 2905 * @param { AVQueueItem } item media item info. 2906 * @returns { Promise<void> } Promise used to return the result. 2907 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2908 * 2.Parameter verification failed. 2909 * @throws {BusinessError} 6600101 - Session service exception 2910 * @throws {BusinessError} 6600109 - The remote connection is not established 2911 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2912 * @since 10 2913 */ 2914 /** 2915 * Play the current item, should contain mediaUri otherwise the playback will fail. 2916 * @param { AVQueueItem } item media item info. 2917 * @returns { Promise<void> } Promise used to return the result. 2918 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2919 * 2.Parameter verification failed. 2920 * @throws {BusinessError} 6600101 - Session service exception 2921 * @throws {BusinessError} 6600109 - The remote connection is not established 2922 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2923 * @atomicservice 2924 * @since 12 2925 */ 2926 start(item: AVQueueItem): Promise<void>; 2927 2928 /** 2929 * Load the current item and mediaUri can be null, this is needed for sink media information displaying 2930 * @param { AVQueueItem } item media item info. 2931 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 2932 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2933 * 2.Parameter verification failed. 2934 * @throws {BusinessError} 6600101 - Session service exception 2935 * @throws {BusinessError} 6600109 - The remote connection is not established 2936 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2937 * @since 10 2938 */ 2939 prepare(item: AVQueueItem, callback: AsyncCallback<void>): void; 2940 2941 /** 2942 * Load the current item and mediaUri can be null, this is needed for sink media information displaying 2943 * @param { AVQueueItem } item media item info. 2944 * @returns { Promise<void> } Promise used to return the result. 2945 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2946 * 2.Parameter verification failed. 2947 * @throws {BusinessError} 6600101 - Session service exception 2948 * @throws {BusinessError} 6600109 - The remote connection is not established 2949 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2950 * @since 10 2951 */ 2952 /** 2953 * Load the current item and mediaUri can be null, this is needed for sink media information displaying 2954 * @param { AVQueueItem } item media item info. 2955 * @returns { Promise<void> } Promise used to return the result. 2956 * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 2957 * 2.Parameter verification failed. 2958 * @throws {BusinessError} 6600101 - Session service exception 2959 * @throws {BusinessError} 6600109 - The remote connection is not established 2960 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2961 * @atomicservice 2962 * @since 12 2963 */ 2964 prepare(item: AVQueueItem): Promise<void>; 2965 2966 /** 2967 * Get the current playing item 2968 * @param { AsyncCallback<AVQueueItem> } callback - The triggered asyncCallback. 2969 * @throws { BusinessError } 6600101 - Session service exception 2970 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2971 * @since 10 2972 */ 2973 getCurrentItem(callback: AsyncCallback<AVQueueItem>): void; 2974 2975 /** 2976 * Get the current playing item 2977 * @returns { Promise<AVQueueItem> } (AVQueueItem) returned through promise 2978 * @throws { BusinessError } 6600101 - Session service exception 2979 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2980 * @since 10 2981 */ 2982 /** 2983 * Get the current playing item 2984 * @returns { Promise<AVQueueItem> } (AVQueueItem) returned through promise 2985 * @throws { BusinessError } 6600101 - Session service exception 2986 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2987 * @atomicservice 2988 * @since 12 2989 */ 2990 getCurrentItem(): Promise<AVQueueItem>; 2991 2992 /** 2993 * Get commands supported by the current cast controller 2994 * @param { AsyncCallback<Array<AVCastControlCommandType>> } callback - The triggered asyncCallback when (getValidCommands). 2995 * @throws { BusinessError } 6600101 - Session service exception. 2996 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2997 * @since 11 2998 */ 2999 getValidCommands(callback: AsyncCallback<Array<AVCastControlCommandType>>): void; 3000 3001 /** 3002 * Get commands supported by the current cast controller 3003 * @returns { Promise<Array<AVCastControlCommandType>> } array of AVCastControlCommandType promise 3004 * @throws { BusinessError } 6600101 - Session service exception. 3005 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3006 * @since 11 3007 */ 3008 getValidCommands(): Promise<Array<AVCastControlCommandType>>; 3009 3010 /** 3011 * Process the response corresponding to the media key request obtained by the application. 3012 * @param { string } assetId - The assetId of resource which provides the response. 3013 * @param { Uint8Array } response - Response corresponding to the request. 3014 * @returns { Promise<void> } void promise when executed successfully 3015 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3016 * 2.Parameter verification failed. 3017 * @throws { BusinessError } 6600101 - Session service exception 3018 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3019 * @atomicservice 3020 * @since 12 3021 */ 3022 processMediaKeyResponse(assetId: string, response: Uint8Array): Promise<void>; 3023 3024 /** 3025 * Destroy the controller 3026 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 3027 * @throws { BusinessError } 6600101 - Session service exception. 3028 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3029 * @since 11 3030 */ 3031 release(callback: AsyncCallback<void>): void; 3032 3033 /** 3034 * Destroy the controller 3035 * @returns { Promise<void> } void promise when executed successfully 3036 * @throws { BusinessError } 6600101 - Session service exception. 3037 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3038 * @since 11 3039 */ 3040 /** 3041 * Destroy the controller 3042 * @returns { Promise<void> } void promise when executed successfully 3043 * @throws { BusinessError } 6600101 - Session service exception. 3044 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3045 * @atomicservice 3046 * @since 12 3047 */ 3048 release(): Promise<void>; 3049 3050 /** 3051 * Register playback state changed callback 3052 * @param { 'playbackStateChange' } type 3053 * @param { Array<keyof AVPlaybackState> | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about 3054 * @param { function } callback - The callback used to handle playback state changed event. 3055 * The callback function provides the {@link AVPlaybackState} parameter. 3056 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3057 * 2.Incorrect parameter types. 3058 * @throws { BusinessError } 6600101 - Session service exception 3059 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3060 * @since 10 3061 */ 3062 /** 3063 * Register playback state changed callback 3064 * @param { 'playbackStateChange' } type 3065 * @param { Array<keyof AVPlaybackState> | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about 3066 * @param { function } callback - The callback used to handle playback state changed event. 3067 * The callback function provides the {@link AVPlaybackState} parameter. 3068 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3069 * 2.Incorrect parameter types. 3070 * @throws { BusinessError } 6600101 - Session service exception 3071 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3072 * @atomicservice 3073 * @since 12 3074 */ 3075 on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void): void; 3076 3077 /** 3078 * Unregister playback state changed callback 3079 * @param { 'playbackStateChange' } type 3080 * @param { function } callback - The callback used to handle playback state changed event. 3081 * The callback function provides the {@link AVPlaybackState} parameter. 3082 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3083 * 2.Incorrect parameter types. 3084 * @throws { BusinessError } 6600101 - Session service exception 3085 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3086 * @since 10 3087 */ 3088 /** 3089 * Unregister playback state changed callback 3090 * @param { 'playbackStateChange' } type 3091 * @param { function } callback - The callback used to handle playback state changed event. 3092 * The callback function provides the {@link AVPlaybackState} parameter. 3093 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3094 * 2.Incorrect parameter types. 3095 * @throws { BusinessError } 6600101 - Session service exception 3096 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3097 * @atomicservice 3098 * @since 12 3099 */ 3100 off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void): void; 3101 3102 /** 3103 * Register listener for current media item playback events. 3104 * @param { 'mediaItemChange' } type Type of the playback event to listen for. 3105 * @param { Callback<AVQueueItem> } callback Callback used to listen for current item changed. 3106 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3107 * 2.Incorrect parameter types. 3108 * @throws { BusinessError } 6600101 - Session service exception 3109 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3110 * @since 10 3111 */ 3112 /** 3113 * Register listener for current media item playback events. 3114 * @param { 'mediaItemChange' } type Type of the playback event to listen for. 3115 * @param { Callback<AVQueueItem> } callback Callback used to listen for current item changed. 3116 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3117 * 2.Incorrect parameter types. 3118 * @throws { BusinessError } 6600101 - Session service exception 3119 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3120 * @atomicservice 3121 * @since 12 3122 */ 3123 on(type: 'mediaItemChange', callback: Callback<AVQueueItem>): void; 3124 3125 /** 3126 * Unregister listener for current media item playback events. 3127 * @param { 'mediaItemChange' } type Type of the playback event to listen for. 3128 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3129 * 2.Incorrect parameter types. 3130 * @throws { BusinessError } 6600101 - Session service exception 3131 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3132 * @since 10 3133 */ 3134 /** 3135 * Unregister listener for current media item playback events. 3136 * @param { 'mediaItemChange' } type Type of the playback event to listen for. 3137 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3138 * 2.Incorrect parameter types. 3139 * @throws { BusinessError } 6600101 - Session service exception 3140 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3141 * @atomicservice 3142 * @since 12 3143 */ 3144 off(type: 'mediaItemChange'): void; 3145 3146 /** 3147 * Register playback command callback sent by remote side or media center. 3148 * Application needs update the new media resource when receive these commands by using playItem. 3149 * @param { 'playNext' } type - Type of the 'playNext' event to listen for. 3150 * @param { Callback<void> } callback - Used to handle 'playNext' command 3151 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3152 * 2.Incorrect parameter types. 3153 * @throws { BusinessError } 6600101 - Session service exception 3154 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3155 * @since 10 3156 */ 3157 /** 3158 * Register playback command callback sent by remote side or media center. 3159 * Application needs update the new media resource when receive these commands by using playItem. 3160 * @param { 'playNext' } type - Type of the 'playNext' event to listen for. 3161 * @param { Callback<void> } callback - Used to handle 'playNext' command 3162 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3163 * 2.Incorrect parameter types. 3164 * @throws { BusinessError } 6600101 - Session service exception 3165 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3166 * @atomicservice 3167 * @since 12 3168 */ 3169 on(type: 'playNext', callback: Callback<void>): void; 3170 3171 /** 3172 * Unregister playback command callback sent by remote side or media center. 3173 * When canceling the callback, need to update the supported commands list. 3174 * @param { 'playNext' } type - Type of the 'playNext' event to listen for. 3175 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3176 * 2.Incorrect parameter types. 3177 * @throws { BusinessError } 6600101 - Session service exception 3178 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3179 * @since 10 3180 */ 3181 /** 3182 * Unregister playback command callback sent by remote side or media center. 3183 * When canceling the callback, need to update the supported commands list. 3184 * @param { 'playNext' } type - Type of the 'playNext' event to listen for. 3185 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3186 * 2.Incorrect parameter types. 3187 * @throws { BusinessError } 6600101 - Session service exception 3188 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3189 * @atomicservice 3190 * @since 12 3191 */ 3192 off(type: 'playNext'): void; 3193 3194 /** 3195 * Register playback command callback sent by remote side or media center. 3196 * Application needs update the new media resource when receive these commands by using playItem. 3197 * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. 3198 * @param { Callback<void> } callback - Used to handle 'playPrevious' command 3199 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3200 * 2.Incorrect parameter types. 3201 * @throws { BusinessError } 6600101 - Session service exception 3202 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3203 * @since 10 3204 */ 3205 /** 3206 * Register playback command callback sent by remote side or media center. 3207 * Application needs update the new media resource when receive these commands by using playItem. 3208 * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. 3209 * @param { Callback<void> } callback - Used to handle 'playPrevious' command 3210 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3211 * 2.Incorrect parameter types. 3212 * @throws { BusinessError } 6600101 - Session service exception 3213 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3214 * @atomicservice 3215 * @since 12 3216 */ 3217 on(type: 'playPrevious', callback: Callback<void>): void; 3218 3219 /** 3220 * Unregister playback command callback sent by remote side or media center. 3221 * When canceling the callback, need to update the supported commands list. 3222 * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. 3223 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3224 * 2.Incorrect parameter types. 3225 * @throws { BusinessError } 6600101 - Session service exception 3226 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3227 * @since 10 3228 */ 3229 /** 3230 * Unregister playback command callback sent by remote side or media center. 3231 * When canceling the callback, need to update the supported commands list. 3232 * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. 3233 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3234 * 2.Incorrect parameter types. 3235 * @throws { BusinessError } 6600101 - Session service exception 3236 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3237 * @atomicservice 3238 * @since 12 3239 */ 3240 off(type: 'playPrevious'): void; 3241 3242 /** 3243 * Register requested playback command callback sent by remote side or media center. 3244 * The AVQueueItem may include the requested assetId, starting position and other configurations. 3245 * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. 3246 * @param { Callback<AVQueueItem> } callback - Used to handle 'requestPlay' command 3247 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3248 * 2.Incorrect parameter types. 3249 * @throws { BusinessError } 6600101 - Session service exception 3250 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3251 * @since 11 3252 */ 3253 on(type: 'requestPlay', callback: Callback<AVQueueItem>): void; 3254 3255 /** 3256 * Unregister requested playback command callback sent by remote side or media center. 3257 * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. 3258 * @param { Callback<AVQueueItem> } callback - Used to handle 'requestPlay' command 3259 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3260 * 2.Incorrect parameter types. 3261 * @throws { BusinessError } 6600101 - Session service exception 3262 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3263 * @since 11 3264 */ 3265 off(type: 'requestPlay', callback?: Callback<AVQueueItem>): void; 3266 3267 /** 3268 * Register endOfStream state callback. 3269 * Application needs update the new media resource when receive these commands by using playItem. 3270 * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. 3271 * @param { Callback<void> } callback - Used to handle 'endOfStream' command 3272 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3273 * 2.Incorrect parameter types. 3274 * @throws { BusinessError } 6600101 - Session service exception 3275 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3276 * @since 11 3277 */ 3278 on(type: 'endOfStream', callback: Callback<void>): void; 3279 3280 /** 3281 * Unregister endOfStream state callback. 3282 * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. 3283 * @param { Callback<void> } callback - Used to handle 'endOfStream' command 3284 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3285 * 2.Incorrect parameter types. 3286 * @throws { BusinessError } 6600101 - Session service exception 3287 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3288 * @since 11 3289 */ 3290 off(type: 'endOfStream', callback?: Callback<void>): void; 3291 3292 /** 3293 * Register listens for playback events. 3294 * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. 3295 * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event. 3296 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3297 * 2.Incorrect parameter types. 3298 * @throws { BusinessError } 6600101 - Session service exception 3299 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3300 * @since 10 3301 */ 3302 /** 3303 * Register listens for playback events. 3304 * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. 3305 * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event. 3306 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3307 * 2.Incorrect parameter types. 3308 * @throws { BusinessError } 6600101 - Session service exception 3309 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3310 * @atomicservice 3311 * @since 12 3312 */ 3313 on(type: 'seekDone', callback: Callback<number>): void; 3314 3315 /** 3316 * Unregister listens for playback events. 3317 * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. 3318 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3319 * 2.Incorrect parameter types. 3320 * @throws { BusinessError } 6600101 - Session service exception 3321 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3322 * @since 10 3323 */ 3324 /** 3325 * Unregister listens for playback events. 3326 * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. 3327 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3328 * 2.Incorrect parameter types. 3329 * @throws { BusinessError } 6600101 - Session service exception 3330 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3331 * @atomicservice 3332 * @since 12 3333 */ 3334 off(type: 'seekDone'): void; 3335 3336 /** 3337 * Register the valid commands of the casted session changed callback 3338 * @param { 'validCommandChange' } type - 'validCommandChange' 3339 * @param { Callback<Array<AVCastControlCommandType>> } callback - The callback used to handle the changes. 3340 * The callback function provides an array of AVCastControlCommandType. 3341 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3342 * 2.Incorrect parameter types. 3343 * @throws { BusinessError } 6600101 - Session service exception. 3344 * @throws { BusinessError } 6600103 - The session controller does not exist. 3345 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3346 * @since 11 3347 */ 3348 on(type: 'validCommandChange', callback: Callback<Array<AVCastControlCommandType>>); 3349 3350 /** 3351 * Unregister the valid commands of the casted session changed callback 3352 * @param { 'validCommandChange' } type - 'validCommandChange' 3353 * @param { Callback<Array<AVCastControlCommandType>> } callback - The callback used to handle the changes. 3354 * The callback function provides an array of AVCastControlCommandType. 3355 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3356 * 2.Incorrect parameter types. 3357 * @throws { BusinessError } 6600101 - Session service exception. 3358 * @throws { BusinessError } 6600103 - The session controller does not exist. 3359 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3360 * @since 11 3361 */ 3362 off(type: 'validCommandChange', callback?: Callback<Array<AVCastControlCommandType>>); 3363 3364 /** 3365 * Register listener for video size change event, used at remote side. 3366 * @param { 'videoSizeChange' } type - Type of the 'videoSizeChange' to listen for. 3367 * @param { function } callback - Callback used to return video size. 3368 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3369 * 2.Incorrect parameter types. 3370 * @throws { BusinessError } 6600101 - Session service exception 3371 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3372 * @since 12 3373 */ 3374 on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void; 3375 3376 /** 3377 * Unregister listener for video size change event, used at remote side. 3378 * @param { 'videoSizeChange' } type - Type of the 'videoSizeChange' to listen for. 3379 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3380 * 2.Incorrect parameter types. 3381 * @throws { BusinessError } 6600101 - Session service exception 3382 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3383 * @since 12 3384 */ 3385 off(type: 'videoSizeChange'): void; 3386 3387 /** 3388 * Register listeners for playback error events. 3389 * @param { 'error' } type Type of the 'error' to listen for. 3390 * @param { ErrorCallback } callback Callback used to listen for the playback error event. 3391 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3392 * 2.Incorrect parameter types. 3393 * @throws { BusinessError } 5400101 - No memory. 3394 * @throws { BusinessError } 5400102 - Operation not allowed. 3395 * @throws { BusinessError } 5400103 - I/O error. 3396 * @throws { BusinessError } 5400104 - Time out. 3397 * @throws { BusinessError } 5400105 - Service died. 3398 * @throws { BusinessError } 5400106 - Unsupport format. 3399 * @throws { BusinessError } 6600101 - Session service exception 3400 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3401 * @since 10 3402 */ 3403 /** 3404 * Register listeners for playback error events. 3405 * @param { 'error' } type Type of the 'error' to listen for. 3406 * @param { ErrorCallback } callback Callback used to listen for the playback error event. 3407 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3408 * 2.Incorrect parameter types. 3409 * @throws { BusinessError } 5400101 - No memory. 3410 * @throws { BusinessError } 5400102 - Operation not allowed. 3411 * @throws { BusinessError } 5400103 - I/O error. 3412 * @throws { BusinessError } 5400104 - Time out. 3413 * @throws { BusinessError } 5400105 - Service died. 3414 * @throws { BusinessError } 5400106 - Unsupport format. 3415 * @throws { BusinessError } 6600101 - Session service exception 3416 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3417 * @atomicservice 3418 * @since 12 3419 */ 3420 on(type: 'error', callback: ErrorCallback): void; 3421 3422 /** 3423 * Unregister listens for playback error events. 3424 * @param { 'error' } type Type of the 'error' to listen for. 3425 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3426 * 2.Incorrect parameter types. 3427 * @throws { BusinessError } 5400101 - No memory. 3428 * @throws { BusinessError } 5400102 - Operation not allowed. 3429 * @throws { BusinessError } 5400103 - I/O error. 3430 * @throws { BusinessError } 5400104 - Time out. 3431 * @throws { BusinessError } 5400105 - Service died. 3432 * @throws { BusinessError } 5400106 - Unsupport format. 3433 * @throws { BusinessError } 6600101 - Session service exception 3434 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3435 * @since 10 3436 */ 3437 /** 3438 * Unregister listens for playback error events. 3439 * @param { 'error' } type Type of the 'error' to listen for. 3440 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3441 * 2.Incorrect parameter types. 3442 * @throws { BusinessError } 5400101 - No memory. 3443 * @throws { BusinessError } 5400102 - Operation not allowed. 3444 * @throws { BusinessError } 5400103 - I/O error. 3445 * @throws { BusinessError } 5400104 - Time out. 3446 * @throws { BusinessError } 5400105 - Service died. 3447 * @throws { BusinessError } 5400106 - Unsupport format. 3448 * @throws { BusinessError } 6600101 - Session service exception 3449 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3450 * @atomicservice 3451 * @since 12 3452 */ 3453 off(type: 'error'): void; 3454 3455 /** 3456 * Register listeners for cast control generic error events. 3457 * @param { 'castControlGenericError' } type Type of the 'castControlGenericError' to listen for. 3458 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3459 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3460 * 2. Incorrect parameter types. 3461 * @throws { BusinessError } 6611000 - The error code for cast control is unspecified. 3462 * @throws { BusinessError } 6611001 - An unspecified error occurs in the remote player. 3463 * @throws { BusinessError } 6611002 - The playback position falls behind the live window. 3464 * @throws { BusinessError } 6611003 - The process of cast control times out. 3465 * @throws { BusinessError } 6611004 - The runtime check failed. 3466 * @throws { BusinessError } 6611100 - Cross-device data transmission is locked. 3467 * @throws { BusinessError } 6611101 - The specified seek mode is not supported. 3468 * @throws { BusinessError } 6611102 - The position to seek to is out of the range of the media asset 3469 * or the specified seek mode is not supported. 3470 * @throws { BusinessError } 6611103 - The specified playback mode is not supported. 3471 * @throws { BusinessError } 6611104 - The specified playback speed is not supported. 3472 * @throws { BusinessError } 6611105 - The action failed because either the media source device or the media sink device has been revoked. 3473 * @throws { BusinessError } 6611106 - The parameter is invalid, for example, the url is illegal to play. 3474 * @throws { BusinessError } 6611107 - Allocation of memory failed. 3475 * @throws { BusinessError } 6611108 - Operation is not allowed. 3476 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3477 * @atomicservice 3478 * @since 13 3479 */ 3480 on(type: 'castControlGenericError', callback: ErrorCallback): void; 3481 3482 /** 3483 * Unregister listeners for cast control generic error events. 3484 * @param { 'castControlGenericError' } type Type of the 'castControlGenericError' to listen for. 3485 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3486 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3487 * 2. Incorrect parameter types. 3488 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3489 * @atomicservice 3490 * @since 13 3491 */ 3492 off(type: 'castControlGenericError', callback?: ErrorCallback): void; 3493 3494 /** 3495 * Register listeners for cast control input/output error events. 3496 * @param { 'castControlIoError' } type Type of the 'castControlIoError' to listen for. 3497 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3498 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3499 * 2. Incorrect parameter types. 3500 * @throws { BusinessError } 6612000 - An unspecified input/output error occurs. 3501 * @throws { BusinessError } 6612001 - Network connection failure. 3502 * @throws { BusinessError } 6612002 - Network timeout. 3503 * @throws { BusinessError } 6612003 - Invalid "Content-Type" HTTP header. 3504 * @throws { BusinessError } 6612004 - The HTTP server returns an unexpected HTTP response status code. 3505 * @throws { BusinessError } 6612005 - The file does not exist. 3506 * @throws { BusinessError } 6612006 - No permission is granted to perform the IO operation. 3507 * @throws { BusinessError } 6612007 - Access to cleartext HTTP traffic is not allowed by the app's network security configuration. 3508 * @throws { BusinessError } 6612008 - Reading data out of the data bound. 3509 * @throws { BusinessError } 6612100 - The media does not contain any contents that can be played. 3510 * @throws { BusinessError } 6612101 - The media cannot be read, for example, because of dust or scratches. 3511 * @throws { BusinessError } 6612102 - This resource is already in use. 3512 * @throws { BusinessError } 6612103 - The content using the validity interval has expired. 3513 * @throws { BusinessError } 6612104 - Using the requested content to play is not allowed. 3514 * @throws { BusinessError } 6612105 - The use of the allowed content cannot be verified. 3515 * @throws { BusinessError } 6612106 - The number of times this content has been used as requested has reached the maximum allowed number of uses. 3516 * @throws { BusinessError } 6612107 - An error occurs when sending packet from source device to sink device. 3517 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3518 * @atomicservice 3519 * @since 13 3520 */ 3521 on(type: 'castControlIoError', callback: ErrorCallback): void; 3522 3523 /** 3524 * Unregister listeners for cast control input/output error events. 3525 * @param { 'castControlIoError' } type Type of the 'castControlIoError' to listen for. 3526 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3527 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3528 * 2. Incorrect parameter types. 3529 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3530 * @atomicservice 3531 * @since 13 3532 */ 3533 off(type: 'castControlIoError', callback?: ErrorCallback): void; 3534 3535 /** 3536 * Register listeners for cast control parsing error events. 3537 * @param { 'castControlParsingError' } type Type of the 'castControlParsingError' to listen for. 3538 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3539 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3540 * 2. Incorrect parameter types. 3541 * @throws { BusinessError } 6613000 - Unspecified error related to content parsing. 3542 * @throws { BusinessError } 6613001 - Parsing error associated with media container format bit streams. 3543 * @throws { BusinessError } 6613002 - Parsing error associated with the media manifest. 3544 * @throws { BusinessError } 6613003 - An error occurs when attempting to extract a file with an unsupported media container format 3545 * or an unsupported media container feature. 3546 * @throws { BusinessError } 6613004 - Unsupported feature in the media manifest. 3547 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3548 * @atomicservice 3549 * @since 13 3550 */ 3551 on(type: 'castControlParsingError', callback: ErrorCallback): void; 3552 3553 /** 3554 * Unregister listeners for cast control parsing error events. 3555 * @param { 'castControlParsingError' } type Type of the 'castControlParsingError' to listen for. 3556 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3557 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3558 * 2. Incorrect parameter types. 3559 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3560 * @atomicservice 3561 * @since 13 3562 */ 3563 off(type: 'castControlParsingError', callback?: ErrorCallback): void; 3564 3565 /** 3566 * Register listeners for cast control decoding error events. 3567 * @param { 'castControlDecodingError' } type Type of the 'castControlDecodingError' to listen for. 3568 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3569 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3570 * 2. Incorrect parameter types. 3571 * @throws { BusinessError } 6614000 - Unspecified decoding error. 3572 * @throws { BusinessError } 6614001 - Decoder initialization failed. 3573 * @throws { BusinessError } 6614002 - Decoder query failed. 3574 * @throws { BusinessError } 6614003 - Decoding the media samples failed. 3575 * @throws { BusinessError } 6614004 - The format of the content to decode exceeds the capabilities of the device. 3576 * @throws { BusinessError } 6614005 - The format of the content to decode is not supported. 3577 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3578 * @atomicservice 3579 * @since 13 3580 */ 3581 on(type: 'castControlDecodingError', callback: ErrorCallback): void; 3582 3583 /** 3584 * Unregister listeners for cast control decoding error events. 3585 * @param { 'castControlDecodingError' } type Type of the 'castControlDecodingError' to listen for. 3586 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3587 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3588 * 2. Incorrect parameter types. 3589 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3590 * @atomicservice 3591 * @since 13 3592 */ 3593 off(type: 'castControlDecodingError', callback?: ErrorCallback): void; 3594 3595 /** 3596 * Register listeners for cast control audio renderer error error events. 3597 * @param { 'castControlAudioRendererError' } type Type of the 'castControlAudioRendererError' to listen for. 3598 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3599 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3600 * 2. Incorrect parameter types. 3601 * @throws { BusinessError } 6615000 - Unspecified errors related to the audio renderer. 3602 * @throws { BusinessError } 6615001 - Initializing the audio renderer failed. 3603 * @throws { BusinessError } 6615002 - The audio renderer fails to write data. 3604 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3605 * @atomicservice 3606 * @since 13 3607 */ 3608 on(type: 'castControlAudioRendererError', callback: ErrorCallback): void; 3609 3610 /** 3611 * Unregister listeners for cast control audio renderer error events. 3612 * @param { 'castControlAudioRendererError' } type Type of the 'castControlAudioRendererError' to listen for. 3613 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3614 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3615 * 2. Incorrect parameter types. 3616 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3617 * @atomicservice 3618 * @since 13 3619 */ 3620 off(type: 'castControlAudioRendererError', callback?: ErrorCallback): void; 3621 3622 /** 3623 * Register listeners for cast control drm error events. 3624 * @param { 'castControlDrmError' } type Type of the 'castControlDrmError' to listen for. 3625 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3626 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3627 * 2. Incorrect parameter types. 3628 * @throws { BusinessError } 6616000 - Unspecified error related to DRM. 3629 * @throws { BusinessError } 6616001 - The chosen DRM protection scheme is not supported by the device. 3630 * @throws { BusinessError } 6616002 - Device provisioning failed. 3631 * @throws { BusinessError } 6616003 - The DRM-protected content to play is incompatible. 3632 * @throws { BusinessError } 6616004 - Failed to obtain a license. 3633 * @throws { BusinessError } 6616005 - The operation is disallowed by the license policy. 3634 * @throws { BusinessError } 6616006 - An error occurs in the DRM system. 3635 * @throws { BusinessError } 6616007 - The device has revoked DRM privileges. 3636 * @throws { BusinessError } 6616008 - The DRM license being loaded into the open DRM session has expired. 3637 * @throws { BusinessError } 6616100 - An error occurs when the DRM processes the key response. 3638 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3639 * @atomicservice 3640 * @since 13 3641 */ 3642 on(type: 'castControlDrmError', callback: ErrorCallback): void; 3643 3644 /** 3645 * Unregister listeners for cast control drm error events. 3646 * @param { 'castControlDrmError' } type Type of the 'castControlDrmError' to listen for. 3647 * @param { ErrorCallback } callback Callback used to listen for the cast control error event. 3648 * @throws { BusinessError } 401 - Parameter check failed. 1. Mandatory parameters are left unspecified. 3649 * 2. Incorrect parameter types. 3650 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3651 * @atomicservice 3652 * @since 13 3653 */ 3654 off(type: 'castControlDrmError', callback?: ErrorCallback): void; 3655 3656 /** 3657 * Register listener for drm key request. 3658 * @param { 'keyRequest' } type - Type of the 'keyRequest' to listen for. 3659 * @param { KeyRequestCallback } callback - Callback used to request drm key. 3660 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3661 * 2.Incorrect parameter types. 3662 * @throws { BusinessError } 6600101 - Session service exception 3663 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3664 * @atomicservice 3665 * @since 12 3666 */ 3667 on(type: 'keyRequest', callback: KeyRequestCallback): void; 3668 3669 /** 3670 * Unregister listener for drm key request. 3671 * @param { 'keyRequest' } type - Type of the 'keyRequest' to listen for. 3672 * @param { KeyRequestCallback } callback - Callback used to request drm key. 3673 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3674 * 2.Incorrect parameter types. 3675 * @throws { BusinessError } 6600101 - Session service exception 3676 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3677 * @atomicservice 3678 * @since 12 3679 */ 3680 off(type: 'keyRequest', callback?: KeyRequestCallback): void; 3681 } 3682 3683 /** 3684 * A helper to enable a picker to select output devices 3685 * 3686 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3687 * @atomicservice 3688 * @since 14 3689 */ 3690 class AVCastPickerHelper { 3691 /** 3692 * The constructor used to create a AVCastPickerHelper object. 3693 * 3694 * @param { Context } context - represents the context. 3695 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3696 * 2.Incorrect parameter types. 3697 * @throws { BusinessError } 6600101 - Session service exception. 3698 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3699 * @atomicservice 3700 * @since 14 3701 */ 3702 constructor(context: Context); 3703 3704 /** 3705 * Pull up the avcastpicker based on the options. 3706 * 3707 * @param { AVCastPickerOptions } [options] - represents the options provided to the picker. 3708 * @returns { Promise<void> } void promise when executed successfully 3709 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3710 * 2.Incorrect parameter types. 3711 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3712 * @atomicservice 3713 * @since 14 3714 */ 3715 select(options?: AVCastPickerOptions): Promise<void>; 3716 3717 /** 3718 * Register picker state change callback. 3719 * @param { 'pickerStateChange' } type - 'pickerStateChange' 3720 * @param { Callback<AVCastPickerState> } callback - The callback used to handle picker state changed event. 3721 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3722 * 2.Incorrect parameter types. 3723 * @throws { BusinessError } 6600101 - Session service exception. 3724 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3725 * @atomicservice 3726 * @since 14 3727 */ 3728 on(type: 'pickerStateChange', callback: Callback<AVCastPickerState>) : void; 3729 3730 /** 3731 * Unregister picker state change callback. 3732 * @param { 'pickerStateChange' } type - 'pickerStateChange' 3733 * @param { Callback<AVCastPickerState> } callback - The callback used to handle picker state changed event. 3734 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 3735 * 2.Incorrect parameter types. 3736 * @throws { BusinessError } 6600101 - Session service exception. 3737 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3738 * @atomicservice 3739 * @since 14 3740 */ 3741 off(type: 'pickerStateChange', callback?: Callback<AVCastPickerState>) : void; 3742 } 3743 3744 /** 3745 * An option to make different picker usage 3746 * 3747 * @typedef AVCastPickerOptions 3748 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3749 * @atomicservice 3750 * @since 14 3751 */ 3752 interface AVCastPickerOptions { 3753 /** 3754 * Indicates current session type to show different picker ui. 3755 * If not set, default value is 'audio'. 3756 * 3757 * @type { ? AVSessionType } 3758 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3759 * @atomicservice 3760 * @since 14 3761 */ 3762 sessionType?: AVSessionType; 3763 } 3764 3765 /** 3766 * The callback of key request. 3767 * 3768 * @typedef { function } KeyRequestCallback 3769 * @param { string } assetId - request key for current assetId 3770 * @param { Uint8Array } requestData - media key request data sent to media key server 3771 * @syscap SystemCapability.Multimedia.AVSession.AVCast 3772 * @atomicservice 3773 * @since 12 3774 */ 3775 type KeyRequestCallback = (assetId: string, requestData: Uint8Array) => void; 3776 3777 /** 3778 * Enumerates the cast display states. 3779 * 3780 * @enum { number } 3781 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3782 * @atomicservice 3783 * @since 12 3784 */ 3785 enum CastDisplayState { 3786 /** 3787 * Screen off. 3788 * 3789 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3790 * @atomicservice 3791 * @since 12 3792 */ 3793 STATE_OFF = 1, 3794 3795 /** 3796 * Screen on. 3797 * 3798 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3799 * @atomicservice 3800 * @since 12 3801 */ 3802 STATE_ON = 2, 3803 } 3804 3805 /** 3806 * Define the information for extended display screen. 3807 * @typedef CastDisplayInfo 3808 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3809 * @atomicservice 3810 * @since 12 3811 */ 3812 interface CastDisplayInfo { 3813 /** 3814 * Display ID. 3815 * The application can get more display information based on the same id from display interface. 3816 * @type { number } 3817 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3818 * @atomicservice 3819 * @since 12 3820 */ 3821 id: number; 3822 3823 /** 3824 * Display name. 3825 * @type { string } 3826 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3827 * @atomicservice 3828 * @since 12 3829 */ 3830 name: string; 3831 3832 /** 3833 * The state of display. 3834 * @type { CastDisplayState } 3835 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3836 * @atomicservice 3837 * @since 12 3838 */ 3839 state: CastDisplayState; 3840 3841 /** 3842 * Display width, in pixels. 3843 * @type { number } 3844 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3845 * @atomicservice 3846 * @since 12 3847 */ 3848 width: number; 3849 3850 /** 3851 * Display height, in pixels. 3852 * @type { number } 3853 * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast 3854 * @atomicservice 3855 * @since 12 3856 */ 3857 height: number; 3858 } 3859 3860 /** 3861 * Define the device connection state. 3862 * @enum { number } 3863 * @syscap SystemCapability.Multimedia.AVSession.Core 3864 * @since 10 3865 */ 3866 /** 3867 * Define the device connection state. 3868 * @enum { number } 3869 * @syscap SystemCapability.Multimedia.AVSession.Core 3870 * @atomicservice 3871 * @since 12 3872 */ 3873 enum ConnectionState { 3874 /** 3875 * A connection state indicating the device is in the process of connecting. 3876 * @syscap SystemCapability.Multimedia.AVSession.Core 3877 * @since 10 3878 */ 3879 /** 3880 * A connection state indicating the device is in the process of connecting. 3881 * @syscap SystemCapability.Multimedia.AVSession.Core 3882 * @atomicservice 3883 * @since 12 3884 */ 3885 STATE_CONNECTING = 0, 3886 3887 /** 3888 * A connection state indicating the device is connected. 3889 * @syscap SystemCapability.Multimedia.AVSession.Core 3890 * @since 10 3891 */ 3892 /** 3893 * A connection state indicating the device is connected. 3894 * @syscap SystemCapability.Multimedia.AVSession.Core 3895 * @atomicservice 3896 * @since 12 3897 */ 3898 STATE_CONNECTED = 1, 3899 3900 /** 3901 * The default connection state indicating the device is disconnected. 3902 * @syscap SystemCapability.Multimedia.AVSession.Core 3903 * @since 10 3904 */ 3905 /** 3906 * The default connection state indicating the device is disconnected. 3907 * @syscap SystemCapability.Multimedia.AVSession.Core 3908 * @atomicservice 3909 * @since 12 3910 */ 3911 STATE_DISCONNECTED = 6, 3912 } 3913 3914 /** 3915 * The pre-defined display tag by system. 3916 * @enum { number } 3917 * @syscap SystemCapability.Multimedia.AVSession.Core 3918 * @since 11 3919 */ 3920 enum DisplayTag { 3921 /** 3922 * Indicate the AUDIO VIVID property of current media resource. 3923 * @syscap SystemCapability.Multimedia.AVSession.Core 3924 * @since 11 3925 */ 3926 TAG_AUDIO_VIVID = 1, 3927 } 3928 3929 /** 3930 * The play list information definition. 3931 * @interface AVQueueInfo 3932 * @syscap SystemCapability.Multimedia.AVSession.Core 3933 * @systemapi 3934 * @since 11 3935 */ 3936 interface AVQueueInfo { 3937 /** 3938 * The bundle name of application which current play list belongs to. 3939 * @type { string } 3940 * @syscap SystemCapability.Multimedia.AVSession.Core 3941 * @systemapi 3942 * @since 11 3943 */ 3944 bundleName: string; 3945 3946 /** 3947 * The name of play list 3948 * @type { string } 3949 * @syscap SystemCapability.Multimedia.AVSession.Core 3950 * @systemapi 3951 * @since 11 3952 */ 3953 avQueueName: string; 3954 3955 /** 3956 * The id of play list 3957 * @type { string } 3958 * @syscap SystemCapability.Multimedia.AVSession.Core 3959 * @systemapi 3960 * @since 11 3961 */ 3962 avQueueId: string; 3963 3964 /** 3965 * The artwork of play list, can be a {@link PixelMap} or a URI formatted string, 3966 * @type { image.PixelMap | string } 3967 * @syscap SystemCapability.Multimedia.AVSession.Core 3968 * @systemapi 3969 * @since 11 3970 */ 3971 avQueueImage: image.PixelMap | string; 3972 3973 /** 3974 * The time when the user last played the playlist. 3975 * The time format can be system, such as 1611081385000, it means 2021-01-20 02:36:25. 3976 * @type { ?number } 3977 * @syscap SystemCapability.Multimedia.AVSession.Core 3978 * @systemapi 3979 * @since 11 3980 */ 3981 lastPlayedTime?: number; 3982 } 3983 3984 /** 3985 * The metadata of the current media.Used to set the properties of the current media file 3986 * @interface AVMetadata 3987 * @syscap SystemCapability.Multimedia.AVSession.Core 3988 * @since 10 3989 */ 3990 /** 3991 * The metadata of the current media.Used to set the properties of the current media file 3992 * @interface AVMetadata 3993 * @syscap SystemCapability.Multimedia.AVSession.Core 3994 * @atomicservice 3995 * @since 12 3996 */ 3997 interface AVMetadata { 3998 /** 3999 * Unique ID used to represent this media. 4000 * @type { string } 4001 * @syscap SystemCapability.Multimedia.AVSession.Core 4002 * @since 10 4003 */ 4004 /** 4005 * Unique ID used to represent this media. 4006 * @type { string } 4007 * @syscap SystemCapability.Multimedia.AVSession.Core 4008 * @atomicservice 4009 * @since 12 4010 */ 4011 assetId: string; 4012 4013 /** 4014 * The title of this media, for display in media center. 4015 * @type { ?string } 4016 * @syscap SystemCapability.Multimedia.AVSession.Core 4017 * @since 10 4018 */ 4019 /** 4020 * The title of this media, for display in media center. 4021 * @type { ?string } 4022 * @syscap SystemCapability.Multimedia.AVSession.Core 4023 * @atomicservice 4024 * @since 12 4025 */ 4026 title?: string; 4027 4028 /** 4029 * The artist of this media 4030 * @type { ?string } 4031 * @syscap SystemCapability.Multimedia.AVSession.Core 4032 * @since 10 4033 */ 4034 /** 4035 * The artist of this media 4036 * @type { ?string } 4037 * @syscap SystemCapability.Multimedia.AVSession.Core 4038 * @atomicservice 4039 * @since 12 4040 */ 4041 artist?: string; 4042 4043 /** 4044 * The author of this media 4045 * @type { ?string } 4046 * @syscap SystemCapability.Multimedia.AVSession.Core 4047 * @since 10 4048 */ 4049 /** 4050 * The author of this media 4051 * @type { ?string } 4052 * @syscap SystemCapability.Multimedia.AVSession.Core 4053 * @atomicservice 4054 * @since 12 4055 */ 4056 author?: string; 4057 4058 /** 4059 * The name of play list which current media belongs to 4060 * @type { ?string } 4061 * @syscap SystemCapability.Multimedia.AVSession.Core 4062 * @since 12 4063 */ 4064 avQueueName?: string; 4065 4066 /** 4067 * The id of play list which current media belongs to, it should be an unique identifier in the application. 4068 * @type { ?string } 4069 * @syscap SystemCapability.Multimedia.AVSession.Core 4070 * @since 11 4071 */ 4072 avQueueId?: string; 4073 4074 /** 4075 * The artwork of play list as a {@link PixelMap} or an uri formatted String, 4076 * @type { ?(image.PixelMap | string) } 4077 * @syscap SystemCapability.Multimedia.AVSession.Core 4078 * @since 11 4079 */ 4080 avQueueImage?: image.PixelMap | string; 4081 4082 /** 4083 * The album of this media 4084 * @type { ?string } 4085 * @syscap SystemCapability.Multimedia.AVSession.Core 4086 * @since 10 4087 */ 4088 /** 4089 * The album of this media 4090 * @type { ?string } 4091 * @syscap SystemCapability.Multimedia.AVSession.Core 4092 * @atomicservice 4093 * @since 12 4094 */ 4095 album?: string; 4096 4097 /** 4098 * The writer of this media 4099 * @type { ?string } 4100 * @syscap SystemCapability.Multimedia.AVSession.Core 4101 * @since 10 4102 */ 4103 /** 4104 * The writer of this media 4105 * @type { ?string } 4106 * @syscap SystemCapability.Multimedia.AVSession.Core 4107 * @atomicservice 4108 * @since 12 4109 */ 4110 writer?: string; 4111 4112 /** 4113 * The composer of this media 4114 * @type { ?string } 4115 * @syscap SystemCapability.Multimedia.AVSession.Core 4116 * @since 10 4117 */ 4118 composer?: string; 4119 4120 /** 4121 * The duration of this media, used to automatically calculate playback position 4122 * @type { ?number } 4123 * @syscap SystemCapability.Multimedia.AVSession.Core 4124 * @since 10 4125 */ 4126 /** 4127 * The duration of this media, used to automatically calculate playback position 4128 * @type { ?number } 4129 * @syscap SystemCapability.Multimedia.AVSession.Core 4130 * @atomicservice 4131 * @since 12 4132 */ 4133 duration?: number; 4134 4135 /** 4136 * The image of the media as a {@link PixelMap} or an uri formatted String, 4137 * used to display in media center. 4138 * @type { ?(image.PixelMap | string) } 4139 * @syscap SystemCapability.Multimedia.AVSession.Core 4140 * @since 10 4141 */ 4142 /** 4143 * The image of the media as a {@link PixelMap} or an uri formatted String, 4144 * used to display in media center. 4145 * @type { ?(image.PixelMap | string) } 4146 * @syscap SystemCapability.Multimedia.AVSession.Core 4147 * @atomicservice 4148 * @since 12 4149 */ 4150 mediaImage?: image.PixelMap | string; 4151 4152 /** 4153 * The image of the bundle icon as a {@link PixelMap}, no need to be set by application. 4154 * @type { ?image.PixelMap } 4155 * @readonly 4156 * @syscap SystemCapability.Multimedia.AVSession.Core 4157 * @since 18 4158 */ 4159 readonly bundleIcon?: image.PixelMap; 4160 4161 /** 4162 * The publishDate of the media 4163 * @type { ?Date } 4164 * @syscap SystemCapability.Multimedia.AVSession.Core 4165 * @since 10 4166 */ 4167 publishDate?: Date; 4168 4169 /** 4170 * The subtitle of the media, used for display 4171 * @type { ?string } 4172 * @syscap SystemCapability.Multimedia.AVSession.Core 4173 * @since 10 4174 */ 4175 /** 4176 * The subtitle of the media, used for display 4177 * @type { ?string } 4178 * @syscap SystemCapability.Multimedia.AVSession.Core 4179 * @atomicservice 4180 * @since 12 4181 */ 4182 subtitle?: string; 4183 4184 /** 4185 * The discription of the media, used for display 4186 * @type { ?string } 4187 * @syscap SystemCapability.Multimedia.AVSession.Core 4188 * @since 10 4189 */ 4190 /** 4191 * The discription of the media, used for display 4192 * @type { ?string } 4193 * @syscap SystemCapability.Multimedia.AVSession.Core 4194 * @atomicservice 4195 * @since 12 4196 */ 4197 description?: string; 4198 4199 /** 4200 * The lyric of the media, it should be in standard lyric format 4201 * @type { ?string } 4202 * @syscap SystemCapability.Multimedia.AVSession.Core 4203 * @since 10 4204 */ 4205 lyric?: string; 4206 4207 /** 4208 * The single lyric text of the media, not including time prefix 4209 * @type { ?string } 4210 * @syscap SystemCapability.Multimedia.AVSession.Core 4211 * @atomicservice 4212 * @since 17 4213 */ 4214 singleLyricText?: string; 4215 4216 /** 4217 * The previous playable media id. 4218 * Used to tell the controller if there is a previous playable media 4219 * @type { ?string } 4220 * @syscap SystemCapability.Multimedia.AVSession.Core 4221 * @since 10 4222 */ 4223 /** 4224 * The previous playable media id. 4225 * Used to tell the controller if there is a previous playable media 4226 * @type { ?string } 4227 * @syscap SystemCapability.Multimedia.AVSession.Core 4228 * @atomicservice 4229 * @since 12 4230 */ 4231 previousAssetId?: string; 4232 4233 /** 4234 * The next playable media id. 4235 * Used to tell the controller if there is a next playable media 4236 * @type { ?string } 4237 * @syscap SystemCapability.Multimedia.AVSession.Core 4238 * @since 10 4239 */ 4240 /** 4241 * The next playable media id. 4242 * Used to tell the controller if there is a next playable media 4243 * @type { ?string } 4244 * @syscap SystemCapability.Multimedia.AVSession.Core 4245 * @atomicservice 4246 * @since 12 4247 */ 4248 nextAssetId?: string; 4249 4250 /** 4251 * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. 4252 * See {@link ProtocolType} 4253 * @type { ?number } 4254 * @syscap SystemCapability.Multimedia.AVSession.Core 4255 * @since 11 4256 */ 4257 /** 4258 * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. 4259 * See {@link ProtocolType} 4260 * @type { ?number } 4261 * @syscap SystemCapability.Multimedia.AVSession.Core 4262 * @atomicservice 4263 * @since 12 4264 */ 4265 filter?: number; 4266 4267 /** 4268 * The drm schemes supported by this session which are represented by uuid. 4269 * @type { ?Array<string> } 4270 * @syscap SystemCapability.Multimedia.AVSession.Core 4271 * @since 12 4272 */ 4273 drmSchemes?: Array<string>; 4274 4275 /** 4276 * The supported skipIntervals when doing fast forward and rewind operation, the default is {@link SECONDS_15}. 4277 * See {@link SkipIntervals} 4278 * @type { ?SkipIntervals } 4279 * @syscap SystemCapability.Multimedia.AVSession.Core 4280 * @since 11 4281 */ 4282 skipIntervals?: SkipIntervals; 4283 4284 /** 4285 * The display tags supported by application to be displayed on media center 4286 * @type { ?number } 4287 * @syscap SystemCapability.Multimedia.AVSession.Core 4288 * @since 11 4289 */ 4290 displayTags?: number; 4291 } 4292 4293 /** 4294 * The description of the media for an item in the playlist of the session 4295 * @interface AVMediaDescription 4296 * @syscap SystemCapability.Multimedia.AVSession.Core 4297 * @since 10 4298 */ 4299 /** 4300 * The description of the media for an item in the playlist of the session 4301 * @interface AVMediaDescription 4302 * @syscap SystemCapability.Multimedia.AVSession.Core 4303 * @atomicservice 4304 * @since 12 4305 */ 4306 interface AVMediaDescription { 4307 /** 4308 * Unique ID used to represent this media. 4309 * @type { string } 4310 * @syscap SystemCapability.Multimedia.AVSession.Core 4311 * @since 10 4312 */ 4313 /** 4314 * Unique ID used to represent this media. 4315 * @type { string } 4316 * @syscap SystemCapability.Multimedia.AVSession.Core 4317 * @atomicservice 4318 * @since 12 4319 */ 4320 assetId: string; 4321 /** 4322 * The title of this media, for display in media center. 4323 * @type { ?string } 4324 * @syscap SystemCapability.Multimedia.AVSession.Core 4325 * @since 10 4326 */ 4327 /** 4328 * The title of this media, for display in media center. 4329 * @type { ?string } 4330 * @syscap SystemCapability.Multimedia.AVSession.Core 4331 * @atomicservice 4332 * @since 12 4333 */ 4334 title?: string; 4335 4336 /** 4337 * The subtitle of the media, used for display 4338 * @type { ?string } 4339 * @syscap SystemCapability.Multimedia.AVSession.Core 4340 * @since 10 4341 */ 4342 /** 4343 * The subtitle of the media, used for display 4344 * @type { ?string } 4345 * @syscap SystemCapability.Multimedia.AVSession.Core 4346 * @atomicservice 4347 * @since 12 4348 */ 4349 subtitle?: string; 4350 4351 /** 4352 * The description of this media 4353 * @type { ?string } 4354 * @syscap SystemCapability.Multimedia.AVSession.Core 4355 * @since 10 4356 */ 4357 /** 4358 * The description of this media 4359 * @type { ?string } 4360 * @syscap SystemCapability.Multimedia.AVSession.Core 4361 * @atomicservice 4362 * @since 12 4363 */ 4364 description?: string; 4365 4366 /** 4367 * The image of this media asset displayed in the media center. 4368 * It can be a {@link PixelMap} or a URI formatted string, 4369 * @type { ?(image.PixelMap | string) } 4370 * @syscap SystemCapability.Multimedia.AVSession.Core 4371 * @since 10 4372 */ 4373 /** 4374 * The image of this media asset displayed in the media center. 4375 * It can be a {@link PixelMap} or a URI formatted string, 4376 * @type { ?(image.PixelMap | string) } 4377 * @syscap SystemCapability.Multimedia.AVSession.Core 4378 * @atomicservice 4379 * @since 12 4380 */ 4381 mediaImage?: image.PixelMap | string; 4382 /** 4383 * Any additional attributes that can be represented as key-value pairs 4384 * @type { ?object } 4385 * @syscap SystemCapability.Multimedia.AVSession.Core 4386 * @since 10 4387 */ 4388 extras?: {[key: string]: Object}; 4389 4390 /** 4391 * The type of this media, such as video, audio and so on. 4392 * @type { ?string } 4393 * @syscap SystemCapability.Multimedia.AVSession.Core 4394 * @since 10 4395 */ 4396 /** 4397 * The type of this media, such as video, audio and so on. 4398 * @type { ?string } 4399 * @syscap SystemCapability.Multimedia.AVSession.Core 4400 * @atomicservice 4401 * @since 12 4402 */ 4403 mediaType?: string; 4404 4405 /** 4406 * The size of this media. 4407 * @type { ?number } 4408 * @syscap SystemCapability.Multimedia.AVSession.Core 4409 * @since 10 4410 */ 4411 /** 4412 * The size of this media. 4413 * @type { ?number } 4414 * @syscap SystemCapability.Multimedia.AVSession.Core 4415 * @atomicservice 4416 * @since 12 4417 */ 4418 mediaSize?: number; 4419 4420 /** 4421 * The album title of this media 4422 * @type { ?string } 4423 * @syscap SystemCapability.Multimedia.AVSession.Core 4424 * @since 10 4425 */ 4426 /** 4427 * The album title of this media 4428 * @type { ?string } 4429 * @syscap SystemCapability.Multimedia.AVSession.Core 4430 * @atomicservice 4431 * @since 12 4432 */ 4433 albumTitle?: string; 4434 4435 /** 4436 * The album cover uri of this media 4437 * @type { ?string } 4438 * @syscap SystemCapability.Multimedia.AVSession.Core 4439 * @since 10 4440 */ 4441 /** 4442 * The album cover uri of this media 4443 * @type { ?string } 4444 * @syscap SystemCapability.Multimedia.AVSession.Core 4445 * @atomicservice 4446 * @since 12 4447 */ 4448 albumCoverUri?: string; 4449 4450 /** 4451 * The lyric content of the media, it should be in standard lyric format 4452 * @type { ?string } 4453 * @syscap SystemCapability.Multimedia.AVSession.Core 4454 * @since 10 4455 */ 4456 /** 4457 * The lyric content of the media, it should be in standard lyric format 4458 * @type { ?string } 4459 * @syscap SystemCapability.Multimedia.AVSession.Core 4460 * @atomicservice 4461 * @since 12 4462 */ 4463 lyricContent?: string; 4464 4465 /** 4466 * The lyric uri of the media. 4467 * @type { ?string } 4468 * @syscap SystemCapability.Multimedia.AVSession.Core 4469 * @since 10 4470 */ 4471 /** 4472 * The lyric uri of the media. 4473 * @type { ?string } 4474 * @syscap SystemCapability.Multimedia.AVSession.Core 4475 * @atomicservice 4476 * @since 12 4477 */ 4478 lyricUri?: string; 4479 4480 /** 4481 * The artist of this media. 4482 * @type { ?string } 4483 * @syscap SystemCapability.Multimedia.AVSession.Core 4484 * @since 10 4485 */ 4486 /** 4487 * The artist of this media. 4488 * @type { ?string } 4489 * @syscap SystemCapability.Multimedia.AVSession.Core 4490 * @atomicservice 4491 * @since 12 4492 */ 4493 artist?: string; 4494 4495 /** 4496 * The uri of the media, used to locate the media in some special cases 4497 * @type { ?string } 4498 * @syscap SystemCapability.Multimedia.AVSession.Core 4499 * @since 10 4500 */ 4501 /** 4502 * The uri of the media, used to locate the media in some special cases 4503 * @type { ?string } 4504 * @syscap SystemCapability.Multimedia.AVSession.Core 4505 * @atomicservice 4506 * @since 12 4507 */ 4508 mediaUri?: string; 4509 4510 /** 4511 * Media file descriptor. 4512 * @type { ?media.AVFileDescriptor } 4513 * @syscap SystemCapability.Multimedia.AVSession.Core 4514 * @since 10 4515 */ 4516 /** 4517 * Media file descriptor. 4518 * @type { ?media.AVFileDescriptor } 4519 * @syscap SystemCapability.Multimedia.AVSession.Core 4520 * @atomicservice 4521 * @since 12 4522 */ 4523 fdSrc?: media.AVFileDescriptor; 4524 4525 /** 4526 * DataSource descriptor. The caller ensures the fileSize and callback are valid. 4527 * @type { ?media.AVDataSrcDescriptor } 4528 * @syscap SystemCapability.Multimedia.AVSession.Core 4529 * @since 12 4530 */ 4531 dataSrc?: media.AVDataSrcDescriptor; 4532 4533 /** 4534 * The drm scheme supported by this resource which is represented by uuid. 4535 * @type { ?string } 4536 * @syscap SystemCapability.Multimedia.AVSession.Core 4537 * @since 12 4538 */ 4539 drmScheme?: string; 4540 4541 /** 4542 * The duration of this media 4543 * @type { ?number } 4544 * @syscap SystemCapability.Multimedia.AVSession.Core 4545 * @since 10 4546 */ 4547 /** 4548 * The duration of this media 4549 * @type { ?number } 4550 * @syscap SystemCapability.Multimedia.AVSession.Core 4551 * @atomicservice 4552 * @since 12 4553 */ 4554 duration?: number; 4555 4556 /** 4557 * Media start position, described by milliseconds. 4558 * @type { ?number } 4559 * @syscap SystemCapability.Multimedia.AVSession.Core 4560 * @since 10 4561 */ 4562 /** 4563 * Media start position, described by milliseconds. 4564 * @type { ?number } 4565 * @syscap SystemCapability.Multimedia.AVSession.Core 4566 * @atomicservice 4567 * @since 12 4568 */ 4569 startPosition?: number; 4570 4571 /** 4572 * Media credits position, described by milliseconds. 4573 * @type { ?number } 4574 * @syscap SystemCapability.Multimedia.AVSession.Core 4575 * @since 10 4576 */ 4577 /** 4578 * Media credits position, described by milliseconds. 4579 * @type { ?number } 4580 * @syscap SystemCapability.Multimedia.AVSession.Core 4581 * @atomicservice 4582 * @since 12 4583 */ 4584 creditsPosition?: number; 4585 4586 /** 4587 * Application name. 4588 * @type { ?string } 4589 * @syscap SystemCapability.Multimedia.AVSession.Core 4590 * @since 10 4591 */ 4592 /** 4593 * Application name. 4594 * @type { ?string } 4595 * @syscap SystemCapability.Multimedia.AVSession.Core 4596 * @atomicservice 4597 * @since 12 4598 */ 4599 appName?: string; 4600 4601 /** 4602 * The display tags supported by application to be displayed on media center 4603 * @type { ?number } 4604 * @syscap SystemCapability.Multimedia.AVSession.Core 4605 * @since 11 4606 */ 4607 /** 4608 * The display tags supported by application to be displayed on media center 4609 * @type { ?number } 4610 * @syscap SystemCapability.Multimedia.AVSession.Core 4611 * @atomicservice 4612 * @since 12 4613 */ 4614 displayTags?: number; 4615 } 4616 4617 /** 4618 * The item in the playlist of the session 4619 * @interface AVQueueItem 4620 * @syscap SystemCapability.Multimedia.AVSession.Core 4621 * @since 10 4622 */ 4623 /** 4624 * The item in the playlist of the session 4625 * @interface AVQueueItem 4626 * @syscap SystemCapability.Multimedia.AVSession.Core 4627 * @atomicservice 4628 * @since 12 4629 */ 4630 interface AVQueueItem { 4631 /** 4632 * Sequence number of the item in the playlist. 4633 * @type { number } 4634 * @syscap SystemCapability.Multimedia.AVSession.Core 4635 * @since 10 4636 */ 4637 /** 4638 * Sequence number of the item in the playlist. 4639 * @type { number } 4640 * @syscap SystemCapability.Multimedia.AVSession.Core 4641 * @atomicservice 4642 * @since 12 4643 */ 4644 itemId: number; 4645 4646 /** 4647 * The media description of the item in the playlist. 4648 * @type { ?AVMediaDescription } 4649 * @syscap SystemCapability.Multimedia.AVSession.Core 4650 * @since 10 4651 */ 4652 /** 4653 * The media description of the item in the playlist. 4654 * @type { ?AVMediaDescription } 4655 * @syscap SystemCapability.Multimedia.AVSession.Core 4656 * @atomicservice 4657 * @since 12 4658 */ 4659 description?: AVMediaDescription; 4660 } 4661 4662 /** 4663 * Used to indicate the playback state of the current media. 4664 * If the playback state of the media changes, it needs to be updated synchronously 4665 * @interface AVPlaybackState 4666 * @syscap SystemCapability.Multimedia.AVSession.Core 4667 * @since 10 4668 */ 4669 /** 4670 * Used to indicate the playback state of the current media. 4671 * If the playback state of the media changes, it needs to be updated synchronously 4672 * @interface AVPlaybackState 4673 * @syscap SystemCapability.Multimedia.AVSession.Core 4674 * @atomicservice 4675 * @since 12 4676 */ 4677 interface AVPlaybackState { 4678 /** 4679 * Current playback state. See {@link PlaybackState} 4680 * @type { ?PlaybackState } 4681 * @syscap SystemCapability.Multimedia.AVSession.Core 4682 * @since 10 4683 */ 4684 /** 4685 * Current playback state. See {@link PlaybackState} 4686 * @type { ?PlaybackState } 4687 * @syscap SystemCapability.Multimedia.AVSession.Core 4688 * @atomicservice 4689 * @since 12 4690 */ 4691 state?: PlaybackState; 4692 4693 /** 4694 * Current playback speed 4695 * @type { ?number } 4696 * @syscap SystemCapability.Multimedia.AVSession.Core 4697 * @since 10 4698 */ 4699 /** 4700 * Current playback speed 4701 * @type { ?number } 4702 * @syscap SystemCapability.Multimedia.AVSession.Core 4703 * @atomicservice 4704 * @since 12 4705 */ 4706 speed?: number; 4707 4708 /** 4709 * Current playback position of this media. See {@link PlaybackPosition} 4710 * @type { ?PlaybackPosition } 4711 * @syscap SystemCapability.Multimedia.AVSession.Core 4712 * @since 10 4713 */ 4714 /** 4715 * Current playback position of this media. See {@link PlaybackPosition} 4716 * @type { ?PlaybackPosition } 4717 * @syscap SystemCapability.Multimedia.AVSession.Core 4718 * @atomicservice 4719 * @since 12 4720 */ 4721 position?: PlaybackPosition; 4722 4723 /** 4724 * The current buffered time, the maximum playable position 4725 * @type { ?number } 4726 * @syscap SystemCapability.Multimedia.AVSession.Core 4727 * @since 10 4728 */ 4729 /** 4730 * The current buffered time, the maximum playable position 4731 * @type { ?number } 4732 * @syscap SystemCapability.Multimedia.AVSession.Core 4733 * @atomicservice 4734 * @since 12 4735 */ 4736 bufferedTime?: number; 4737 4738 /** 4739 * Current playback loop mode. See {@link LoopMode} 4740 * @type { ?LoopMode } 4741 * @syscap SystemCapability.Multimedia.AVSession.Core 4742 * @since 10 4743 */ 4744 /** 4745 * Current playback loop mode. See {@link LoopMode} 4746 * @type { ?LoopMode } 4747 * @syscap SystemCapability.Multimedia.AVSession.Core 4748 * @atomicservice 4749 * @since 12 4750 */ 4751 loopMode?: LoopMode; 4752 4753 /** 4754 * Current Favorite Status 4755 * @type { ?boolean } 4756 * @syscap SystemCapability.Multimedia.AVSession.Core 4757 * @since 10 4758 */ 4759 /** 4760 * Current Favorite Status 4761 * @type { ?boolean } 4762 * @syscap SystemCapability.Multimedia.AVSession.Core 4763 * @atomicservice 4764 * @since 12 4765 */ 4766 isFavorite?: boolean; 4767 4768 /** 4769 * Current active item id 4770 * @type { ?number } 4771 * @syscap SystemCapability.Multimedia.AVSession.Core 4772 * @since 10 4773 */ 4774 /** 4775 * Current active item id 4776 * @type { ?number } 4777 * @syscap SystemCapability.Multimedia.AVSession.Core 4778 * @atomicservice 4779 * @since 12 4780 */ 4781 activeItemId?: number; 4782 4783 /** 4784 * Current player volume 4785 * @type { ?number } 4786 * @syscap SystemCapability.Multimedia.AVSession.Core 4787 * @since 10 4788 */ 4789 /** 4790 * Current player volume 4791 * @type { ?number } 4792 * @syscap SystemCapability.Multimedia.AVSession.Core 4793 * @atomicservice 4794 * @since 12 4795 */ 4796 volume?: number; 4797 4798 /** 4799 * maximum volume 4800 * @type { ?number } 4801 * @syscap SystemCapability.Multimedia.AVSession.Core 4802 * @since 11 4803 */ 4804 /** 4805 * maximum volume 4806 * @type { ?number } 4807 * @syscap SystemCapability.Multimedia.AVSession.Core 4808 * @atomicservice 4809 * @since 12 4810 */ 4811 maxVolume?: number; 4812 4813 /** 4814 * Current muted status 4815 * @type { ?boolean } 4816 * @syscap SystemCapability.Multimedia.AVSession.Core 4817 * @since 11 4818 */ 4819 /** 4820 * Current muted status 4821 * @type { ?boolean } 4822 * @syscap SystemCapability.Multimedia.AVSession.Core 4823 * @atomicservice 4824 * @since 12 4825 */ 4826 muted?: boolean; 4827 4828 /** 4829 * The duration of this media asset. 4830 * @type { ?number } 4831 * @syscap SystemCapability.Multimedia.AVSession.Core 4832 * @since 11 4833 */ 4834 duration?: number; 4835 4836 /** 4837 * The video width of this media asset. 4838 * @type { ?number } 4839 * @syscap SystemCapability.Multimedia.AVSession.Core 4840 * @since 11 4841 */ 4842 /** 4843 * The video width of this media asset. 4844 * @type { ?number } 4845 * @syscap SystemCapability.Multimedia.AVSession.Core 4846 * @atomicservice 4847 * @since 12 4848 */ 4849 videoWidth?: number; 4850 4851 /** 4852 * The video height of this media asset. 4853 * @type { ?number } 4854 * @syscap SystemCapability.Multimedia.AVSession.Core 4855 * @since 11 4856 */ 4857 /** 4858 * The video height of this media asset. 4859 * @type { ?number } 4860 * @syscap SystemCapability.Multimedia.AVSession.Core 4861 * @atomicservice 4862 * @since 12 4863 */ 4864 videoHeight?: number; 4865 4866 /** 4867 * Current custom media packets 4868 * @type { ?object } 4869 * @syscap SystemCapability.Multimedia.AVSession.Core 4870 * @since 10 4871 */ 4872 /** 4873 * Current custom media packets 4874 * @type { ?object } 4875 * @syscap SystemCapability.Multimedia.AVSession.Core 4876 * @atomicservice 4877 * @since 12 4878 */ 4879 extras?: {[key: string]: Object}; 4880 } 4881 4882 /** 4883 * Playback position definition 4884 * @interface PlaybackPosition 4885 * @syscap SystemCapability.Multimedia.AVSession.Core 4886 * @since 10 4887 */ 4888 /** 4889 * Playback position definition 4890 * @interface PlaybackPosition 4891 * @syscap SystemCapability.Multimedia.AVSession.Core 4892 * @atomicservice 4893 * @since 12 4894 */ 4895 interface PlaybackPosition { 4896 /** 4897 * Elapsed time(position) of this media set by the app. 4898 * @type { number } 4899 * @syscap SystemCapability.Multimedia.AVSession.Core 4900 * @since 10 4901 */ 4902 /** 4903 * Elapsed time(position) of this media set by the app. 4904 * @type { number } 4905 * @syscap SystemCapability.Multimedia.AVSession.Core 4906 * @atomicservice 4907 * @since 12 4908 */ 4909 elapsedTime: number; 4910 4911 /** 4912 * Record the system time when elapsedTime is set. 4913 * @type { number } 4914 * @syscap SystemCapability.Multimedia.AVSession.Core 4915 * @since 10 4916 */ 4917 /** 4918 * Record the system time when elapsedTime is set. 4919 * @type { number } 4920 * @syscap SystemCapability.Multimedia.AVSession.Core 4921 * @atomicservice 4922 * @since 12 4923 */ 4924 updateTime: number; 4925 } 4926 4927 /** 4928 * The metadata of the current call. 4929 * @interface CallMetadata 4930 * @syscap SystemCapability.Multimedia.AVSession.Core 4931 * @since 11 4932 */ 4933 /** 4934 * The metadata of the current call. 4935 * @typedef CallMetadata 4936 * @syscap SystemCapability.Multimedia.AVSession.Core 4937 * @atomicservice 4938 * @since 12 4939 */ 4940 interface CallMetadata { 4941 /** 4942 * The displayed user name of current call. 4943 * @type { ?string } 4944 * @syscap SystemCapability.Multimedia.AVSession.Core 4945 * @since 11 4946 */ 4947 /** 4948 * The displayed user name of current call. 4949 * @type { ?string } 4950 * @syscap SystemCapability.Multimedia.AVSession.Core 4951 * @atomicservice 4952 * @since 12 4953 */ 4954 name?: string; 4955 4956 /** 4957 * The phone number of current call. 4958 * @type { ?string } 4959 * @syscap SystemCapability.Multimedia.AVSession.Core 4960 * @since 11 4961 */ 4962 /** 4963 * The phone number of current call. 4964 * @type { ?string } 4965 * @syscap SystemCapability.Multimedia.AVSession.Core 4966 * @atomicservice 4967 * @since 12 4968 */ 4969 phoneNumber?: string; 4970 4971 /** 4972 * The displayed picture that represents a particular user. 4973 * @type { ?image.PixelMap } 4974 * @syscap SystemCapability.Multimedia.AVSession.Core 4975 * @since 11 4976 */ 4977 /** 4978 * The displayed picture that represents a particular user. 4979 * @type { ?image.PixelMap } 4980 * @syscap SystemCapability.Multimedia.AVSession.Core 4981 * @atomicservice 4982 * @since 12 4983 */ 4984 avatar?: image.PixelMap; 4985 } 4986 4987 /** 4988 * Used to indicate the call state of the current call. 4989 * @interface AVCallState 4990 * @syscap SystemCapability.Multimedia.AVSession.Core 4991 * @since 11 4992 */ 4993 /** 4994 * Used to indicate the call state of the current call. 4995 * @typedef AVCallState 4996 * @syscap SystemCapability.Multimedia.AVSession.Core 4997 * @atomicservice 4998 * @since 12 4999 */ 5000 interface AVCallState { 5001 /** 5002 * Current call state. See {@link CallState} 5003 * @type { CallState } 5004 * @syscap SystemCapability.Multimedia.AVSession.Core 5005 * @since 11 5006 */ 5007 /** 5008 * Current call state. See {@link CallState} 5009 * @type { CallState } 5010 * @syscap SystemCapability.Multimedia.AVSession.Core 5011 * @atomicservice 5012 * @since 12 5013 */ 5014 state: CallState; 5015 5016 /** 5017 * Current muted status. 5018 * @type { boolean } 5019 * @syscap SystemCapability.Multimedia.AVSession.Core 5020 * @since 11 5021 */ 5022 /** 5023 * Current muted status. 5024 * @type { boolean } 5025 * @syscap SystemCapability.Multimedia.AVSession.Core 5026 * @atomicservice 5027 * @since 12 5028 */ 5029 muted: boolean; 5030 } 5031 5032 /** 5033 * Enumeration of current call state 5034 * @enum { number } 5035 * @syscap SystemCapability.Multimedia.AVSession.Core 5036 * @since 11 5037 */ 5038 /** 5039 * Enumeration of current call state 5040 * @enum { number } 5041 * @syscap SystemCapability.Multimedia.AVSession.Core 5042 * @atomicservice 5043 * @since 12 5044 */ 5045 enum CallState { 5046 /** 5047 * Idle state. 5048 * @syscap SystemCapability.Multimedia.AVSession.Core 5049 * @since 11 5050 */ 5051 /** 5052 * Idle state. 5053 * @syscap SystemCapability.Multimedia.AVSession.Core 5054 * @atomicservice 5055 * @since 12 5056 */ 5057 CALL_STATE_IDLE = 0, 5058 5059 /** 5060 * Incoming state. 5061 * @syscap SystemCapability.Multimedia.AVSession.Core 5062 * @since 11 5063 */ 5064 /** 5065 * Incoming state. 5066 * @syscap SystemCapability.Multimedia.AVSession.Core 5067 * @atomicservice 5068 * @since 12 5069 */ 5070 CALL_STATE_INCOMING = 1, 5071 5072 /** 5073 * Active state in calling. 5074 * @syscap SystemCapability.Multimedia.AVSession.Core 5075 * @since 11 5076 */ 5077 /** 5078 * Active state in calling. 5079 * @syscap SystemCapability.Multimedia.AVSession.Core 5080 * @atomicservice 5081 * @since 12 5082 */ 5083 CALL_STATE_ACTIVE = 2, 5084 5085 /** 5086 * Dialing state. 5087 * @syscap SystemCapability.Multimedia.AVSession.Core 5088 * @since 11 5089 */ 5090 /** 5091 * Dialing state. 5092 * @syscap SystemCapability.Multimedia.AVSession.Core 5093 * @atomicservice 5094 * @since 12 5095 */ 5096 CALL_STATE_DIALING = 3, 5097 5098 /** 5099 * Waiting state. 5100 * @syscap SystemCapability.Multimedia.AVSession.Core 5101 * @since 11 5102 */ 5103 /** 5104 * Waiting state. 5105 * @syscap SystemCapability.Multimedia.AVSession.Core 5106 * @atomicservice 5107 * @since 12 5108 */ 5109 CALL_STATE_WAITING = 4, 5110 5111 /** 5112 * Holding state. 5113 * @syscap SystemCapability.Multimedia.AVSession.Core 5114 * @since 11 5115 */ 5116 /** 5117 * Holding state. 5118 * @syscap SystemCapability.Multimedia.AVSession.Core 5119 * @atomicservice 5120 * @since 12 5121 */ 5122 CALL_STATE_HOLDING = 5, 5123 5124 /** 5125 * Disconnecting state. 5126 * @syscap SystemCapability.Multimedia.AVSession.Core 5127 * @since 11 5128 */ 5129 /** 5130 * Disconnecting state. 5131 * @syscap SystemCapability.Multimedia.AVSession.Core 5132 * @atomicservice 5133 * @since 12 5134 */ 5135 CALL_STATE_DISCONNECTING = 6, 5136 } 5137 5138 /** 5139 * cast category indicating different playback scenes 5140 * @enum { number } 5141 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5142 * @since 10 5143 */ 5144 /** 5145 * cast category indicating different playback scenes 5146 * @enum { number } 5147 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5148 * @atomicservice 5149 * @since 12 5150 */ 5151 enum AVCastCategory { 5152 /** 5153 * The default cast type "local", media can be routed on the same device, 5154 * including internal speakers or audio jack on the device itself, A2DP devices. 5155 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5156 * @since 10 5157 */ 5158 /** 5159 * The default cast type "local", media can be routed on the same device, 5160 * including internal speakers or audio jack on the device itself, A2DP devices. 5161 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5162 * @atomicservice 5163 * @since 12 5164 */ 5165 CATEGORY_LOCAL = 0, 5166 5167 /** 5168 * The remote category indicating the media is presenting on a remote device, 5169 * the application needs to get an AVCastController to control remote playback. 5170 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5171 * @since 10 5172 */ 5173 /** 5174 * The remote category indicating the media is presenting on a remote device, 5175 * the application needs to get an AVCastController to control remote playback. 5176 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5177 * @atomicservice 5178 * @since 12 5179 */ 5180 CATEGORY_REMOTE = 1, 5181 } 5182 /** 5183 * Device type definition 5184 * @enum { number } 5185 * @syscap SystemCapability.Multimedia.AVSession.Core 5186 * @since 10 5187 */ 5188 /** 5189 * Device type definition 5190 * @enum { number } 5191 * @syscap SystemCapability.Multimedia.AVSession.Core 5192 * @atomicservice 5193 * @since 12 5194 */ 5195 enum DeviceType { 5196 /** 5197 * A device type indicating the route is on internal speakers or audio jack on the device itself. 5198 * @syscap SystemCapability.Multimedia.AVSession.Core 5199 * @since 10 5200 */ 5201 /** 5202 * A device type indicating the route is on internal speakers or audio jack on the device itself. 5203 * @syscap SystemCapability.Multimedia.AVSession.Core 5204 * @atomicservice 5205 * @since 12 5206 */ 5207 DEVICE_TYPE_LOCAL = 0, 5208 5209 /** 5210 * A device type indicating the route is on a TV. 5211 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5212 * @since 10 5213 */ 5214 /** 5215 * A device type indicating the route is on a TV. 5216 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5217 * @atomicservice 5218 * @since 12 5219 */ 5220 DEVICE_TYPE_TV = 2, 5221 5222 /** 5223 * A device type indicating the route is on a smart speaker. 5224 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5225 * @since 10 5226 */ 5227 /** 5228 * A device type indicating the route is on a smart speaker. 5229 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5230 * @atomicservice 5231 * @since 12 5232 */ 5233 DEVICE_TYPE_SMART_SPEAKER = 3, 5234 5235 /** 5236 * A device type indicating the route is on a bluetooth device. 5237 * @syscap SystemCapability.Multimedia.AVSession.Core 5238 * @since 10 5239 */ 5240 /** 5241 * A device type indicating the route is on a bluetooth device. 5242 * @syscap SystemCapability.Multimedia.AVSession.Core 5243 * @atomicservice 5244 * @since 12 5245 */ 5246 DEVICE_TYPE_BLUETOOTH = 10, 5247 } 5248 5249 /** 5250 * Device Information Definition 5251 * @interface DeviceInfo 5252 * @syscap SystemCapability.Multimedia.AVSession.Core 5253 * @since 10 5254 */ 5255 /** 5256 * Device Information Definition 5257 * @interface DeviceInfo 5258 * @syscap SystemCapability.Multimedia.AVSession.Core 5259 * @atomicservice 5260 * @since 12 5261 */ 5262 interface DeviceInfo { 5263 /** 5264 * The playback type supported by the device. See {@link AVCastCategory} 5265 * @type { AVCastCategory } 5266 * @syscap SystemCapability.Multimedia.AVSession.Core 5267 * @since 10 5268 */ 5269 /** 5270 * The playback type supported by the device. See {@link AVCastCategory} 5271 * @type { AVCastCategory } 5272 * @syscap SystemCapability.Multimedia.AVSession.Core 5273 * @atomicservice 5274 * @since 12 5275 */ 5276 castCategory: AVCastCategory; 5277 /** 5278 * Audio device id.The length of the audioDeviceId array is greater than 1 5279 * if output to multiple devices at the same time. 5280 * @type { string } 5281 * @syscap SystemCapability.Multimedia.AVSession.Core 5282 * @since 10 5283 */ 5284 /** 5285 * Audio device id.The length of the audioDeviceId array is greater than 1 5286 * if output to multiple devices at the same time. 5287 * @type { string } 5288 * @syscap SystemCapability.Multimedia.AVSession.Core 5289 * @atomicservice 5290 * @since 12 5291 */ 5292 deviceId: string; 5293 5294 /** 5295 * Device name. The length of the deviceName array is greater than 1 5296 * if output to multiple devices at the same time. 5297 * @type { string } 5298 * @syscap SystemCapability.Multimedia.AVSession.Core 5299 * @since 10 5300 */ 5301 /** 5302 * Device name. The length of the deviceName array is greater than 1 5303 * if output to multiple devices at the same time. 5304 * @type { string } 5305 * @syscap SystemCapability.Multimedia.AVSession.Core 5306 * @atomicservice 5307 * @since 12 5308 */ 5309 deviceName: string; 5310 5311 /** 5312 * device type. 5313 * @type { DeviceType } 5314 * @syscap SystemCapability.Multimedia.AVSession.Core 5315 * @since 10 5316 */ 5317 /** 5318 * device type. 5319 * @type { DeviceType } 5320 * @syscap SystemCapability.Multimedia.AVSession.Core 5321 * @atomicservice 5322 * @since 12 5323 */ 5324 deviceType: DeviceType; 5325 5326 /** 5327 * Device manufacturer. 5328 * @type { ?string } 5329 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5330 * @atomicservice 5331 * @since 13 5332 */ 5333 manufacturer?: string; 5334 5335 /** 5336 * Device model name. 5337 * @type { ?string } 5338 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5339 * @atomicservice 5340 * @since 13 5341 */ 5342 modelName?: string; 5343 5344 /** 5345 * Network id. 5346 * @type { ?string } 5347 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5348 * @systemapi 5349 * @since 13 5350 */ 5351 networkId?: string; 5352 5353 /** 5354 * device ip address if available. 5355 * @type { ?string } 5356 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5357 * @systemapi 5358 * @since 10 5359 */ 5360 ipAddress?: string; 5361 5362 /** 5363 * device provider which supplies the route capability. 5364 * @type { ?number } 5365 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5366 * @systemapi 5367 * @since 10 5368 */ 5369 providerId?: number; 5370 5371 /** 5372 * The protocols supported by current device, can be union of {@link ProtocolType}. 5373 * @type { ?number } 5374 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5375 * @since 11 5376 */ 5377 /** 5378 * The protocols supported by current device, can be union of {@link ProtocolType}. 5379 * @type { ?number } 5380 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5381 * @atomicservice 5382 * @since 12 5383 */ 5384 supportedProtocols?: number; 5385 5386 /** 5387 * The drm capability supported by current device, each drm is represented by uuid. 5388 * @type { ?Array<string> } 5389 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5390 * @atomicservice 5391 * @since 12 5392 */ 5393 supportedDrmCapabilities?: Array<string>; 5394 5395 /** 5396 * Define different authentication status. 5397 * 0: Device not authenticated. 5398 * 1: Device already authenticated. 5399 * @type { ?number } 5400 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5401 * @systemapi 5402 * @since 11 5403 */ 5404 authenticationStatus?: number; 5405 5406 /** 5407 * Indicates the current device is legacy or not. 5408 * @type { ?boolean } 5409 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5410 * @systemapi 5411 * @since 13 5412 */ 5413 isLegacy?: boolean; 5414 5415 /** 5416 * Medium types used to discover devices. 5417 * 1: BLE 5418 * 2: COAP 5419 * @type { ?number } 5420 * @syscap SystemCapability.Multimedia.AVSession.AVCast 5421 * @systemapi 5422 * @since 13 5423 */ 5424 mediumTypes?: number; 5425 } 5426 5427 /** 5428 * Target Device Information Definition 5429 * @interface OutputDeviceInfo 5430 * @syscap SystemCapability.Multimedia.AVSession.Core 5431 * @since 10 5432 */ 5433 /** 5434 * Target Device Information Definition 5435 * @interface OutputDeviceInfo 5436 * @syscap SystemCapability.Multimedia.AVSession.Core 5437 * @atomicservice 5438 * @since 12 5439 */ 5440 interface OutputDeviceInfo { 5441 /** 5442 * Arrays of device information 5443 * @type { Array<DeviceInfo> } 5444 * @syscap SystemCapability.Multimedia.AVSession.Core 5445 * @since 10 5446 */ 5447 /** 5448 * Arrays of device information 5449 * @type { Array<DeviceInfo> } 5450 * @syscap SystemCapability.Multimedia.AVSession.Core 5451 * @atomicservice 5452 * @since 12 5453 */ 5454 devices: Array<DeviceInfo>; 5455 } 5456 5457 /** 5458 * Loop Play Mode Definition 5459 * @enum { number } 5460 * @syscap SystemCapability.Multimedia.AVSession.Core 5461 * @since 10 5462 */ 5463 /** 5464 * Loop Play Mode Definition 5465 * @enum { number } 5466 * @syscap SystemCapability.Multimedia.AVSession.Core 5467 * @atomicservice 5468 * @since 12 5469 */ 5470 enum LoopMode { 5471 /** 5472 * The default mode is sequential playback 5473 * @syscap SystemCapability.Multimedia.AVSession.Core 5474 * @since 10 5475 */ 5476 /** 5477 * The default mode is sequential playback 5478 * @syscap SystemCapability.Multimedia.AVSession.Core 5479 * @atomicservice 5480 * @since 12 5481 */ 5482 LOOP_MODE_SEQUENCE = 0, 5483 5484 /** 5485 * Single loop mode 5486 * @syscap SystemCapability.Multimedia.AVSession.Core 5487 * @since 10 5488 */ 5489 /** 5490 * Single loop mode 5491 * @syscap SystemCapability.Multimedia.AVSession.Core 5492 * @atomicservice 5493 * @since 12 5494 */ 5495 LOOP_MODE_SINGLE = 1, 5496 5497 /** 5498 * List loop mode 5499 * @syscap SystemCapability.Multimedia.AVSession.Core 5500 * @since 10 5501 */ 5502 /** 5503 * List loop mode 5504 * @syscap SystemCapability.Multimedia.AVSession.Core 5505 * @atomicservice 5506 * @since 12 5507 */ 5508 LOOP_MODE_LIST = 2, 5509 5510 /** 5511 * Shuffle playback mode 5512 * @syscap SystemCapability.Multimedia.AVSession.Core 5513 * @since 10 5514 */ 5515 /** 5516 * Shuffle playback mode 5517 * @syscap SystemCapability.Multimedia.AVSession.Core 5518 * @atomicservice 5519 * @since 12 5520 */ 5521 LOOP_MODE_SHUFFLE = 3, 5522 5523 /** 5524 * Custom playback mode supported by application 5525 * @syscap SystemCapability.Multimedia.AVSession.Core 5526 * @since 11 5527 */ 5528 /** 5529 * Custom playback mode supported by application 5530 * @syscap SystemCapability.Multimedia.AVSession.Core 5531 * @atomicservice 5532 * @since 12 5533 */ 5534 LOOP_MODE_CUSTOM = 4, 5535 } 5536 5537 /** 5538 * Supported skip intervals definition 5539 * @enum { number } 5540 * @syscap SystemCapability.Multimedia.AVSession.Core 5541 * @since 11 5542 */ 5543 enum SkipIntervals { 5544 /** 5545 * 10 seconds 5546 * @syscap SystemCapability.Multimedia.AVSession.Core 5547 * @since 11 5548 */ 5549 SECONDS_10 = 10, 5550 /** 5551 * 15 seconds 5552 * @syscap SystemCapability.Multimedia.AVSession.Core 5553 * @since 11 5554 */ 5555 SECONDS_15 = 15, 5556 /** 5557 * 30 seconds 5558 * @syscap SystemCapability.Multimedia.AVSession.Core 5559 * @since 11 5560 */ 5561 SECONDS_30 = 30, 5562 } 5563 5564 /** 5565 * Definition of current playback state 5566 * @enum { number } 5567 * @syscap SystemCapability.Multimedia.AVSession.Core 5568 * @since 10 5569 */ 5570 /** 5571 * Definition of current playback state 5572 * @enum { number } 5573 * @syscap SystemCapability.Multimedia.AVSession.Core 5574 * @atomicservice 5575 * @since 12 5576 */ 5577 enum PlaybackState { 5578 /** 5579 * Initial state. The initial state of media file 5580 * @syscap SystemCapability.Multimedia.AVSession.Core 5581 * @since 10 5582 */ 5583 /** 5584 * Initial state. The initial state of media file 5585 * @syscap SystemCapability.Multimedia.AVSession.Core 5586 * @atomicservice 5587 * @since 12 5588 */ 5589 PLAYBACK_STATE_INITIAL = 0, 5590 5591 /** 5592 * Preparing state. Indicates that the media file is not ready to play, 5593 * the media is loading or buffering 5594 * @syscap SystemCapability.Multimedia.AVSession.Core 5595 * @since 10 5596 */ 5597 /** 5598 * Preparing state. Indicates that the media file is not ready to play, 5599 * the media is loading or buffering 5600 * @syscap SystemCapability.Multimedia.AVSession.Core 5601 * @atomicservice 5602 * @since 12 5603 */ 5604 PLAYBACK_STATE_PREPARE = 1, 5605 5606 /** 5607 * Playing state. 5608 * @syscap SystemCapability.Multimedia.AVSession.Core 5609 * @since 10 5610 */ 5611 /** 5612 * Playing state. 5613 * @syscap SystemCapability.Multimedia.AVSession.Core 5614 * @atomicservice 5615 * @since 12 5616 */ 5617 PLAYBACK_STATE_PLAY = 2, 5618 5619 /** 5620 * Paused state. 5621 * @syscap SystemCapability.Multimedia.AVSession.Core 5622 * @since 10 5623 */ 5624 /** 5625 * Paused state. 5626 * @syscap SystemCapability.Multimedia.AVSession.Core 5627 * @atomicservice 5628 * @since 12 5629 */ 5630 PLAYBACK_STATE_PAUSE = 3, 5631 5632 /** 5633 * Fast forwarding state. 5634 * @syscap SystemCapability.Multimedia.AVSession.Core 5635 * @since 10 5636 */ 5637 /** 5638 * Fast forwarding state. 5639 * @syscap SystemCapability.Multimedia.AVSession.Core 5640 * @atomicservice 5641 * @since 12 5642 */ 5643 PLAYBACK_STATE_FAST_FORWARD = 4, 5644 5645 /** 5646 * Rewinding state. 5647 * @syscap SystemCapability.Multimedia.AVSession.Core 5648 * @since 10 5649 */ 5650 /** 5651 * Rewinding state. 5652 * @syscap SystemCapability.Multimedia.AVSession.Core 5653 * @atomicservice 5654 * @since 12 5655 */ 5656 PLAYBACK_STATE_REWIND = 5, 5657 5658 /** 5659 * Stopped state.The server will clear the media playback position and other information. 5660 * @syscap SystemCapability.Multimedia.AVSession.Core 5661 * @since 10 5662 */ 5663 /** 5664 * Stopped state.The server will clear the media playback position and other information. 5665 * @syscap SystemCapability.Multimedia.AVSession.Core 5666 * @atomicservice 5667 * @since 12 5668 */ 5669 PLAYBACK_STATE_STOP = 6, 5670 5671 /** 5672 * Completed state. 5673 * @syscap SystemCapability.Multimedia.AVSession.Core 5674 * @since 10 5675 */ 5676 /** 5677 * Completed state. 5678 * @syscap SystemCapability.Multimedia.AVSession.Core 5679 * @atomicservice 5680 * @since 12 5681 */ 5682 PLAYBACK_STATE_COMPLETED = 7, 5683 5684 /** 5685 * Released state. 5686 * @syscap SystemCapability.Multimedia.AVSession.Core 5687 * @since 10 5688 */ 5689 /** 5690 * Released state. 5691 * @syscap SystemCapability.Multimedia.AVSession.Core 5692 * @atomicservice 5693 * @since 12 5694 */ 5695 PLAYBACK_STATE_RELEASED = 8, 5696 5697 /** 5698 * error state. 5699 * @syscap SystemCapability.Multimedia.AVSession.Core 5700 * @since 10 5701 */ 5702 /** 5703 * error state. 5704 * @syscap SystemCapability.Multimedia.AVSession.Core 5705 * @atomicservice 5706 * @since 12 5707 */ 5708 PLAYBACK_STATE_ERROR = 9, 5709 5710 /** 5711 * Idle state. 5712 * @syscap SystemCapability.Multimedia.AVSession.Core 5713 * @since 11 5714 */ 5715 /** 5716 * Idle state. 5717 * @syscap SystemCapability.Multimedia.AVSession.Core 5718 * @atomicservice 5719 * @since 12 5720 */ 5721 PLAYBACK_STATE_IDLE = 10, 5722 5723 /** 5724 * Buffering state. 5725 * @syscap SystemCapability.Multimedia.AVSession.Core 5726 * @since 11 5727 */ 5728 /** 5729 * Buffering state. 5730 * @syscap SystemCapability.Multimedia.AVSession.Core 5731 * @atomicservice 5732 * @since 12 5733 */ 5734 PLAYBACK_STATE_BUFFERING = 11, 5735 } 5736 5737 /** 5738 * The description of the session 5739 * @interface AVSessionDescriptor 5740 * @syscap SystemCapability.Multimedia.AVSession.Manager 5741 * @systemapi 5742 * @since 9 5743 */ 5744 interface AVSessionDescriptor { 5745 /** 5746 * Unique ID of the session 5747 * @type { string } 5748 * @syscap SystemCapability.Multimedia.AVSession.Manager 5749 * @systemapi 5750 * @since 9 5751 */ 5752 sessionId: string; 5753 5754 /** 5755 * Session type, currently supports audio or video 5756 * @type { AVSessionType } 5757 * @syscap SystemCapability.Multimedia.AVSession.Manager 5758 * @systemapi 5759 * @since 9 5760 */ 5761 type: AVSessionType; 5762 5763 /** 5764 * The session tag set by the application 5765 * @type { string } 5766 * @syscap SystemCapability.Multimedia.AVSession.Manager 5767 * @systemapi 5768 * @since 9 5769 */ 5770 sessionTag: string; 5771 5772 /** 5773 * The elementName of the ability that created this session. See {@link ElementName} in bundle/elementName.d.ts 5774 * @type { ElementName } 5775 * @syscap SystemCapability.Multimedia.AVSession.Manager 5776 * @systemapi 5777 * @since 9 5778 */ 5779 elementName: ElementName; 5780 5781 /** 5782 * Session active state 5783 * @type { boolean } 5784 * @syscap SystemCapability.Multimedia.AVSession.Manager 5785 * @systemapi 5786 * @since 9 5787 */ 5788 isActive: boolean; 5789 5790 /** 5791 * Is it the top priority session 5792 * @type { boolean } 5793 * @syscap SystemCapability.Multimedia.AVSession.Manager 5794 * @systemapi 5795 * @since 9 5796 */ 5797 isTopSession: boolean; 5798 5799 /** 5800 * The current output device information. 5801 * It will be undefined if this is a local session. 5802 * @type { OutputDeviceInfo } 5803 * @syscap SystemCapability.Multimedia.AVSession.Manager 5804 * @systemapi 5805 * @since 9 5806 */ 5807 outputDevice: OutputDeviceInfo; 5808 } 5809 5810 /** 5811 * The extra info object. 5812 * 5813 * @typedef { object } ExtraInfo 5814 * @syscap SystemCapability.Multimedia.AVSession.Core 5815 * @since 18 5816 */ 5817 type ExtraInfo = { [key: string]: Object; }; 5818 5819 /** 5820 * Session controller,used to control media playback and get media information 5821 * @interface AVSessionController 5822 * @syscap SystemCapability.Multimedia.AVSession.Core 5823 * @since 10 5824 */ 5825 /** 5826 * Session controller,used to control media playback and get media information 5827 * @typedef AVSessionController 5828 * @syscap SystemCapability.Multimedia.AVSession.Core 5829 * @atomicservice 5830 * @since 12 5831 */ 5832 interface AVSessionController { 5833 /** 5834 * Unique session Id 5835 * @type { string } 5836 * @syscap SystemCapability.Multimedia.AVSession.Core 5837 * @since 10 5838 */ 5839 /** 5840 * Unique session Id 5841 * @type { string } 5842 * @readonly 5843 * @syscap SystemCapability.Multimedia.AVSession.Core 5844 * @atomicservice 5845 * @since 12 5846 */ 5847 readonly sessionId: string; 5848 5849 /** 5850 * Get the playback status of the current session 5851 * @param { AsyncCallback<AVPlaybackState> } callback - The triggered asyncCallback when (getAVPlaybackState). 5852 * @throws { BusinessError } 6600101 - Session service exception. 5853 * @throws { BusinessError } 6600102 - The session does not exist. 5854 * @throws { BusinessError } 6600103 - The session controller does not exist. 5855 * @syscap SystemCapability.Multimedia.AVSession.Core 5856 * @since 10 5857 */ 5858 getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void; 5859 5860 /** 5861 * Get the playback status of the current session 5862 * @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise 5863 * @throws { BusinessError } 6600101 - Session service exception. 5864 * @throws { BusinessError } 6600102 - The session does not exist. 5865 * @throws { BusinessError } 6600103 - The session controller does not exist. 5866 * @syscap SystemCapability.Multimedia.AVSession.Core 5867 * @since 10 5868 */ 5869 /** 5870 * Get the playback status of the current session 5871 * @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise 5872 * @throws { BusinessError } 6600101 - Session service exception. 5873 * @throws { BusinessError } 6600102 - The session does not exist. 5874 * @throws { BusinessError } 6600103 - The session controller does not exist. 5875 * @syscap SystemCapability.Multimedia.AVSession.Core 5876 * @atomicservice 5877 * @since 12 5878 */ 5879 getAVPlaybackState(): Promise<AVPlaybackState>; 5880 5881 /** 5882 * Get the playback status of the current session 5883 * @returns { AVPlaybackState } (AVPlaybackState) returned 5884 * @throws { BusinessError } 6600101 - Session service exception. 5885 * @throws { BusinessError } 6600102 - The session does not exist. 5886 * @throws { BusinessError } 6600103 - The session controller does not exist. 5887 * @syscap SystemCapability.Multimedia.AVSession.Core 5888 * @since 10 5889 */ 5890 /** 5891 * Get the playback status of the current session 5892 * @returns { AVPlaybackState } (AVPlaybackState) returned 5893 * @throws { BusinessError } 6600101 - Session service exception. 5894 * @throws { BusinessError } 6600102 - The session does not exist. 5895 * @throws { BusinessError } 6600103 - The session controller does not exist. 5896 * @syscap SystemCapability.Multimedia.AVSession.Core 5897 * @atomicservice 5898 * @since 12 5899 */ 5900 getAVPlaybackStateSync(): AVPlaybackState; 5901 5902 /** 5903 * Get the metadata of the current session 5904 * @param { AsyncCallback<AVMetadata> } callback - The triggered asyncCallback when (getAVMetadata). 5905 * @throws { BusinessError } 6600101 - Session service exception. 5906 * @throws { BusinessError } 6600102 - The session does not exist. 5907 * @throws { BusinessError } 6600103 - The session controller does not exist. 5908 * @syscap SystemCapability.Multimedia.AVSession.Core 5909 * @since 10 5910 */ 5911 getAVMetadata(callback: AsyncCallback<AVMetadata>): void; 5912 5913 /** 5914 * Get the metadata of the current session 5915 * @returns { Promise<AVMetadata> } (AVMetadata) returned through promise 5916 * @throws { BusinessError } 6600101 - Session service exception. 5917 * @throws { BusinessError } 6600102 - The session does not exist. 5918 * @throws { BusinessError } 6600103 - The session controller does not exist. 5919 * @syscap SystemCapability.Multimedia.AVSession.Core 5920 * @since 10 5921 */ 5922 /** 5923 * Get the metadata of the current session 5924 * @returns { Promise<AVMetadata> } (AVMetadata) returned through promise 5925 * @throws { BusinessError } 6600101 - Session service exception. 5926 * @throws { BusinessError } 6600102 - The session does not exist. 5927 * @throws { BusinessError } 6600103 - The session controller does not exist. 5928 * @syscap SystemCapability.Multimedia.AVSession.Core 5929 * @atomicservice 5930 * @since 12 5931 */ 5932 getAVMetadata(): Promise<AVMetadata>; 5933 5934 /** 5935 * Get the metadata of the current session 5936 * @returns { AVMetadata } (AVMetadata) returned 5937 * @throws { BusinessError } 6600101 - Session service exception. 5938 * @throws { BusinessError } 6600102 - The session does not exist. 5939 * @throws { BusinessError } 6600103 - The session controller does not exist. 5940 * @syscap SystemCapability.Multimedia.AVSession.Core 5941 * @since 10 5942 */ 5943 /** 5944 * Get the metadata of the current session 5945 * @returns { AVMetadata } (AVMetadata) returned 5946 * @throws { BusinessError } 6600101 - Session service exception. 5947 * @throws { BusinessError } 6600102 - The session does not exist. 5948 * @throws { BusinessError } 6600103 - The session controller does not exist. 5949 * @syscap SystemCapability.Multimedia.AVSession.Core 5950 * @atomicservice 5951 * @since 12 5952 */ 5953 getAVMetadataSync(): AVMetadata; 5954 5955 /** 5956 * Get the call status of the current session 5957 * @param { AsyncCallback<AVCallState> } callback - The triggered asyncCallback when (getAVCallState). 5958 * @throws { BusinessError } 6600101 - Session service exception. 5959 * @throws { BusinessError } 6600102 - The session does not exist. 5960 * @throws { BusinessError } 6600103 - The session controller does not exist. 5961 * @syscap SystemCapability.Multimedia.AVSession.Core 5962 * @since 11 5963 */ 5964 getAVCallState(callback: AsyncCallback<AVCallState>): void; 5965 5966 /** 5967 * Get the call status of the current session 5968 * @returns { Promise<AVCallState> } (AVCallState) returned through promise 5969 * @throws { BusinessError } 6600101 - Session service exception. 5970 * @throws { BusinessError } 6600102 - The session does not exist. 5971 * @throws { BusinessError } 6600103 - The session controller does not exist. 5972 * @syscap SystemCapability.Multimedia.AVSession.Core 5973 * @since 11 5974 */ 5975 getAVCallState(): Promise<AVCallState>; 5976 5977 /** 5978 * Get the call metadata of the current session 5979 * @param { AsyncCallback<CallMetadata> } callback - The triggered asyncCallback when (getCallMetadata). 5980 * @throws { BusinessError } 6600101 - Session service exception. 5981 * @throws { BusinessError } 6600102 - The session does not exist. 5982 * @throws { BusinessError } 6600103 - The session controller does not exist. 5983 * @syscap SystemCapability.Multimedia.AVSession.Core 5984 * @since 11 5985 */ 5986 getCallMetadata(callback: AsyncCallback<CallMetadata>): void; 5987 5988 /** 5989 * Get the call metadata of the current session 5990 * @returns { Promise<CallMetadata> } (CallMetadata) returned through promise 5991 * @throws { BusinessError } 6600101 - Session service exception. 5992 * @throws { BusinessError } 6600102 - The session does not exist. 5993 * @throws { BusinessError } 6600103 - The session controller does not exist. 5994 * @syscap SystemCapability.Multimedia.AVSession.Core 5995 * @since 11 5996 */ 5997 getCallMetadata(): Promise<CallMetadata>; 5998 5999 /** 6000 * Get the name of the playlist of the current session 6001 * @param { AsyncCallback<string> } callback - The triggered asyncCallback when (getAVQueueTitle). 6002 * @throws { BusinessError } 6600101 - Session service exception. 6003 * @throws { BusinessError } 6600102 - The session does not exist. 6004 * @throws { BusinessError } 6600103 - The session controller does not exist. 6005 * @syscap SystemCapability.Multimedia.AVSession.Core 6006 * @since 10 6007 */ 6008 getAVQueueTitle(callback: AsyncCallback<string>): void; 6009 6010 /** 6011 * Get the name of the playlist of the current session 6012 * @returns { Promise<string> } (string) returned through promise 6013 * @throws { BusinessError } 6600101 - Session service exception. 6014 * @throws { BusinessError } 6600102 - The session does not exist. 6015 * @throws { BusinessError } 6600103 - The session controller does not exist. 6016 * @syscap SystemCapability.Multimedia.AVSession.Core 6017 * @since 10 6018 */ 6019 /** 6020 * Get the name of the playlist of the current session 6021 * @returns { Promise<string> } (string) returned through promise 6022 * @throws { BusinessError } 6600101 - Session service exception. 6023 * @throws { BusinessError } 6600102 - The session does not exist. 6024 * @throws { BusinessError } 6600103 - The session controller does not exist. 6025 * @syscap SystemCapability.Multimedia.AVSession.Core 6026 * @atomicservice 6027 * @since 12 6028 */ 6029 getAVQueueTitle(): Promise<string>; 6030 6031 /** 6032 * Get the name of the playlist of the current session 6033 * @returns { string } (string) returned 6034 * @throws { BusinessError } 6600101 - Session service exception. 6035 * @throws { BusinessError } 6600102 - The session does not exist. 6036 * @throws { BusinessError } 6600103 - The session controller does not exist. 6037 * @syscap SystemCapability.Multimedia.AVSession.Core 6038 * @since 10 6039 */ 6040 /** 6041 * Get the name of the playlist of the current session 6042 * @returns { string } (string) returned 6043 * @throws { BusinessError } 6600101 - Session service exception. 6044 * @throws { BusinessError } 6600102 - The session does not exist. 6045 * @throws { BusinessError } 6600103 - The session controller does not exist. 6046 * @syscap SystemCapability.Multimedia.AVSession.Core 6047 * @atomicservice 6048 * @since 12 6049 */ 6050 getAVQueueTitleSync(): string; 6051 6052 /** 6053 * Get the playlist of the current session 6054 * @param { AsyncCallback<Array<AVQueueItem>> } callback - The triggered asyncCallback when (getAVQueueItems). 6055 * @throws { BusinessError } 6600101 - Session service exception. 6056 * @throws { BusinessError } 6600102 - The session does not exist. 6057 * @throws { BusinessError } 6600103 - The session controller does not exist. 6058 * @syscap SystemCapability.Multimedia.AVSession.Core 6059 * @since 10 6060 */ 6061 getAVQueueItems(callback: AsyncCallback<Array<AVQueueItem>>): void; 6062 6063 /** 6064 * Get the playlist of the current session 6065 * @returns { Promise<Array<AVQueueItem>> } (Array<AVQueueItem>) returned through promise 6066 * @throws { BusinessError } 6600101 - Session service exception. 6067 * @throws { BusinessError } 6600102 - The session does not exist. 6068 * @throws { BusinessError } 6600103 - The session controller does not exist. 6069 * @syscap SystemCapability.Multimedia.AVSession.Core 6070 * @since 10 6071 */ 6072 /** 6073 * Get the playlist of the current session 6074 * @returns { Promise<Array<AVQueueItem>> } (Array<AVQueueItem>) returned through promise 6075 * @throws { BusinessError } 6600101 - Session service exception. 6076 * @throws { BusinessError } 6600102 - The session does not exist. 6077 * @throws { BusinessError } 6600103 - The session controller does not exist. 6078 * @syscap SystemCapability.Multimedia.AVSession.Core 6079 * @atomicservice 6080 * @since 12 6081 */ 6082 getAVQueueItems(): Promise<Array<AVQueueItem>>; 6083 6084 /** 6085 * Get the playlist of the current session 6086 * @returns { Array<AVQueueItem> } (Array<AVQueueItem>) returned 6087 * @throws { BusinessError } 6600101 - Session service exception. 6088 * @throws { BusinessError } 6600102 - The session does not exist. 6089 * @throws { BusinessError } 6600103 - The session controller does not exist. 6090 * @syscap SystemCapability.Multimedia.AVSession.Core 6091 * @since 10 6092 */ 6093 /** 6094 * Get the playlist of the current session 6095 * @returns { Array<AVQueueItem> } (Array<AVQueueItem>) returned 6096 * @throws { BusinessError } 6600101 - Session service exception. 6097 * @throws { BusinessError } 6600102 - The session does not exist. 6098 * @throws { BusinessError } 6600103 - The session controller does not exist. 6099 * @syscap SystemCapability.Multimedia.AVSession.Core 6100 * @atomicservice 6101 * @since 12 6102 */ 6103 getAVQueueItemsSync(): Array<AVQueueItem>; 6104 6105 /** 6106 * Set the item in the playlist to be played 6107 * @param { number } itemId - The serial number of the item to be played 6108 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 6109 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6110 * 2.Parameter verification failed. 6111 * @throws { BusinessError } 6600101 - Session service exception. 6112 * @throws { BusinessError } 6600102 - The session does not exist. 6113 * @throws { BusinessError } 6600103 - The session controller does not exist. 6114 * @syscap SystemCapability.Multimedia.AVSession.Core 6115 * @since 10 6116 */ 6117 skipToQueueItem(itemId: number, callback: AsyncCallback<void>): void; 6118 6119 /** 6120 * Set the item in the playlist to be played 6121 * @param { number } itemId - The serial number of the item to be played 6122 * @returns { Promise<void> } void promise when executed successfully 6123 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6124 * 2.Parameter verification failed. 6125 * @throws { BusinessError } 6600101 - Session service exception. 6126 * @throws { BusinessError } 6600102 - The session does not exist. 6127 * @throws { BusinessError } 6600103 - The session controller does not exist. 6128 * @syscap SystemCapability.Multimedia.AVSession.Core 6129 * @since 10 6130 */ 6131 /** 6132 * Set the item in the playlist to be played 6133 * @param { number } itemId - The serial number of the item to be played 6134 * @returns { Promise<void> } void promise when executed successfully 6135 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6136 * 2.Parameter verification failed. 6137 * @throws { BusinessError } 6600101 - Session service exception. 6138 * @throws { BusinessError } 6600102 - The session does not exist. 6139 * @throws { BusinessError } 6600103 - The session controller does not exist. 6140 * @syscap SystemCapability.Multimedia.AVSession.Core 6141 * @atomicservice 6142 * @since 12 6143 */ 6144 skipToQueueItem(itemId: number): Promise<void>; 6145 6146 /** 6147 * Get output device information 6148 * @param { AsyncCallback<OutputDeviceInfo> } callback - The triggered asyncCallback when (getOutputDevice). 6149 * @throws { BusinessError } 600101 - Session service exception. 6150 * @throws { BusinessError } 600103 - The session controller does not exist. 6151 * @syscap SystemCapability.Multimedia.AVSession.Core 6152 * @since 10 6153 */ 6154 getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void; 6155 6156 /** 6157 * Get output device information 6158 * @returns { Promise<OutputDeviceInfo> } (OutputDeviceInfo) returned through promise 6159 * @throws { BusinessError } 600101 - Session service exception. 6160 * @throws { BusinessError } 600103 - The session controller does not exist. 6161 * @syscap SystemCapability.Multimedia.AVSession.Core 6162 * @since 10 6163 */ 6164 /** 6165 * Get output device information 6166 * @returns { Promise<OutputDeviceInfo> } (OutputDeviceInfo) returned through promise 6167 * @throws { BusinessError } 600101 - Session service exception. 6168 * @throws { BusinessError } 600103 - The session controller does not exist. 6169 * @syscap SystemCapability.Multimedia.AVSession.Core 6170 * @atomicservice 6171 * @since 12 6172 */ 6173 getOutputDevice(): Promise<OutputDeviceInfo>; 6174 6175 /** 6176 * Get output device information 6177 * @returns { OutputDeviceInfo } (OutputDeviceInfo) returned 6178 * @throws { BusinessError } 6600101 - Session service exception. 6179 * @throws { BusinessError } 6600103 - The session controller does not exist. 6180 * @syscap SystemCapability.Multimedia.AVSession.Core 6181 * @since 10 6182 */ 6183 /** 6184 * Get output device information 6185 * @returns { OutputDeviceInfo } (OutputDeviceInfo) returned 6186 * @throws { BusinessError } 6600101 - Session service exception. 6187 * @throws { BusinessError } 6600103 - The session controller does not exist. 6188 * @syscap SystemCapability.Multimedia.AVSession.Core 6189 * @atomicservice 6190 * @since 12 6191 */ 6192 getOutputDeviceSync(): OutputDeviceInfo; 6193 6194 /** 6195 * Send media key event to this session 6196 * @param { KeyEvent } event - The KeyEvent 6197 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 6198 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6199 * 2.Parameter verification failed. 6200 * @throws { BusinessError } 600101 - Session service exception. 6201 * @throws { BusinessError } 600102 - The session does not exist. 6202 * @throws { BusinessError } 600103 - The session controller does not exist. 6203 * @throws { BusinessError } 600105 - Invalid session command. 6204 * @throws { BusinessError } 600106 - The session is not activated. 6205 * @syscap SystemCapability.Multimedia.AVSession.Core 6206 * @since 10 6207 */ 6208 sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void; 6209 6210 /** 6211 * Send media key event to this session 6212 * @param { KeyEvent } event - The KeyEvent 6213 * @returns { Promise<void> } void promise when executed successfully 6214 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6215 * 2.Parameter verification failed. 6216 * @throws { BusinessError } 600101 - Session service exception. 6217 * @throws { BusinessError } 600102 - The session does not exist. 6218 * @throws { BusinessError } 600103 - The session controller does not exist. 6219 * @throws { BusinessError } 600105 - Invalid session command. 6220 * @throws { BusinessError } 600106 - The session is not activated. 6221 * @syscap SystemCapability.Multimedia.AVSession.Core 6222 * @since 10 6223 */ 6224 /** 6225 * Send media key event to this session 6226 * @param { KeyEvent } event - The KeyEvent 6227 * @returns { Promise<void> } void promise when executed successfully 6228 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6229 * 2.Parameter verification failed. 6230 * @throws { BusinessError } 600101 - Session service exception. 6231 * @throws { BusinessError } 600102 - The session does not exist. 6232 * @throws { BusinessError } 600103 - The session controller does not exist. 6233 * @throws { BusinessError } 600105 - Invalid session command. 6234 * @throws { BusinessError } 600106 - The session is not activated. 6235 * @syscap SystemCapability.Multimedia.AVSession.Core 6236 * @atomicservice 6237 * @since 12 6238 */ 6239 sendAVKeyEvent(event: KeyEvent): Promise<void>; 6240 6241 /** 6242 * Get the {@link WantAgent} of this session that can launch the session ability 6243 * @param { AsyncCallback<WantAgent> } callback - The asyncCallback triggered when getting the WantAgent. 6244 * @throws { BusinessError } 6600101 - Session service exception. 6245 * @throws { BusinessError } 6600102 - The session does not exist. 6246 * @throws { BusinessError } 6600103 - The session controller does not exist. 6247 * @syscap SystemCapability.Multimedia.AVSession.Core 6248 * @since 10 6249 */ 6250 getLaunchAbility(callback: AsyncCallback<WantAgent>): void; 6251 6252 /** 6253 * Get the {@link WantAgent} of this session that can launch the session ability 6254 * @returns { Promise<WantAgent> } WantAgent promise 6255 * @throws { BusinessError } 6600101 - Session service exception. 6256 * @throws { BusinessError } 6600102 - The session does not exist. 6257 * @throws { BusinessError } 6600103 - The session controller does not exist. 6258 * @syscap SystemCapability.Multimedia.AVSession.Core 6259 * @since 10 6260 */ 6261 /** 6262 * Get the {@link WantAgent} of this session that can launch the session ability 6263 * @returns { Promise<WantAgent> } WantAgent promise 6264 * @throws { BusinessError } 6600101 - Session service exception. 6265 * @throws { BusinessError } 6600102 - The session does not exist. 6266 * @throws { BusinessError } 6600103 - The session controller does not exist. 6267 * @syscap SystemCapability.Multimedia.AVSession.Core 6268 * @atomicservice 6269 * @since 12 6270 */ 6271 getLaunchAbility(): Promise<WantAgent>; 6272 6273 /** 6274 * Get the adjusted playback position. The time automatically calculated by the system 6275 * taking into account factors such as playback status, playback speed, and application update time. 6276 * @returns { number } current playback position in ms.Note that the returns value of each call will be different. 6277 * @throws { BusinessError } 6600101 - Session service exception. 6278 * @throws { BusinessError } 6600103 - The session controller does not exist. 6279 * @syscap SystemCapability.Multimedia.AVSession.Core 6280 * @since 10 6281 */ 6282 /** 6283 * Get the adjusted playback position. The time automatically calculated by the system 6284 * taking into account factors such as playback status, playback speed, and application update time. 6285 * @returns { number } current playback position in ms.Note that the returns value of each call will be different. 6286 * @throws { BusinessError } 6600101 - Session service exception. 6287 * @throws { BusinessError } 6600103 - The session controller does not exist. 6288 * @syscap SystemCapability.Multimedia.AVSession.Core 6289 * @atomicservice 6290 * @since 12 6291 */ 6292 getRealPlaybackPositionSync(): number; 6293 6294 /** 6295 * Check if the current session is active 6296 * @param { AsyncCallback<boolean> } callback - The triggered asyncCallback when (isActive). 6297 * @throws { BusinessError } 6600101 - Session service exception. 6298 * @throws { BusinessError } 6600102 - The session does not exist. 6299 * @throws { BusinessError } 6600103 - The session controller does not exist. 6300 * @syscap SystemCapability.Multimedia.AVSession.Core 6301 * @since 10 6302 */ 6303 isActive(callback: AsyncCallback<boolean>): void; 6304 6305 /** 6306 * Check if the current session is active 6307 * @returns { Promise<boolean> } boolean promise 6308 * @throws { BusinessError } 6600101 - Session service exception. 6309 * @throws { BusinessError } 6600102 - The session does not exist. 6310 * @throws { BusinessError } 6600103 - The session controller does not exist. 6311 * @syscap SystemCapability.Multimedia.AVSession.Core 6312 * @since 10 6313 */ 6314 /** 6315 * Check if the current session is active 6316 * @returns { Promise<boolean> } boolean promise 6317 * @throws { BusinessError } 6600101 - Session service exception. 6318 * @throws { BusinessError } 6600102 - The session does not exist. 6319 * @throws { BusinessError } 6600103 - The session controller does not exist. 6320 * @syscap SystemCapability.Multimedia.AVSession.Core 6321 * @atomicservice 6322 * @since 12 6323 */ 6324 isActive(): Promise<boolean>; 6325 6326 /** 6327 * Check if the current session is active 6328 * @returns { boolean } boolean 6329 * @throws { BusinessError } 6600101 - Session service exception. 6330 * @throws { BusinessError } 6600102 - The session does not exist. 6331 * @throws { BusinessError } 6600103 - The session controller does not exist. 6332 * @syscap SystemCapability.Multimedia.AVSession.Core 6333 * @since 10 6334 */ 6335 /** 6336 * Check if the current session is active 6337 * @returns { boolean } boolean 6338 * @throws { BusinessError } 6600101 - Session service exception. 6339 * @throws { BusinessError } 6600102 - The session does not exist. 6340 * @throws { BusinessError } 6600103 - The session controller does not exist. 6341 * @syscap SystemCapability.Multimedia.AVSession.Core 6342 * @atomicservice 6343 * @since 12 6344 */ 6345 isActiveSync(): boolean; 6346 6347 /** 6348 * Destroy the server controller 6349 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 6350 * @throws { BusinessError } 6600101 - Session service exception. 6351 * @throws { BusinessError } 6600103 - The session controller does not exist. 6352 * @syscap SystemCapability.Multimedia.AVSession.Core 6353 * @since 10 6354 */ 6355 destroy(callback: AsyncCallback<void>): void; 6356 6357 /** 6358 * Destroy the server controller 6359 * @returns { Promise<void> } void promise when executed successfully 6360 * @throws { BusinessError } 6600101 - Session service exception. 6361 * @throws { BusinessError } 6600103 - The session controller does not exist. 6362 * @syscap SystemCapability.Multimedia.AVSession.Core 6363 * @since 10 6364 */ 6365 /** 6366 * Destroy the server controller 6367 * @returns { Promise<void> } void promise when executed successfully 6368 * @throws { BusinessError } 6600101 - Session service exception. 6369 * @throws { BusinessError } 6600103 - The session controller does not exist. 6370 * @syscap SystemCapability.Multimedia.AVSession.Core 6371 * @atomicservice 6372 * @since 12 6373 */ 6374 destroy(): Promise<void>; 6375 6376 /** 6377 * Get commands supported by the current session 6378 * @param { AsyncCallback<Array<AVControlCommandType>> } callback - The triggered asyncCallback when (getValidCommands). 6379 * @throws { BusinessError } 6600101 - Session service exception. 6380 * @throws { BusinessError } 6600102 - The session does not exist. 6381 * @throws { BusinessError } 6600103 - The session controller does not exist. 6382 * @syscap SystemCapability.Multimedia.AVSession.Core 6383 * @since 10 6384 */ 6385 getValidCommands(callback: AsyncCallback<Array<AVControlCommandType>>): void; 6386 6387 /** 6388 * Get commands supported by the current session 6389 * @returns { Promise<Array<AVControlCommandType>> } array of AVControlCommandType promise 6390 * @throws { BusinessError } 6600101 - Session service exception. 6391 * @throws { BusinessError } 6600102 - The session does not exist. 6392 * @throws { BusinessError } 6600103 - The session controller does not exist. 6393 * @syscap SystemCapability.Multimedia.AVSession.Core 6394 * @since 10 6395 */ 6396 /** 6397 * Get commands supported by the current session 6398 * @returns { Promise<Array<AVControlCommandType>> } array of AVControlCommandType promise 6399 * @throws { BusinessError } 6600101 - Session service exception. 6400 * @throws { BusinessError } 6600102 - The session does not exist. 6401 * @throws { BusinessError } 6600103 - The session controller does not exist. 6402 * @syscap SystemCapability.Multimedia.AVSession.Core 6403 * @atomicservice 6404 * @since 12 6405 */ 6406 getValidCommands(): Promise<Array<AVControlCommandType>>; 6407 6408 /** 6409 * Get commands supported by the current session 6410 * @returns {Array<AVControlCommandType> } array of AVControlCommandType 6411 * @throws { BusinessError } 6600101 - Session service exception. 6412 * @throws { BusinessError } 6600102 - The session does not exist. 6413 * @throws { BusinessError } 6600103 - The session controller does not exist. 6414 * @syscap SystemCapability.Multimedia.AVSession.Core 6415 * @since 10 6416 */ 6417 /** 6418 * Get commands supported by the current session 6419 * @returns {Array<AVControlCommandType> } array of AVControlCommandType 6420 * @throws { BusinessError } 6600101 - Session service exception. 6421 * @throws { BusinessError } 6600102 - The session does not exist. 6422 * @throws { BusinessError } 6600103 - The session controller does not exist. 6423 * @syscap SystemCapability.Multimedia.AVSession.Core 6424 * @atomicservice 6425 * @since 12 6426 */ 6427 getValidCommandsSync(): Array<AVControlCommandType>; 6428 6429 /** 6430 * Send control commands to this session 6431 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 6432 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 6433 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6434 * 2.Parameter verification failed. 6435 * @throws { BusinessError } 6600101 - Session service exception. 6436 * @throws { BusinessError } 6600102 - The session does not exist. 6437 * @throws { BusinessError } 6600103 - The session controller does not exist. 6438 * @throws { BusinessError } 6600105 - Invalid session command. 6439 * @throws { BusinessError } 6600106 - The session is not activated. 6440 * @throws { BusinessError } 6600107 - Too many commands or events. 6441 * @syscap SystemCapability.Multimedia.AVSession.Core 6442 * @since 10 6443 */ 6444 sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void; 6445 6446 /** 6447 * Send control commands to this session 6448 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 6449 * @returns { Promise<void> } void promise when executed successfully 6450 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6451 * 2.Parameter verification failed. 6452 * @throws { BusinessError } 6600101 - Session service exception. 6453 * @throws { BusinessError } 6600102 - The session does not exist. 6454 * @throws { BusinessError } 6600103 - The session controller does not exist. 6455 * @throws { BusinessError } 6600105 - Invalid session command. 6456 * @throws { BusinessError } 6600106 - The session is not activated. 6457 * @throws { BusinessError } 6600107 - Too many commands or events. 6458 * @syscap SystemCapability.Multimedia.AVSession.Core 6459 * @since 10 6460 */ 6461 /** 6462 * Send control commands to this session 6463 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 6464 * @returns { Promise<void> } void promise when executed successfully 6465 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6466 * 2.Parameter verification failed. 6467 * @throws { BusinessError } 6600101 - Session service exception. 6468 * @throws { BusinessError } 6600102 - The session does not exist. 6469 * @throws { BusinessError } 6600103 - The session controller does not exist. 6470 * @throws { BusinessError } 6600105 - Invalid session command. 6471 * @throws { BusinessError } 6600106 - The session is not activated. 6472 * @throws { BusinessError } 6600107 - Too many commands or events. 6473 * @syscap SystemCapability.Multimedia.AVSession.Core 6474 * @atomicservice 6475 * @since 12 6476 */ 6477 sendControlCommand(command: AVControlCommand): Promise<void>; 6478 6479 /** 6480 * Send common commands to this session 6481 * @param { string } command - The command name to be sent. 6482 * @param { object } args - The parameters of session event 6483 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 6484 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6485 * 2.Parameter verification failed. 6486 * @throws { BusinessError } 6600101 - Session service exception. 6487 * @throws { BusinessError } 6600102 - The session does not exist. 6488 * @throws { BusinessError } 6600103 - The session controller does not exist. 6489 * @throws { BusinessError } 6600105 - Invalid session command. 6490 * @throws { BusinessError } 6600106 - The session is not activated. 6491 * @throws { BusinessError } 6600107 - Too many commands or events. 6492 * @syscap SystemCapability.Multimedia.AVSession.Core 6493 * @since 10 6494 */ 6495 sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback<void>): void; 6496 6497 /** 6498 * Send common commands to this session 6499 * @param { string } command - The command name to be sent. 6500 * @param { object } args - The parameters of session event 6501 * @returns { Promise<void> } void promise when executed successfully 6502 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6503 * 2.Parameter verification failed. 6504 * @throws { BusinessError } 6600101 - Session service exception. 6505 * @throws { BusinessError } 6600102 - The session does not exist. 6506 * @throws { BusinessError } 6600103 - The session controller does not exist. 6507 * @throws { BusinessError } 6600105 - Invalid session command. 6508 * @throws { BusinessError } 6600106 - The session is not activated. 6509 * @throws { BusinessError } 6600107 - Too many commands or events. 6510 * @syscap SystemCapability.Multimedia.AVSession.Core 6511 * @since 10 6512 */ 6513 /** 6514 * Send common commands to this session 6515 * @param { string } command - The command name to be sent. 6516 * @param { object } args - The parameters of session event 6517 * @returns { Promise<void> } void promise when executed successfully 6518 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6519 * 2.Parameter verification failed. 6520 * @throws { BusinessError } 6600101 - Session service exception. 6521 * @throws { BusinessError } 6600102 - The session does not exist. 6522 * @throws { BusinessError } 6600103 - The session controller does not exist. 6523 * @throws { BusinessError } 6600105 - Invalid session command. 6524 * @throws { BusinessError } 6600106 - The session is not activated. 6525 * @throws { BusinessError } 6600107 - Too many commands or events. 6526 * @syscap SystemCapability.Multimedia.AVSession.Core 6527 * @atomicservice 6528 * @since 12 6529 */ 6530 sendCommonCommand(command: string, args: {[key: string]: Object}): Promise<void>; 6531 6532 /** 6533 * Get custom media packets provided by the corresponding session 6534 * @param { AsyncCallback<{[key: string]: Object}> } callback - The triggered asyncCallback when (getExtras). 6535 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6536 * 2.Incorrect parameter types. 3.Parameter verification failed. 6537 * @throws { BusinessError } 6600101 - Session service exception. 6538 * @throws { BusinessError } 6600102 - The session does not exist. 6539 * @throws { BusinessError } 6600103 - The session controller does not exist. 6540 * @throws { BusinessError } 6600105 - Invalid session command. 6541 * @throws { BusinessError } 6600107 - Too many commands or events. 6542 * @syscap SystemCapability.Multimedia.AVSession.Core 6543 * @since 10 6544 */ 6545 getExtras(callback: AsyncCallback<{[key: string]: Object}>): void; 6546 6547 /** 6548 * Get custom media packets provided by the corresponding session 6549 * @returns { Promise<{[key: string]: Object}> } the parameters of extras 6550 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6551 * 2.Incorrect parameter types. 3.Parameter verification failed. 6552 * @throws { BusinessError } 6600101 - Session service exception. 6553 * @throws { BusinessError } 6600102 - The session does not exist. 6554 * @throws { BusinessError } 6600103 - The session controller does not exist. 6555 * @throws { BusinessError } 6600105 - Invalid session command. 6556 * @throws { BusinessError } 6600107 - Too many commands or events. 6557 * @syscap SystemCapability.Multimedia.AVSession.Core 6558 * @since 10 6559 */ 6560 /** 6561 * Get custom media packets provided by the corresponding session 6562 * @returns { Promise<{[key: string]: Object}> } the parameters of extras 6563 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6564 * 2.Incorrect parameter types. 3.Parameter verification failed. 6565 * @throws { BusinessError } 6600101 - Session service exception. 6566 * @throws { BusinessError } 6600102 - The session does not exist. 6567 * @throws { BusinessError } 6600103 - The session controller does not exist. 6568 * @throws { BusinessError } 6600105 - Invalid session command. 6569 * @throws { BusinessError } 6600107 - Too many commands or events. 6570 * @syscap SystemCapability.Multimedia.AVSession.Core 6571 * @atomicservice 6572 * @since 12 6573 */ 6574 getExtras(): Promise<{[key: string]: Object}>; 6575 6576 /** 6577 * Get extra information for remote device, such as volume level, connected devices. 6578 * @param { string } extraEvent - the event name to get 6579 * @returns { Promise<ExtraInfo> } the value returned for such event 6580 * @throws { BusinessError } 6600101 - Session service exception. 6581 * @throws { BusinessError } 6600102 - The session does not exist. 6582 * @throws { BusinessError } 6600103 - The session controller does not exist. 6583 * @throws { BusinessError } 6600105 - Invalid session command. 6584 * @syscap SystemCapability.Multimedia.AVSession.Core 6585 * @since 18 6586 */ 6587 getExtrasWithEvent(extraEvent: string): Promise<ExtraInfo>; 6588 6589 /** 6590 * Register metadata changed callback 6591 * @param { 'metadataChange' } type 6592 * @param { Array<keyof AVMetadata> | 'all' } filter - The properties of {@link AVMetadata} that you cared about 6593 * @param { function } callback - The callback used to handle metadata changed event. 6594 * The callback function provides the {@link AVMetadata} parameter. 6595 * It only contains the properties set in the filter. 6596 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6597 * 2.Incorrect parameter types. 6598 * @throws { BusinessError } 6600101 - Session service exception. 6599 * @throws { BusinessError } 6600103 - The session controller does not exist. 6600 * @syscap SystemCapability.Multimedia.AVSession.Core 6601 * @since 10 6602 */ 6603 /** 6604 * Register metadata changed callback 6605 * @param { 'metadataChange' } type 6606 * @param { Array<keyof AVMetadata> | 'all' } filter - The properties of {@link AVMetadata} that you cared about 6607 * @param { function } callback - The callback used to handle metadata changed event. 6608 * The callback function provides the {@link AVMetadata} parameter. 6609 * It only contains the properties set in the filter. 6610 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6611 * 2.Incorrect parameter types. 6612 * @throws { BusinessError } 6600101 - Session service exception. 6613 * @throws { BusinessError } 6600103 - The session controller does not exist. 6614 * @syscap SystemCapability.Multimedia.AVSession.Core 6615 * @atomicservice 6616 * @since 12 6617 */ 6618 on(type: 'metadataChange', filter: Array<keyof AVMetadata> | 'all', callback: (data: AVMetadata) => void); 6619 6620 /** 6621 * Unregister metadata changed callback 6622 * @param { 'metadataChange' } type 6623 * @param { function } callback - The callback used to handle metadata changed event. 6624 * The callback function provides the {@link AVMetadata} parameter. 6625 * It only contains the properties set in the filter. 6626 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6627 * 2.Incorrect parameter types. 6628 * @throws { BusinessError } 6600101 - Session service exception. 6629 * @throws { BusinessError } 6600103 - The session controller does not exist. 6630 * @syscap SystemCapability.Multimedia.AVSession.Core 6631 * @since 10 6632 */ 6633 /** 6634 * Unregister metadata changed callback 6635 * @param { 'metadataChange' } type 6636 * @param { function } callback - The callback used to handle metadata changed event. 6637 * The callback function provides the {@link AVMetadata} parameter. 6638 * It only contains the properties set in the filter. 6639 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6640 * 2.Incorrect parameter types. 6641 * @throws { BusinessError } 6600101 - Session service exception. 6642 * @throws { BusinessError } 6600103 - The session controller does not exist. 6643 * @syscap SystemCapability.Multimedia.AVSession.Core 6644 * @atomicservice 6645 * @since 12 6646 */ 6647 off(type: 'metadataChange', callback?: (data: AVMetadata) => void); 6648 6649 /** 6650 * Register playback state changed callback 6651 * @param { 'playbackStateChange' } type 6652 * @param { Array<keyof AVPlaybackState> | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about 6653 * @param { function } callback - The callback used to handle playback state changed event. 6654 * The callback function provides the {@link AVPlaybackState} parameter. 6655 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6656 * 2.Incorrect parameter types. 6657 * @throws { BusinessError } 6600101 - Session service exception. 6658 * @throws { BusinessError } 6600103 - The session controller does not exist. 6659 * @syscap SystemCapability.Multimedia.AVSession.Core 6660 * @since 10 6661 */ 6662 /** 6663 * Register playback state changed callback 6664 * @param { 'playbackStateChange' } type 6665 * @param { Array<keyof AVPlaybackState> | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about 6666 * @param { function } callback - The callback used to handle playback state changed event. 6667 * The callback function provides the {@link AVPlaybackState} parameter. 6668 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6669 * 2.Incorrect parameter types. 6670 * @throws { BusinessError } 6600101 - Session service exception. 6671 * @throws { BusinessError } 6600103 - The session controller does not exist. 6672 * @syscap SystemCapability.Multimedia.AVSession.Core 6673 * @atomicservice 6674 * @since 12 6675 */ 6676 on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void); 6677 6678 /** 6679 * Unregister playback state changed callback 6680 * @param { 'playbackStateChange' } type 6681 * @param { function } callback - The callback used to handle playback state changed event. 6682 * The callback function provides the {@link AVPlaybackState} parameter. 6683 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6684 * 2.Incorrect parameter types. 6685 * @throws { BusinessError } 6600101 - Session service exception. 6686 * @throws { BusinessError } 6600103 - The session controller does not exist. 6687 * @syscap SystemCapability.Multimedia.AVSession.Core 6688 * @since 10 6689 */ 6690 /** 6691 * Unregister playback state changed callback 6692 * @param { 'playbackStateChange' } type 6693 * @param { function } callback - The callback used to handle playback state changed event. 6694 * The callback function provides the {@link AVPlaybackState} parameter. 6695 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6696 * 2.Incorrect parameter types. 6697 * @throws { BusinessError } 6600101 - Session service exception. 6698 * @throws { BusinessError } 6600103 - The session controller does not exist. 6699 * @syscap SystemCapability.Multimedia.AVSession.Core 6700 * @atomicservice 6701 * @since 12 6702 */ 6703 off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void); 6704 6705 /** 6706 * Register call metadata changed callback 6707 * @param { 'callMetadataChange' } type - 'callMetadataChange' 6708 * @param { Array<keyof CallMetadata> | 'all' } filter - The properties of {@link CallMetadata} that you cared about 6709 * @param { Callback<CallMetadata> } callback - The callback used to handle call metadata changed event. 6710 * The callback function provides the {@link CallMetadata} parameter. 6711 * It only contains the properties set in the filter. 6712 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6713 * 2.Incorrect parameter types. 6714 * @throws { BusinessError } 6600101 - Session service exception. 6715 * @throws { BusinessError } 6600103 - The session controller does not exist. 6716 * @syscap SystemCapability.Multimedia.AVSession.Core 6717 * @since 11 6718 */ 6719 /** 6720 * Register call metadata changed callback 6721 * @param { 'callMetadataChange' } type - 'callMetadataChange' 6722 * @param { Array<keyof CallMetadata> | 'all' } filter - The properties of {@link CallMetadata} that you cared about 6723 * @param { Callback<CallMetadata> } callback - The callback used to handle call metadata changed event. 6724 * The callback function provides the {@link CallMetadata} parameter. 6725 * It only contains the properties set in the filter. 6726 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6727 * 2.Incorrect parameter types. 6728 * @throws { BusinessError } 6600101 - Session service exception. 6729 * @throws { BusinessError } 6600103 - The session controller does not exist. 6730 * @syscap SystemCapability.Multimedia.AVSession.Core 6731 * @atomicservice 6732 * @since 12 6733 */ 6734 on(type: 'callMetadataChange', filter: Array<keyof CallMetadata> | 'all', callback: Callback<CallMetadata>): void; 6735 6736 /** 6737 * Unregister call metadata changed callback 6738 * @param { 'callMetadataChange' } type - 'callMetadataChange' 6739 * @param { Callback<CallMetadata> } callback - The callback used to handle call metadata changed event. 6740 * The callback function provides the {@link CallMetadata} parameter. 6741 * It only contains the properties set in the filter. 6742 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6743 * 2.Incorrect parameter types. 6744 * @throws { BusinessError } 6600101 - Session service exception. 6745 * @throws { BusinessError } 6600103 - The session controller does not exist. 6746 * @syscap SystemCapability.Multimedia.AVSession.Core 6747 * @since 11 6748 */ 6749 /** 6750 * Unregister call metadata changed callback 6751 * @param { 'callMetadataChange' } type - 'callMetadataChange' 6752 * @param { Callback<CallMetadata> } callback - The callback used to handle call metadata changed event. 6753 * The callback function provides the {@link CallMetadata} parameter. 6754 * It only contains the properties set in the filter. 6755 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6756 * 2.Incorrect parameter types. 6757 * @throws { BusinessError } 6600101 - Session service exception. 6758 * @throws { BusinessError } 6600103 - The session controller does not exist. 6759 * @syscap SystemCapability.Multimedia.AVSession.Core 6760 * @atomicservice 6761 * @since 12 6762 */ 6763 off(type: 'callMetadataChange', callback?: Callback<CallMetadata>): void; 6764 6765 /** 6766 * Register call state changed callback 6767 * @param { 'callStateChange' } type - 'callStateChange' 6768 * @param { Array<keyof AVCallState> | 'all' } filter - The properties of {@link AVCallState} that you cared about 6769 * @param { Callback<AVCallState> } callback - The callback used to handle call state changed event. 6770 * The callback function provides the {@link AVCallState} parameter. 6771 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6772 * 2.Incorrect parameter types. 6773 * @throws { BusinessError } 6600101 - Session service exception. 6774 * @throws { BusinessError } 6600103 - The session controller does not exist. 6775 * @syscap SystemCapability.Multimedia.AVSession.Core 6776 * @since 11 6777 */ 6778 /** 6779 * Register call state changed callback 6780 * @param { 'callStateChange' } type - 'callStateChange' 6781 * @param { Array<keyof AVCallState> | 'all' } filter - The properties of {@link AVCallState} that you cared about 6782 * @param { Callback<AVCallState> } callback - The callback used to handle call state changed event. 6783 * The callback function provides the {@link AVCallState} parameter. 6784 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6785 * 2.Incorrect parameter types. 6786 * @throws { BusinessError } 6600101 - Session service exception. 6787 * @throws { BusinessError } 6600103 - The session controller does not exist. 6788 * @syscap SystemCapability.Multimedia.AVSession.Core 6789 * @atomicservice 6790 * @since 12 6791 */ 6792 on(type: 'callStateChange', filter: Array<keyof AVCallState> | 'all', callback: Callback<AVCallState>): void; 6793 6794 /** 6795 * Unregister playback state changed callback 6796 * @param { 'callStateChange' } type - 'callStateChange' 6797 * @param { Callback<AVCallState> } callback - The callback used to handle call state changed event. 6798 * The callback function provides the {@link AVCallState} parameter. 6799 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6800 * 2.Incorrect parameter types. 6801 * @throws { BusinessError } 6600101 - Session service exception. 6802 * @throws { BusinessError } 6600103 - The session controller does not exist. 6803 * @syscap SystemCapability.Multimedia.AVSession.Core 6804 * @since 11 6805 */ 6806 /** 6807 * Unregister playback state changed callback 6808 * @param { 'callStateChange' } type - 'callStateChange' 6809 * @param { Callback<AVCallState> } callback - The callback used to handle call state changed event. 6810 * The callback function provides the {@link AVCallState} parameter. 6811 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6812 * 2.Incorrect parameter types. 6813 * @throws { BusinessError } 6600101 - Session service exception. 6814 * @throws { BusinessError } 6600103 - The session controller does not exist. 6815 * @syscap SystemCapability.Multimedia.AVSession.Core 6816 * @atomicservice 6817 * @since 12 6818 */ 6819 off(type: 'callStateChange', callback?: Callback<AVCallState>): void; 6820 6821 /** 6822 * Register current session destroyed callback 6823 * @param { 'sessionDestroy' } type 6824 * @param { function } callback - The callback used to handle current session destroyed event. 6825 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6826 * 2.Incorrect parameter types. 6827 * @throws { BusinessError } 6600101 - Session service exception. 6828 * @throws { BusinessError } 6600103 - The session controller does not exist. 6829 * @syscap SystemCapability.Multimedia.AVSession.Core 6830 * @since 10 6831 */ 6832 /** 6833 * Register current session destroyed callback 6834 * @param { 'sessionDestroy' } type 6835 * @param { function } callback - The callback used to handle current session destroyed event. 6836 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6837 * 2.Incorrect parameter types. 6838 * @throws { BusinessError } 6600101 - Session service exception. 6839 * @throws { BusinessError } 6600103 - The session controller does not exist. 6840 * @syscap SystemCapability.Multimedia.AVSession.Core 6841 * @atomicservice 6842 * @since 12 6843 */ 6844 on(type: 'sessionDestroy', callback: () => void); 6845 6846 /** 6847 * Unregister current session destroyed callback 6848 * @param { 'sessionDestroy' } type - 'sessionDestroy' 6849 * @param { function } callback - The callback used to handle current session destroyed event. 6850 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6851 * 2.Incorrect parameter types. 6852 * @throws { BusinessError } 6600101 - Session service exception. 6853 * @throws { BusinessError } 6600103 - The session controller does not exist. 6854 * @syscap SystemCapability.Multimedia.AVSession.Core 6855 * @since 10 6856 */ 6857 /** 6858 * Unregister current session destroyed callback 6859 * @param { 'sessionDestroy' } type - 'sessionDestroy' 6860 * @param { function } callback - The callback used to handle current session destroyed event. 6861 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6862 * 2.Incorrect parameter types. 6863 * @throws { BusinessError } 6600101 - Session service exception. 6864 * @throws { BusinessError } 6600103 - The session controller does not exist. 6865 * @syscap SystemCapability.Multimedia.AVSession.Core 6866 * @atomicservice 6867 * @since 12 6868 */ 6869 off(type: 'sessionDestroy', callback?: () => void); 6870 6871 /** 6872 * Register the active state of this session changed callback 6873 * @param { 'activeStateChange' } type - 'activeStateChange' 6874 * @param { function } callback - The callback used to handle the active state of this session changed event. 6875 * The callback function provides the changed session state. 6876 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6877 * 2.Incorrect parameter types. 6878 * @throws { BusinessError } 6600101 - Session service exception. 6879 * @throws { BusinessError } 6600103 - The session controller does not exist. 6880 * @syscap SystemCapability.Multimedia.AVSession.Core 6881 * @since 10 6882 */ 6883 /** 6884 * Register the active state of this session changed callback 6885 * @param { 'activeStateChange' } type - 'activeStateChange' 6886 * @param { function } callback - The callback used to handle the active state of this session changed event. 6887 * The callback function provides the changed session state. 6888 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6889 * 2.Incorrect parameter types. 6890 * @throws { BusinessError } 6600101 - Session service exception. 6891 * @throws { BusinessError } 6600103 - The session controller does not exist. 6892 * @syscap SystemCapability.Multimedia.AVSession.Core 6893 * @atomicservice 6894 * @since 12 6895 */ 6896 on(type: 'activeStateChange', callback: (isActive: boolean) => void); 6897 6898 /** 6899 * Unregister the active state of this session changed callback 6900 * @param { 'activeStateChange' } type - 'activeStateChange' 6901 * @param { function } callback - The callback used to handle the active state of this session changed event. 6902 * The callback function provides the changed session state. 6903 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6904 * 2.Incorrect parameter types. 6905 * @throws { BusinessError } 6600101 - Session service exception. 6906 * @throws { BusinessError } 6600103 - The session controller does not exist. 6907 * @syscap SystemCapability.Multimedia.AVSession.Core 6908 * @since 10 6909 */ 6910 /** 6911 * Unregister the active state of this session changed callback 6912 * @param { 'activeStateChange' } type - 'activeStateChange' 6913 * @param { function } callback - The callback used to handle the active state of this session changed event. 6914 * The callback function provides the changed session state. 6915 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6916 * 2.Incorrect parameter types. 6917 * @throws { BusinessError } 6600101 - Session service exception. 6918 * @throws { BusinessError } 6600103 - The session controller does not exist. 6919 * @syscap SystemCapability.Multimedia.AVSession.Core 6920 * @atomicservice 6921 * @since 12 6922 */ 6923 off(type: 'activeStateChange', callback?: (isActive: boolean) => void); 6924 6925 /** 6926 * Register the valid commands of the session changed callback 6927 * @param { 'validCommandChange' } type - 'validCommandChange' 6928 * @param { function } callback - The callback used to handle the changes. 6929 * The callback function provides an array of AVControlCommandType. 6930 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6931 * 2.Incorrect parameter types. 6932 * @throws { BusinessError } 6600101 - Session service exception. 6933 * @throws { BusinessError } 6600103 - The session controller does not exist. 6934 * @syscap SystemCapability.Multimedia.AVSession.Core 6935 * @since 10 6936 */ 6937 /** 6938 * Register the valid commands of the session changed callback 6939 * @param { 'validCommandChange' } type - 'validCommandChange' 6940 * @param { function } callback - The callback used to handle the changes. 6941 * The callback function provides an array of AVControlCommandType. 6942 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6943 * 2.Incorrect parameter types. 6944 * @throws { BusinessError } 6600101 - Session service exception. 6945 * @throws { BusinessError } 6600103 - The session controller does not exist. 6946 * @syscap SystemCapability.Multimedia.AVSession.Core 6947 * @atomicservice 6948 * @since 12 6949 */ 6950 on(type: 'validCommandChange', callback: (commands: Array<AVControlCommandType>) => void); 6951 6952 /** 6953 * Unregister the valid commands of the session changed callback 6954 * @param { 'validCommandChange' } type - 'validCommandChange' 6955 * @param { function } callback - The callback used to handle the changes. 6956 * The callback function provides an array of AVControlCommandType. 6957 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6958 * 2.Incorrect parameter types. 6959 * @throws { BusinessError } 6600101 - Session service exception. 6960 * @throws { BusinessError } 6600103 - The session controller does not exist. 6961 * @syscap SystemCapability.Multimedia.AVSession.Core 6962 * @since 10 6963 */ 6964 /** 6965 * Unregister the valid commands of the session changed callback 6966 * @param { 'validCommandChange' } type - 'validCommandChange' 6967 * @param { function } callback - The callback used to handle the changes. 6968 * The callback function provides an array of AVControlCommandType. 6969 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6970 * 2.Incorrect parameter types. 6971 * @throws { BusinessError } 6600101 - Session service exception. 6972 * @throws { BusinessError } 6600103 - The session controller does not exist. 6973 * @syscap SystemCapability.Multimedia.AVSession.Core 6974 * @atomicservice 6975 * @since 12 6976 */ 6977 off(type: 'validCommandChange', callback?: (commands: Array<AVControlCommandType>) => void); 6978 6979 /** 6980 * Register session output device change callback 6981 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 6982 * @param { function } callback - Used to handle output device changed. 6983 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 6984 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6985 * 2.Incorrect parameter types. 6986 * @throws { BusinessError } 6600101 - Session service exception 6987 * @throws { BusinessError } 6600103 - The session controller does not exist 6988 * @syscap SystemCapability.Multimedia.AVSession.Core 6989 * @since 10 6990 */ 6991 /** 6992 * Register session output device change callback 6993 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 6994 * @param { function } callback - Used to handle output device changed. 6995 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 6996 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 6997 * 2.Incorrect parameter types. 6998 * @throws { BusinessError } 6600101 - Session service exception 6999 * @throws { BusinessError } 6600103 - The session controller does not exist 7000 * @syscap SystemCapability.Multimedia.AVSession.Core 7001 * @atomicservice 7002 * @since 12 7003 */ 7004 on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 7005 7006 /** 7007 * Unregister session output device change callback 7008 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 7009 * @param { function } callback - Used to handle output device changed. 7010 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 7011 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7012 * 2.Incorrect parameter types. 7013 * @throws { BusinessError } 6600101 - Session service exception 7014 * @throws { BusinessError } 6600103 - The session controller does not exist 7015 * @syscap SystemCapability.Multimedia.AVSession.Core 7016 * @since 10 7017 */ 7018 /** 7019 * Unregister session output device change callback 7020 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 7021 * @param { function } callback - Used to handle output device changed. 7022 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 7023 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7024 * 2.Incorrect parameter types. 7025 * @throws { BusinessError } 6600101 - Session service exception 7026 * @throws { BusinessError } 6600103 - The session controller does not exist 7027 * @syscap SystemCapability.Multimedia.AVSession.Core 7028 * @atomicservice 7029 * @since 12 7030 */ 7031 off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 7032 7033 /** 7034 * Register session event callback 7035 * @param { 'sessionEvent' } type - 'sessionEvent' 7036 * @param { function } callback - The callback used to handle session event changed event. 7037 * The callback function provides the event string and key-value pair parameters. 7038 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7039 * 2.Incorrect parameter types. 7040 * @throws { BusinessError } 6600101 - Session service exception. 7041 * @throws { BusinessError } 6600103 - The session controller does not exist. 7042 * @syscap SystemCapability.Multimedia.AVSession.Core 7043 * @since 10 7044 */ 7045 /** 7046 * Register session event callback 7047 * @param { 'sessionEvent' } type - 'sessionEvent' 7048 * @param { function } callback - The callback used to handle session event changed event. 7049 * The callback function provides the event string and key-value pair parameters. 7050 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7051 * 2.Incorrect parameter types. 7052 * @throws { BusinessError } 6600101 - Session service exception. 7053 * @throws { BusinessError } 6600103 - The session controller does not exist. 7054 * @syscap SystemCapability.Multimedia.AVSession.Core 7055 * @atomicservice 7056 * @since 12 7057 */ 7058 on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key: string]: Object}) => void): void; 7059 7060 /** 7061 * Unregister session event callback 7062 * @param { 'sessionEvent' } type - 'sessionEvent' 7063 * @param { function } callback - Used to cancel a specific listener 7064 * The callback function provides the event string and key-value pair parameters. 7065 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7066 * 2.Incorrect parameter types. 7067 * @throws { BusinessError } 6600101 - Session service exception. 7068 * @throws { BusinessError } 6600103 - The session controller does not exist. 7069 * @syscap SystemCapability.Multimedia.AVSession.Core 7070 * @since 10 7071 */ 7072 /** 7073 * Unregister session event callback 7074 * @param { 'sessionEvent' } type - 'sessionEvent' 7075 * @param { function } callback - Used to cancel a specific listener 7076 * The callback function provides the event string and key-value pair parameters. 7077 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7078 * 2.Incorrect parameter types. 7079 * @throws { BusinessError } 6600101 - Session service exception. 7080 * @throws { BusinessError } 6600103 - The session controller does not exist. 7081 * @syscap SystemCapability.Multimedia.AVSession.Core 7082 * @atomicservice 7083 * @since 12 7084 */ 7085 off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key: string]: Object}) => void): void; 7086 7087 /** 7088 * Register session playlist change callback 7089 * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' 7090 * @param { function } callback - Used to handle playlist changed. 7091 * The callback provides the new array of AVQueueItem {@link AVQueueItem} 7092 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7093 * 2.Incorrect parameter types. 7094 * @throws { BusinessError } 6600101 - Session service exception. 7095 * @throws { BusinessError } 6600103 - The session controller does not exist. 7096 * @syscap SystemCapability.Multimedia.AVSession.Core 7097 * @since 10 7098 */ 7099 /** 7100 * Register session playlist change callback 7101 * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' 7102 * @param { function } callback - Used to handle playlist changed. 7103 * The callback provides the new array of AVQueueItem {@link AVQueueItem} 7104 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7105 * 2.Incorrect parameter types. 7106 * @throws { BusinessError } 6600101 - Session service exception. 7107 * @throws { BusinessError } 6600103 - The session controller does not exist. 7108 * @syscap SystemCapability.Multimedia.AVSession.Core 7109 * @atomicservice 7110 * @since 12 7111 */ 7112 on(type: 'queueItemsChange', callback: (items: Array<AVQueueItem>) => void): void; 7113 7114 /** 7115 * Unregister session playlist change callback 7116 * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' 7117 * @param { function } callback - Used to handle playlist changed. 7118 * The callback provides the new array of AVQueueItem {@link AVQueueItem} 7119 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7120 * 2.Incorrect parameter types. 7121 * @throws { BusinessError } 6600101 - Session service exception. 7122 * @throws { BusinessError } 6600103 - The session controller does not exist. 7123 * @syscap SystemCapability.Multimedia.AVSession.Core 7124 * @since 10 7125 */ 7126 /** 7127 * Unregister session playlist change callback 7128 * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' 7129 * @param { function } callback - Used to handle playlist changed. 7130 * The callback provides the new array of AVQueueItem {@link AVQueueItem} 7131 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7132 * 2.Incorrect parameter types. 7133 * @throws { BusinessError } 6600101 - Session service exception. 7134 * @throws { BusinessError } 6600103 - The session controller does not exist. 7135 * @syscap SystemCapability.Multimedia.AVSession.Core 7136 * @atomicservice 7137 * @since 12 7138 */ 7139 off(type: 'queueItemsChange', callback?: (items: Array<AVQueueItem>) => void): void; 7140 7141 /** 7142 * Register the name of session playlist change callback 7143 * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' 7144 * @param { function } callback - Used to handle name of playlist changed. 7145 * The callback provides the new name. 7146 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7147 * 2.Incorrect parameter types. 7148 * @throws { BusinessError } 6600101 - Session service exception. 7149 * @throws { BusinessError } 6600103 - The session controller does not exist. 7150 * @syscap SystemCapability.Multimedia.AVSession.Core 7151 * @since 10 7152 */ 7153 /** 7154 * Register the name of session playlist change callback 7155 * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' 7156 * @param { function } callback - Used to handle name of playlist changed. 7157 * The callback provides the new name. 7158 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7159 * 2.Incorrect parameter types. 7160 * @throws { BusinessError } 6600101 - Session service exception. 7161 * @throws { BusinessError } 6600103 - The session controller does not exist. 7162 * @syscap SystemCapability.Multimedia.AVSession.Core 7163 * @atomicservice 7164 * @since 12 7165 */ 7166 on(type: 'queueTitleChange', callback: (title: string) => void): void; 7167 7168 /** 7169 * Unregister the name of session playlist change callback 7170 * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' 7171 * @param { function } callback - Used to handle name of playlist changed. 7172 * The callback provides the new name. 7173 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7174 * 2.Incorrect parameter types. 7175 * @throws { BusinessError } 6600101 - Session service exception. 7176 * @throws { BusinessError } 6600103 - The session controller does not exist. 7177 * @syscap SystemCapability.Multimedia.AVSession.Core 7178 * @since 10 7179 */ 7180 /** 7181 * Unregister the name of session playlist change callback 7182 * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' 7183 * @param { function } callback - Used to handle name of playlist changed. 7184 * The callback provides the new name. 7185 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7186 * 2.Incorrect parameter types. 7187 * @throws { BusinessError } 6600101 - Session service exception. 7188 * @throws { BusinessError } 6600103 - The session controller does not exist. 7189 * @syscap SystemCapability.Multimedia.AVSession.Core 7190 * @atomicservice 7191 * @since 12 7192 */ 7193 off(type: 'queueTitleChange', callback?: (title: string) => void): void; 7194 7195 /** 7196 * Register the custom media packets change callback 7197 * @param { 'extrasChange' } type - Registration Type 'extrasChange' 7198 * @param { function } callback - Used to handle custom media packets changed. 7199 * The callback provides the new media packets. 7200 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7201 * 2.Incorrect parameter types. 7202 * @throws { BusinessError } 6600101 - Session service exception. 7203 * @throws { BusinessError } 6600103 - The session controller does not exist. 7204 * @syscap SystemCapability.Multimedia.AVSession.Core 7205 * @since 10 7206 */ 7207 /** 7208 * Register the custom media packets change callback 7209 * @param { 'extrasChange' } type - Registration Type 'extrasChange' 7210 * @param { function } callback - Used to handle custom media packets changed. 7211 * The callback provides the new media packets. 7212 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7213 * 2.Incorrect parameter types. 7214 * @throws { BusinessError } 6600101 - Session service exception. 7215 * @throws { BusinessError } 6600103 - The session controller does not exist. 7216 * @syscap SystemCapability.Multimedia.AVSession.Core 7217 * @atomicservice 7218 * @since 12 7219 */ 7220 on(type: 'extrasChange', callback: (extras: {[key: string]: Object}) => void): void; 7221 7222 /** 7223 * Unregister the custom media packets change callback 7224 * @param { 'extrasChange' } type - Registration Type 'extrasChange' 7225 * @param { function } callback - Used to handle custom media packets changed. 7226 * The callback provides the new media packets. 7227 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7228 * 2.Incorrect parameter types. 7229 * @throws { BusinessError } 6600101 - Session service exception. 7230 * @throws { BusinessError } 6600103 - The session controller does not exist. 7231 * @syscap SystemCapability.Multimedia.AVSession.Core 7232 * @since 10 7233 */ 7234 /** 7235 * Unregister the custom media packets change callback 7236 * @param { 'extrasChange' } type - Registration Type 'extrasChange' 7237 * @param { function } callback - Used to handle custom media packets changed. 7238 * The callback provides the new media packets. 7239 * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. 7240 * 2.Incorrect parameter types. 7241 * @throws { BusinessError } 6600101 - Session service exception. 7242 * @throws { BusinessError } 6600103 - The session controller does not exist. 7243 * @syscap SystemCapability.Multimedia.AVSession.Core 7244 * @atomicservice 7245 * @since 12 7246 */ 7247 off(type: 'extrasChange', callback?: (extras: {[key: string]: Object}) => void): void; 7248 } 7249 7250 /** 7251 * The type of control command 7252 * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 7253 * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' } AVControlCommandType 7254 * @syscap SystemCapability.Multimedia.AVSession.Core 7255 * @since 10 7256 */ 7257 /** 7258 * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' 7259 * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 7260 * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 7261 * 'toggleCallMute' } AVControlCommandType 7262 * @syscap SystemCapability.Multimedia.AVSession.Core 7263 * @since 11 7264 */ 7265 /** 7266 * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' 7267 * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 7268 * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 7269 * 'toggleCallMute' } AVControlCommandType 7270 * @syscap SystemCapability.Multimedia.AVSession.Core 7271 * @atomicservice 7272 * @since 12 7273 */ 7274 /** 7275 * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' 7276 * @typedef { 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 7277 * 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 7278 * 'toggleCallMute' | 'setTargetLoopMode' } AVControlCommandType 7279 * @syscap SystemCapability.Multimedia.AVSession.Core 7280 * @atomicservice 7281 * @since 18 7282 */ 7283 type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 7284 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' | 'setTargetLoopMode'; 7285 7286 /** 7287 * The definition of command to be sent to the session 7288 * @interface AVControlCommand 7289 * @syscap SystemCapability.Multimedia.AVSession.Core 7290 * @since 10 7291 */ 7292 /** 7293 * The definition of command to be sent to the session 7294 * @typedef AVControlCommand 7295 * @syscap SystemCapability.Multimedia.AVSession.Core 7296 * @atomicservice 7297 * @since 12 7298 */ 7299 interface AVControlCommand { 7300 /** 7301 * The command value {@link AVControlCommandType} 7302 * @type { AVControlCommandType } 7303 * @syscap SystemCapability.Multimedia.AVSession.Core 7304 * @since 10 7305 */ 7306 /** 7307 * The command value {@link AVControlCommandType} 7308 * @type { AVControlCommandType } 7309 * @syscap SystemCapability.Multimedia.AVSession.Core 7310 * @atomicservice 7311 * @since 12 7312 */ 7313 command: AVControlCommandType; 7314 7315 /** 7316 * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} 7317 * seek command requires a number parameter 7318 * setSpeed command requires a number parameter 7319 * setLoopMode command requires a {@link LoopMode} parameter. 7320 * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter 7321 * other commands need no parameter 7322 * @type { ?(LoopMode | string | number) } 7323 * @syscap SystemCapability.Multimedia.AVSession.Core 7324 * @since 10 7325 */ 7326 /** 7327 * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} 7328 * seek command requires a number parameter 7329 * setSpeed command requires a number parameter 7330 * setLoopMode command requires a {@link LoopMode} parameter. 7331 * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter 7332 * other commands need no parameter 7333 * @type { ?(LoopMode | string | number) } 7334 * @syscap SystemCapability.Multimedia.AVSession.Core 7335 * @atomicservice 7336 * @since 12 7337 */ 7338 parameter?: LoopMode | string | number; 7339 } 7340 7341 /** 7342 * Enumerates ErrorCode types, returns in BusinessError.code. 7343 * @enum { number } 7344 * @syscap SystemCapability.Multimedia.AVSession.Core 7345 * @since 10 7346 */ 7347 /** 7348 * Enumerates ErrorCode types, returns in BusinessError.code. 7349 * @enum { number } 7350 * @syscap SystemCapability.Multimedia.AVSession.Core 7351 * @atomicservice 7352 * @since 12 7353 */ 7354 enum AVSessionErrorCode { 7355 /** 7356 * Session service exception. 7357 * @syscap SystemCapability.Multimedia.AVSession.Core 7358 * @since 10 7359 */ 7360 /** 7361 * Session service exception. 7362 * @syscap SystemCapability.Multimedia.AVSession.Core 7363 * @atomicservice 7364 * @since 12 7365 */ 7366 ERR_CODE_SERVICE_EXCEPTION = 6600101, 7367 7368 /** 7369 * The session does not exist 7370 * @syscap SystemCapability.Multimedia.AVSession.Core 7371 * @since 10 7372 */ 7373 /** 7374 * The session does not exist 7375 * @syscap SystemCapability.Multimedia.AVSession.Core 7376 * @atomicservice 7377 * @since 12 7378 */ 7379 ERR_CODE_SESSION_NOT_EXIST = 6600102, 7380 7381 /** 7382 * The session controller does not exist. 7383 * @syscap SystemCapability.Multimedia.AVSession.Core 7384 * @since 10 7385 */ 7386 /** 7387 * The session controller does not exist. 7388 * @syscap SystemCapability.Multimedia.AVSession.Core 7389 * @atomicservice 7390 * @since 12 7391 */ 7392 ERR_CODE_CONTROLLER_NOT_EXIST = 6600103, 7393 7394 /** 7395 * The remote session connection failed. 7396 * @syscap SystemCapability.Multimedia.AVSession.Core 7397 * @since 10 7398 */ 7399 /** 7400 * The remote session connection failed. 7401 * @syscap SystemCapability.Multimedia.AVSession.Core 7402 * @atomicservice 7403 * @since 12 7404 */ 7405 ERR_CODE_REMOTE_CONNECTION_ERR = 6600104, 7406 7407 /** 7408 * Invalid session command. 7409 * @syscap SystemCapability.Multimedia.AVSession.Core 7410 * @since 10 7411 */ 7412 /** 7413 * Invalid session command. 7414 * @syscap SystemCapability.Multimedia.AVSession.Core 7415 * @atomicservice 7416 * @since 12 7417 */ 7418 ERR_CODE_COMMAND_INVALID = 6600105, 7419 7420 /** 7421 * The session is not activated. 7422 * @syscap SystemCapability.Multimedia.AVSession.Core 7423 * @since 10 7424 */ 7425 /** 7426 * The session is not activated. 7427 * @syscap SystemCapability.Multimedia.AVSession.Core 7428 * @atomicservice 7429 * @since 12 7430 */ 7431 ERR_CODE_SESSION_INACTIVE = 6600106, 7432 7433 /** 7434 * Too many commands or events. 7435 * @syscap SystemCapability.Multimedia.AVSession.Core 7436 * @since 10 7437 */ 7438 /** 7439 * Too many commands or events. 7440 * @syscap SystemCapability.Multimedia.AVSession.Core 7441 * @atomicservice 7442 * @since 12 7443 */ 7444 ERR_CODE_MESSAGE_OVERLOAD = 6600107, 7445 7446 /** 7447 * Device connecting failed. 7448 * @syscap SystemCapability.Multimedia.AVSession.Core 7449 * @since 10 7450 */ 7451 /** 7452 * Device connecting failed. 7453 * @syscap SystemCapability.Multimedia.AVSession.Core 7454 * @atomicservice 7455 * @since 12 7456 */ 7457 ERR_CODE_DEVICE_CONNECTION_FAILED = 6600108, 7458 7459 /** 7460 * The remote connection is not established. 7461 * @syscap SystemCapability.Multimedia.AVSession.Core 7462 * @since 10 7463 */ 7464 /** 7465 * The remote connection is not established. 7466 * @syscap SystemCapability.Multimedia.AVSession.Core 7467 * @atomicservice 7468 * @since 12 7469 */ 7470 ERR_CODE_REMOTE_CONNECTION_NOT_EXIST = 6600109, 7471 7472 /** 7473 * The error code for cast control is unspecified. 7474 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7475 * @atomicservice 7476 * @since 13 7477 */ 7478 ERR_CODE_CAST_CONTROL_UNSPECIFIED = 6611000, 7479 7480 /** 7481 * An unspecified error occurs in the remote player. 7482 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7483 * @atomicservice 7484 * @since 13 7485 */ 7486 ERR_CODE_CAST_CONTROL_REMOTE_ERROR = 6611001, 7487 7488 /** 7489 * The playback position falls behind the live window. 7490 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7491 * @atomicservice 7492 * @since 13 7493 */ 7494 ERR_CODE_CAST_CONTROL_BEHIND_LIVE_WINDOW = 6611002, 7495 7496 /** 7497 * The process of cast control times out. 7498 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7499 * @atomicservice 7500 * @since 13 7501 */ 7502 ERR_CODE_CAST_CONTROL_TIMEOUT = 6611003, 7503 7504 /** 7505 * The runtime check failed. 7506 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7507 * @atomicservice 7508 * @since 13 7509 */ 7510 ERR_CODE_CAST_CONTROL_RUNTIME_CHECK_FAILED = 6611004, 7511 7512 /** 7513 * Cross-device data transmission is locked. 7514 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7515 * @atomicservice 7516 * @since 13 7517 */ 7518 ERR_CODE_CAST_CONTROL_PLAYER_NOT_WORKING = 6611100, 7519 7520 /** 7521 * The specified seek mode is not supported. 7522 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7523 * @atomicservice 7524 * @since 13 7525 */ 7526 ERR_CODE_CAST_CONTROL_SEEK_MODE_UNSUPPORTED = 6611101, 7527 7528 /** 7529 * The position to seek to is out of the range of the media asset or the specified seek mode is not supported. 7530 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7531 * @atomicservice 7532 * @since 13 7533 */ 7534 ERR_CODE_CAST_CONTROL_ILLEGAL_SEEK_TARGET = 6611102, 7535 7536 /** 7537 * The specified playback mode is not supported. 7538 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7539 * @atomicservice 7540 * @since 13 7541 */ 7542 ERR_CODE_CAST_CONTROL_PLAY_MODE_UNSUPPORTED = 6611103, 7543 7544 /** 7545 * The specified playback speed is not supported. 7546 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7547 * @atomicservice 7548 * @since 13 7549 */ 7550 ERR_CODE_CAST_CONTROL_PLAY_SPEED_UNSUPPORTED = 6611104, 7551 7552 /** 7553 * The action failed because either the media source device or the media sink device has been revoked. 7554 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7555 * @atomicservice 7556 * @since 13 7557 */ 7558 ERR_CODE_CAST_CONTROL_DEVICE_MISSING = 6611105, 7559 7560 /** 7561 * The parameter is invalid, for example, the url is illegal to play. 7562 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7563 * @atomicservice 7564 * @since 13 7565 */ 7566 ERR_CODE_CAST_CONTROL_INVALID_PARAM = 6611106, 7567 7568 /** 7569 * Allocation of memory failed. 7570 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7571 * @atomicservice 7572 * @since 13 7573 */ 7574 ERR_CODE_CAST_CONTROL_NO_MEMORY = 6611107, 7575 7576 /** 7577 * Operation is not allowed. 7578 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7579 * @atomicservice 7580 * @since 13 7581 */ 7582 ERR_CODE_CAST_CONTROL_OPERATION_NOT_ALLOWED = 6611108, 7583 7584 /** 7585 * An unspecified input/output error occurs. 7586 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7587 * @atomicservice 7588 * @since 13 7589 */ 7590 ERR_CODE_CAST_CONTROL_IO_UNSPECIFIED = 6612000, 7591 7592 /** 7593 * Network connection failure. 7594 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7595 * @atomicservice 7596 * @since 13 7597 */ 7598 ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_FAILED = 6612001, 7599 7600 /** 7601 * Network timeout. 7602 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7603 * @atomicservice 7604 * @since 13 7605 */ 7606 ERR_CODE_CAST_CONTROL_IO_NETWORK_CONNECTION_TIMEOUT = 6612002, 7607 7608 /** 7609 * Invalid "Content-Type" HTTP header. 7610 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7611 * @atomicservice 7612 * @since 13 7613 */ 7614 ERR_CODE_CAST_CONTROL_IO_INVALID_HTTP_CONTENT_TYPE = 6612003, 7615 7616 /** 7617 * The HTTP server returns an unexpected HTTP response status code. 7618 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7619 * @atomicservice 7620 * @since 13 7621 */ 7622 ERR_CODE_CAST_CONTROL_IO_BAD_HTTP_STATUS = 6612004, 7623 7624 /** 7625 * The file does not exist. 7626 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7627 * @atomicservice 7628 * @since 13 7629 */ 7630 ERR_CODE_CAST_CONTROL_IO_FILE_NOT_FOUND = 6612005, 7631 7632 /** 7633 * No permission is granted to perform the IO operation. 7634 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7635 * @atomicservice 7636 * @since 13 7637 */ 7638 ERR_CODE_CAST_CONTROL_IO_NO_PERMISSION = 6612006, 7639 7640 /** 7641 * Access to cleartext HTTP traffic is not allowed by the app's network security configuration. 7642 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7643 * @atomicservice 7644 * @since 13 7645 */ 7646 ERR_CODE_CAST_CONTROL_IO_CLEARTEXT_NOT_PERMITTED = 6612007, 7647 7648 /** 7649 * Reading data out of the data bound. 7650 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7651 * @atomicservice 7652 * @since 13 7653 */ 7654 ERR_CODE_CAST_CONTROL_IO_READ_POSITION_OUT_OF_RANGE = 6612008, 7655 7656 /** 7657 * The media does not contain any contents that can be played. 7658 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7659 * @atomicservice 7660 * @since 13 7661 */ 7662 ERR_CODE_CAST_CONTROL_IO_NO_CONTENTS = 6612100, 7663 7664 /** 7665 * The media cannot be read, for example, because of dust or scratches. 7666 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7667 * @atomicservice 7668 * @since 13 7669 */ 7670 ERR_CODE_CAST_CONTROL_IO_READ_ERROR = 6612101, 7671 7672 /** 7673 * This resource is already in use. 7674 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7675 * @atomicservice 7676 * @since 13 7677 */ 7678 ERR_CODE_CAST_CONTROL_IO_CONTENT_BUSY = 6612102, 7679 7680 /** 7681 * The content using the validity interval has expired. 7682 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7683 * @atomicservice 7684 * @since 13 7685 */ 7686 ERR_CODE_CAST_CONTROL_IO_CONTENT_EXPIRED = 6612103, 7687 7688 /** 7689 * Using the requested content to play is not allowed. 7690 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7691 * @atomicservice 7692 * @since 13 7693 */ 7694 ERR_CODE_CAST_CONTROL_IO_USE_FORBIDDEN = 6612104, 7695 7696 /** 7697 * The use of the allowed content cannot be verified. 7698 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7699 * @atomicservice 7700 * @since 13 7701 */ 7702 ERR_CODE_CAST_CONTROL_IO_NOT_VERIFIED = 6612105, 7703 7704 /** 7705 * The number of times this content has been used as requested has reached the maximum allowed number of uses. 7706 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7707 * @atomicservice 7708 * @since 13 7709 */ 7710 ERR_CODE_CAST_CONTROL_IO_EXHAUSTED_ALLOWED_USES = 6612106, 7711 7712 /** 7713 * An error occurs when sending packet from source device to sink device. 7714 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7715 * @atomicservice 7716 * @since 13 7717 */ 7718 ERR_CODE_CAST_CONTROL_IO_NETWORK_PACKET_SENDING_FAILED = 6612107, 7719 7720 /** 7721 * Unspecified error related to content parsing. 7722 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7723 * @atomicservice 7724 * @since 13 7725 */ 7726 ERR_CODE_CAST_CONTROL_PARSING_UNSPECIFIED = 6613000, 7727 7728 /** 7729 * Parsing error associated with media container format bit streams. 7730 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7731 * @atomicservice 7732 * @since 13 7733 */ 7734 ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_MALFORMED = 6613001, 7735 7736 /** 7737 * Parsing error associated with the media manifest. 7738 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7739 * @atomicservice 7740 * @since 13 7741 */ 7742 ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_MALFORMED = 6613002, 7743 7744 /** 7745 * An error occurs when attempting to extract a file with an unsupported media container format 7746 * or an unsupported media container feature. 7747 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7748 * @atomicservice 7749 * @since 13 7750 */ 7751 ERR_CODE_CAST_CONTROL_PARSING_CONTAINER_UNSUPPORTED = 6613003, 7752 7753 /** 7754 * Unsupported feature in the media manifest. 7755 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7756 * @atomicservice 7757 * @since 13 7758 */ 7759 ERR_CODE_CAST_CONTROL_PARSING_MANIFEST_UNSUPPORTED = 6613004, 7760 7761 /** 7762 * Unspecified decoding error. 7763 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7764 * @atomicservice 7765 * @since 13 7766 */ 7767 ERR_CODE_CAST_CONTROL_DECODING_UNSPECIFIED = 6614000, 7768 7769 /** 7770 * Decoder initialization failed. 7771 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7772 * @atomicservice 7773 * @since 13 7774 */ 7775 ERR_CODE_CAST_CONTROL_DECODING_INIT_FAILED = 6614001, 7776 7777 /** 7778 * Decoder query failed. 7779 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7780 * @atomicservice 7781 * @since 13 7782 */ 7783 ERR_CODE_CAST_CONTROL_DECODING_QUERY_FAILED = 6614002, 7784 7785 /** 7786 * Decoding the media samples failed. 7787 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7788 * @atomicservice 7789 * @since 13 7790 */ 7791 ERR_CODE_CAST_CONTROL_DECODING_FAILED = 6614003, 7792 7793 /** 7794 * The format of the content to decode exceeds the capabilities of the device. 7795 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7796 * @atomicservice 7797 * @since 13 7798 */ 7799 ERR_CODE_CAST_CONTROL_DECODING_FORMAT_EXCEEDS_CAPABILITIES = 6614004, 7800 7801 /** 7802 * The format of the content to decode is not supported. 7803 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7804 * @atomicservice 7805 * @since 13 7806 */ 7807 ERR_CODE_CAST_CONTROL_DECODING_FORMAT_UNSUPPORTED = 6614005, 7808 7809 /** 7810 * Unspecified errors related to the audio renderer. 7811 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7812 * @atomicservice 7813 * @since 13 7814 */ 7815 ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_UNSPECIFIED = 6615000, 7816 7817 /** 7818 * Initializing the audio renderer failed. 7819 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7820 * @atomicservice 7821 * @since 13 7822 */ 7823 ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_INIT_FAILED = 6615001, 7824 7825 /** 7826 * The audio renderer fails to write data. 7827 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7828 * @atomicservice 7829 * @since 13 7830 */ 7831 ERR_CODE_CAST_CONTROL_AUDIO_RENDERER_WRITE_FAILED = 6615002, 7832 7833 /** 7834 * Unspecified error related to DRM. 7835 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7836 * @atomicservice 7837 * @since 13 7838 */ 7839 ERR_CODE_CAST_CONTROL_DRM_UNSPECIFIED = 6616000, 7840 7841 /** 7842 * The chosen DRM protection scheme is not supported by the device. 7843 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7844 * @atomicservice 7845 * @since 13 7846 */ 7847 ERR_CODE_CAST_CONTROL_DRM_SCHEME_UNSUPPORTED = 6616001, 7848 7849 /** 7850 * Device provisioning failed. 7851 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7852 * @atomicservice 7853 * @since 13 7854 */ 7855 ERR_CODE_CAST_CONTROL_DRM_PROVISIONING_FAILED = 6616002, 7856 7857 /** 7858 * The DRM-protected content to play is incompatible. 7859 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7860 * @atomicservice 7861 * @since 13 7862 */ 7863 ERR_CODE_CAST_CONTROL_DRM_CONTENT_ERROR = 6616003, 7864 7865 /** 7866 * Failed to obtain a license. 7867 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7868 * @atomicservice 7869 * @since 13 7870 */ 7871 ERR_CODE_CAST_CONTROL_DRM_LICENSE_ACQUISITION_FAILED = 6616004, 7872 7873 /** 7874 * The operation is disallowed by the license policy. 7875 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7876 * @atomicservice 7877 * @since 13 7878 */ 7879 ERR_CODE_CAST_CONTROL_DRM_DISALLOWED_OPERATION = 6616005, 7880 7881 /** 7882 * An error occurs in the DRM system. 7883 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7884 * @atomicservice 7885 * @since 13 7886 */ 7887 ERR_CODE_CAST_CONTROL_DRM_SYSTEM_ERROR = 6616006, 7888 7889 /** 7890 * The device has revoked DRM privileges. 7891 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7892 * @atomicservice 7893 * @since 13 7894 */ 7895 ERR_CODE_CAST_CONTROL_DRM_DEVICE_REVOKED = 6616007, 7896 7897 /** 7898 * The DRM license being loaded into the open DRM session has expired. 7899 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7900 * @atomicservice 7901 * @since 13 7902 */ 7903 ERR_CODE_CAST_CONTROL_DRM_LICENSE_EXPIRED = 6616008, 7904 7905 /** 7906 * An error occurs when the DRM processes the key response. 7907 * @syscap SystemCapability.Multimedia.AVSession.AVCast 7908 * @atomicservice 7909 * @since 13 7910 */ 7911 ERR_CODE_CAST_CONTROL_DRM_PROVIDE_KEY_RESPONSE_ERROR = 6616100, 7912 } 7913} 7914 7915export default avSession; 7916