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