1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Seek mode. 18 * 19 * @enum { number } 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 8 22 */ 23/** 24 * Seek mode. 25 * 26 * @enum { number } 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @since 10 30 */ 31declare enum SeekMode { 32 /** 33 * Sync to keyframes before the time point. 34 * 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @since 8 37 */ 38 /** 39 * Sync to keyframes before the time point. 40 * 41 * @syscap SystemCapability.ArkUI.ArkUI.Full 42 * @crossplatform 43 * @since 10 44 */ 45 PreviousKeyframe, 46 47 /** 48 * Sync to keyframes after the time point. 49 * 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @since 8 52 */ 53 /** 54 * Sync to keyframes after the time point. 55 * 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @crossplatform 58 * @since 10 59 */ 60 NextKeyframe, 61 62 /** 63 * Sync to closest keyframes. 64 * 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @since 8 67 */ 68 /** 69 * Sync to closest keyframes. 70 * 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @crossplatform 73 * @since 10 74 */ 75 ClosestKeyframe, 76 77 /** 78 * Seek to frames closest the time point. 79 * 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @since 8 82 */ 83 /** 84 * Seek to frames closest the time point. 85 * 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @crossplatform 88 * @since 10 89 */ 90 Accurate, 91} 92 93/** 94 * playback speed. 95 * 96 * @enum { number } 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @since 8 99 */ 100/** 101 * playback speed. 102 * 103 * @enum { number } 104 * @syscap SystemCapability.ArkUI.ArkUI.Full 105 * @crossplatform 106 * @since 10 107 */ 108declare enum PlaybackSpeed { 109 /** 110 * 0.75x speed playback. 111 * 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @since 8 114 */ 115 /** 116 * 0.75x speed playback. 117 * 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @crossplatform 120 * @since 10 121 */ 122 Speed_Forward_0_75_X, 123 124 /** 125 * 1.00x speed playback. 126 * 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @since 8 129 */ 130 /** 131 * 1.00x speed playback. 132 * 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @crossplatform 135 * @since 10 136 */ 137 Speed_Forward_1_00_X, 138 139 /** 140 * 1.25x speed playback. 141 * 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @since 8 144 */ 145 /** 146 * 1.25x speed playback. 147 * 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @crossplatform 150 * @since 10 151 */ 152 Speed_Forward_1_25_X, 153 154 /** 155 * 1.75x speed playback. 156 * 157 * @syscap SystemCapability.ArkUI.ArkUI.Full 158 * @since 8 159 */ 160 /** 161 * 1.75x speed playback. 162 * 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @crossplatform 165 * @since 10 166 */ 167 Speed_Forward_1_75_X, 168 169 /** 170 * 2.00x speed playback. 171 * 172 * @syscap SystemCapability.ArkUI.ArkUI.Full 173 * @since 8 174 */ 175 /** 176 * 2.00x speed playback. 177 * 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @crossplatform 180 * @since 10 181 */ 182 Speed_Forward_2_00_X, 183} 184 185/** 186 * Defines the video options. 187 * 188 * @interface VideoOptions 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @since 7 191 */ 192/** 193 * Defines the video options. 194 * 195 * @interface VideoOptions 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @crossplatform 198 * @since 10 199 */ 200declare interface VideoOptions { 201 /** 202 * src of video. 203 * 204 * @type { ?(string | Resource) } 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @since 7 207 */ 208 /** 209 * src of video. 210 * 211 * @type { ?(string | Resource) } 212 * @syscap SystemCapability.ArkUI.ArkUI.Full 213 * @crossplatform 214 * @since 10 215 */ 216 src?: string | Resource; 217 218 /** 219 * playback rate of video. 220 * 221 * @type { ?(number | string | PlaybackSpeed) } 222 * @syscap SystemCapability.ArkUI.ArkUI.Full 223 * @since 7 224 */ 225 /** 226 * playback rate of video. 227 * 228 * @type { ?(number | string | PlaybackSpeed) } 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @crossplatform 231 * @since 10 232 */ 233 currentProgressRate?: number | string | PlaybackSpeed; 234 235 /** 236 * preview uri of video. 237 * 238 * @type { ?(string | PixelMap | Resource) } 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @since 7 241 */ 242 /** 243 * preview uri of video. 244 * 245 * @type { ?(string | PixelMap | Resource) } 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @crossplatform 248 * @since 10 249 */ 250 previewUri?: string | PixelMap | Resource; 251 252 /** 253 * controller of video. 254 * 255 * @type { ?VideoController } 256 * @syscap SystemCapability.ArkUI.ArkUI.Full 257 * @since 7 258 */ 259 /** 260 * controller of video. 261 * 262 * @type { ?VideoController } 263 * @syscap SystemCapability.ArkUI.ArkUI.Full 264 * @crossplatform 265 * @since 10 266 */ 267 controller?: VideoController; 268} 269 270/** 271 * Defines the video controller. 272 * 273 * @syscap SystemCapability.ArkUI.ArkUI.Full 274 * @since 7 275 */ 276/** 277 * Defines the video controller. 278 * 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @crossplatform 281 * @since 10 282 */ 283declare class VideoController { 284 /** 285 * constructor. 286 * 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @since 7 289 */ 290 /** 291 * constructor. 292 * 293 * @syscap SystemCapability.ArkUI.ArkUI.Full 294 * @crossplatform 295 * @since 10 296 */ 297 constructor(); 298 299 /** 300 * Provides events to play. 301 * 302 * @syscap SystemCapability.ArkUI.ArkUI.Full 303 * @since 7 304 */ 305 /** 306 * Provides events to play. 307 * 308 * @syscap SystemCapability.ArkUI.ArkUI.Full 309 * @crossplatform 310 * @since 10 311 */ 312 start(); 313 314 /** 315 * Provides a pause event for playback. 316 * 317 * @syscap SystemCapability.ArkUI.ArkUI.Full 318 * @since 7 319 */ 320 /** 321 * Provides a pause event for playback. 322 * 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @crossplatform 325 * @since 10 326 */ 327 pause(); 328 329 /** 330 * Provides an event to stop playback. 331 * 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @since 7 334 */ 335 /** 336 * Provides an event to stop playback. 337 * 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @crossplatform 340 * @since 10 341 */ 342 stop(); 343 344 /** 345 * Provide the progress method of video playback. 346 * 347 * @param { number } value 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @since 7 350 */ 351 /** 352 * Provide the progress method of video playback. 353 * 354 * @param { number } value 355 * @syscap SystemCapability.ArkUI.ArkUI.Full 356 * @crossplatform 357 * @since 10 358 */ 359 setCurrentTime(value: number); 360 361 /** 362 * Provides a full screen playback method. 363 * 364 * @param { boolean } value 365 * @syscap SystemCapability.ArkUI.ArkUI.Full 366 * @since 7 367 */ 368 /** 369 * Provides a full screen playback method. 370 * 371 * @param { boolean } value 372 * @syscap SystemCapability.ArkUI.ArkUI.Full 373 * @crossplatform 374 * @since 10 375 */ 376 requestFullscreen(value: boolean); 377 378 /** 379 * Provides a method to exit full screen playback. 380 * 381 * @syscap SystemCapability.ArkUI.ArkUI.Full 382 * @since 7 383 */ 384 /** 385 * Provides a method to exit full screen playback. 386 * 387 * @syscap SystemCapability.ArkUI.ArkUI.Full 388 * @crossplatform 389 * @since 10 390 */ 391 exitFullscreen(); 392 393 /** 394 * Provide the progress method of video playback. 395 * 396 * @param { number } value 397 * @param { SeekMode } seekMode 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @since 8 400 */ 401 /** 402 * Provide the progress method of video playback. 403 * 404 * @param { number } value 405 * @param { SeekMode } seekMode 406 * @syscap SystemCapability.ArkUI.ArkUI.Full 407 * @crossplatform 408 * @since 10 409 */ 410 setCurrentTime(value: number, seekMode: SeekMode); 411} 412 413/** 414 * Defines the video interface. 415 * 416 * @interface VideoInterface 417 * @syscap SystemCapability.ArkUI.ArkUI.Full 418 * @since 7 419 */ 420/** 421 * Defines the video interface. 422 * 423 * @interface VideoInterface 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @crossplatform 426 * @since 10 427 */ 428interface VideoInterface { 429 /** 430 * Set the value. 431 * 432 * @param { VideoOptions } value 433 * @returns { VideoAttribute } 434 * @syscap SystemCapability.ArkUI.ArkUI.Full 435 * @since 7 436 */ 437 /** 438 * Set the value. 439 * 440 * @param { VideoOptions } value 441 * @returns { VideoAttribute } 442 * @syscap SystemCapability.ArkUI.ArkUI.Full 443 * @crossplatform 444 * @since 10 445 */ 446 (value: VideoOptions): VideoAttribute; 447} 448 449/** 450 * Defines the video attribute functions. 451 * 452 * @extends CommonMethod 453 * @syscap SystemCapability.ArkUI.ArkUI.Full 454 * @since 7 455 */ 456/** 457 * Defines the video attribute functions. 458 * 459 * @extends CommonMethod 460 * @syscap SystemCapability.ArkUI.ArkUI.Full 461 * @crossplatform 462 * @since 10 463 */ 464declare class VideoAttribute extends CommonMethod<VideoAttribute> { 465 /** 466 * Called when judging whether the video is muted. 467 * 468 * @param { boolean } value 469 * @returns { VideoAttribute } 470 * @syscap SystemCapability.ArkUI.ArkUI.Full 471 * @since 7 472 */ 473 /** 474 * Called when judging whether the video is muted. 475 * 476 * @param { boolean } value 477 * @returns { VideoAttribute } 478 * @syscap SystemCapability.ArkUI.ArkUI.Full 479 * @crossplatform 480 * @since 10 481 */ 482 muted(value: boolean): VideoAttribute; 483 484 /** 485 * Called when judging whether the video is played automatically. 486 * 487 * @param { boolean } value 488 * @returns { VideoAttribute } 489 * @syscap SystemCapability.ArkUI.ArkUI.Full 490 * @since 7 491 */ 492 /** 493 * Called when judging whether the video is played automatically. 494 * 495 * @param { boolean } value 496 * @returns { VideoAttribute } 497 * @syscap SystemCapability.ArkUI.ArkUI.Full 498 * @crossplatform 499 * @since 10 500 */ 501 autoPlay(value: boolean): VideoAttribute; 502 503 /** 504 * Called when judging whether the control bar is displayed. 505 * 506 * @param { boolean } value 507 * @returns { VideoAttribute } 508 * @syscap SystemCapability.ArkUI.ArkUI.Full 509 * @since 7 510 */ 511 /** 512 * Called when judging whether the control bar is displayed. 513 * 514 * @param { boolean } value 515 * @returns { VideoAttribute } 516 * @syscap SystemCapability.ArkUI.ArkUI.Full 517 * @crossplatform 518 * @since 10 519 */ 520 controls(value: boolean): VideoAttribute; 521 522 /** 523 * Called when judging whether the video is played circular. 524 * 525 * @param { boolean } value 526 * @returns { VideoAttribute } 527 * @syscap SystemCapability.ArkUI.ArkUI.Full 528 * @since 6 529 */ 530 /** 531 * Called when judging whether the video is played circular. 532 * 533 * @param { boolean } value 534 * @returns { VideoAttribute } 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @since 10 538 */ 539 loop(value: boolean): VideoAttribute; 540 541 /** 542 * Called when determining the zoom type of the video source. 543 * 544 * @param { ImageFit } value 545 * @returns { VideoAttribute } 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @since 7 548 */ 549 /** 550 * Called when determining the zoom type of the video source. 551 * 552 * @param { ImageFit } value 553 * @returns { VideoAttribute } 554 * @syscap SystemCapability.ArkUI.ArkUI.Full 555 * @crossplatform 556 * @since 10 557 */ 558 objectFit(value: ImageFit): VideoAttribute; 559 560 /** 561 * Called when the video is played. 562 * 563 * @param { function } event 564 * @returns { VideoAttribute } 565 * @syscap SystemCapability.ArkUI.ArkUI.Full 566 * @since 7 567 */ 568 /** 569 * Called when the video is played. 570 * 571 * @param { function } event 572 * @returns { VideoAttribute } 573 * @syscap SystemCapability.ArkUI.ArkUI.Full 574 * @crossplatform 575 * @since 10 576 */ 577 onStart(event: () => void): VideoAttribute; 578 579 /** 580 * Called when the video is paused. 581 * 582 * @param { function } event 583 * @returns { VideoAttribute } 584 * @syscap SystemCapability.ArkUI.ArkUI.Full 585 * @since 7 586 */ 587 /** 588 * Called when the video is paused. 589 * 590 * @param { function } event 591 * @returns { VideoAttribute } 592 * @syscap SystemCapability.ArkUI.ArkUI.Full 593 * @crossplatform 594 * @since 10 595 */ 596 onPause(event: () => void): VideoAttribute; 597 598 /** 599 * Called when the video playback ends. 600 * 601 * @param { function } event 602 * @returns { VideoAttribute } 603 * @syscap SystemCapability.ArkUI.ArkUI.Full 604 * @since 7 605 */ 606 /** 607 * Called when the video playback ends. 608 * 609 * @param { function } event 610 * @returns { VideoAttribute } 611 * @syscap SystemCapability.ArkUI.ArkUI.Full 612 * @crossplatform 613 * @since 10 614 */ 615 onFinish(event: () => void): VideoAttribute; 616 617 /** 618 * Called when the video enters and exits the full screen. 619 * 620 * @param { function } callback 621 * @returns { VideoAttribute } 622 * @syscap SystemCapability.ArkUI.ArkUI.Full 623 * @since 7 624 */ 625 /** 626 * Called when the video enters and exits the full screen. 627 * 628 * @param { function } callback 629 * @returns { VideoAttribute } 630 * @syscap SystemCapability.ArkUI.ArkUI.Full 631 * @crossplatform 632 * @since 10 633 */ 634 onFullscreenChange(callback: (event: { 635 /** 636 * Play the flag in full screen. 637 * 638 * @syscap SystemCapability.ArkUI.ArkUI.Full 639 * @crossplatform 640 * @since 10 641 */ 642 fullscreen: boolean 643 }) => void): VideoAttribute; 644 645 /** 646 * Called when the video preparation is complete. 647 * 648 * @param { function } callback 649 * @returns { VideoAttribute } 650 * @syscap SystemCapability.ArkUI.ArkUI.Full 651 * @since 7 652 */ 653 /** 654 * Called when the video preparation is complete. 655 * 656 * @param { function } callback 657 * @returns { VideoAttribute } 658 * @syscap SystemCapability.ArkUI.ArkUI.Full 659 * @crossplatform 660 * @since 10 661 */ 662 onPrepared(callback: (event: { 663 /** 664 * Playback duration. 665 * 666 * @syscap SystemCapability.ArkUI.ArkUI.Full 667 * @crossplatform 668 * @since 10 669 */ 670 duration: number 671 }) => void): VideoAttribute; 672 673 /** 674 * Called when the time information is reported when the progress bar process is operated. 675 * 676 * @param { function } callback 677 * @returns { VideoAttribute } 678 * @syscap SystemCapability.ArkUI.ArkUI.Full 679 * @since 7 680 */ 681 /** 682 * Called when the time information is reported when the progress bar process is operated. 683 * 684 * @param { function } callback 685 * @returns { VideoAttribute } 686 * @syscap SystemCapability.ArkUI.ArkUI.Full 687 * @crossplatform 688 * @since 10 689 */ 690 onSeeking(callback: (event: { 691 /** 692 * Play time. 693 * 694 * @syscap SystemCapability.ArkUI.ArkUI.Full 695 * @crossplatform 696 * @since 10 697 */ 698 time: number 699 }) => void): VideoAttribute; 700 701 /** 702 * Called when the playback time information is reported after the operation progress bar is completed. 703 * 704 * @param { function } callback 705 * @returns { VideoAttribute } 706 * @syscap SystemCapability.ArkUI.ArkUI.Full 707 * @since 7 708 */ 709 /** 710 * Called when the playback time information is reported after the operation progress bar is completed. 711 * 712 * @param { function } callback 713 * @returns { VideoAttribute } 714 * @syscap SystemCapability.ArkUI.ArkUI.Full 715 * @crossplatform 716 * @since 10 717 */ 718 onSeeked(callback: (event: { 719 /** 720 * Play time. 721 * 722 * @syscap SystemCapability.ArkUI.ArkUI.Full 723 * @crossplatform 724 * @since 10 725 */ 726 time: number 727 }) => void): VideoAttribute; 728 729 /** 730 * Called when the playback progress changes. 731 * 732 * @param { function } callback 733 * @returns { VideoAttribute } 734 * @syscap SystemCapability.ArkUI.ArkUI.Full 735 * @since 7 736 */ 737 /** 738 * Called when the playback progress changes. 739 * 740 * @param { function } callback 741 * @returns { VideoAttribute } 742 * @syscap SystemCapability.ArkUI.ArkUI.Full 743 * @crossplatform 744 * @since 10 745 */ 746 onUpdate(callback: (event: { 747 /** 748 * Play time. 749 * 750 * @syscap SystemCapability.ArkUI.ArkUI.Full 751 * @crossplatform 752 * @since 10 753 */ 754 time: number 755 }) => void): VideoAttribute; 756 757 /** 758 * Called when playback fails. 759 * 760 * @param { function } event 761 * @returns { VideoAttribute } 762 * @syscap SystemCapability.ArkUI.ArkUI.Full 763 * @since 7 764 */ 765 /** 766 * Called when playback fails. 767 * 768 * @param { function } event 769 * @returns { VideoAttribute } 770 * @syscap SystemCapability.ArkUI.ArkUI.Full 771 * @crossplatform 772 * @since 10 773 */ 774 onError(event: () => void): VideoAttribute; 775} 776 777/** 778 * Defines Video Component. 779 * 780 * @syscap SystemCapability.ArkUI.ArkUI.Full 781 * @since 7 782 */ 783/** 784 * Defines Video Component. 785 * 786 * @syscap SystemCapability.ArkUI.ArkUI.Full 787 * @crossplatform 788 * @since 10 789 */ 790declare const Video: VideoInterface; 791 792/** 793 * Defines Video Component instance. 794 * 795 * @syscap SystemCapability.ArkUI.ArkUI.Full 796 * @since 7 797 */ 798/** 799 * Defines Video Component instance. 800 * 801 * @syscap SystemCapability.ArkUI.ArkUI.Full 802 * @crossplatform 803 * @since 10 804 */ 805declare const VideoInstance: VideoAttribute; 806