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