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