1/* 2* Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16/** 17 * @file 18 * @kit AVSessionKit 19 */ 20 21import type { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; 22import { WantAgent } from './@ohos.wantAgent'; 23import { KeyEvent } from './@ohos.multimodalInput.keyEvent'; 24import { ElementName } from './bundleManager/ElementName'; 25import image from './@ohos.multimedia.image'; 26import audio from './@ohos.multimedia.audio'; 27import type media from './@ohos.multimedia.media'; 28import type Context from './application/BaseContext'; 29 30/** 31 * @namespace avSession 32 * @syscap SystemCapability.Multimedia.AVSession.Core 33 * @since 9 34 */ 35 36 37declare namespace avSession { 38 /** 39 * Create an AVSession instance. An ability can only create one AVSession 40 * @param { Context } context - The context of application 41 * @param { string } tag - A user-defined name for this session 42 * @param { AVSessionType } type - The type of session {@link AVSessionType} 43 * @param { AsyncCallback<AVSession> } callback - async callback for AVSession. 44 * @throws { BusinessError } 401 - parameter check failed 45 * @throws { BusinessError } 6600101 - Session service exception. 46 * @syscap SystemCapability.Multimedia.AVSession.Core 47 * @since 10 48 */ 49 function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession>): void; 50 51 /** 52 * Create an AVSession instance. An ability can only create one AVSession 53 * @param { Context } context - The context of application 54 * @param { string } tag - A user-defined name for this session 55 * @param { AVSessionType } type - The type of session {@link AVSessionType} 56 * @returns { Promise<AVSession> } Promise for AVSession 57 * @throws { BusinessError } 401 - parameter check failed 58 * @throws { BusinessError } 6600101 - Session service exception. 59 * @syscap SystemCapability.Multimedia.AVSession.Core 60 * @since 10 61 */ 62 function createAVSession(context: Context, tag: string, type: AVSessionType): Promise<AVSession>; 63 64 /** 65 * Get all avsession descriptors of the system 66 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 67 * @param { AsyncCallback<Array<Readonly<AVSessionDescriptor>>> } callback - async callback for an array of AVSessionDescriptors. 68 * @throws { BusinessError } 201 - permission denied 69 * @throws { BusinessError } 6600101 - Session service exception. 70 * @syscap SystemCapability.Multimedia.AVSession.Manager 71 * @systemapi 72 * @since 9 73 */ 74 function getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void; 75 76 /** 77 * Get all avsession descriptors of the system 78 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 79 * @returns { Promise<Array<Readonly<AVSessionDescriptor>>> } Promise for an array of AVSessionDescriptors 80 * @throws { BusinessError } 201 - permission denied 81 * @throws { BusinessError } 6600101 - Session service exception. 82 * @syscap SystemCapability.Multimedia.AVSession.Manager 83 * @systemapi 84 * @since 9 85 */ 86 function getAllSessionDescriptors(): Promise<Array<Readonly<AVSessionDescriptor>>>; 87 88 /** 89 * Get history avsession records. These sessions have been destroyed. 90 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 91 * @param { number } maxSize - Specifies the maximum size of the returned value array. 92 * @param { AsyncCallback<Array<Readonly<AVSessionDescriptor>>> } callback - async callback for an array of AVSessionDescriptors. 93 * If provided '0' or not provided, the maximum value is determined by the system. 94 * @throws { BusinessError } 401 - parameter check failed 95 * @throws { BusinessError } 6600101 - Session service exception. 96 * @syscap SystemCapability.Multimedia.AVSession.Manager 97 * @systemapi Hide this for inner system use 98 * @since 10 99 */ 100 function getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void; 101 102 /** 103 * Get history avsession records. These sessions have been destroyed. 104 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 105 * @param { number } maxSize - Specifies the maximum size of the returned value array. 106 * If provided '0' or not provided, the maximum value is determined by the system. 107 * @returns { Promise<Array<Readonly<AVSessionDescriptor>>> } Promise for an array of AVSessionDescriptors 108 * @throws { BusinessError } 401 - parameter check failed 109 * @throws { BusinessError } 6600101 - Session service exception. 110 * @syscap SystemCapability.Multimedia.AVSession.Manager 111 * @systemapi Hide this for inner system use 112 * @since 10 113 */ 114 function getHistoricalSessionDescriptors(maxSize?: number): Promise<Array<Readonly<AVSessionDescriptor>>>; 115 116 /** 117 * Get history play list information records. 118 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 119 * @param { number } maxSize - Specifies the maximum size of the returned value array. 120 * @param { number } maxAppSize - Specifies the maximum app size of the returned value array. 121 * @param { AsyncCallback<Array<Readonly<AVQueueInfo>>> } callback - async callback for an array of AVQueueInfo. 122 * If provided '0' or not provided, the maximum value is determined by the system. 123 * @throws { BusinessError } 201 - permission denied 124 * @throws { BusinessError } 202 - Not System App. 125 * @throws { BusinessError } 401 - parameter check failed 126 * @throws { BusinessError } 6600101 - Session service exception. 127 * @syscap SystemCapability.Multimedia.AVSession.Manager 128 * @systemapi Hide this for inner system use 129 * @since 11 130 */ 131 function getHistoricalAVQueueInfos(maxSize: number, maxAppSize: number, callback: AsyncCallback<Array<Readonly<AVQueueInfo>>>): void; 132 133 /** 134 * Get history play list information records. 135 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 136 * @param { number } maxSize - Specifies the maximum size of the returned value array. 137 * @param { number } maxAppSize - Specifies the maximum app size of the returned value array. 138 * @returns { Promise<Array<Readonly<AVQueueInfo>>> } Promise for an array of AVQueueInfo 139 * @throws { BusinessError } 401 - parameter check failed 140 * @throws { BusinessError } 6600101 - Session service exception. 141 * @syscap SystemCapability.Multimedia.AVSession.Manager 142 * @systemapi Hide this for inner system use 143 * @since 11 144 */ 145 function getHistoricalAVQueueInfos(maxSize: number, maxAppSize: number): Promise<Array<Readonly<AVQueueInfo>>>; 146 147 /** 148 * Create an avsession controller 149 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 150 * @param { string } sessionId - Specifies the sessionId to create the controller. 151 * @param { AsyncCallback<AVSessionController> } callback - async callback for AVSessionController. 152 * If provided 'default', the system will create a default controller, Used to control the system default session 153 * @throws { BusinessError } 201 - permission denied 154 * @throws { BusinessError } 401 - parameter check failed 155 * @throws { BusinessError } 6600101 - Session service exception. 156 * @throws { BusinessError } 6600102 - The session does not exist. 157 * @syscap SystemCapability.Multimedia.AVSession.Manager 158 * @systemapi 159 * @since 9 160 */ 161 function createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void; 162 163 /** 164 * Create an avsession controller 165 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 166 * @param { string } sessionId - Specifies the sessionId to create the controller. 167 * If provided 'default', the system will create a default controller, Used to control the system default session 168 * @returns { Promise<AVSessionController> } Promise for AVSessionController 169 * @throws { BusinessError } 201 - permission denied 170 * @throws { BusinessError } 401 - parameter check failed 171 * @throws { BusinessError } 6600101 - Session service exception. 172 * @throws { BusinessError } 6600102 - The session does not exist. 173 * @syscap SystemCapability.Multimedia.AVSession.Manager 174 * @systemapi 175 * @since 9 176 */ 177 function createController(sessionId: string): Promise<AVSessionController>; 178 179 /** 180 * Cast Audio to the remote devices or cast back local device 181 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 182 * @param { SessionToken | 'all' } session - Specifies the sessionId which to send to remote. 183 * @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast. 184 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 185 * 'all' means cast all the media audio of this device to remote. 186 * @throws { BusinessError } 201 - permission denied 187 * @throws { BusinessError } 401 - parameter check failed 188 * @throws { BusinessError } 6600101 - Session service exception. 189 * @throws { BusinessError } 6600102 - The session does not exist. 190 * @throws { BusinessError } 6600104 - The remote session connection failed. 191 * @syscap SystemCapability.Multimedia.AVSession.Manager 192 * @systemapi 193 * @since 9 194 */ 195 function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void; 196 197 /** 198 * Cast Audio to the remote devices or cast back local device 199 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 200 * @param { SessionToken | 'all' } session - Specifies the sessionId which to send to remote. 201 * @param { Array<audio.AudioDeviceDescriptor> } audioDevices - Specifies the audio devices to cast. 202 * @returns { Promise<void> } void promise when executed successfully 203 * 'all' means cast all the media audio of this device to remote. 204 * @throws { BusinessError } 201 - permission denied 205 * @throws { BusinessError } 401 - parameter check failed 206 * @throws { BusinessError } 6600101 - Session service exception. 207 * @throws { BusinessError } 6600102 - The session does not exist. 208 * @throws { BusinessError } 6600104 - The remote session connection failed. 209 * @syscap SystemCapability.Multimedia.AVSession.Manager 210 * @systemapi 211 * @since 9 212 */ 213 function castAudio(session: SessionToken | 'all', audioDevices: Array<audio.AudioDeviceDescriptor>): Promise<void>; 214 215 /** 216 * Start an application for media playback. 217 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 218 * @param { string } bundleName - Specifies the bundleName which to be started. 219 * @param { string } assetId - Specifies the assetId to be started. 220 * @returns { Promise<void> } void promise when executed successfully 221 * @throws { BusinessError } 201 - permission denied 222 * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app. 223 * @throws { BusinessError } 401 - parameter check failed 224 * @throws { BusinessError } 6600101 - Session service exception. 225 * @syscap SystemCapability.Multimedia.AVSession.Manager 226 * @systemapi 227 * @since 11 228 */ 229 function startAVPlayback(bundleName: string, assetId: string): Promise<void>; 230 231 /** 232 * Session token. Used to judge the legitimacy of the session. 233 * @typedef SessionToken 234 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 235 * @syscap SystemCapability.Multimedia.AVSession.Manager 236 * @systemapi 237 * @since 9 238 */ 239 interface SessionToken { 240 /** 241 * The unique session id of the avsession object 242 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 243 * @type { string } 244 * @syscap SystemCapability.Multimedia.AVSession.Manager 245 * @systemapi 246 * @since 9 247 */ 248 sessionId: string; 249 250 /** 251 * Process id of session 252 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 253 * @type { ?number } 254 * @syscap SystemCapability.Multimedia.AVSession.Manager 255 * @systemapi 256 * @since 9 257 */ 258 pid?: number; 259 260 /** 261 * User id 262 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 263 * @type { ?number } 264 * @syscap SystemCapability.Multimedia.AVSession.Manager 265 * @systemapi 266 * @since 9 267 */ 268 uid?: number; 269 } 270 271 /** 272 * Register session create callback 273 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 274 * @param { 'sessionCreate' } type - Registration Type, 'sessionCreate' 275 * @param { function } callback - Used to handle ('sessionCreate' command) 276 * @throws { BusinessError } 201 - permission denied 277 * @throws { BusinessError } 401 - parameter check failed 278 * @throws { BusinessError } 6600101 - Session service exception. 279 * @syscap SystemCapability.Multimedia.AVSession.Manager 280 * @systemapi 281 * @since 9 282 */ 283 function on(type: 'sessionCreate', callback: (session: AVSessionDescriptor) => void): void; 284 285 /** 286 * Register session destroy callback 287 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 288 * @param { 'sessionDestroy' } type - Registration Type, 'sessionDestroy' 289 * @param { function } callback - Used to handle ('sessionDestroy' command) 290 * @throws { BusinessError } 201 - permission denied 291 * @throws { BusinessError } 401 - parameter check failed 292 * @throws { BusinessError } 6600101 - Session service exception. 293 * @syscap SystemCapability.Multimedia.AVSession.Manager 294 * @systemapi 295 * @since 9 296 */ 297 function on(type: 'sessionDestroy', callback: (session: AVSessionDescriptor) => void): void; 298 299 /** 300 * Register top session changed callback 301 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 302 * @param { 'topSessionChange' } type - Registration Type, top priority session change, 'topSessionChange' 303 * @param { function } callback - Used to handle ('topSessionChange' command) 304 * @throws { BusinessError } 201 - permission denied 305 * @throws { BusinessError } 401 - parameter check failed 306 * @throws { BusinessError } 6600101 - Session service exception. 307 * @syscap SystemCapability.Multimedia.AVSession.Manager 308 * @systemapi 309 * @since 9 310 */ 311 function on(type: 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void; 312 313 /** 314 * Unregister session create callback 315 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 316 * @param { 'sessionCreate' } type - Registration Type, session creation, 'sessionCreate' 317 * @param { function } callback - Used to unregister listener for ('sessionCreate') command 318 * @throws { BusinessError } 201 - permission denied 319 * @throws { BusinessError } 401 - parameter check failed 320 * @throws { BusinessError } 6600101 - Session service exception. 321 * @syscap SystemCapability.Multimedia.AVSession.Manager 322 * @systemapi 323 * @since 9 324 */ 325 function off(type: 'sessionCreate', callback?: (session: AVSessionDescriptor) => void): void; 326 327 /** 328 * Unregister session destroy callback 329 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 330 * @param { 'sessionDestroy' } type - Registration Type, session deletion, 'sessionDestroy' 331 * @param { function } callback - Used to unregister listener for ('sessionDestroy') command 332 * @throws { BusinessError } 201 - permission denied 333 * @throws { BusinessError } 401 - parameter check failed 334 * @throws { BusinessError } 6600101 - Session service exception. 335 * @syscap SystemCapability.Multimedia.AVSession.Manager 336 * @systemapi 337 * @since 9 338 */ 339 function off(type: 'sessionDestroy', callback?: (session: AVSessionDescriptor) => void): void; 340 341 /** 342 * Unregister top session changed callback 343 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 344 * @param { 'topSessionChange' } type - Registration Type, top priority session change, 'topSessionChange' 345 * @param { function } callback - Used to unregister listener for ('topSessionChange') command 346 * @throws { BusinessError } 201 - permission denied 347 * @throws { BusinessError } 401 - parameter check failed 348 * @throws { BusinessError } 6600101 - Session service exception. 349 * @syscap SystemCapability.Multimedia.AVSession.Manager 350 * @systemapi 351 * @since 9 352 */ 353 function off(type: 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void; 354 355 /** 356 * Register Session service death callback, notifying the application to clean up resources. 357 * @param { 'sessionServiceDie' } type - Registration Type, 'sessionServiceDie' 358 * @param { function } callback - Used to handle ('sessionServiceDie') command. 359 * @throws { BusinessError } 201 - permission denied 360 * @throws { BusinessError } 401 - parameter check failed 361 * @throws { BusinessError } 6600101 - Session service exception. 362 * @syscap SystemCapability.Multimedia.AVSession.Core 363 * @systemapi 364 * @since 9 365 */ 366 function on(type: 'sessionServiceDie', callback: () => void): void; 367 368 /** 369 * Unregister Session service death callback, notifying the application to clean up resources. 370 * @param { 'sessionServiceDie' } type - Registration Type, 'sessionServiceDie' 371 * @param { function } callback - Used to unregister listener for ('sessionServiceDie') command. 372 * @throws { BusinessError } 201 - permission denied 373 * @throws { BusinessError } 401 - parameter check failed 374 * @throws { BusinessError } 6600101 - Session service exception. 375 * @syscap SystemCapability.Multimedia.AVSession.Core 376 * @systemapi 377 * @since 9 378 */ 379 function off(type: 'sessionServiceDie', callback?: () => void): void; 380 381 /** 382 * Send system media key event.The system automatically selects the recipient. 383 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 384 * @param { KeyEvent } event - The key event to be sent 385 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 386 * @throws { BusinessError } 201 - permission denied 387 * @throws { BusinessError } 401 - parameter check failed 388 * @throws { BusinessError } 6600101 - Session service exception. 389 * @throws { BusinessError } 6600105 - Invalid session command. 390 * @syscap SystemCapability.Multimedia.AVSession.Manager 391 * @systemapi 392 * @since 9 393 */ 394 function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void; 395 396 /** 397 * Send system media key event.The system automatically selects the recipient. 398 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 399 * @param { KeyEvent } event - The key event to be sent 400 * @returns { Promise<void> } void promise when executed successfully 401 * @throws { BusinessError } 201 - permission denied 402 * @throws { BusinessError } 401 - parameter check failed 403 * @throws { BusinessError } 6600101 - Session service exception. 404 * @throws { BusinessError } 6600105 - Invalid session command. 405 * @syscap SystemCapability.Multimedia.AVSession.Manager 406 * @systemapi 407 * @since 9 408 */ 409 function sendSystemAVKeyEvent(event: KeyEvent): Promise<void>; 410 411 /** 412 * Send system control command.The system automatically selects the recipient. 413 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 414 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 415 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 416 * @throws { BusinessError } 201 - permission denied 417 * @throws { BusinessError } 401 - parameter check failed 418 * @throws { BusinessError } 6600101 - Session service exception. 419 * @throws { BusinessError } 6600105 - Invalid session command. 420 * @throws { BusinessError } 6600107 - Too many commands or events. 421 * @syscap SystemCapability.Multimedia.AVSession.Manager 422 * @systemapi 423 * @since 9 424 */ 425 function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void; 426 427 /** 428 * Send system control command.The system automatically selects the recipient. 429 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 430 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 431 * @returns { Promise<void> } void promise when executed successfully 432 * @throws { BusinessError } 201 - permission denied 433 * @throws { BusinessError } 401 - parameter check failed 434 * @throws { BusinessError } 6600101 - Session service exception. 435 * @throws { BusinessError } 6600105 - Invalid session command. 436 * @throws { BusinessError } 6600107 - Too many commands or events. 437 * @syscap SystemCapability.Multimedia.AVSession.Manager 438 * @systemapi 439 * @since 9 440 */ 441 function sendSystemControlCommand(command: AVControlCommand): Promise<void>; 442 443 /** 444 * Define different protocol capability 445 * @enum { number } 446 * @syscap SystemCapability.Multimedia.AVSession.AVCast 447 * @since 11 448 */ 449 enum ProtocolType { 450 /** 451 * The default cast type "local", media can be routed on the same device, 452 * including internal speakers or audio jack on the device itself, A2DP devices. 453 * @syscap SystemCapability.Multimedia.AVSession.AVCast 454 * @since 11 455 */ 456 TYPE_LOCAL = 0, 457 458 /** 459 * Cast+ mirror capability 460 * @syscap SystemCapability.Multimedia.AVSession.AVCast 461 * @systemapi 462 * @since 10 463 */ 464 TYPE_CAST_PLUS_MIRROR = 1, 465 466 /** 467 * The Cast+ Stream indicating the media is presenting on a different device 468 * the application need get an AVCastController to control remote playback. 469 * @syscap SystemCapability.Multimedia.AVSession.AVCast 470 * @since 11 471 */ 472 TYPE_CAST_PLUS_STREAM = 2, 473 } 474 475 /** 476 * Start device discovery. 477 * @param { AsyncCallback<void> } callback a callback function 478 * @syscap SystemCapability.Multimedia.AVSession.AVCast 479 * @systemapi 480 * @since 10 481 */ 482 function startCastDeviceDiscovery(callback: AsyncCallback<void>): void; 483 484 /** 485 * Start device discovery. 486 * @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} 487 * @param { AsyncCallback<void> } callback a callback function 488 * @throws { BusinessError } 401 - parameter check failed 489 * @syscap SystemCapability.Multimedia.AVSession.AVCast 490 * @systemapi 491 * @since 10 492 */ 493 function startCastDeviceDiscovery(filter: number, callback: AsyncCallback<void>): void; 494 495 /** 496 * Start device discovery. 497 * @param { number } filter device filter when discovering, can be an union of {@link ProtocolType} 498 * @returns { Promise<void> } Promise for the result 499 * @throws { BusinessError } 401 - parameter check failed 500 * @syscap SystemCapability.Multimedia.AVSession.AVCast 501 * @systemapi 502 * @since 10 503 */ 504 function startCastDeviceDiscovery(filter?: number): Promise<void>; 505 506 /** 507 * Stop device discovery. 508 * @param { AsyncCallback<void> } callback a callback function 509 * @syscap SystemCapability.Multimedia.AVSession.AVCast 510 * @systemapi 511 * @since 10 512 */ 513 function stopCastDeviceDiscovery(callback: AsyncCallback<void>): void; 514 515 /** 516 * Stop device discovery. 517 * @returns { Promise<void> } Promise for the result 518 * @syscap SystemCapability.Multimedia.AVSession.AVCast 519 * @systemapi 520 * @since 10 521 */ 522 function stopCastDeviceDiscovery(): Promise<void>; 523 524 /** 525 * Enable or disable device to be discoverable, used at sink side. 526 * @param { boolean } enable true: can be discoverable, false: cannot be discoverable. 527 * @param { AsyncCallback<void> } callback a callback function 528 * @throws { BusinessError } 401 - parameter check failed 529 * @syscap SystemCapability.Multimedia.AVSession.AVCast 530 * @systemapi 531 * @since 10 532 */ 533 function setDiscoverable(enable: boolean, callback: AsyncCallback<void>): void; 534 535 /** 536 * Enable or disable device to be discoverable, used at sink side. 537 * @param { boolean } enable true: can be discoverable, false: cannot be discoverable. 538 * @returns { Promise<void> } Promise for the result 539 * @throws { BusinessError } 401 - parameter check failed 540 * @syscap SystemCapability.Multimedia.AVSession.AVCast 541 * @systemapi 542 * @since 10 543 */ 544 function setDiscoverable(enable: boolean): Promise<void>; 545 546 /** 547 * Register device discovery callback 548 * @param { 'deviceAvailable' } type Registration Type 549 * @param { function } callback Used to returns the device info 550 * @throws {BusinessError} 201 - permission denied 551 * @throws {BusinessError} 401 - parameter check failed 552 * @syscap SystemCapability.Multimedia.AVSession.AVCast 553 * @systemapi 554 * @since 10 555 */ 556 function on(type: 'deviceAvailable', callback: (device: OutputDeviceInfo) => void): void; 557 558 /** 559 * Unregister device discovery callback 560 * @param { 'deviceAvailable' } type Registration Type 561 * @param { function } callback Used to returns the device info 562 * @throws {BusinessError} 201 - permission denied 563 * @throws {BusinessError} 401 - parameter check failed 564 * @syscap SystemCapability.Multimedia.AVSession.AVCast 565 * @systemapi 566 * @since 10 567 */ 568 function off(type: 'deviceAvailable', callback?: (device: OutputDeviceInfo) => void): void; 569 570 /** 571 * Register device offline callback 572 * @param { 'deviceOffline' } type - Registration Type 573 * @param { function } callback - Used to returns the device info 574 * @throws {BusinessError} 201 - permission denied 575 * @throws {BusinessError} 401 - parameter check failed 576 * @syscap SystemCapability.Multimedia.AVSession.AVCast 577 * @systemapi 578 * @since 11 579 */ 580 function on(type: 'deviceOffline', callback: (deviceId: string) => void): void; 581 582 /** 583 * Unregister device offline callback 584 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 585 * @param { 'deviceOffline' } type - Registration Type 586 * @param { function } callback - Used to returns the device info 587 * @throws {BusinessError} 201 - permission denied 588 * @throws {BusinessError} 202 - Not System App. 589 * @throws {BusinessError} 401 - parameter check failed 590 * @syscap SystemCapability.Multimedia.AVSession.AVCast 591 * @systemapi 592 * @since 11 593 */ 594 function off(type: 'deviceOffline', callback?: (deviceId: string) => void): void; 595 596 /** 597 * Register a callback to retrieve an avsession cast controller. 598 * This function can be used at both side to get the same controller to do the playback control. 599 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 600 * @param { string } sessionId Specifies the sessionId to get controller. 601 * @param { AsyncCallback<AVCastController> } callback - async callback for the AVCastController. 602 * @throws {BusinessError} 201 - permission denied 603 * @throws { BusinessError } 401 - parameter check failed 604 * @throws {BusinessError} 6600101 - Session service exception 605 * @throws {BusinessError} 6600102 - session does not exist 606 * @syscap SystemCapability.Multimedia.AVSession.AVCast 607 * @systemapi 608 * @since 10 609 */ 610 function getAVCastController(sessionId: string, callback: AsyncCallback<AVCastController>): void; 611 612 /** 613 * Get the current session's remote controller client. 614 * If the avsession is not under casting state, the controller will return null. 615 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 616 * @param { string } sessionId Specifies the sessionId to get controller. 617 * @returns { Promise<AVCastController> } Promise for the AVCastController 618 * @throws {BusinessError} 201 - permission denied 619 * @throws { BusinessError } 401 - parameter check failed 620 * @throws {BusinessError} 6600101 - server exception 621 * @throws {BusinessError} 6600102 - session does not exist 622 * @syscap SystemCapability.Multimedia.AVSession.AVCast 623 * @systemapi 624 * @since 10 625 */ 626 function getAVCastController(sessionId: string): Promise<AVCastController>; 627 628 /** 629 * Cast resource to remote device. 630 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 631 * @param { SessionToken } session Specifies the sessionId which is to be casted. 632 * @param { OutputDeviceInfo } device Specifies the device to cast. 633 * @param { AsyncCallback<void> } callback A callback instance used to return when start casting. 634 * @throws {BusinessError} 201 - permission denied 635 * @throws {BusinessError} 401 - parameter check failed 636 * @throws {BusinessError} 6600101 - Session service exception 637 * @throws {BusinessError} 6600108 - Device connecting failed 638 * @syscap SystemCapability.Multimedia.AVSession.AVCast 639 * @systemapi 640 * @since 10 641 */ 642 function startCasting(session: SessionToken, device: OutputDeviceInfo, callback: AsyncCallback<void>): void; 643 644 /** 645 * Cast resource to remote device. 646 * @permission ohos.permission.MANAGE_MEDIA_RESOURCES 647 * @param { SessionToken } session Specifies the sessionId which is to be casted. 648 * @param { OutputDeviceInfo } device Specifies the device to cast. 649 * @returns { Promise<void> } Promise for the result 650 * @throws {BusinessError} 201 - permission denied 651 * @throws {BusinessError} 401 - parameter check failed 652 * @throws {BusinessError} 6600101 - Session service exception 653 * @throws {BusinessError} 6600108 - Device connecting failed 654 * @syscap SystemCapability.Multimedia.AVSession.AVCast 655 * @systemapi 656 * @since 10 657 */ 658 function startCasting(session: SessionToken, device: OutputDeviceInfo): Promise<void>; 659 660 /** 661 * Stop current cast and disconnect device connection. 662 * @param { SessionToken } session Specifies the sessionId which is to be stopped. 663 * @param { AsyncCallback<void> } callback A callback instance used to return when cast stopped completed. 664 * @throws { BusinessError } 401 - parameter check failed 665 * @throws { BusinessError } 6600109 - The remote connection is not established 666 * @syscap SystemCapability.Multimedia.AVSession.AVCast 667 * @systemapi 668 * @since 10 669 */ 670 function stopCasting(session: SessionToken, callback: AsyncCallback<void>): void; 671 672 /** 673 * Stop current cast and disconnect device connection. 674 * @param { SessionToken } session Specifies the sessionId which is to be stopped. 675 * @returns { Promise<void> } Promise for the result 676 * @throws { BusinessError } 401 - parameter check failed 677 * @throws { BusinessError } 6600109 - The remote connection is not established 678 * @syscap SystemCapability.Multimedia.AVSession.AVCast 679 * @systemapi 680 * @since 10 681 */ 682 function stopCasting(session: SessionToken): Promise<void>; 683 684 /** 685 * Session type, support audio & video 686 * @syscap SystemCapability.Multimedia.AVSession.Core 687 * @since 10 688 */ 689 /** 690 * Session type, support voice_call 691 * @syscap SystemCapability.Multimedia.AVSession.Core 692 * @since 11 693 */ 694 type AVSessionType = 'audio' | 'video' | 'voice_call'; 695 696 /** 697 * AVSession object. 698 * @interface AVSession 699 * @syscap SystemCapability.Multimedia.AVSession.Core 700 * @since 10 701 */ 702 interface AVSession { 703 /** 704 * unique session Id 705 * @syscap SystemCapability.Multimedia.AVSession.Core 706 * @since 10 707 */ 708 readonly sessionId: string; 709 710 /** 711 * Get current session type 712 * @syscap SystemCapability.Multimedia.AVSession.Core 713 * @since 10 714 */ 715 readonly sessionType: AVSessionType; 716 717 /** 718 * Set the metadata of this session. 719 * In addition to the required properties, users can fill in partially supported properties 720 * @param { AVMetadata } data {@link AVMetadata} 721 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 722 * @throws { BusinessError } 401 - parameter check failed 723 * @throws { BusinessError } 6600101 - Session service exception. 724 * @throws { BusinessError } 6600102 - The session does not exist. 725 * @syscap SystemCapability.Multimedia.AVSession.Core 726 * @since 10 727 */ 728 setAVMetadata(data: AVMetadata, callback: AsyncCallback<void>): void; 729 730 /** 731 * Set the metadata of this session. 732 * In addition to the required properties, users can fill in partially supported properties 733 * @param { AVMetadata } data {@link AVMetadata} 734 * @returns { Promise<void> } void promise when executed successfully 735 * @throws { BusinessError } 401 - parameter check failed 736 * @throws { BusinessError } 6600101 - Session service exception. 737 * @throws { BusinessError } 6600102 - The session does not exist. 738 * @syscap SystemCapability.Multimedia.AVSession.Core 739 * @since 10 740 */ 741 setAVMetadata(data: AVMetadata): Promise<void>; 742 743 /** 744 * Set the metadata related with current call. 745 * @param { CallMetadata } data - {@link CallMetadata} 746 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 747 * @throws { BusinessError } 401 - parameter check failed 748 * @throws { BusinessError } 6600101 - Session service exception. 749 * @throws { BusinessError } 6600102 - The session does not exist. 750 * @syscap SystemCapability.Multimedia.AVSession.Core 751 * @since 11 752 */ 753 setCallMetadata(data: CallMetadata, callback: AsyncCallback<void>): void; 754 755 /** 756 * Set the metadata related with current call. 757 * @param { CallMetadata } data - {@link CallMetadata} 758 * @returns { Promise<void> } void promise when executed successfully 759 * @throws { BusinessError } 401 - parameter check failed 760 * @throws { BusinessError } 6600101 - Session service exception. 761 * @throws { BusinessError } 6600102 - The session does not exist. 762 * @syscap SystemCapability.Multimedia.AVSession.Core 763 * @since 11 764 */ 765 setCallMetadata(data: CallMetadata): Promise<void>; 766 767 /** 768 * Set the playback state of this session. 769 * @param { AVPlaybackState } state {@link AVPlaybackState} 770 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 771 * @throws { BusinessError } 401 - parameter check failed 772 * @throws { BusinessError } 6600101 - Session service exception. 773 * @throws { BusinessError } 6600102 - The session does not exist. 774 * @syscap SystemCapability.Multimedia.AVSession.Core 775 * @since 10 776 */ 777 setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void>): void; 778 779 /** 780 * Set the playback state of this session. 781 * @param { AVPlaybackState } state {@link AVPlaybackState} 782 * @returns { Promise<void> } void promise when executed successfully 783 * @throws { BusinessError } 401 - parameter check failed 784 * @throws { BusinessError } 6600101 - Session service exception. 785 * @throws { BusinessError } 6600102 - The session does not exist. 786 * @syscap SystemCapability.Multimedia.AVSession.Core 787 * @since 10 788 */ 789 setAVPlaybackState(state: AVPlaybackState): Promise<void>; 790 791 /** 792 * Set the call state of this session. 793 * @param { AVCallState } state - {@link AVCallState} 794 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 795 * @throws { BusinessError } 401 - parameter check failed 796 * @throws { BusinessError } 6600101 - Session service exception. 797 * @throws { BusinessError } 6600102 - The session does not exist. 798 * @syscap SystemCapability.Multimedia.AVSession.Core 799 * @since 11 800 */ 801 setAVCallState(state: AVCallState, callback: AsyncCallback<void>): void; 802 803 /** 804 * Set the call state of this session. 805 * @param { AVCallState } state - {@link AVCallState} 806 * @returns { Promise<void> } void promise when executed successfully 807 * @throws { BusinessError } 401 - parameter check failed 808 * @throws { BusinessError } 6600101 - Session service exception. 809 * @throws { BusinessError } 6600102 - The session does not exist. 810 * @syscap SystemCapability.Multimedia.AVSession.Core 811 * @since 11 812 */ 813 setAVCallState(state: AVCallState): Promise<void>; 814 815 /** 816 * Set the ability to start the session corresponding to 817 * @param { WantAgent } ability - The WantAgent for launch the ability 818 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 819 * @throws { BusinessError } 401 - parameter check failed 820 * @throws { BusinessError } 6600101 - Session service exception. 821 * @throws { BusinessError } 6600102 - The session does not exist. 822 * @syscap SystemCapability.Multimedia.AVSession.Core 823 * @since 10 824 */ 825 setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void>): void; 826 827 /** 828 * Set the ability to start the session corresponding to 829 * @param { WantAgent } ability - The WantAgent for launch the ability 830 * @returns { Promise<void> } void promise when executed successfully 831 * @throws { BusinessError } 401 - parameter check failed 832 * @throws { BusinessError } 6600101 - Session service exception. 833 * @throws { BusinessError } 6600102 - The session does not exist. 834 * @syscap SystemCapability.Multimedia.AVSession.Core 835 * @since 10 836 */ 837 setLaunchAbility(ability: WantAgent): Promise<void>; 838 839 /** 840 * Dispatch the session event of this session. 841 * @param { string } event - Session event name to dispatch 842 * @param { object } args - The parameters of session event 843 * @param { AsyncCallback<void>} callback - The asyncCallback triggered when the command is executed successfully 844 * @throws { BusinessError } 401 - parameter check failed 845 * @throws { BusinessError } 6600101 - Session service exception. 846 * @throws { BusinessError } 6600102 - The session does not exist. 847 * @syscap SystemCapability.Multimedia.AVSession.Core 848 * @since 10 849 */ 850 dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback<void>): void; 851 852 /** 853 * Dispatch the session event of this session. 854 * @param { string } event - Session event name to dispatch 855 * @param { object } args - The parameters of session event 856 * @returns { Promise<void> } void promise when executed successfully 857 * @throws { BusinessError } 401 - parameter check failed 858 * @throws { BusinessError } 6600101 - Session service exception. 859 * @throws { BusinessError } 6600102 - The session does not exist. 860 * @syscap SystemCapability.Multimedia.AVSession.Core 861 * @since 10 862 */ 863 dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise<void>; 864 865 /** 866 * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. 867 * @param { Array<AVQueueItem> } items - An array of the AVQueueItem 868 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 869 * @throws { BusinessError } 401 - parameter check failed 870 * @throws { BusinessError } 6600101 - Session service exception. 871 * @throws { BusinessError } 6600102 - The session does not exist. 872 * @syscap SystemCapability.Multimedia.AVSession.Core 873 * @since 10 874 */ 875 setAVQueueItems(items: Array<AVQueueItem>, callback: AsyncCallback<void>): void; 876 877 /** 878 * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. 879 * @param { Array<AVQueueItem> } items - An array of the AVQueueItem 880 * @returns { Promise<void> } void promise when executed successfully 881 * @throws { BusinessError } 401 - parameter check failed 882 * @throws { BusinessError } 6600101 - Session service exception. 883 * @throws { BusinessError } 6600102 - The session does not exist. 884 * @syscap SystemCapability.Multimedia.AVSession.Core 885 * @since 10 886 */ 887 setAVQueueItems(items: Array<AVQueueItem>): Promise<void>; 888 889 /** 890 * Set the name of the playlist presented by this session. 891 * @param { string } title - The name of the playlist 892 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 893 * @throws { BusinessError } 401 - parameter check failed 894 * @throws { BusinessError } 6600101 - Session service exception. 895 * @throws { BusinessError } 6600102 - The session does not exist. 896 * @syscap SystemCapability.Multimedia.AVSession.Core 897 * @since 10 898 */ 899 setAVQueueTitle(title: string, callback: AsyncCallback<void>): void; 900 901 /** 902 * Set the name of the playlist presented by this session. 903 * @param { string } title - The name of the playlist 904 * @returns { Promise<void> } void promise when executed successfully 905 * @throws { BusinessError } 401 - parameter check failed 906 * @throws { BusinessError } 6600101 - Session service exception. 907 * @throws { BusinessError } 6600102 - The session does not exist. 908 * @syscap SystemCapability.Multimedia.AVSession.Core 909 * @since 10 910 */ 911 setAVQueueTitle(title: string): Promise<void>; 912 913 /** 914 * Set the custom media packets for this session. 915 * @param { object } extras - The custom media packets 916 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 917 * @throws { BusinessError } 401 - parameter check failed 918 * @throws { BusinessError } 6600101 - Session service exception. 919 * @throws { BusinessError } 6600102 - The session does not exist. 920 * @syscap SystemCapability.Multimedia.AVSession.Core 921 * @since 10 922 */ 923 setExtras(extras: {[key: string]: Object}, callback: AsyncCallback<void>): void; 924 925 /** 926 * Set the custom media packets for this session. 927 * @param { object } extras - The custom media packets 928 * @returns { Promise<void> } void promise when executed successfully 929 * @throws { BusinessError } 401 - parameter check failed 930 * @throws { BusinessError } 6600101 - Session service exception. 931 * @throws { BusinessError } 6600102 - The session does not exist. 932 * @syscap SystemCapability.Multimedia.AVSession.Core 933 * @since 10 934 */ 935 setExtras(extras: {[key: string]: Object}): Promise<void>; 936 937 /** 938 * Get the current session's own controller 939 * @param { AsyncCallback<AVSessionController> } callback - async callback for the AVSessionController. 940 * @throws { BusinessError } 6600101 - Session service exception. 941 * @throws { BusinessError } 6600102 - The session does not exist. 942 * @syscap SystemCapability.Multimedia.AVSession.Core 943 * @since 10 944 */ 945 getController(callback: AsyncCallback<AVSessionController>): void; 946 947 /** 948 * Get the current session's own controller 949 * @returns { Promise<AVSessionController> } Promise for the AVSessionController 950 * @throws { BusinessError } 6600101 - Session service exception. 951 * @throws { BusinessError } 6600102 - The session does not exist. 952 * @syscap SystemCapability.Multimedia.AVSession.Core 953 * @since 10 954 */ 955 getController(): Promise<AVSessionController>; 956 957 /** 958 * Get the cast controller when the session is casted to remote device. 959 * If the avsession is not under casting state, the controller will return null. 960 * @param { AsyncCallback<AVCastController> } callback - async callback for the AVCastController. 961 * @throws {BusinessError} 6600102 - {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist 962 * @throws {BusinessError} 6600110 - 6600109 - remote connection does not exist 963 * @syscap SystemCapability.Multimedia.AVSession.AVCast 964 * @since 10 965 */ 966 getAVCastController(callback: AsyncCallback<AVCastController>): void; 967 968 /** 969 * Get the cast controller when the session is casted to remote device. 970 * If the avsession is not under casting state, the controller will return null. 971 * @returns { Promise<AVCastController> } Promise for the AVCastController 972 * @throws {BusinessError} 6600102 - {@link #ERR_CODE_SESSION_NOT_EXIST} session does not exist 973 * @throws {BusinessError} 6600110 - 6600109 - remote connection does not exist 974 * @syscap SystemCapability.Multimedia.AVSession.AVCast 975 * @since 10 976 */ 977 getAVCastController(): Promise<AVCastController>; 978 979 /** 980 * Get output device information 981 * @param { AsyncCallback<OutputDeviceInfo> } callback - async callback for the OutputDeviceInfo. 982 * @throws { BusinessError } 6600101 - Session service exception. 983 * @throws { BusinessError } 6600102 - The session does not exist. 984 * @syscap SystemCapability.Multimedia.AVSession.Core 985 * @since 10 986 */ 987 getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void; 988 989 /** 990 * Get output device information 991 * @returns { Promise<OutputDeviceInfo> } Promise for the OutputDeviceInfo 992 * @throws { BusinessError } 6600101 - Session service exception. 993 * @throws { BusinessError } 6600102 - The session does not exist. 994 * @syscap SystemCapability.Multimedia.AVSession.Core 995 * @since 10 996 */ 997 getOutputDevice(): Promise<OutputDeviceInfo>; 998 999 /** 1000 * Get output device information 1001 * @returns { OutputDeviceInfo } the OutputDeviceInfo 1002 * @throws { BusinessError } 6600101 - Session service exception. 1003 * @throws { BusinessError } 6600102 - The session does not exist. 1004 * @syscap SystemCapability.Multimedia.AVSession.Core 1005 * @since 10 1006 */ 1007 getOutputDeviceSync(): OutputDeviceInfo; 1008 1009 /** 1010 * Register play command callback. 1011 * As long as it is registered, it means that the ability supports this command. 1012 * If you cancel the callback, you need to call off {@link off} 1013 * When canceling the callback, need to update the supported commands list. 1014 * Each playback command only supports registering one callback, 1015 * and the new callback will replace the previous one. 1016 * @param { 'play' } type - Command to register 'play'. 1017 * @param { function } callback - Used to handle ('play') command 1018 * @throws { BusinessError } 401 - parameter check failed 1019 * @throws { BusinessError } 6600101 - Session service exception. 1020 * @throws { BusinessError } 6600102 - The session does not exist. 1021 * @syscap SystemCapability.Multimedia.AVSession.Core 1022 * @since 10 1023 */ 1024 on(type: 'play', callback: () => void): void; 1025 1026 /** 1027 * Register pause command callback. 1028 * As long as it is registered, it means that the ability supports this command. 1029 * If you cancel the callback, you need to call off {@link off} 1030 * When canceling the callback, need to update the supported commands list. 1031 * Each playback command only supports registering one callback, 1032 * and the new callback will replace the previous one. 1033 * @param { 'pause' } type - Command to register 'pause'. 1034 * @param { function } callback - Used to handle ('pause') command 1035 * @throws { BusinessError } 401 - parameter check failed 1036 * @throws { BusinessError } 6600101 - Session service exception. 1037 * @throws { BusinessError } 6600102 - The session does not exist. 1038 * @syscap SystemCapability.Multimedia.AVSession.Core 1039 * @since 10 1040 */ 1041 on(type: 'pause', callback: () => void): void; 1042 1043 /** 1044 * Register stop command callback. 1045 * As long as it is registered, it means that the ability supports this command. 1046 * If you cancel the callback, you need to call off {@link off} 1047 * When canceling the callback, need to update the supported commands list. 1048 * Each playback command only supports registering one callback, 1049 * and the new callback will replace the previous one. 1050 * @param { 'stop' } type - Command to register 'stop'. 1051 * @param { function } callback - Used to handle ('stop') command 1052 * @throws { BusinessError } 401 - parameter check failed 1053 * @throws { BusinessError } 6600101 - Session service exception. 1054 * @throws { BusinessError } 6600102 - The session does not exist. 1055 * @syscap SystemCapability.Multimedia.AVSession.Core 1056 * @since 10 1057 */ 1058 on(type: 'stop', callback: () => void): void; 1059 1060 /** 1061 * Register playNext command callback. 1062 * As long as it is registered, it means that the ability supports this command. 1063 * If you cancel the callback, you need to call off {@link off} 1064 * When canceling the callback, need to update the supported commands list. 1065 * Each playback command only supports registering one callback, 1066 * and the new callback will replace the previous one. 1067 * @param { 'playNext' } type - Command to register 'playNext'. 1068 * @param { function } callback - Used to handle ('playNext') command 1069 * @throws { BusinessError } 401 - parameter check failed 1070 * @throws { BusinessError } 6600101 - Session service exception. 1071 * @throws { BusinessError } 6600102 - The session does not exist. 1072 * @syscap SystemCapability.Multimedia.AVSession.Core 1073 * @since 10 1074 */ 1075 on(type: 'playNext', callback: () => void): void; 1076 1077 /** 1078 * Register playPrevious command callback. 1079 * As long as it is registered, it means that the ability supports this command. 1080 * If you cancel the callback, you need to call off {@link off} 1081 * When canceling the callback, need to update the supported commands list. 1082 * Each playback command only supports registering one callback, 1083 * and the new callback will replace the previous one. 1084 * @param { 'playPrevious' } type - Command to register 'playPrevious'. 1085 * @param { function } callback - Used to handle ('playPrevious') command 1086 * @throws { BusinessError } 401 - parameter check failed 1087 * @throws { BusinessError } 6600101 - Session service exception. 1088 * @throws { BusinessError } 6600102 - The session does not exist. 1089 * @syscap SystemCapability.Multimedia.AVSession.Core 1090 * @since 10 1091 */ 1092 on(type: 'playPrevious', callback: () => void): void; 1093 1094 /** 1095 * Register fastForward command callback. 1096 * As long as it is registered, it means that the ability supports this command. 1097 * If you cancel the callback, you need to call off {@link off} 1098 * When canceling the callback, need to update the supported commands list. 1099 * Each playback command only supports registering one callback, 1100 * and the new callback will replace the previous one. 1101 * @param { 'fastForward' } type - Command to register 'fastForward'. 1102 * @param { function } callback - Used to handle ('fastForward') command 1103 * @throws { BusinessError } 401 - parameter check failed 1104 * @throws { BusinessError } 6600101 - Session service exception. 1105 * @throws { BusinessError } 6600102 - The session does not exist. 1106 * @syscap SystemCapability.Multimedia.AVSession.Core 1107 * @since 10 1108 */ 1109 on(type: 'fastForward', callback: (time ?: number) => void): void; 1110 1111 /** 1112 * Register rewind command callback. 1113 * As long as it is registered, it means that the ability supports this command. 1114 * If you cancel the callback, you need to call off {@link off} 1115 * When canceling the callback, need to update the supported commands list. 1116 * Each playback command only supports registering one callback, 1117 * and the new callback will replace the previous one. 1118 * @param { 'rewind' } type - Command to register 'rewind'. 1119 * @param { function } callback - Used to handle ('rewind') command 1120 * @throws { BusinessError } 401 - parameter check failed 1121 * @throws { BusinessError } 6600101 - Session service exception. 1122 * @throws { BusinessError } 6600102 - The session does not exist. 1123 * @syscap SystemCapability.Multimedia.AVSession.Core 1124 * @since 10 1125 */ 1126 on(type: 'rewind', callback: (time ?: number) => void): void; 1127 1128 /** 1129 * Unregister play command callback. 1130 * When canceling the callback, need to update the supported commands list. 1131 * @param { 'play' } type - Command to register 'play'. 1132 * @param { function } callback - Used to handle ('play') command 1133 * @throws { BusinessError } 401 - parameter check failed 1134 * @throws { BusinessError } 6600101 - Session service exception. 1135 * @throws { BusinessError } 6600102 - The session does not exist. 1136 * @syscap SystemCapability.Multimedia.AVSession.Core 1137 * @since 10 1138 */ 1139 off(type: 'play', callback?: () => void): void; 1140 1141 /** 1142 * Unregister pause command callback. 1143 * When canceling the callback, need to update the supported commands list. 1144 * @param { 'pause' } type - Command to register 'pause'. 1145 * @param { function } callback - Used to handle ('pause') command 1146 * @throws { BusinessError } 401 - parameter check failed 1147 * @throws { BusinessError } 6600101 - Session service exception. 1148 * @throws { BusinessError } 6600102 - The session does not exist. 1149 * @syscap SystemCapability.Multimedia.AVSession.Core 1150 * @since 10 1151 */ 1152 off(type: 'pause', callback?: () => void): void; 1153 1154 /** 1155 * Unregister stop command callback. 1156 * When canceling the callback, need to update the supported commands list. 1157 * @param { 'stop' } type - Command to register 'stop'. 1158 * @param { function } callback - Used to handle ('stop') command 1159 * @throws { BusinessError } 401 - parameter check failed 1160 * @throws { BusinessError } 6600101 - Session service exception. 1161 * @throws { BusinessError } 6600102 - The session does not exist. 1162 * @syscap SystemCapability.Multimedia.AVSession.Core 1163 * @since 10 1164 */ 1165 off(type: 'stop', callback?: () => void): void; 1166 1167 /** 1168 * Unregister playNext command callback. 1169 * When canceling the callback, need to update the supported commands list. 1170 * @param { 'playNext' } type - Command to register 'playNext'. 1171 * @param { function } callback - Used to handle ('playNext') command 1172 * @throws { BusinessError } 401 - parameter check failed 1173 * @throws { BusinessError } 6600101 - Session service exception. 1174 * @throws { BusinessError } 6600102 - The session does not exist. 1175 * @syscap SystemCapability.Multimedia.AVSession.Core 1176 * @since 10 1177 */ 1178 off(type: 'playNext', callback?: () => void): void; 1179 1180 /** 1181 * Unregister playPrevious command callback. 1182 * When canceling the callback, need to update the supported commands list. 1183 * @param { 'playPrevious' } type - Command to register 'playPrevious'. 1184 * @param { function } callback - Used to handle ('playPrevious') command 1185 * @throws { BusinessError } 401 - parameter check failed 1186 * @throws { BusinessError } 6600101 - Session service exception. 1187 * @throws { BusinessError } 6600102 - The session does not exist. 1188 * @syscap SystemCapability.Multimedia.AVSession.Core 1189 * @since 10 1190 */ 1191 off(type: 'playPrevious', callback?: () => void): void; 1192 1193 /** 1194 * Unregister fastForward command callback. 1195 * When canceling the callback, need to update the supported commands list. 1196 * @param { 'fastForward' } type - Command to register 'fastForward'. 1197 * @param { function } callback - Used to handle ('fastForward') command 1198 * @throws { BusinessError } 401 - parameter check failed 1199 * @throws { BusinessError } 6600101 - Session service exception. 1200 * @throws { BusinessError } 6600102 - The session does not exist. 1201 * @syscap SystemCapability.Multimedia.AVSession.Core 1202 * @since 10 1203 */ 1204 off(type: 'fastForward', callback?: () => void): void; 1205 1206 /** 1207 * Unregister rewind command callback. 1208 * When canceling the callback, need to update the supported commands list. 1209 * @param { 'rewind' } type - Command to register 'rewind'. 1210 * @param { function } callback - Used to handle ('rewind') command 1211 * @throws { BusinessError } 401 - parameter check failed 1212 * @throws { BusinessError } 6600101 - Session service exception. 1213 * @throws { BusinessError } 6600102 - The session does not exist. 1214 * @syscap SystemCapability.Multimedia.AVSession.Core 1215 * @since 10 1216 */ 1217 off(type: 'rewind', callback?: () => void): void; 1218 1219 /** 1220 * Register playFromAssetId command callback. 1221 * As long as it is registered, it means that the ability supports this command. 1222 * If you cancel the callback, you need to call off {@link off} 1223 * When canceling the callback, need to update the supported commands list. 1224 * Each playback command only supports registering one callback, 1225 * and the new callback will replace the previous one. 1226 * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. 1227 * @param { function } callback - Used to handle ('playFromAssetId') command 1228 * @throws { BusinessError } 401 - parameter check failed 1229 * @throws { BusinessError } 6600101 - Session service exception. 1230 * @throws { BusinessError } 6600102 - The session does not exist. 1231 * @syscap SystemCapability.Multimedia.AVSession.Core 1232 * @since 11 1233 */ 1234 on(type: 'playFromAssetId', callback: (assetId: number) => void): void; 1235 1236 /** 1237 * Unregister playFromAssetId command callback. 1238 * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. 1239 * @param { function } callback - Used to handle ('playFromAssetId') command 1240 * @throws { BusinessError } 401 - parameter check 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 11 1245 */ 1246 off(type: 'playFromAssetId', callback?: (assetId: number) => void): void; 1247 1248 /** 1249 * Register seek command callback 1250 * @param { 'seek' } type - Registration Type 'seek' 1251 * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) 1252 * @throws { BusinessError } 401 - parameter check failed 1253 * @throws { BusinessError } 6600101 - Session service exception. 1254 * @throws { BusinessError } 6600102 - The session does not exist. 1255 * @syscap SystemCapability.Multimedia.AVSession.Core 1256 * @since 10 1257 */ 1258 on(type: 'seek', callback: (time: number) => void): void; 1259 1260 /** 1261 * Unregister seek command callback 1262 * @param { 'seek' } type - Registration Type 'seek' 1263 * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) 1264 * @throws { BusinessError } 401 - parameter check failed 1265 * @throws { BusinessError } 6600101 - Session service exception. 1266 * @throws { BusinessError } 6600102 - The session does not exist. 1267 * @syscap SystemCapability.Multimedia.AVSession.Core 1268 * @since 10 1269 */ 1270 off(type: 'seek', callback?: (time: number) => void): void; 1271 1272 /** 1273 * Register setSpeed command callback 1274 * @param { 'setSpeed' } type - Registration Type 'setSpeed' 1275 * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value 1276 * @throws { BusinessError } 401 - parameter check failed 1277 * @throws { BusinessError } 6600101 - Session service exception. 1278 * @throws { BusinessError } 6600102 - The session does not exist. 1279 * @syscap SystemCapability.Multimedia.AVSession.Core 1280 * @since 10 1281 */ 1282 on(type: 'setSpeed', callback: (speed: number) => void): void; 1283 1284 /** 1285 * Unregister setSpeed command callback 1286 * @param { 'setSpeed' } type - Registration Type 'setSpeed' 1287 * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value 1288 * @throws { BusinessError } 401 - parameter check failed 1289 * @throws { BusinessError } 6600101 - Session service exception. 1290 * @throws { BusinessError } 6600102 - The session does not exist. 1291 * @syscap SystemCapability.Multimedia.AVSession.Core 1292 * @since 10 1293 */ 1294 off(type: 'setSpeed', callback?: (speed: number) => void): void; 1295 1296 /** 1297 * Register setLoopMode command callback 1298 * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' 1299 * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} 1300 * @throws { BusinessError } 401 - parameter check failed 1301 * @throws { BusinessError } 6600101 - Session service exception. 1302 * @throws { BusinessError } 6600102 - The session does not exist. 1303 * @syscap SystemCapability.Multimedia.AVSession.Core 1304 * @since 10 1305 */ 1306 on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void; 1307 1308 /** 1309 * Unregister setLoopMode command callback 1310 * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' 1311 * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} 1312 * @throws { BusinessError } 401 - parameter check failed 1313 * @throws { BusinessError } 6600101 - Session service exception. 1314 * @throws { BusinessError } 6600102 - The session does not exist. 1315 * @syscap SystemCapability.Multimedia.AVSession.Core 1316 * @since 10 1317 */ 1318 off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void; 1319 1320 /** 1321 * Register toggle favorite command callback 1322 * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' 1323 * @param { function } callback - Used to handle toggleFavorite command.The callback provides 1324 * the assetId for which the favorite status needs to be switched. 1325 * @throws { BusinessError } 401 - parameter check failed 1326 * @throws { BusinessError } 6600101 - Session service exception. 1327 * @throws { BusinessError } 6600102 - The session does not exist. 1328 * @syscap SystemCapability.Multimedia.AVSession.Core 1329 * @since 10 1330 */ 1331 on(type: 'toggleFavorite', callback: (assetId: string) => void): void; 1332 1333 /** 1334 * Unregister toggle favorite command callback 1335 * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' 1336 * @param { function } callback - Used to handle toggleFavorite command.The callback provides 1337 * the assetId for which the favorite status needs to be switched. 1338 * @throws { BusinessError } 401 - parameter check failed 1339 * @throws { BusinessError } 6600101 - Session service exception. 1340 * @throws { BusinessError } 6600102 - The session does not exist. 1341 * @syscap SystemCapability.Multimedia.AVSession.Core 1342 * @since 10 1343 */ 1344 off(type: 'toggleFavorite', callback?: (assetId: string) => void): void; 1345 1346 /** 1347 * Register media key handling callback 1348 * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' 1349 * @param { function } callback - Used to handle key events.The callback provides the KeyEvent 1350 * @throws { BusinessError } 401 - parameter check failed 1351 * @throws { BusinessError } 6600101 - Session service exception. 1352 * @throws { BusinessError } 6600102 - The session does not exist. 1353 * @syscap SystemCapability.Multimedia.AVSession.Core 1354 * @since 10 1355 */ 1356 on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void; 1357 1358 /** 1359 * Unregister media key handling callback 1360 * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' 1361 * @param { function } callback - Used to handle key events.The callback provides the KeyEvent 1362 * @throws { BusinessError } 401 - parameter check failed 1363 * @throws { BusinessError } 6600101 - Session service exception. 1364 * @throws { BusinessError } 6600102 - The session does not exist. 1365 * @syscap SystemCapability.Multimedia.AVSession.Core 1366 * @since 10 1367 */ 1368 off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void; 1369 1370 /** 1371 * Register session output device change callback 1372 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 1373 * @param { function } callback - Used to handle output device changed. 1374 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 1375 * @throws { BusinessError } 401 - parameter check failed 1376 * @throws { BusinessError } 6600101 - Session service exception 1377 * @throws { BusinessError } 6600102 - The session does not exist 1378 * @syscap SystemCapability.Multimedia.AVSession.Core 1379 * @since 10 1380 */ 1381 on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 1382 1383 /** 1384 * Unregister session output device change callback 1385 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 1386 * @param { function } callback - Used to handle output device changed. 1387 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 1388 * @throws { BusinessError } 401 - parameter check failed 1389 * @throws { BusinessError } 6600101 - Session service exception 1390 * @throws { BusinessError } 6600102 - The session does not exist 1391 * @syscap SystemCapability.Multimedia.AVSession.Core 1392 * @since 10 1393 */ 1394 off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 1395 1396 /** 1397 * Register session custom command change callback 1398 * @param { 'commonCommand' } type - Registration Type 'commonCommand' 1399 * @param { function } callback - Used to handle event when the common command is received 1400 * The callback provide the command name and command args 1401 * @throws { BusinessError } 401 - parameter check failed 1402 * @throws { BusinessError } 6600101 - Session service exception. 1403 * @throws { BusinessError } 6600102 - The session does not exist. 1404 * @syscap SystemCapability.Multimedia.AVSession.Core 1405 * @since 10 1406 */ 1407 on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Object}) => void): void; 1408 1409 /** 1410 * Unregister session custom command change callback 1411 * @param { 'commonCommand' } type - Registration Type 'commonCommand' 1412 * @param { function } callback - Used to cancel a specific listener 1413 * The callback provide the command name and command args 1414 * @throws { BusinessError } 401 - parameter check failed 1415 * @throws { BusinessError } 6600101 - Session service exception. 1416 * @throws { BusinessError } 6600102 - The session does not exist. 1417 * @syscap SystemCapability.Multimedia.AVSession.Core 1418 * @since 10 1419 */ 1420 off(type: 'commonCommand', callback?: (command: string, args: {[key: string]: Object}) => void): void; 1421 1422 /** 1423 * Register the item to play from the playlist change callback 1424 * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' 1425 * @param { function } callback - Used to handle the item to be played. 1426 * The callback provide the new device info {@link OutputDeviceInfo} 1427 * @throws { BusinessError } 401 - parameter check failed 1428 * @throws { BusinessError } 6600101 - Session service exception. 1429 * @throws { BusinessError } 6600102 - The session does not exist. 1430 * @syscap SystemCapability.Multimedia.AVSession.Core 1431 * @since 10 1432 */ 1433 on(type: 'skipToQueueItem', callback: (itemId: number) => void): void; 1434 1435 /** 1436 * Unregister the item to play from the playlist change callback 1437 * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' 1438 * @param { function } callback - Used to handle the item to be played. 1439 * The callback provide the new device info {@link OutputDeviceInfo} 1440 * @throws { BusinessError } 401 - parameter check failed 1441 * @throws { BusinessError } 6600101 - Session service exception. 1442 * @throws { BusinessError } 6600102 - The session does not exist. 1443 * @syscap SystemCapability.Multimedia.AVSession.Core 1444 * @since 10 1445 */ 1446 off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void; 1447 1448 /** 1449 * Register answer command callback. 1450 * As long as it is registered, it means that the ability supports this command. 1451 * If you cancel the callback, you need to call off {@link off} 1452 * @param { 'answer' } type - Command to register 'answer'. 1453 * @param { Callback<void> } callback - Used to handle ('answer') command 1454 * @throws { BusinessError } 401 - parameter check failed 1455 * @throws { BusinessError } 6600101 - Session service exception. 1456 * @throws { BusinessError } 6600102 - The session does not exist. 1457 * @syscap SystemCapability.Multimedia.AVSession.Core 1458 * @since 11 1459 */ 1460 on(type: 'answer', callback: Callback<void>): void; 1461 1462 /** 1463 * Unregister answer command callback. 1464 * @param { 'answer' } type - Command to register 'answer'. 1465 * @param { Callback<void> } callback - Used to handle ('answer') command 1466 * @throws { BusinessError } 401 - parameter check failed 1467 * @throws { BusinessError } 6600101 - Session service exception. 1468 * @throws { BusinessError } 6600102 - The session does not exist. 1469 * @syscap SystemCapability.Multimedia.AVSession.Core 1470 * @since 11 1471 */ 1472 off(type: 'answer', callback?: Callback<void>): void; 1473 1474 /** 1475 * Register hangUp command callback. 1476 * As long as it is registered, it means that the ability supports this command. 1477 * If you cancel the callback, you need to call off {@link off} 1478 * @param { 'hangUp' } type - Command to register 'hangUp'. 1479 * @param { Callback<void> } callback - Used to handle ('hangUp') command 1480 * @throws { BusinessError } 401 - parameter check failed 1481 * @throws { BusinessError } 6600101 - Session service exception. 1482 * @throws { BusinessError } 6600102 - The session does not exist. 1483 * @syscap SystemCapability.Multimedia.AVSession.Core 1484 * @since 11 1485 */ 1486 on(type: 'hangUp', callback: Callback<void>): void; 1487 1488 /** 1489 * Unregister hangUp command callback. 1490 * @param { 'hangUp' } type - Command to register 'hangUp'. 1491 * @param { Callback<void> } callback - Used to handle ('hangUp') command 1492 * @throws { BusinessError } 401 - parameter check failed 1493 * @throws { BusinessError } 6600101 - Session service exception. 1494 * @throws { BusinessError } 6600102 - The session does not exist. 1495 * @syscap SystemCapability.Multimedia.AVSession.Core 1496 * @since 11 1497 */ 1498 off(type: 'hangUp', callback?: Callback<void>): void; 1499 1500 /** 1501 * Register toggleCallMute command callback. 1502 * As long as it is registered, it means that the ability supports this command. 1503 * If you cancel the callback, you need to call off {@link off} 1504 * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. 1505 * @param { Callback<void> } callback - Used to handle ('toggleCallMute') command 1506 * @throws { BusinessError } 401 - parameter check failed 1507 * @throws { BusinessError } 6600101 - Session service exception. 1508 * @throws { BusinessError } 6600102 - The session does not exist. 1509 * @syscap SystemCapability.Multimedia.AVSession.Core 1510 * @since 11 1511 */ 1512 on(type: 'toggleCallMute', callback: Callback<void>): void; 1513 1514 /** 1515 * Unregister toggleCallMute command callback. 1516 * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. 1517 * @param { Callback<void> } callback - Used to handle ('toggleCallMute') command 1518 * @throws { BusinessError } 401 - parameter check failed 1519 * @throws { BusinessError } 6600101 - Session service exception. 1520 * @throws { BusinessError } 6600102 - The session does not exist. 1521 * @syscap SystemCapability.Multimedia.AVSession.Core 1522 * @since 11 1523 */ 1524 off(type: 'toggleCallMute', callback?: Callback<void>): void; 1525 1526 /** 1527 * Stop current cast and disconnect device connection. 1528 * @param { AsyncCallback<void> } callback A callback instance used to return when cast stopped completed. 1529 * @throws { BusinessError } 6600109 - The remote connection is not established 1530 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1531 * @since 10 1532 */ 1533 stopCasting(callback: AsyncCallback<void>): void; 1534 1535 /** 1536 * Stop current cast and disconnect device connection. 1537 * @returns { Promise<void> } void result promise when executed successfully 1538 * @throws { BusinessError } 6600109 - The remote connection is not established 1539 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1540 * @since 10 1541 */ 1542 stopCasting(): Promise<void>; 1543 1544 /** 1545 * Activate the session, indicating that the session can accept control commands 1546 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the session is activated. 1547 * @throws { BusinessError } 6600101 - Session service exception. 1548 * @throws { BusinessError } 6600102 - The session does not exist. 1549 * @syscap SystemCapability.Multimedia.AVSession.Core 1550 * @since 10 1551 */ 1552 activate(callback: AsyncCallback<void>): void; 1553 1554 /** 1555 * Activate the session, indicating that the session can accept control commands 1556 * @returns { Promise<void> } void result promise when executed successfully 1557 * @throws { BusinessError } 6600101 - Session service exception. 1558 * @throws { BusinessError } 6600102 - The session does not exist. 1559 * @syscap SystemCapability.Multimedia.AVSession.Core 1560 * @since 10 1561 */ 1562 activate(): Promise<void>; 1563 1564 /** 1565 * Deactivate the session, indicating that the session not ready to accept control commands 1566 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the session is deactivated. 1567 * @throws { BusinessError } 6600101 - Session service exception. 1568 * @throws { BusinessError } 6600102 - The session does not exist. 1569 * @syscap SystemCapability.Multimedia.AVSession.Core 1570 * @since 10 1571 */ 1572 deactivate(callback: AsyncCallback<void>): void; 1573 1574 /** 1575 * Deactivate the session, indicating that the session not ready to accept control commands 1576 * @returns { Promise<void> } void promise when executed successfully 1577 * @throws { BusinessError } 6600101 - Session service exception. 1578 * @throws { BusinessError } 6600102 - The session does not exist. 1579 * @syscap SystemCapability.Multimedia.AVSession.Core 1580 * @since 10 1581 */ 1582 deactivate(): Promise<void>; 1583 1584 /** 1585 * Destroy this session, the server will clean up the session resources 1586 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1587 * @throws { BusinessError } 6600101 - Session service exception. 1588 * @throws { BusinessError } 6600102 - The session does not exist. 1589 * @syscap SystemCapability.Multimedia.AVSession.Core 1590 * @since 10 1591 */ 1592 destroy(callback: AsyncCallback<void>): void; 1593 1594 /** 1595 * Destroy this session, the server will clean up the session resources 1596 * @returns { Promise<void> } void promise when executed successfully 1597 * @throws { BusinessError } 6600101 - Session service exception. 1598 * @throws { BusinessError } 6600102 - The session does not exist. 1599 * @syscap SystemCapability.Multimedia.AVSession.Core 1600 * @since 10 1601 */ 1602 destroy(): Promise<void>; 1603 } 1604 1605 /** 1606 * The type of control command 1607 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1608 * @since 10 1609 */ 1610 type AVCastControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 1611 'seek' | 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute'; 1612 1613 /** 1614 * The definition of command to be sent to the session 1615 * @interface AVCastControlCommand 1616 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1617 * @since 10 1618 */ 1619 interface AVCastControlCommand { 1620 /** 1621 * The command value {@link AVCastControlCommandType} 1622 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1623 * @since 10 1624 */ 1625 command: AVCastControlCommandType; 1626 1627 /** 1628 * Parameter carried in the command. 1629 * The seek command must carry the number parameter. 1630 * The setVolume command must carry the number parameter. 1631 * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. 1632 * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. 1633 * The setLoopMode command must carry the {@link LoopMode} parameter. 1634 * Other commands do not need to carry parameters. 1635 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1636 * @since 10 1637 */ 1638 parameter?: media.PlaybackSpeed | number | string | LoopMode; 1639 } 1640 1641 /** 1642 * AVCastController definition used to implement a remote control when a cast is connected 1643 * @interface AVCastController 1644 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1645 * @since 10 1646 */ 1647 interface AVCastController { 1648 /** 1649 * Set a surface instance to display playing view, used at sink side. 1650 * @param { string } surfaceId - surface id, video player will use this id get a surface instance. 1651 * @param { AsyncCallback<void> } callback - A callback instance used to return when set surface completed. 1652 * @throws { BusinessError } 401 - parameter check failed 1653 * @throws { BusinessError } 6600109 - The remote connection is not established 1654 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1655 * @systemapi 1656 * @since 10 1657 */ 1658 setDisplaySurface(surfaceId: string, callback: AsyncCallback<void>): void; 1659 1660 /** 1661 * Set a surface instance to display playing view, used at sink side. 1662 * @param { string } surfaceId - surface id, video player will use this id get a surface instance. 1663 * @returns { Promise<void> } Promise used to return the result. 1664 * @throws { BusinessError } 401 - parameter check failed 1665 * @throws { BusinessError } 6600109 - The remote connection is not established 1666 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1667 * @systemapi 1668 * @since 10 1669 */ 1670 setDisplaySurface(surfaceId: string): Promise<void>; 1671 1672 /** 1673 * Get the playback status of the current player 1674 * @param { AsyncCallback<AVPlaybackState> } callback - The triggered asyncCallback when (getAVPlaybackState). 1675 * @throws { BusinessError } 6600101 - Session service exception 1676 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1677 * @since 10 1678 */ 1679 getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void; 1680 1681 /** 1682 * Get the playback status of the current player 1683 * @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise 1684 * @throws { BusinessError } 6600101 - Session service exception 1685 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1686 * @since 10 1687 */ 1688 getAVPlaybackState(): Promise<AVPlaybackState>; 1689 1690 /** 1691 * Send control commands to remote player 1692 * @param { AVCastControlCommand } command The command to be send. 1693 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1694 * @throws { BusinessError } 401 - parameter check failed 1695 * @throws { BusinessError } 6600101 - Session service exception 1696 * @throws { BusinessError } 6600105 - Invalid session command 1697 * @throws { BusinessError } 6600109 - The remote connection is not established 1698 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1699 * @since 10 1700 */ 1701 sendControlCommand(command: AVCastControlCommand, callback: AsyncCallback<void>): void; 1702 1703 /** 1704 * Send control commands to remote player 1705 * @param { AVCastControlCommand } command The command to be send. 1706 * @returns { Promise<void> } Promise used to return the result. 1707 * @throws { BusinessError } 401 - parameter check failed 1708 * @throws { BusinessError } 6600101 - Session service exception 1709 * @throws { BusinessError } 6600105 - Invalid session command 1710 * @throws { BusinessError } 6600109 - The remote connection is not established 1711 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1712 * @since 10 1713 */ 1714 sendControlCommand(command: AVCastControlCommand): Promise<void>; 1715 1716 /** 1717 * Play the current item, should contain mediaUri otherwise the playback will fail. 1718 * @param { AVQueueItem } item media item info. 1719 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1720 * @throws {BusinessError} 401 - parameter check failed 1721 * @throws {BusinessError} 6600101 - Session service exception 1722 * @throws {BusinessError} 6600109 - The remote connection is not established 1723 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1724 * @since 10 1725 */ 1726 start(item: AVQueueItem, callback: AsyncCallback<void>): void; 1727 1728 /** 1729 * Play the current item, should contain mediaUri otherwise the playback will fail. 1730 * @param { AVQueueItem } item media item info. 1731 * @returns { Promise<void> } Promise used to return the result. 1732 * @throws {BusinessError} 401 - parameter check failed 1733 * @throws {BusinessError} 6600101 - Session service exception 1734 * @throws {BusinessError} 6600109 - The remote connection is not established 1735 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1736 * @since 10 1737 */ 1738 start(item: AVQueueItem): Promise<void>; 1739 1740 /** 1741 * Load the current item and mediaUri can be null, this is needed for sink media information displaying 1742 * @param { AVQueueItem } item media item info. 1743 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 1744 * @throws {BusinessError} 401 - parameter check failed 1745 * @throws {BusinessError} 6600101 - Session service exception 1746 * @throws {BusinessError} 6600109 - The remote connection is not established 1747 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1748 * @since 10 1749 */ 1750 prepare(item: AVQueueItem, callback: AsyncCallback<void>): void; 1751 1752 /** 1753 * Load the current item and mediaUri can be null, this is needed for sink media information displaying 1754 * @param { AVQueueItem } item media item info. 1755 * @returns { Promise<void> } Promise used to return the result. 1756 * @throws {BusinessError} 401 - parameter check failed 1757 * @throws {BusinessError} 6600101 - Session service exception 1758 * @throws {BusinessError} 6600109 - The remote connection is not established 1759 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1760 * @since 10 1761 */ 1762 prepare(item: AVQueueItem): Promise<void>; 1763 1764 /** 1765 * Get the current playing item 1766 * @param { AsyncCallback<AVQueueItem> } callback - The triggered asyncCallback. 1767 * @throws { BusinessError } 6600101 - Session service exception 1768 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1769 * @since 10 1770 */ 1771 getCurrentItem(callback: AsyncCallback<AVQueueItem>): void; 1772 1773 /** 1774 * Get the current playing item 1775 * @returns { Promise<AVQueueItem> } (AVQueueItem) returned through promise 1776 * @throws { BusinessError } 6600101 - Session service exception 1777 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1778 * @since 10 1779 */ 1780 getCurrentItem(): Promise<AVQueueItem>; 1781 1782 /** 1783 * Get commands supported by the current cast controller 1784 * @param { AsyncCallback<Array<AVCastControlCommandType>> } callback - The triggered asyncCallback when (getValidCommands). 1785 * @throws { BusinessError } 6600101 - Session service exception. 1786 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1787 * @since 11 1788 */ 1789 getValidCommands(callback: AsyncCallback<Array<AVCastControlCommandType>>): void; 1790 1791 /** 1792 * Get commands supported by the current cast controller 1793 * @returns { Promise<Array<AVCastControlCommandType>> } array of AVCastControlCommandType promise 1794 * @throws { BusinessError } 6600101 - Session service exception. 1795 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1796 * @since 11 1797 */ 1798 getValidCommands(): Promise<Array<AVCastControlCommandType>>; 1799 1800 /** 1801 * Destroy the controller 1802 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 1803 * @throws { BusinessError } 6600101 - Session service exception. 1804 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1805 * @since 11 1806 */ 1807 release(callback: AsyncCallback<void>): void; 1808 1809 /** 1810 * Destroy the controller 1811 * @returns { Promise<void> } void promise when executed successfully 1812 * @throws { BusinessError } 6600101 - Session service exception. 1813 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1814 * @since 11 1815 */ 1816 release(): Promise<void>; 1817 1818 /** 1819 * Register playback state changed callback 1820 * @param { 'playbackStateChange' } type 1821 * @param { Array<keyof AVPlaybackState> | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about 1822 * @param { function } callback - The callback used to handle playback state changed event. 1823 * The callback function provides the {@link AVPlaybackState} parameter. 1824 * @throws { BusinessError } 401 - parameter check failed 1825 * @throws { BusinessError } 6600101 - Session service exception 1826 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1827 * @since 10 1828 */ 1829 on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void): void; 1830 1831 /** 1832 * Unregister playback state changed callback 1833 * @param { 'playbackStateChange' } type 1834 * @param { function } callback - The callback used to handle playback state changed event. 1835 * The callback function provides the {@link AVPlaybackState} parameter. 1836 * @throws { BusinessError } 401 - parameter check failed 1837 * @throws { BusinessError } 6600101 - Session service exception 1838 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1839 * @since 10 1840 */ 1841 off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void): void; 1842 1843 /** 1844 * Register listener for current media item playback events. 1845 * @param { 'mediaItemChange' } type Type of the playback event to listen for. 1846 * @param { Callback<AVQueueItem> } callback Callback used to listen for current item changed. 1847 * @throws { BusinessError } 401 - parameter check failed 1848 * @throws { BusinessError } 6600101 - Session service exception 1849 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1850 * @since 10 1851 */ 1852 on(type: 'mediaItemChange', callback: Callback<AVQueueItem>): void; 1853 1854 /** 1855 * Unregister listener for current media item playback events. 1856 * @param { 'mediaItemChange' } type Type of the playback event to listen for. 1857 * @throws { BusinessError } 401 - parameter check failed 1858 * @throws { BusinessError } 6600101 - Session service exception 1859 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1860 * @since 10 1861 */ 1862 off(type: 'mediaItemChange'): void; 1863 1864 /** 1865 * Register playback command callback sent by remote side or media center. 1866 * Application needs update the new media resource when receive these commands by using playItem. 1867 * @param { 'playNext' } type - Type of the 'playNext' event to listen for. 1868 * @param { Callback<void> } callback - Used to handle 'playNext' command 1869 * @throws { BusinessError } 401 - parameter check failed 1870 * @throws { BusinessError } 6600101 - Session service exception 1871 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1872 * @since 10 1873 */ 1874 on(type: 'playNext', callback: Callback<void>): void; 1875 1876 /** 1877 * Unregister playback command callback sent by remote side or media center. 1878 * When canceling the callback, need to update the supported commands list. 1879 * @param { 'playNext' } type - Type of the 'playNext' event to listen for. 1880 * @throws { BusinessError } 401 - parameter check failed 1881 * @throws { BusinessError } 6600101 - Session service exception 1882 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1883 * @since 10 1884 */ 1885 off(type: 'playNext'): void; 1886 1887 /** 1888 * Register playback command callback sent by remote side or media center. 1889 * Application needs update the new media resource when receive these commands by using playItem. 1890 * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. 1891 * @param { Callback<void> } callback - Used to handle 'playPrevious' command 1892 * @throws { BusinessError } 401 - parameter check failed 1893 * @throws { BusinessError } 6600101 - Session service exception 1894 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1895 * @since 10 1896 */ 1897 on(type: 'playPrevious', callback: Callback<void>): void; 1898 1899 /** 1900 * Unregister playback command callback sent by remote side or media center. 1901 * When canceling the callback, need to update the supported commands list. 1902 * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. 1903 * @throws { BusinessError } 401 - parameter check failed 1904 * @throws { BusinessError } 6600101 - Session service exception 1905 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1906 * @since 10 1907 */ 1908 off(type: 'playPrevious'): void; 1909 1910 /** 1911 * Register requested playback command callback sent by remote side or media center. 1912 * The AVQueueItem may include the requested assetId, starting position and other configurations. 1913 * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. 1914 * @param { Callback<AVQueueItem> } callback - Used to handle 'requestPlay' command 1915 * @throws { BusinessError } 401 - parameter check failed 1916 * @throws { BusinessError } 6600101 - Session service exception 1917 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1918 * @since 11 1919 */ 1920 on(type: 'requestPlay', callback: Callback<AVQueueItem>): void; 1921 1922 /** 1923 * Unregister requested playback command callback sent by remote side or media center. 1924 * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. 1925 * @param { Callback<AVQueueItem> } callback - Used to handle 'requestPlay' command 1926 * @throws { BusinessError } 401 - parameter check failed 1927 * @throws { BusinessError } 6600101 - Session service exception 1928 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1929 * @since 11 1930 */ 1931 off(type: 'requestPlay', callback?: Callback<AVQueueItem>): void; 1932 1933 /** 1934 * Register endOfStream state callback. 1935 * Application needs update the new media resource when receive these commands by using playItem. 1936 * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. 1937 * @param { Callback<void> } callback - Used to handle 'endOfStream' command 1938 * @throws { BusinessError } 401 - parameter check failed 1939 * @throws { BusinessError } 6600101 - Session service exception 1940 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1941 * @since 11 1942 */ 1943 on(type: 'endOfStream', callback: Callback<void>): void; 1944 1945 /** 1946 * Unregister endOfStream state callback. 1947 * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. 1948 * @param { Callback<void> } callback - Used to handle 'endOfStream' command 1949 * @throws { BusinessError } 401 - parameter check failed 1950 * @throws { BusinessError } 6600101 - Session service exception 1951 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1952 * @since 11 1953 */ 1954 off(type: 'endOfStream', callback?: Callback<void>): void; 1955 1956 /** 1957 * Register listens for playback events. 1958 * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. 1959 * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event. 1960 * @throws { BusinessError } 401 - parameter check failed 1961 * @throws { BusinessError } 6600101 - Session service exception 1962 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1963 * @since 10 1964 */ 1965 on(type: 'seekDone', callback: Callback<number>): void; 1966 1967 /** 1968 * Unregister listens for playback events. 1969 * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. 1970 * @throws { BusinessError } 401 - parameter check failed 1971 * @throws { BusinessError } 6600101 - Session service exception 1972 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1973 * @since 10 1974 */ 1975 off(type: 'seekDone'): void; 1976 1977 /** 1978 * Register the valid commands of the casted session changed callback 1979 * @param { 'validCommandChange' } type - 'validCommandChange' 1980 * @param { Callback<Array<AVCastControlCommandType>> } callback - The callback used to handle the changes. 1981 * The callback function provides an array of AVCastControlCommandType. 1982 * @throws { BusinessError } 401 - parameter check failed 1983 * @throws { BusinessError } 6600101 - Session service exception. 1984 * @throws { BusinessError } 6600103 - The session controller does not exist. 1985 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1986 * @since 11 1987 */ 1988 on(type: 'validCommandChange', callback: Callback<Array<AVCastControlCommandType>>); 1989 1990 /** 1991 * Unregister the valid commands of the casted session changed callback 1992 * @param { 'validCommandChange' } type - 'validCommandChange' 1993 * @param { Callback<Array<AVCastControlCommandType>> } callback - The callback used to handle the changes. 1994 * The callback function provides an array of AVCastControlCommandType. 1995 * @throws { BusinessError } 401 - parameter check failed 1996 * @throws { BusinessError } 6600101 - Session service exception. 1997 * @throws { BusinessError } 6600103 - The session controller does not exist. 1998 * @syscap SystemCapability.Multimedia.AVSession.AVCast 1999 * @since 11 2000 */ 2001 off(type: 'validCommandChange', callback?: Callback<Array<AVCastControlCommandType>>); 2002 2003 /** 2004 * Register listener for video size change event, used at remote side. 2005 * @param { 'videoSizeChange' } type - Type of the 'videoSizeChange' to listen for. 2006 * @param { function } callback - Callback used to return video size. 2007 * @throws { BusinessError } 401 - parameter check failed 2008 * @throws { BusinessError } 6600101 - Session service exception 2009 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2010 * @systemapi 2011 * @since 10 2012 */ 2013 on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void; 2014 2015 /** 2016 * Unregister listener for video size change event, used at remote side. 2017 * @param { 'videoSizeChange' } type - Type of the 'videoSizeChange' to listen for. 2018 * @throws { BusinessError } 401 - parameter check failed 2019 * @throws { BusinessError } 6600101 - Session service exception 2020 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2021 * @systemapi 2022 * @since 10 2023 */ 2024 off(type: 'videoSizeChange'): void; 2025 2026 /** 2027 * Register listeners for playback error events. 2028 * @param { 'error' } type Type of the 'error' to listen for. 2029 * @param { ErrorCallback } callback Callback used to listen for the playback error event. 2030 * @throws { BusinessError } 401 - parameter check failed 2031 * @throws { BusinessError } 5400101 - No memory. 2032 * @throws { BusinessError } 5400102 - Operation not allowed. 2033 * @throws { BusinessError } 5400103 - I/O error. 2034 * @throws { BusinessError } 5400104 - Time out. 2035 * @throws { BusinessError } 5400105 - Service died. 2036 * @throws { BusinessError } 5400106 - Unsupport format. 2037 * @throws { BusinessError } 6600101 - Session service exception 2038 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2039 * @since 10 2040 */ 2041 on(type: 'error', callback: ErrorCallback): void; 2042 2043 /** 2044 * Unregister listens for playback error events. 2045 * @param { 'error' } type Type of the 'error' to listen for. 2046 * @throws { BusinessError } 401 - parameter check failed 2047 * @throws { BusinessError } 5400101 - No memory. 2048 * @throws { BusinessError } 5400102 - Operation not allowed. 2049 * @throws { BusinessError } 5400103 - I/O error. 2050 * @throws { BusinessError } 5400104 - Time out. 2051 * @throws { BusinessError } 5400105 - Service died. 2052 * @throws { BusinessError } 5400106 - Unsupport format. 2053 * @throws { BusinessError } 6600101 - Session service exception 2054 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2055 * @since 10 2056 */ 2057 off(type: 'error'): void; 2058 } 2059 2060 /** 2061 * Define the device connection state. 2062 * @enum { number } 2063 * @syscap SystemCapability.Multimedia.AVSession.Core 2064 * @since 10 2065 */ 2066 enum ConnectionState { 2067 /** 2068 * A connection state indicating the device is in the process of connecting. 2069 * @syscap SystemCapability.Multimedia.AVSession.Core 2070 * @since 10 2071 */ 2072 STATE_CONNECTING = 0, 2073 2074 /** 2075 * A connection state indicating the device is connected. 2076 * @syscap SystemCapability.Multimedia.AVSession.Core 2077 * @since 10 2078 */ 2079 STATE_CONNECTED = 1, 2080 2081 /** 2082 * The default connection state indicating the device is disconnected. 2083 * @syscap SystemCapability.Multimedia.AVSession.Core 2084 * @since 10 2085 */ 2086 STATE_DISCONNECTED = 6, 2087 } 2088 2089 /** 2090 * The pre-defined display tag by system. 2091 * @enum { number } 2092 * @syscap SystemCapability.Multimedia.AVSession.Core 2093 * @since 11 2094 */ 2095 enum DisplayTag { 2096 /** 2097 * Indicate the AUDIO VIVID property of current media resource. 2098 * @syscap SystemCapability.Multimedia.AVSession.Core 2099 * @since 11 2100 */ 2101 TAG_AUDIO_VIVID = 1, 2102 } 2103 2104 /** 2105 * The play list information definition. 2106 * @interface AVQueueInfo 2107 * @syscap SystemCapability.Multimedia.AVSession.Core 2108 * @systemapi 2109 * @since 11 2110 */ 2111 interface AVQueueInfo { 2112 /** 2113 * The bundle name of application which current play list belongs to. 2114 * @type { string } 2115 * @syscap SystemCapability.Multimedia.AVSession.Core 2116 * @systemapi 2117 * @since 11 2118 */ 2119 bundleName: string; 2120 2121 /** 2122 * The name of play list 2123 * @type { string } 2124 * @syscap SystemCapability.Multimedia.AVSession.Core 2125 * @systemapi 2126 * @since 11 2127 */ 2128 avQueueName: string; 2129 2130 /** 2131 * The id of play list 2132 * @type { string } 2133 * @syscap SystemCapability.Multimedia.AVSession.Core 2134 * @systemapi 2135 * @since 11 2136 */ 2137 avQueueId: string; 2138 2139 /** 2140 * The artwork of play list, can be a {@link PixelMap} or a URI formatted string, 2141 * @syscap SystemCapability.Multimedia.AVSession.Core 2142 * @systemapi 2143 * @since 11 2144 */ 2145 avQueueImage: image.PixelMap | string; 2146 2147 /** 2148 * The time when the user last played the playlist. 2149 * The time format can be system, such as 1611081385000, it means 2021-01-20 02:36:25. 2150 * @type { ?number } 2151 * @syscap SystemCapability.Multimedia.AVSession.Core 2152 * @systemapi 2153 * @since 11 2154 */ 2155 lastPlayedTime?: number; 2156 } 2157 2158 /** 2159 * The metadata of the current media.Used to set the properties of the current media file 2160 * @interface AVMetadata 2161 * @syscap SystemCapability.Multimedia.AVSession.Core 2162 * @since 10 2163 */ 2164 interface AVMetadata { 2165 /** 2166 * Unique ID used to represent this media. 2167 * @type { string } 2168 * @syscap SystemCapability.Multimedia.AVSession.Core 2169 * @since 10 2170 */ 2171 assetId: string; 2172 2173 /** 2174 * The title of this media, for display in media center. 2175 * @type { ?string } 2176 * @syscap SystemCapability.Multimedia.AVSession.Core 2177 * @since 10 2178 */ 2179 title?: string; 2180 2181 /** 2182 * The artist of this media 2183 * @type { ?string } 2184 * @syscap SystemCapability.Multimedia.AVSession.Core 2185 * @since 10 2186 */ 2187 artist?: string; 2188 2189 /** 2190 * The author of this media 2191 * @type { ?string } 2192 * @syscap SystemCapability.Multimedia.AVSession.Core 2193 * @since 10 2194 */ 2195 author?: string; 2196 2197 /** 2198 * The name of play list which current media belongs to 2199 * @type { ?string } 2200 * @syscap SystemCapability.Multimedia.AVSession.Core 2201 * @systemapi 2202 * @since 11 2203 */ 2204 avQueueName?: string; 2205 2206 /** 2207 * The id of play list which current media belongs to, it should be an unique identifier in the application. 2208 * @type { ?string } 2209 * @syscap SystemCapability.Multimedia.AVSession.Core 2210 * @since 11 2211 */ 2212 avQueueId?: string; 2213 2214 /** 2215 * The artwork of play list as a {@link PixelMap} or an uri formatted String, 2216 * @syscap SystemCapability.Multimedia.AVSession.Core 2217 * @since 11 2218 */ 2219 avQueueImage?: image.PixelMap | string; 2220 2221 /** 2222 * The album of this media 2223 * @type { ?string } 2224 * @syscap SystemCapability.Multimedia.AVSession.Core 2225 * @since 10 2226 */ 2227 album?: string; 2228 2229 /** 2230 * The writer of this media 2231 * @type { ?string } 2232 * @syscap SystemCapability.Multimedia.AVSession.Core 2233 * @since 10 2234 */ 2235 writer?: string; 2236 2237 /** 2238 * The composer of this media 2239 * @type { ?string } 2240 * @syscap SystemCapability.Multimedia.AVSession.Core 2241 * @since 10 2242 */ 2243 composer?: string; 2244 2245 /** 2246 * The duration of this media, used to automatically calculate playback position 2247 * @type { ?number } 2248 * @syscap SystemCapability.Multimedia.AVSession.Core 2249 * @since 10 2250 */ 2251 duration?: number; 2252 2253 /** 2254 * The image of the media as a {@link PixelMap} or an uri formatted String, 2255 * used to display in media center. 2256 * @syscap SystemCapability.Multimedia.AVSession.Core 2257 * @since 10 2258 */ 2259 mediaImage?: image.PixelMap | string; 2260 2261 /** 2262 * The publishDate of the media 2263 * @type { ?Date } 2264 * @syscap SystemCapability.Multimedia.AVSession.Core 2265 * @since 10 2266 */ 2267 publishDate?: Date; 2268 2269 /** 2270 * The subtitle of the media, used for display 2271 * @type { ?string } 2272 * @syscap SystemCapability.Multimedia.AVSession.Core 2273 * @since 10 2274 */ 2275 subtitle?: string; 2276 2277 /** 2278 * The discription of the media, used for display 2279 * @type { ?string } 2280 * @syscap SystemCapability.Multimedia.AVSession.Core 2281 * @since 10 2282 */ 2283 description?: string; 2284 2285 /** 2286 * The lyric of the media, it should be in standard lyric format 2287 * @type { ?string } 2288 * @syscap SystemCapability.Multimedia.AVSession.Core 2289 * @since 10 2290 */ 2291 lyric?: string; 2292 2293 /** 2294 * The previous playable media id. 2295 * Used to tell the controller if there is a previous playable media 2296 * @type { ?string } 2297 * @syscap SystemCapability.Multimedia.AVSession.Core 2298 * @since 10 2299 */ 2300 previousAssetId?: string; 2301 2302 /** 2303 * The next playable media id. 2304 * Used to tell the controller if there is a next playable media 2305 * @type { ?string } 2306 * @syscap SystemCapability.Multimedia.AVSession.Core 2307 * @since 10 2308 */ 2309 nextAssetId?: string; 2310 2311 /** 2312 * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. 2313 * See {@link ProtocolType} 2314 * @type { ?number } 2315 * @syscap SystemCapability.Multimedia.AVSession.Core 2316 * @since 11 2317 */ 2318 filter?: number; 2319 2320 /** 2321 * The supported skipIntervals when doing fast forward and rewind operation, the default is {@link SECONDS_15}. 2322 * See {@link SkipIntervals} 2323 * @type { ?SkipIntervals } 2324 * @syscap SystemCapability.Multimedia.AVSession.Core 2325 * @since 11 2326 */ 2327 skipIntervals?: SkipIntervals; 2328 2329 /** 2330 * The display tags supported by application to be displayed on media center 2331 * @type { ?number } 2332 * @syscap SystemCapability.Multimedia.AVSession.Core 2333 * @since 11 2334 */ 2335 displayTags?: number; 2336 } 2337 2338 /** 2339 * The description of the media for an item in the playlist of the session 2340 * @interface AVMediaDescription 2341 * @syscap SystemCapability.Multimedia.AVSession.Core 2342 * @since 10 2343 */ 2344 interface AVMediaDescription { 2345 /** 2346 * Unique ID used to represent this media. 2347 * @type { string } 2348 * @syscap SystemCapability.Multimedia.AVSession.Core 2349 * @since 10 2350 */ 2351 assetId: string; 2352 /** 2353 * The title of this media, for display in media center. 2354 * @type { ?string } 2355 * @syscap SystemCapability.Multimedia.AVSession.Core 2356 * @since 10 2357 */ 2358 title?: string; 2359 2360 /** 2361 * The subtitle of the media, used for display 2362 * @type { ?string } 2363 * @syscap SystemCapability.Multimedia.AVSession.Core 2364 * @since 10 2365 */ 2366 subtitle?: string; 2367 2368 /** 2369 * The description of this media 2370 * @type { ?string } 2371 * @syscap SystemCapability.Multimedia.AVSession.Core 2372 * @since 10 2373 */ 2374 description?: string; 2375 2376 /** 2377 * The image of this media asset displayed in the media center. 2378 * It can be a {@link PixelMap} or a URI formatted string, 2379 * @syscap SystemCapability.Multimedia.AVSession.Core 2380 * @since 10 2381 */ 2382 mediaImage?: image.PixelMap | string; 2383 /** 2384 * Any additional attributes that can be represented as key-value pairs 2385 * @syscap SystemCapability.Multimedia.AVSession.Core 2386 * @since 10 2387 */ 2388 extras?: {[key: string]: Object}; 2389 2390 /** 2391 * The type of this media, such as video, audio and so on. 2392 * @type { ?string } 2393 * @syscap SystemCapability.Multimedia.AVSession.Core 2394 * @since 10 2395 */ 2396 mediaType?: string; 2397 2398 /** 2399 * The size of this media. 2400 * @type { ?number } 2401 * @syscap SystemCapability.Multimedia.AVSession.Core 2402 * @since 10 2403 */ 2404 mediaSize?: number; 2405 2406 /** 2407 * The album title of this media 2408 * @type { ?string } 2409 * @syscap SystemCapability.Multimedia.AVSession.Core 2410 * @since 10 2411 */ 2412 albumTitle?: string; 2413 2414 /** 2415 * The album cover uri of this media 2416 * @type { ?string } 2417 * @syscap SystemCapability.Multimedia.AVSession.Core 2418 * @since 10 2419 */ 2420 albumCoverUri?: string; 2421 2422 /** 2423 * The lyric content of the media, it should be in standard lyric format 2424 * @type { ?string } 2425 * @syscap SystemCapability.Multimedia.AVSession.Core 2426 * @since 10 2427 */ 2428 lyricContent?: string; 2429 2430 /** 2431 * The lyric uri of the media. 2432 * @type { ?string } 2433 * @syscap SystemCapability.Multimedia.AVSession.Core 2434 * @since 10 2435 */ 2436 lyricUri?: string; 2437 2438 /** 2439 * The artist of this media. 2440 * @type { ?string } 2441 * @syscap SystemCapability.Multimedia.AVSession.Core 2442 * @since 10 2443 */ 2444 artist?: string; 2445 2446 /** 2447 * The uri of the media, used to locate the media in some special cases 2448 * @type { ?string } 2449 * @syscap SystemCapability.Multimedia.AVSession.Core 2450 * @since 10 2451 */ 2452 mediaUri?: string; 2453 2454 /** 2455 * Media file descriptor. 2456 * @syscap SystemCapability.Multimedia.AVSession.Core 2457 * @since 10 2458 */ 2459 fdSrc?: media.AVFileDescriptor; 2460 2461 /** 2462 * The duration of this media 2463 * @type { ?number } 2464 * @syscap SystemCapability.Multimedia.AVSession.Core 2465 * @since 10 2466 */ 2467 duration?: number; 2468 2469 /** 2470 * Media start position, described by milliseconds. 2471 * @type { ?number } 2472 * @syscap SystemCapability.Multimedia.AVSession.Core 2473 * @since 10 2474 */ 2475 startPosition?: number; 2476 2477 /** 2478 * Media credits position, described by milliseconds. 2479 * @type { ?number } 2480 * @syscap SystemCapability.Multimedia.AVSession.Core 2481 * @since 10 2482 */ 2483 creditsPosition?: number; 2484 2485 /** 2486 * Application name. 2487 * @type { ?string } 2488 * @syscap SystemCapability.Multimedia.AVSession.Core 2489 * @since 10 2490 */ 2491 appName?: string; 2492 2493 /** 2494 * The display tags supported by application to be displayed on media center 2495 * @type { ?number } 2496 * @syscap SystemCapability.Multimedia.AVSession.Core 2497 * @since 11 2498 */ 2499 displayTags?: number; 2500 } 2501 2502 /** 2503 * The item in the playlist of the session 2504 * @interface AVQueueItem 2505 * @syscap SystemCapability.Multimedia.AVSession.Core 2506 * @since 10 2507 */ 2508 interface AVQueueItem { 2509 /** 2510 * Sequence number of the item in the playlist. 2511 * @type { number } 2512 * @syscap SystemCapability.Multimedia.AVSession.Core 2513 * @since 10 2514 */ 2515 itemId: number; 2516 2517 /** 2518 * The media description of the item in the playlist. 2519 * @syscap SystemCapability.Multimedia.AVSession.Core 2520 * @since 10 2521 */ 2522 description?: AVMediaDescription; 2523 } 2524 2525 /** 2526 * Used to indicate the playback state of the current media. 2527 * If the playback state of the media changes, it needs to be updated synchronously 2528 * @interface AVPlaybackState 2529 * @syscap SystemCapability.Multimedia.AVSession.Core 2530 * @since 10 2531 */ 2532 interface AVPlaybackState { 2533 /** 2534 * Current playback state. See {@link PlaybackState} 2535 * @syscap SystemCapability.Multimedia.AVSession.Core 2536 * @since 10 2537 */ 2538 state?: PlaybackState; 2539 2540 /** 2541 * Current playback speed 2542 * @type { ?number } 2543 * @syscap SystemCapability.Multimedia.AVSession.Core 2544 * @since 10 2545 */ 2546 speed?: number; 2547 2548 /** 2549 * Current playback position of this media. See {@link PlaybackPosition} 2550 * @syscap SystemCapability.Multimedia.AVSession.Core 2551 * @since 10 2552 */ 2553 position?: PlaybackPosition; 2554 2555 /** 2556 * The current buffered time, the maximum playable position 2557 * @type { ?number } 2558 * @syscap SystemCapability.Multimedia.AVSession.Core 2559 * @since 10 2560 */ 2561 bufferedTime?: number; 2562 2563 /** 2564 * Current playback loop mode. See {@link LoopMode} 2565 * @syscap SystemCapability.Multimedia.AVSession.Core 2566 * @since 10 2567 */ 2568 loopMode?: LoopMode; 2569 2570 /** 2571 * Current Favorite Status 2572 * @type { ?boolean } 2573 * @syscap SystemCapability.Multimedia.AVSession.Core 2574 * @since 10 2575 */ 2576 isFavorite?: boolean; 2577 2578 /** 2579 * Current active item id 2580 * @type { ?number } 2581 * @syscap SystemCapability.Multimedia.AVSession.Core 2582 * @since 10 2583 */ 2584 activeItemId?: number; 2585 2586 /** 2587 * Current player volume 2588 * @type { ?number } 2589 * @syscap SystemCapability.Multimedia.AVSession.Core 2590 * @since 10 2591 */ 2592 volume?: number; 2593 2594 /** 2595 * maximum volume 2596 * @type { ?number } 2597 * @syscap SystemCapability.Multimedia.AVSession.Core 2598 * @since 11 2599 */ 2600 maxVolume?: number; 2601 2602 /** 2603 * Current muted status 2604 * @type { ?boolean } 2605 * @syscap SystemCapability.Multimedia.AVSession.Core 2606 * @since 11 2607 */ 2608 muted?: boolean; 2609 2610 /** 2611 * The duration of this media asset. 2612 * @type { ?number } 2613 * @syscap SystemCapability.Multimedia.AVSession.Core 2614 * @since 11 2615 */ 2616 duration?: number; 2617 2618 /** 2619 * The video width of this media asset. 2620 * @type { ?number } 2621 * @syscap SystemCapability.Multimedia.AVSession.Core 2622 * @since 11 2623 */ 2624 videoWidth?: number; 2625 2626 /** 2627 * The video height of this media asset. 2628 * @type { ?number } 2629 * @syscap SystemCapability.Multimedia.AVSession.Core 2630 * @since 11 2631 */ 2632 videoHeight?: number; 2633 2634 /** 2635 * Current custom media packets 2636 * @syscap SystemCapability.Multimedia.AVSession.Core 2637 * @since 10 2638 */ 2639 extras?: {[key: string]: Object}; 2640 } 2641 2642 /** 2643 * Playback position definition 2644 * @interface PlaybackPosition 2645 * @syscap SystemCapability.Multimedia.AVSession.Core 2646 * @since 10 2647 */ 2648 interface PlaybackPosition { 2649 /** 2650 * Elapsed time(position) of this media set by the app. 2651 * @type { number } 2652 * @syscap SystemCapability.Multimedia.AVSession.Core 2653 * @since 10 2654 */ 2655 elapsedTime: number; 2656 2657 /** 2658 * Record the system time when elapsedTime is set. 2659 * @type { number } 2660 * @syscap SystemCapability.Multimedia.AVSession.Core 2661 * @since 10 2662 */ 2663 updateTime: number; 2664 } 2665 2666 /** 2667 * The metadata of the current call. 2668 * @interface CallMetadata 2669 * @syscap SystemCapability.Multimedia.AVSession.Core 2670 * @since 11 2671 */ 2672 interface CallMetadata { 2673 /** 2674 * The displayed user name of current call. 2675 * @type { ?string } 2676 * @syscap SystemCapability.Multimedia.AVSession.Core 2677 * @since 11 2678 */ 2679 name?: string; 2680 2681 /** 2682 * The phone number of current call. 2683 * @type { ?string } 2684 * @syscap SystemCapability.Multimedia.AVSession.Core 2685 * @since 11 2686 */ 2687 phoneNumber?: string; 2688 2689 /** 2690 * The displayed picture that represents a particular user. 2691 * @type { ?image.PixelMap } 2692 * @syscap SystemCapability.Multimedia.AVSession.Core 2693 * @since 11 2694 */ 2695 avatar?: image.PixelMap; 2696 } 2697 2698 /** 2699 * Used to indicate the call state of the current call. 2700 * @interface AVCallState 2701 * @syscap SystemCapability.Multimedia.AVSession.Core 2702 * @since 11 2703 */ 2704 interface AVCallState { 2705 /** 2706 * Current call state. See {@link CallState} 2707 * @type {CallState} 2708 * @syscap SystemCapability.Multimedia.AVSession.Core 2709 * @since 11 2710 */ 2711 state: CallState; 2712 2713 /** 2714 * Current muted status. 2715 * @type { boolean } 2716 * @syscap SystemCapability.Multimedia.AVSession.Core 2717 * @since 11 2718 */ 2719 muted: boolean; 2720 } 2721 2722 /** 2723 * Enumeration of current call state 2724 * @enum { number } 2725 * @syscap SystemCapability.Multimedia.AVSession.Core 2726 * @since 11 2727 */ 2728 enum CallState { 2729 /** 2730 * Idle state. 2731 * @syscap SystemCapability.Multimedia.AVSession.Core 2732 * @since 11 2733 */ 2734 CALL_STATE_IDLE = 0, 2735 2736 /** 2737 * Incoming state. 2738 * @syscap SystemCapability.Multimedia.AVSession.Core 2739 * @since 11 2740 */ 2741 CALL_STATE_INCOMING = 1, 2742 2743 /** 2744 * Active state in calling. 2745 * @syscap SystemCapability.Multimedia.AVSession.Core 2746 * @since 11 2747 */ 2748 CALL_STATE_ACTIVE = 2, 2749 2750 /** 2751 * Dialing state. 2752 * @syscap SystemCapability.Multimedia.AVSession.Core 2753 * @since 11 2754 */ 2755 CALL_STATE_DIALING = 3, 2756 2757 /** 2758 * Waiting state. 2759 * @syscap SystemCapability.Multimedia.AVSession.Core 2760 * @since 11 2761 */ 2762 CALL_STATE_WAITING = 4, 2763 2764 /** 2765 * Holding state. 2766 * @syscap SystemCapability.Multimedia.AVSession.Core 2767 * @since 11 2768 */ 2769 CALL_STATE_HOLDING = 5, 2770 2771 /** 2772 * Disconnecting state. 2773 * @syscap SystemCapability.Multimedia.AVSession.Core 2774 * @since 11 2775 */ 2776 CALL_STATE_DISCONNECTING = 6, 2777 } 2778 2779 /** 2780 * cast category indicating different playback scenes 2781 * @enum { number } 2782 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2783 * @since 10 2784 */ 2785 enum AVCastCategory { 2786 /** 2787 * The default cast type "local", media can be routed on the same device, 2788 * including internal speakers or audio jack on the device itself, A2DP devices. 2789 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2790 * @since 10 2791 */ 2792 CATEGORY_LOCAL = 0, 2793 2794 /** 2795 * The remote category indicating the media is presenting on a remote device, 2796 * the application needs to get an AVCastController to control remote playback. 2797 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2798 * @since 10 2799 */ 2800 CATEGORY_REMOTE = 1, 2801 } 2802 /** 2803 * Device type definition 2804 * @enum { number } 2805 * @syscap SystemCapability.Multimedia.AVSession.Core 2806 * @since 10 2807 */ 2808 enum DeviceType { 2809 /** 2810 * A device type indicating the route is on internal speakers or audio jack on the device itself. 2811 * @syscap SystemCapability.Multimedia.AVSession.Core 2812 * @since 10 2813 */ 2814 DEVICE_TYPE_LOCAL = 0, 2815 2816 /** 2817 * A device type indicating the route is on a TV. 2818 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2819 * @since 10 2820 */ 2821 DEVICE_TYPE_TV = 2, 2822 2823 /** 2824 * A device type indicating the route is on a smart speaker. 2825 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2826 * @since 10 2827 */ 2828 DEVICE_TYPE_SMART_SPEAKER = 3, 2829 2830 /** 2831 * A device type indicating the route is on a bluetooth device. 2832 * @syscap SystemCapability.Multimedia.AVSession.Core 2833 * @since 10 2834 */ 2835 DEVICE_TYPE_BLUETOOTH = 10, 2836 } 2837 2838 /** 2839 * Device Information Definition 2840 * @interface DeviceInfo 2841 * @syscap SystemCapability.Multimedia.AVSession.Core 2842 * @since 10 2843 */ 2844 interface DeviceInfo { 2845 /** 2846 * The playback type supported by the device. See {@link AVCastCategory} 2847 * @syscap SystemCapability.Multimedia.AVSession.Core 2848 * @since 10 2849 */ 2850 castCategory: AVCastCategory; 2851 /** 2852 * Audio device id.The length of the audioDeviceId array is greater than 1 2853 * if output to multiple devices at the same time. 2854 * @syscap SystemCapability.Multimedia.AVSession.Core 2855 * @since 10 2856 */ 2857 deviceId: string; 2858 2859 /** 2860 * Device name. The length of the deviceName array is greater than 1 2861 * if output to multiple devices at the same time. 2862 * @syscap SystemCapability.Multimedia.AVSession.Core 2863 * @since 10 2864 */ 2865 deviceName: string; 2866 2867 /** 2868 * device type. 2869 * @syscap SystemCapability.Multimedia.AVSession.Core 2870 * @since 10 2871 */ 2872 deviceType: DeviceType; 2873 2874 /** 2875 * device ip address if available. 2876 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2877 * @systemapi 2878 * @since 10 2879 */ 2880 ipAddress?: string; 2881 2882 /** 2883 * device provider which supplies the route capability. 2884 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2885 * @systemapi 2886 * @since 10 2887 */ 2888 providerId?: number; 2889 2890 /** 2891 * The protocols supported by current device, can be union of {@link ProtocolType}. 2892 * @type { ?number } 2893 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2894 * @since 11 2895 */ 2896 supportedProtocols?: number; 2897 2898 /** 2899 * Define different authentication status. 2900 * 0: Device not authenticated. 2901 * 1: Device already authenticated. 2902 * @type { ?number } 2903 * @syscap SystemCapability.Multimedia.AVSession.AVCast 2904 * @systemapi 2905 * @since 11 2906 */ 2907 authenticationStatus?: number; 2908 } 2909 2910 /** 2911 * Target Device Information Definition 2912 * @interface OutputDeviceInfo 2913 * @syscap SystemCapability.Multimedia.AVSession.Core 2914 * @since 10 2915 */ 2916 interface OutputDeviceInfo { 2917 /** 2918 * Arrays of device information 2919 * @syscap SystemCapability.Multimedia.AVSession.Core 2920 * @since 10 2921 */ 2922 devices: Array<DeviceInfo>; 2923 } 2924 2925 /** 2926 * Loop Play Mode Definition 2927 * @enum { number } 2928 * @syscap SystemCapability.Multimedia.AVSession.Core 2929 * @since 10 2930 */ 2931 enum LoopMode { 2932 /** 2933 * The default mode is sequential playback 2934 * @syscap SystemCapability.Multimedia.AVSession.Core 2935 * @since 10 2936 */ 2937 LOOP_MODE_SEQUENCE = 0, 2938 2939 /** 2940 * Single loop mode 2941 * @syscap SystemCapability.Multimedia.AVSession.Core 2942 * @since 10 2943 */ 2944 LOOP_MODE_SINGLE = 1, 2945 2946 /** 2947 * List loop mode 2948 * @syscap SystemCapability.Multimedia.AVSession.Core 2949 * @since 10 2950 */ 2951 LOOP_MODE_LIST = 2, 2952 2953 /** 2954 * Shuffle playback mode 2955 * @syscap SystemCapability.Multimedia.AVSession.Core 2956 * @since 10 2957 */ 2958 LOOP_MODE_SHUFFLE = 3, 2959 2960 /** 2961 * Custom playback mode supported by application 2962 * @syscap SystemCapability.Multimedia.AVSession.Core 2963 * @since 11 2964 */ 2965 LOOP_MODE_CUSTOM = 4, 2966 } 2967 2968 /** 2969 * Supported skip intervals definition 2970 * @enum { number } 2971 * @syscap SystemCapability.Multimedia.AVSession.Core 2972 * @since 11 2973 */ 2974 enum SkipIntervals { 2975 /** 2976 * 10 seconds 2977 * @syscap SystemCapability.Multimedia.AVSession.Core 2978 * @since 11 2979 */ 2980 SECONDS_10 = 10, 2981 /** 2982 * 15 seconds 2983 * @syscap SystemCapability.Multimedia.AVSession.Core 2984 * @since 11 2985 */ 2986 SECONDS_15 = 15, 2987 /** 2988 * 30 seconds 2989 * @syscap SystemCapability.Multimedia.AVSession.Core 2990 * @since 11 2991 */ 2992 SECONDS_30 = 30, 2993 } 2994 2995 /** 2996 * Definition of current playback state 2997 * @enum { number } 2998 * @syscap SystemCapability.Multimedia.AVSession.Core 2999 * @since 10 3000 */ 3001 enum PlaybackState { 3002 /** 3003 * Initial state. The initial state of media file 3004 * @syscap SystemCapability.Multimedia.AVSession.Core 3005 * @since 10 3006 */ 3007 PLAYBACK_STATE_INITIAL = 0, 3008 3009 /** 3010 * Preparing state. Indicates that the media file is not ready to play, 3011 * the media is loading or buffering 3012 * @syscap SystemCapability.Multimedia.AVSession.Core 3013 * @since 10 3014 */ 3015 PLAYBACK_STATE_PREPARE = 1, 3016 3017 /** 3018 * Playing state. 3019 * @syscap SystemCapability.Multimedia.AVSession.Core 3020 * @since 10 3021 */ 3022 PLAYBACK_STATE_PLAY = 2, 3023 3024 /** 3025 * Paused state. 3026 * @syscap SystemCapability.Multimedia.AVSession.Core 3027 * @since 10 3028 */ 3029 PLAYBACK_STATE_PAUSE = 3, 3030 3031 /** 3032 * Fast forwarding state. 3033 * @syscap SystemCapability.Multimedia.AVSession.Core 3034 * @since 10 3035 */ 3036 PLAYBACK_STATE_FAST_FORWARD = 4, 3037 3038 /** 3039 * Rewinding state. 3040 * @syscap SystemCapability.Multimedia.AVSession.Core 3041 * @since 10 3042 */ 3043 PLAYBACK_STATE_REWIND = 5, 3044 3045 /** 3046 * Stopped state.The server will clear the media playback position and other information. 3047 * @syscap SystemCapability.Multimedia.AVSession.Core 3048 * @since 10 3049 */ 3050 PLAYBACK_STATE_STOP = 6, 3051 3052 /** 3053 * Completed state. 3054 * @syscap SystemCapability.Multimedia.AVSession.Core 3055 * @since 10 3056 */ 3057 PLAYBACK_STATE_COMPLETED = 7, 3058 3059 /** 3060 * Released state. 3061 * @syscap SystemCapability.Multimedia.AVSession.Core 3062 * @since 10 3063 */ 3064 PLAYBACK_STATE_RELEASED = 8, 3065 3066 /** 3067 * error state. 3068 * @syscap SystemCapability.Multimedia.AVSession.Core 3069 * @since 10 3070 */ 3071 PLAYBACK_STATE_ERROR = 9, 3072 3073 /** 3074 * Idle state. 3075 * @syscap SystemCapability.Multimedia.AVSession.Core 3076 * @since 11 3077 */ 3078 PLAYBACK_STATE_IDLE = 10, 3079 3080 /** 3081 * Buffering state. 3082 * @syscap SystemCapability.Multimedia.AVSession.Core 3083 * @since 11 3084 */ 3085 PLAYBACK_STATE_BUFFERING = 11, 3086 } 3087 3088 /** 3089 * The description of the session 3090 * @interface AVSessionDescriptor 3091 * @syscap SystemCapability.Multimedia.AVSession.Manager 3092 * @systemapi 3093 * @since 9 3094 */ 3095 interface AVSessionDescriptor { 3096 /** 3097 * Unique ID of the session 3098 * @type { string } 3099 * @syscap SystemCapability.Multimedia.AVSession.Manager 3100 * @systemapi 3101 * @since 9 3102 */ 3103 sessionId: string; 3104 3105 /** 3106 * Session type, currently supports audio or video 3107 * @syscap SystemCapability.Multimedia.AVSession.Manager 3108 * @systemapi 3109 * @since 9 3110 */ 3111 type: AVSessionType; 3112 3113 /** 3114 * The session tag set by the application 3115 * @type { string } 3116 * @syscap SystemCapability.Multimedia.AVSession.Manager 3117 * @systemapi 3118 * @since 9 3119 */ 3120 sessionTag: string; 3121 3122 /** 3123 * The elementName of the ability that created this session. See {@link ElementName} in bundle/elementName.d.ts 3124 * @syscap SystemCapability.Multimedia.AVSession.Manager 3125 * @systemapi 3126 * @since 9 3127 */ 3128 elementName: ElementName; 3129 3130 /** 3131 * Session active state 3132 * @type { boolean } 3133 * @syscap SystemCapability.Multimedia.AVSession.Manager 3134 * @systemapi 3135 * @since 9 3136 */ 3137 isActive: boolean; 3138 3139 /** 3140 * Is it the top priority session 3141 * @type { boolean } 3142 * @syscap SystemCapability.Multimedia.AVSession.Manager 3143 * @systemapi 3144 * @since 9 3145 */ 3146 isTopSession: boolean; 3147 3148 /** 3149 * The current output device information. 3150 * It will be undefined if this is a local session. 3151 * @syscap SystemCapability.Multimedia.AVSession.Manager 3152 * @systemapi 3153 * @since 9 3154 */ 3155 outputDevice: OutputDeviceInfo; 3156 } 3157 3158 /** 3159 * Session controller,used to control media playback and get media information 3160 * @interface AVSessionController 3161 * @syscap SystemCapability.Multimedia.AVSession.Core 3162 * @since 10 3163 */ 3164 interface AVSessionController { 3165 /** 3166 * Unique session Id 3167 * @syscap SystemCapability.Multimedia.AVSession.Core 3168 * @since 10 3169 */ 3170 readonly sessionId: string; 3171 3172 /** 3173 * Get the playback status of the current session 3174 * @param { AsyncCallback<AVPlaybackState> } callback - The triggered asyncCallback when (getAVPlaybackState). 3175 * @throws { BusinessError } 6600101 - Session service exception. 3176 * @throws { BusinessError } 6600102 - The session does not exist. 3177 * @throws { BusinessError } 6600103 - The session controller does not exist. 3178 * @syscap SystemCapability.Multimedia.AVSession.Core 3179 * @since 10 3180 */ 3181 getAVPlaybackState(callback: AsyncCallback<AVPlaybackState>): void; 3182 3183 /** 3184 * Get the playback status of the current session 3185 * @returns { Promise<AVPlaybackState> } (AVPlaybackState) returned through promise 3186 * @throws { BusinessError } 6600101 - Session service exception. 3187 * @throws { BusinessError } 6600102 - The session does not exist. 3188 * @throws { BusinessError } 6600103 - The session controller does not exist. 3189 * @syscap SystemCapability.Multimedia.AVSession.Core 3190 * @since 10 3191 */ 3192 getAVPlaybackState(): Promise<AVPlaybackState>; 3193 3194 /** 3195 * Get the playback status of the current session 3196 * @returns { AVPlaybackState } (AVPlaybackState) returned 3197 * @throws { BusinessError } 6600101 - Session service exception. 3198 * @throws { BusinessError } 6600102 - The session does not exist. 3199 * @throws { BusinessError } 6600103 - The session controller does not exist. 3200 * @syscap SystemCapability.Multimedia.AVSession.Core 3201 * @since 10 3202 */ 3203 getAVPlaybackStateSync(): AVPlaybackState; 3204 3205 /** 3206 * Get the metadata of the current session 3207 * @param { AsyncCallback<AVMetadata> } callback - The triggered asyncCallback when (getAVMetadata). 3208 * @throws { BusinessError } 6600101 - Session service exception. 3209 * @throws { BusinessError } 6600102 - The session does not exist. 3210 * @throws { BusinessError } 6600103 - The session controller does not exist. 3211 * @syscap SystemCapability.Multimedia.AVSession.Core 3212 * @since 10 3213 */ 3214 getAVMetadata(callback: AsyncCallback<AVMetadata>): void; 3215 3216 /** 3217 * Get the metadata of the current session 3218 * @returns { Promise<AVMetadata> } (AVMetadata) returned through promise 3219 * @throws { BusinessError } 6600101 - Session service exception. 3220 * @throws { BusinessError } 6600102 - The session does not exist. 3221 * @throws { BusinessError } 6600103 - The session controller does not exist. 3222 * @syscap SystemCapability.Multimedia.AVSession.Core 3223 * @since 10 3224 */ 3225 getAVMetadata(): Promise<AVMetadata>; 3226 3227 /** 3228 * Get the metadata of the current session 3229 * @returns { AVMetadata } (AVMetadata) returned 3230 * @throws { BusinessError } 6600101 - Session service exception. 3231 * @throws { BusinessError } 6600102 - The session does not exist. 3232 * @throws { BusinessError } 6600103 - The session controller does not exist. 3233 * @syscap SystemCapability.Multimedia.AVSession.Core 3234 * @since 10 3235 */ 3236 getAVMetadataSync(): AVMetadata; 3237 3238 /** 3239 * Get the call status of the current session 3240 * @param { AsyncCallback<AVCallState> } callback - The triggered asyncCallback when (getAVCallState). 3241 * @throws { BusinessError } 6600101 - Session service exception. 3242 * @throws { BusinessError } 6600102 - The session does not exist. 3243 * @throws { BusinessError } 6600103 - The session controller does not exist. 3244 * @syscap SystemCapability.Multimedia.AVSession.Core 3245 * @since 11 3246 */ 3247 getAVCallState(callback: AsyncCallback<AVCallState>): void; 3248 3249 /** 3250 * Get the call status of the current session 3251 * @returns { Promise<AVCallState> } (AVCallState) returned through promise 3252 * @throws { BusinessError } 6600101 - Session service exception. 3253 * @throws { BusinessError } 6600102 - The session does not exist. 3254 * @throws { BusinessError } 6600103 - The session controller does not exist. 3255 * @syscap SystemCapability.Multimedia.AVSession.Core 3256 * @since 11 3257 */ 3258 getAVCallState(): Promise<AVCallState>; 3259 3260 /** 3261 * Get the call metadata of the current session 3262 * @param { AsyncCallback<CallMetadata> } callback - The triggered asyncCallback when (getCallMetadata). 3263 * @throws { BusinessError } 6600101 - Session service exception. 3264 * @throws { BusinessError } 6600102 - The session does not exist. 3265 * @throws { BusinessError } 6600103 - The session controller does not exist. 3266 * @syscap SystemCapability.Multimedia.AVSession.Core 3267 * @since 11 3268 */ 3269 getCallMetadata(callback: AsyncCallback<CallMetadata>): void; 3270 3271 /** 3272 * Get the call metadata of the current session 3273 * @returns { Promise<CallMetadata> } (CallMetadata) returned through promise 3274 * @throws { BusinessError } 6600101 - Session service exception. 3275 * @throws { BusinessError } 6600102 - The session does not exist. 3276 * @throws { BusinessError } 6600103 - The session controller does not exist. 3277 * @syscap SystemCapability.Multimedia.AVSession.Core 3278 * @since 11 3279 */ 3280 getCallMetadata(): Promise<CallMetadata>; 3281 3282 /** 3283 * Get the name of the playlist of the current session 3284 * @param { AsyncCallback<string> } callback - The triggered asyncCallback when (getAVQueueTitle). 3285 * @throws { BusinessError } 6600101 - Session service exception. 3286 * @throws { BusinessError } 6600102 - The session does not exist. 3287 * @throws { BusinessError } 6600103 - The session controller does not exist. 3288 * @syscap SystemCapability.Multimedia.AVSession.Core 3289 * @since 10 3290 */ 3291 getAVQueueTitle(callback: AsyncCallback<string>): void; 3292 3293 /** 3294 * Get the name of the playlist of the current session 3295 * @returns { Promise<string> } (string) returned through promise 3296 * @throws { BusinessError } 6600101 - Session service exception. 3297 * @throws { BusinessError } 6600102 - The session does not exist. 3298 * @throws { BusinessError } 6600103 - The session controller does not exist. 3299 * @syscap SystemCapability.Multimedia.AVSession.Core 3300 * @since 10 3301 */ 3302 getAVQueueTitle(): Promise<string>; 3303 3304 /** 3305 * Get the name of the playlist of the current session 3306 * @returns { string } (string) returned 3307 * @throws { BusinessError } 6600101 - Session service exception. 3308 * @throws { BusinessError } 6600102 - The session does not exist. 3309 * @throws { BusinessError } 6600103 - The session controller does not exist. 3310 * @syscap SystemCapability.Multimedia.AVSession.Core 3311 * @since 10 3312 */ 3313 getAVQueueTitleSync(): string; 3314 3315 /** 3316 * Get the playlist of the current session 3317 * @param { AsyncCallback<Array<AVQueueItem>> } callback - The triggered asyncCallback when (getAVQueueItems). 3318 * @throws { BusinessError } 6600101 - Session service exception. 3319 * @throws { BusinessError } 6600102 - The session does not exist. 3320 * @throws { BusinessError } 6600103 - The session controller does not exist. 3321 * @syscap SystemCapability.Multimedia.AVSession.Core 3322 * @since 10 3323 */ 3324 getAVQueueItems(callback: AsyncCallback<Array<AVQueueItem>>): void; 3325 3326 /** 3327 * Get the playlist of the current session 3328 * @returns { Promise<Array<AVQueueItem>> } (Array<AVQueueItem>) returned through promise 3329 * @throws { BusinessError } 6600101 - Session service exception. 3330 * @throws { BusinessError } 6600102 - The session does not exist. 3331 * @throws { BusinessError } 6600103 - The session controller does not exist. 3332 * @syscap SystemCapability.Multimedia.AVSession.Core 3333 * @since 10 3334 */ 3335 getAVQueueItems(): Promise<Array<AVQueueItem>>; 3336 3337 /** 3338 * Get the playlist of the current session 3339 * @returns { Array<AVQueueItem> } (Array<AVQueueItem>) returned 3340 * @throws { BusinessError } 6600101 - Session service exception. 3341 * @throws { BusinessError } 6600102 - The session does not exist. 3342 * @throws { BusinessError } 6600103 - The session controller does not exist. 3343 * @syscap SystemCapability.Multimedia.AVSession.Core 3344 * @since 10 3345 */ 3346 getAVQueueItemsSync(): Array<AVQueueItem>; 3347 3348 /** 3349 * Set the item in the playlist to be played 3350 * @param { number } itemId - The serial number of the item to be played 3351 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully 3352 * @throws { BusinessError } 401 - parameter check failed 3353 * @throws { BusinessError } 6600101 - Session service exception. 3354 * @throws { BusinessError } 6600102 - The session does not exist. 3355 * @throws { BusinessError } 6600103 - The session controller does not exist. 3356 * @syscap SystemCapability.Multimedia.AVSession.Core 3357 * @since 10 3358 */ 3359 skipToQueueItem(itemId: number, callback: AsyncCallback<void>): void; 3360 3361 /** 3362 * Set the item in the playlist to be played 3363 * @param { number } itemId - The serial number of the item to be played 3364 * @returns { Promise<void> } void promise when executed successfully 3365 * @throws { BusinessError } 401 - parameter check failed 3366 * @throws { BusinessError } 6600101 - Session service exception. 3367 * @throws { BusinessError } 6600102 - The session does not exist. 3368 * @throws { BusinessError } 6600103 - The session controller does not exist. 3369 * @syscap SystemCapability.Multimedia.AVSession.Core 3370 * @since 10 3371 */ 3372 skipToQueueItem(itemId: number): Promise<void>; 3373 3374 /** 3375 * Get output device information 3376 * @param { AsyncCallback<OutputDeviceInfo> } callback - The triggered asyncCallback when (getOutputDevice). 3377 * @throws { BusinessError } 600101 - Session service exception. 3378 * @throws { BusinessError } 600103 - The session controller does not exist. 3379 * @syscap SystemCapability.Multimedia.AVSession.Core 3380 * @since 10 3381 */ 3382 getOutputDevice(callback: AsyncCallback<OutputDeviceInfo>): void; 3383 3384 /** 3385 * Get output device information 3386 * @returns { Promise<OutputDeviceInfo> } (OutputDeviceInfo) returned through promise 3387 * @throws { BusinessError } 600101 - Session service exception. 3388 * @throws { BusinessError } 600103 - The session controller does not exist. 3389 * @syscap SystemCapability.Multimedia.AVSession.Core 3390 * @since 10 3391 */ 3392 getOutputDevice(): Promise<OutputDeviceInfo>; 3393 3394 /** 3395 * Get output device information 3396 * @returns { OutputDeviceInfo } (OutputDeviceInfo) returned 3397 * @throws { BusinessError } 6600101 - Session service exception. 3398 * @throws { BusinessError } 6600103 - The session controller does not exist. 3399 * @syscap SystemCapability.Multimedia.AVSession.Core 3400 * @since 10 3401 */ 3402 getOutputDeviceSync(): OutputDeviceInfo; 3403 3404 /** 3405 * Send media key event to this session 3406 * @param { KeyEvent } event - The KeyEvent 3407 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 3408 * @throws { BusinessError } 401 - parameter check failed 3409 * @throws { BusinessError } 600101 - Session service exception. 3410 * @throws { BusinessError } 600102 - The session does not exist. 3411 * @throws { BusinessError } 600103 - The session controller does not exist. 3412 * @throws { BusinessError } 600105 - Invalid session command. 3413 * @throws { BusinessError } 600106 - The session is not activated. 3414 * @syscap SystemCapability.Multimedia.AVSession.Core 3415 * @since 10 3416 */ 3417 sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void; 3418 3419 /** 3420 * Send media key event to this session 3421 * @param { KeyEvent } event - The KeyEvent 3422 * @returns { Promise<void> } void promise when executed successfully 3423 * @throws { BusinessError } 401 - parameter check failed 3424 * @throws { BusinessError } 600101 - Session service exception. 3425 * @throws { BusinessError } 600102 - The session does not exist. 3426 * @throws { BusinessError } 600103 - The session controller does not exist. 3427 * @throws { BusinessError } 600105 - Invalid session command. 3428 * @throws { BusinessError } 600106 - The session is not activated. 3429 * @syscap SystemCapability.Multimedia.AVSession.Core 3430 * @since 10 3431 */ 3432 sendAVKeyEvent(event: KeyEvent): Promise<void>; 3433 3434 /** 3435 * Get the {@link WantAgent} of this session that can launch the session ability 3436 * @param { AsyncCallback<WantAgent> } callback - The asyncCallback triggered when getting the WantAgent. 3437 * @throws { BusinessError } 6600101 - Session service exception. 3438 * @throws { BusinessError } 6600102 - The session does not exist. 3439 * @throws { BusinessError } 6600103 - The session controller does not exist. 3440 * @syscap SystemCapability.Multimedia.AVSession.Core 3441 * @since 10 3442 */ 3443 getLaunchAbility(callback: AsyncCallback<WantAgent>): void; 3444 3445 /** 3446 * Get the {@link WantAgent} of this session that can launch the session ability 3447 * @returns { Promise<WantAgent> } WantAgent promise 3448 * @throws { BusinessError } 6600101 - Session service exception. 3449 * @throws { BusinessError } 6600102 - The session does not exist. 3450 * @throws { BusinessError } 6600103 - The session controller does not exist. 3451 * @syscap SystemCapability.Multimedia.AVSession.Core 3452 * @since 10 3453 */ 3454 getLaunchAbility(): Promise<WantAgent>; 3455 3456 /** 3457 * Get the adjusted playback position. The time automatically calculated by the system 3458 * taking into account factors such as playback status, playback speed, and application update time. 3459 * @returns { number } current playback position in ms.Note that the returns value of each call will be different. 3460 * @throws { BusinessError } 6600101 - Session service exception. 3461 * @throws { BusinessError } 6600103 - The session controller does not exist. 3462 * @syscap SystemCapability.Multimedia.AVSession.Core 3463 * @since 10 3464 */ 3465 getRealPlaybackPositionSync(): number; 3466 3467 /** 3468 * Check if the current session is active 3469 * @param { AsyncCallback<boolean> } callback - The triggered asyncCallback when (isActive). 3470 * @throws { BusinessError } 6600101 - Session service exception. 3471 * @throws { BusinessError } 6600102 - The session does not exist. 3472 * @throws { BusinessError } 6600103 - The session controller does not exist. 3473 * @syscap SystemCapability.Multimedia.AVSession.Core 3474 * @since 10 3475 */ 3476 isActive(callback: AsyncCallback<boolean>): void; 3477 3478 /** 3479 * Check if the current session is active 3480 * @returns { Promise<boolean> } boolean promise 3481 * @throws { BusinessError } 6600101 - Session service exception. 3482 * @throws { BusinessError } 6600102 - The session does not exist. 3483 * @throws { BusinessError } 6600103 - The session controller does not exist. 3484 * @syscap SystemCapability.Multimedia.AVSession.Core 3485 * @since 10 3486 */ 3487 isActive(): Promise<boolean>; 3488 3489 /** 3490 * Check if the current session is active 3491 * @returns { boolean } boolean 3492 * @throws { BusinessError } 6600101 - Session service exception. 3493 * @throws { BusinessError } 6600102 - The session does not exist. 3494 * @throws { BusinessError } 6600103 - The session controller does not exist. 3495 * @syscap SystemCapability.Multimedia.AVSession.Core 3496 * @since 10 3497 */ 3498 isActiveSync(): boolean; 3499 3500 /** 3501 * Destroy the server controller 3502 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 3503 * @throws { BusinessError } 6600101 - Session service exception. 3504 * @throws { BusinessError } 6600103 - The session controller does not exist. 3505 * @syscap SystemCapability.Multimedia.AVSession.Core 3506 * @since 10 3507 */ 3508 destroy(callback: AsyncCallback<void>): void; 3509 3510 /** 3511 * Destroy the server controller 3512 * @returns { Promise<void> } void promise when executed successfully 3513 * @throws { BusinessError } 6600101 - Session service exception. 3514 * @throws { BusinessError } 6600103 - The session controller does not exist. 3515 * @syscap SystemCapability.Multimedia.AVSession.Core 3516 * @since 10 3517 */ 3518 destroy(): Promise<void>; 3519 3520 /** 3521 * Get commands supported by the current session 3522 * @param { AsyncCallback<Array<AVControlCommandType>> } callback - The triggered asyncCallback when (getValidCommands). 3523 * @throws { BusinessError } 6600101 - Session service exception. 3524 * @throws { BusinessError } 6600102 - The session does not exist. 3525 * @throws { BusinessError } 6600103 - The session controller does not exist. 3526 * @syscap SystemCapability.Multimedia.AVSession.Core 3527 * @since 10 3528 */ 3529 getValidCommands(callback: AsyncCallback<Array<AVControlCommandType>>): void; 3530 3531 /** 3532 * Get commands supported by the current session 3533 * @returns { Promise<Array<AVControlCommandType>> } array of AVControlCommandType promise 3534 * @throws { BusinessError } 6600101 - Session service exception. 3535 * @throws { BusinessError } 6600102 - The session does not exist. 3536 * @throws { BusinessError } 6600103 - The session controller does not exist. 3537 * @syscap SystemCapability.Multimedia.AVSession.Core 3538 * @since 10 3539 */ 3540 getValidCommands(): Promise<Array<AVControlCommandType>>; 3541 3542 /** 3543 * Get commands supported by the current session 3544 * @returns {Array<AVControlCommandType> } array of AVControlCommandType 3545 * @throws { BusinessError } 6600101 - Session service exception. 3546 * @throws { BusinessError } 6600102 - The session does not exist. 3547 * @throws { BusinessError } 6600103 - The session controller does not exist. 3548 * @syscap SystemCapability.Multimedia.AVSession.Core 3549 * @since 10 3550 */ 3551 getValidCommandsSync(): Array<AVControlCommandType>; 3552 3553 /** 3554 * Send control commands to this session 3555 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 3556 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 3557 * @throws { BusinessError } 401 - parameter check failed 3558 * @throws { BusinessError } 6600101 - Session service exception. 3559 * @throws { BusinessError } 6600102 - The session does not exist. 3560 * @throws { BusinessError } 6600103 - The session controller does not exist. 3561 * @throws { BusinessError } 6600105 - Invalid session command. 3562 * @throws { BusinessError } 6600106 - The session is not activated. 3563 * @throws { BusinessError } 6600107 - Too many commands or events. 3564 * @syscap SystemCapability.Multimedia.AVSession.Core 3565 * @since 10 3566 */ 3567 sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void; 3568 3569 /** 3570 * Send control commands to this session 3571 * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} 3572 * @returns { Promise<void> } void promise when executed successfully 3573 * @throws { BusinessError } 401 - parameter check failed 3574 * @throws { BusinessError } 6600101 - Session service exception. 3575 * @throws { BusinessError } 6600102 - The session does not exist. 3576 * @throws { BusinessError } 6600103 - The session controller does not exist. 3577 * @throws { BusinessError } 6600105 - Invalid session command. 3578 * @throws { BusinessError } 6600106 - The session is not activated. 3579 * @throws { BusinessError } 6600107 - Too many commands or events. 3580 * @syscap SystemCapability.Multimedia.AVSession.Core 3581 * @since 10 3582 */ 3583 sendControlCommand(command: AVControlCommand): Promise<void>; 3584 3585 /** 3586 * Send common commands to this session 3587 * @param { string } command - The command name to be sent. 3588 * @param { object } args - The parameters of session event 3589 * @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully. 3590 * @throws { BusinessError } 401 - parameter check failed 3591 * @throws { BusinessError } 6600101 - Session service exception. 3592 * @throws { BusinessError } 6600102 - The session does not exist. 3593 * @throws { BusinessError } 6600103 - The session controller does not exist. 3594 * @throws { BusinessError } 6600105 - Invalid session command. 3595 * @throws { BusinessError } 6600106 - The session is not activated. 3596 * @throws { BusinessError } 6600107 - Too many commands or events. 3597 * @syscap SystemCapability.Multimedia.AVSession.Core 3598 * @since 10 3599 */ 3600 sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback<void>): void; 3601 3602 /** 3603 * Send common commands to this session 3604 * @param { string } command - The command name to be sent. 3605 * @param { object } args - The parameters of session event 3606 * @returns { Promise<void> } void promise when executed successfully 3607 * @throws { BusinessError } 401 - parameter check failed 3608 * @throws { BusinessError } 6600101 - Session service exception. 3609 * @throws { BusinessError } 6600102 - The session does not exist. 3610 * @throws { BusinessError } 6600103 - The session controller does not exist. 3611 * @throws { BusinessError } 6600105 - Invalid session command. 3612 * @throws { BusinessError } 6600106 - The session is not activated. 3613 * @throws { BusinessError } 6600107 - Too many commands or events. 3614 * @syscap SystemCapability.Multimedia.AVSession.Core 3615 * @since 10 3616 */ 3617 sendCommonCommand(command: string, args: {[key: string]: Object}): Promise<void>; 3618 3619 /** 3620 * Get custom media packets provided by the corresponding session 3621 * @param { AsyncCallback<{[key: string]: Object}> } callback - The triggered asyncCallback when (getExtras). 3622 * @throws { BusinessError } 401 - parameter check failed 3623 * @throws { BusinessError } 6600101 - Session service exception. 3624 * @throws { BusinessError } 6600102 - The session does not exist. 3625 * @throws { BusinessError } 6600103 - The session controller does not exist. 3626 * @throws { BusinessError } 6600105 - Invalid session command. 3627 * @throws { BusinessError } 6600107 - Too many commands or events. 3628 * @syscap SystemCapability.Multimedia.AVSession.Core 3629 * @since 10 3630 */ 3631 getExtras(callback: AsyncCallback<{[key: string]: Object}>): void; 3632 3633 /** 3634 * Get custom media packets provided by the corresponding session 3635 * @returns { Promise<{[key: string]: Object}> } the parameters of extras 3636 * @throws { BusinessError } 401 - parameter check failed 3637 * @throws { BusinessError } 6600101 - Session service exception. 3638 * @throws { BusinessError } 6600102 - The session does not exist. 3639 * @throws { BusinessError } 6600103 - The session controller does not exist. 3640 * @throws { BusinessError } 6600105 - Invalid session command. 3641 * @throws { BusinessError } 6600107 - Too many commands or events. 3642 * @syscap SystemCapability.Multimedia.AVSession.Core 3643 * @since 10 3644 */ 3645 getExtras(): Promise<{[key: string]: Object}>; 3646 3647 /** 3648 * Register metadata changed callback 3649 * @param { 'metadataChange' } type 3650 * @param { Array<keyof AVMetadata> | 'all' } filter - The properties of {@link AVMetadata} that you cared about 3651 * @param { function } callback - The callback used to handle metadata changed event. 3652 * The callback function provides the {@link AVMetadata} parameter. 3653 * It only contains the properties set in the filter. 3654 * @throws { BusinessError } 401 - parameter check failed 3655 * @throws { BusinessError } 6600101 - Session service exception. 3656 * @throws { BusinessError } 6600103 - The session controller does not exist. 3657 * @syscap SystemCapability.Multimedia.AVSession.Core 3658 * @since 10 3659 */ 3660 on(type: 'metadataChange', filter: Array<keyof AVMetadata> | 'all', callback: (data: AVMetadata) => void); 3661 3662 /** 3663 * Unregister metadata changed callback 3664 * @param { 'metadataChange' } type 3665 * @param { function } callback - The callback used to handle metadata changed event. 3666 * The callback function provides the {@link AVMetadata} parameter. 3667 * It only contains the properties set in the filter. 3668 * @throws { BusinessError } 401 - parameter check failed 3669 * @throws { BusinessError } 6600101 - Session service exception. 3670 * @throws { BusinessError } 6600103 - The session controller does not exist. 3671 * @syscap SystemCapability.Multimedia.AVSession.Core 3672 * @since 10 3673 */ 3674 off(type: 'metadataChange', callback?: (data: AVMetadata) => void); 3675 3676 /** 3677 * Register playback state changed callback 3678 * @param { 'playbackStateChange' } type 3679 * @param { Array<keyof AVPlaybackState> | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about 3680 * @param { function } callback - The callback used to handle playback state changed event. 3681 * The callback function provides the {@link AVPlaybackState} parameter. 3682 * @throws { BusinessError } 401 - parameter check failed 3683 * @throws { BusinessError } 6600101 - Session service exception. 3684 * @throws { BusinessError } 6600103 - The session controller does not exist. 3685 * @syscap SystemCapability.Multimedia.AVSession.Core 3686 * @since 10 3687 */ 3688 on(type: 'playbackStateChange', filter: Array<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void); 3689 3690 /** 3691 * Unregister playback state changed callback 3692 * @param { 'playbackStateChange' } type 3693 * @param { function } callback - The callback used to handle playback state changed event. 3694 * The callback function provides the {@link AVPlaybackState} parameter. 3695 * @throws { BusinessError } 401 - parameter check failed 3696 * @throws { BusinessError } 6600101 - Session service exception. 3697 * @throws { BusinessError } 6600103 - The session controller does not exist. 3698 * @syscap SystemCapability.Multimedia.AVSession.Core 3699 * @since 10 3700 */ 3701 off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void); 3702 3703 /** 3704 * Register call metadata changed callback 3705 * @param { 'callMetadataChange' } type - 'callMetadataChange' 3706 * @param { Array<keyof CallMetadata> | 'all' } filter - The properties of {@link CallMetadata} that you cared about 3707 * @param { Callback<CallMetadata> } callback - The callback used to handle call metadata changed event. 3708 * The callback function provides the {@link CallMetadata} parameter. 3709 * It only contains the properties set in the filter. 3710 * @throws { BusinessError } 401 - parameter check failed 3711 * @throws { BusinessError } 6600101 - Session service exception. 3712 * @throws { BusinessError } 6600103 - The session controller does not exist. 3713 * @syscap SystemCapability.Multimedia.AVSession.Core 3714 * @since 11 3715 */ 3716 on(type: 'callMetadataChange', filter: Array<keyof CallMetadata> | 'all', callback: Callback<CallMetadata>): void; 3717 3718 /** 3719 * Unregister call metadata changed callback 3720 * @param { 'callMetadataChange' } type - 'callMetadataChange' 3721 * @param { Callback<CallMetadata> } callback - The callback used to handle call metadata changed event. 3722 * The callback function provides the {@link CallMetadata} parameter. 3723 * It only contains the properties set in the filter. 3724 * @throws { BusinessError } 401 - parameter check failed 3725 * @throws { BusinessError } 6600101 - Session service exception. 3726 * @throws { BusinessError } 6600103 - The session controller does not exist. 3727 * @syscap SystemCapability.Multimedia.AVSession.Core 3728 * @since 11 3729 */ 3730 off(type: 'callMetadataChange', callback?: Callback<CallMetadata>): void; 3731 3732 /** 3733 * Register call state changed callback 3734 * @param { 'callStateChange' } type - 'callStateChange' 3735 * @param { Array<keyof AVCallState> | 'all' } filter - The properties of {@link AVCallState} that you cared about 3736 * @param { Callback<AVCallState> } callback - The callback used to handle call state changed event. 3737 * The callback function provides the {@link AVCallState} parameter. 3738 * @throws { BusinessError } 401 - parameter check failed 3739 * @throws { BusinessError } 6600101 - Session service exception. 3740 * @throws { BusinessError } 6600103 - The session controller does not exist. 3741 * @syscap SystemCapability.Multimedia.AVSession.Core 3742 * @since 11 3743 */ 3744 on(type: 'callStateChange', filter: Array<keyof AVCallState> | 'all', callback: Callback<AVCallState>): void; 3745 3746 /** 3747 * Unregister playback state changed callback 3748 * @param { 'callStateChange' } type - 'callStateChange' 3749 * @param { Callback<AVCallState> } callback - The callback used to handle call state changed event. 3750 * The callback function provides the {@link AVCallState} parameter. 3751 * @throws { BusinessError } 401 - parameter check failed 3752 * @throws { BusinessError } 6600101 - Session service exception. 3753 * @throws { BusinessError } 6600103 - The session controller does not exist. 3754 * @syscap SystemCapability.Multimedia.AVSession.Core 3755 * @since 11 3756 */ 3757 off(type: 'callStateChange', callback?: Callback<AVCallState>): void; 3758 3759 /** 3760 * Register current session destroyed callback 3761 * @param { 'sessionDestroy' } type 3762 * @param { function } callback - The callback used to handle current session destroyed event. 3763 * @throws { BusinessError } 401 - parameter check failed 3764 * @throws { BusinessError } 6600101 - Session service exception. 3765 * @throws { BusinessError } 6600103 - The session controller does not exist. 3766 * @syscap SystemCapability.Multimedia.AVSession.Core 3767 * @since 10 3768 */ 3769 on(type: 'sessionDestroy', callback: () => void); 3770 3771 /** 3772 * Unregister current session destroyed callback 3773 * @param { 'sessionDestroy' } type - 'sessionDestroy' 3774 * @param { function } callback - The callback used to handle current session destroyed event. 3775 * @throws { BusinessError } 401 - parameter check failed 3776 * @throws { BusinessError } 6600101 - Session service exception. 3777 * @throws { BusinessError } 6600103 - The session controller does not exist. 3778 * @syscap SystemCapability.Multimedia.AVSession.Core 3779 * @since 10 3780 */ 3781 off(type: 'sessionDestroy', callback?: () => void); 3782 3783 /** 3784 * Register the active state of this session changed callback 3785 * @param { 'activeStateChange' } type - 'activeStateChange' 3786 * @param { function } callback - The callback used to handle the active state of this session changed event. 3787 * The callback function provides the changed session state. 3788 * @throws { BusinessError } 401 - parameter check failed 3789 * @throws { BusinessError } 6600101 - Session service exception. 3790 * @throws { BusinessError } 6600103 - The session controller does not exist. 3791 * @syscap SystemCapability.Multimedia.AVSession.Core 3792 * @since 10 3793 */ 3794 on(type: 'activeStateChange', callback: (isActive: boolean) => void); 3795 3796 /** 3797 * Unregister the active state of this session changed callback 3798 * @param { 'activeStateChange' } type - 'activeStateChange' 3799 * @param { function } callback - The callback used to handle the active state of this session changed event. 3800 * The callback function provides the changed session state. 3801 * @throws { BusinessError } 401 - parameter check failed 3802 * @throws { BusinessError } 6600101 - Session service exception. 3803 * @throws { BusinessError } 6600103 - The session controller does not exist. 3804 * @syscap SystemCapability.Multimedia.AVSession.Core 3805 * @since 10 3806 */ 3807 off(type: 'activeStateChange', callback?: (isActive: boolean) => void); 3808 3809 /** 3810 * Register the valid commands of the session changed callback 3811 * @param { 'validCommandChange' } type - 'validCommandChange' 3812 * @param { function } callback - The callback used to handle the changes. 3813 * The callback function provides an array of AVControlCommandType. 3814 * @throws { BusinessError } 401 - parameter check failed 3815 * @throws { BusinessError } 6600101 - Session service exception. 3816 * @throws { BusinessError } 6600103 - The session controller does not exist. 3817 * @syscap SystemCapability.Multimedia.AVSession.Core 3818 * @since 10 3819 */ 3820 on(type: 'validCommandChange', callback: (commands: Array<AVControlCommandType>) => void); 3821 3822 /** 3823 * Unregister the valid commands of the session changed callback 3824 * @param { 'validCommandChange' } type - 'validCommandChange' 3825 * @param { function } callback - The callback used to handle the changes. 3826 * The callback function provides an array of AVControlCommandType. 3827 * @throws { BusinessError } 401 - parameter check failed 3828 * @throws { BusinessError } 6600101 - Session service exception. 3829 * @throws { BusinessError } 6600103 - The session controller does not exist. 3830 * @syscap SystemCapability.Multimedia.AVSession.Core 3831 * @since 10 3832 */ 3833 off(type: 'validCommandChange', callback?: (commands: Array<AVControlCommandType>) => void); 3834 3835 /** 3836 * Register session output device change callback 3837 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 3838 * @param { function } callback - Used to handle output device changed. 3839 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 3840 * @throws { BusinessError } 401 - parameter check failed 3841 * @throws { BusinessError } 6600101 - Session service exception 3842 * @throws { BusinessError } 6600103 - The session controller does not exist 3843 * @syscap SystemCapability.Multimedia.AVSession.Core 3844 * @since 10 3845 */ 3846 on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 3847 3848 /** 3849 * Unregister session output device change callback 3850 * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' 3851 * @param { function } callback - Used to handle output device changed. 3852 * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. 3853 * @throws { BusinessError } 401 - parameter check failed 3854 * @throws { BusinessError } 6600101 - Session service exception 3855 * @throws { BusinessError } 6600103 - The session controller does not exist 3856 * @syscap SystemCapability.Multimedia.AVSession.Core 3857 * @since 10 3858 */ 3859 off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; 3860 3861 /** 3862 * Register session event callback 3863 * @param { 'sessionEvent' } type - 'sessionEvent' 3864 * @param { function } callback - The callback used to handle session event changed event. 3865 * The callback function provides the event string and key-value pair parameters. 3866 * @throws { BusinessError } 401 - parameter check failed 3867 * @throws { BusinessError } 6600101 - Session service exception. 3868 * @throws { BusinessError } 6600103 - The session controller does not exist. 3869 * @syscap SystemCapability.Multimedia.AVSession.Core 3870 * @since 10 3871 */ 3872 on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key: string]: Object}) => void): void; 3873 3874 /** 3875 * Unregister session event callback 3876 * @param { 'sessionEvent' } type - 'sessionEvent' 3877 * @param { function } callback - Used to cancel a specific listener 3878 * The callback function provides the event string and key-value pair parameters. 3879 * @throws { BusinessError } 401 - parameter check failed 3880 * @throws { BusinessError } 6600101 - Session service exception. 3881 * @throws { BusinessError } 6600103 - The session controller does not exist. 3882 * @syscap SystemCapability.Multimedia.AVSession.Core 3883 * @since 10 3884 */ 3885 off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key: string]: Object}) => void): void; 3886 3887 /** 3888 * Register session playlist change callback 3889 * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' 3890 * @param { function } callback - Used to handle playlist changed. 3891 * The callback provides the new array of AVQueueItem {@link AVQueueItem} 3892 * @throws { BusinessError } 401 - parameter check failed 3893 * @throws { BusinessError } 6600101 - Session service exception. 3894 * @throws { BusinessError } 6600103 - The session controller does not exist. 3895 * @syscap SystemCapability.Multimedia.AVSession.Core 3896 * @since 10 3897 */ 3898 on(type: 'queueItemsChange', callback: (items: Array<AVQueueItem>) => void): void; 3899 3900 /** 3901 * Unregister session playlist change callback 3902 * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' 3903 * @param { function } callback - Used to handle playlist changed. 3904 * The callback provides the new array of AVQueueItem {@link AVQueueItem} 3905 * @throws { BusinessError } 401 - parameter check failed 3906 * @throws { BusinessError } 6600101 - Session service exception. 3907 * @throws { BusinessError } 6600103 - The session controller does not exist. 3908 * @syscap SystemCapability.Multimedia.AVSession.Core 3909 * @since 10 3910 */ 3911 off(type: 'queueItemsChange', callback?: (items: Array<AVQueueItem>) => void): void; 3912 3913 /** 3914 * Register the name of session playlist change callback 3915 * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' 3916 * @param { function } callback - Used to handle name of playlist changed. 3917 * The callback provides the new name. 3918 * @throws { BusinessError } 401 - parameter check failed 3919 * @throws { BusinessError } 6600101 - Session service exception. 3920 * @throws { BusinessError } 6600103 - The session controller does not exist. 3921 * @syscap SystemCapability.Multimedia.AVSession.Core 3922 * @since 10 3923 */ 3924 on(type: 'queueTitleChange', callback: (title: string) => void): void; 3925 3926 /** 3927 * Unregister the name of session playlist change callback 3928 * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' 3929 * @param { function } callback - Used to handle name of playlist changed. 3930 * The callback provides the new name. 3931 * @throws { BusinessError } 401 - parameter check failed 3932 * @throws { BusinessError } 6600101 - Session service exception. 3933 * @throws { BusinessError } 6600103 - The session controller does not exist. 3934 * @syscap SystemCapability.Multimedia.AVSession.Core 3935 * @since 10 3936 */ 3937 off(type: 'queueTitleChange', callback?: (title: string) => void): void; 3938 3939 /** 3940 * Register the custom media packets change callback 3941 * @param { 'extrasChange' } type - Registration Type 'extrasChange' 3942 * @param { function } callback - Used to handle custom media packets changed. 3943 * The callback provides the new media packets. 3944 * @throws { BusinessError } 401 - parameter check failed 3945 * @throws { BusinessError } 6600101 - Session service exception. 3946 * @throws { BusinessError } 6600103 - The session controller does not exist. 3947 * @syscap SystemCapability.Multimedia.AVSession.Core 3948 * @since 10 3949 */ 3950 on(type: 'extrasChange', callback: (extras: {[key: string]: Object}) => void): void; 3951 3952 /** 3953 * Unregister the custom media packets change callback 3954 * @param { 'extrasChange' } type - Registration Type 'extrasChange' 3955 * @param { function } callback - Used to handle custom media packets changed. 3956 * The callback provides the new media packets. 3957 * @throws { BusinessError } 401 - parameter check failed 3958 * @throws { BusinessError } 6600101 - Session service exception. 3959 * @throws { BusinessError } 6600103 - The session controller does not exist. 3960 * @syscap SystemCapability.Multimedia.AVSession.Core 3961 * @since 10 3962 */ 3963 off(type: 'extrasChange', callback?: (extras: {[key: string]: Object}) => void): void; 3964 } 3965 3966 /** 3967 * The type of control command 3968 * @syscap SystemCapability.Multimedia.AVSession.Core 3969 * @since 10 3970 */ 3971 /** 3972 * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' 3973 * @syscap SystemCapability.Multimedia.AVSession.Core 3974 * @since 11 3975 */ 3976 type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 3977 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute'; 3978 3979 /** 3980 * The definition of command to be sent to the session 3981 * @interface AVControlCommand 3982 * @syscap SystemCapability.Multimedia.AVSession.Core 3983 * @since 10 3984 */ 3985 interface AVControlCommand { 3986 /** 3987 * The command value {@link AVControlCommandType} 3988 * @syscap SystemCapability.Multimedia.AVSession.Core 3989 * @since 10 3990 */ 3991 command: AVControlCommandType; 3992 3993 /** 3994 * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} 3995 * seek command requires a number parameter 3996 * setSpeed command requires a number parameter 3997 * setLoopMode command requires a {@link LoopMode} parameter. 3998 * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter 3999 * other commands need no parameter 4000 * @syscap SystemCapability.Multimedia.AVSession.Core 4001 * @since 10 4002 */ 4003 parameter?: LoopMode | string | number; 4004 } 4005 4006 /** 4007 * Enumerates ErrorCode types, returns in BusinessError.code. 4008 * @enum { number } 4009 * @syscap SystemCapability.Multimedia.AVSession.Core 4010 * @since 10 4011 */ 4012 enum AVSessionErrorCode { 4013 /** 4014 * Session service exception. 4015 * @syscap SystemCapability.Multimedia.AVSession.Core 4016 * @since 10 4017 */ 4018 ERR_CODE_SERVICE_EXCEPTION = 6600101, 4019 4020 /** 4021 * The session does not exist 4022 * @syscap SystemCapability.Multimedia.AVSession.Core 4023 * @since 10 4024 */ 4025 ERR_CODE_SESSION_NOT_EXIST = 6600102, 4026 4027 /** 4028 * The session controller does not exist. 4029 * @syscap SystemCapability.Multimedia.AVSession.Core 4030 * @since 10 4031 */ 4032 ERR_CODE_CONTROLLER_NOT_EXIST = 6600103, 4033 4034 /** 4035 * The remote session connection failed. 4036 * @syscap SystemCapability.Multimedia.AVSession.Core 4037 * @since 10 4038 */ 4039 ERR_CODE_REMOTE_CONNECTION_ERR = 6600104, 4040 4041 /** 4042 * Invalid session command. 4043 * @syscap SystemCapability.Multimedia.AVSession.Core 4044 * @since 10 4045 */ 4046 ERR_CODE_COMMAND_INVALID = 6600105, 4047 4048 /** 4049 * The session is not activated. 4050 * @syscap SystemCapability.Multimedia.AVSession.Core 4051 * @since 10 4052 */ 4053 ERR_CODE_SESSION_INACTIVE = 6600106, 4054 4055 /** 4056 * Too many commands or events. 4057 * @syscap SystemCapability.Multimedia.AVSession.Core 4058 * @since 10 4059 */ 4060 ERR_CODE_MESSAGE_OVERLOAD = 6600107, 4061 4062 /** 4063 * Device connecting failed. 4064 * @syscap SystemCapability.Multimedia.AVSession.Core 4065 * @since 10 4066 */ 4067 ERR_CODE_DEVICE_CONNECTION_FAILED = 6600108, 4068 4069 /** 4070 * The remote connection is not established. 4071 * @syscap SystemCapability.Multimedia.AVSession.Core 4072 * @since 10 4073 */ 4074 ERR_CODE_REMOTE_CONNECTION_NOT_EXIST = 6600109, 4075 } 4076} 4077 4078export default avSession; 4079