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