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