1/* 2* Copyright (C) 2023 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16/** 17 * @file Defines the DRM capability. 18 * @kit DrmKit 19 */ 20 21/** 22 * This module provides the DRM capability to multimedia player. 23 * @namespace drm 24 * @syscap SystemCapability.Multimedia.Drm.Core 25 * @since 11 26 */ 27/** 28 * This module provides the DRM capability to multimedia player. 29 * @namespace drm 30 * @syscap SystemCapability.Multimedia.Drm.Core 31 * @atomicservice 32 * @since 12 33 */ 34declare namespace drm { 35/** 36 * Enumerates drm error code. 37 * @enum { number } 38 * @syscap SystemCapability.Multimedia.Drm.Core 39 * @since 11 40 */ 41/** 42 * Enumerates drm error code. 43 * @enum { number } 44 * @syscap SystemCapability.Multimedia.Drm.Core 45 * @atomicservice 46 * @since 14 47 */ 48 enum DrmErrorCode { 49 /** 50 * All unknown errors. 51 * @syscap SystemCapability.Multimedia.Drm.Core 52 * @since 11 53 */ 54 /** 55 * All unknown errors. 56 * @syscap SystemCapability.Multimedia.Drm.Core 57 * @atomicservice 58 * @since 14 59 */ 60 ERROR_UNKNOWN = 24700101, 61 /** 62 * Meet max MediaKeySystem num limit. 63 * @syscap SystemCapability.Multimedia.Drm.Core 64 * @since 11 65 */ 66 /** 67 * Meet max MediaKeySystem num limit. 68 * @syscap SystemCapability.Multimedia.Drm.Core 69 * @atomicservice 70 * @since 14 71 */ 72 MAX_SYSTEM_NUM_REACHED = 24700103, 73 /** 74 * Meet max MediaKeySession num limit. 75 * @syscap SystemCapability.Multimedia.Drm.Core 76 * @since 11 77 */ 78 /** 79 * Meet max MediaKeySession num limit. 80 * @syscap SystemCapability.Multimedia.Drm.Core 81 * @atomicservice 82 * @since 14 83 */ 84 MAX_SESSION_NUM_REACHED = 24700104, 85 /** 86 * Fatal service error, for example, service died. 87 * @syscap SystemCapability.Multimedia.Drm.Core 88 * @since 11 89 */ 90 /** 91 * Fatal service error, for example, service died. 92 * @syscap SystemCapability.Multimedia.Drm.Core 93 * @atomicservice 94 * @since 14 95 */ 96 SERVICE_FATAL_ERROR = 24700201 97 } 98 99 /** 100 * Enumerates which config name we can get. 101 * @enum { string } 102 * @syscap SystemCapability.Multimedia.Drm.Core 103 * @since 11 104 */ 105 /** 106 * Enumerates which config name we can get. 107 * @enum { string } 108 * @syscap SystemCapability.Multimedia.Drm.Core 109 * @atomicservice 110 * @since 14 111 */ 112 enum PreDefinedConfigName { 113 /** 114 * Config name vendor 115 * @syscap SystemCapability.Multimedia.Drm.Core 116 * @since 11 117 */ 118 /** 119 * Config name vendor 120 * @syscap SystemCapability.Multimedia.Drm.Core 121 * @atomicservice 122 * @since 14 123 */ 124 CONFIG_DEVICE_VENDOR = 'vendor', 125 /** 126 * Config name version 127 * @syscap SystemCapability.Multimedia.Drm.Core 128 * @since 11 129 */ 130 /** 131 * Config name version 132 * @syscap SystemCapability.Multimedia.Drm.Core 133 * @atomicservice 134 * @since 14 135 */ 136 CONFIG_DEVICE_VERSION = 'version', 137 /** 138 * Config name description 139 * @syscap SystemCapability.Multimedia.Drm.Core 140 * @since 11 141 */ 142 /** 143 * Config name description 144 * @syscap SystemCapability.Multimedia.Drm.Core 145 * @atomicservice 146 * @since 14 147 */ 148 CONFIG_DEVICE_DESCRIPTION = 'description', 149 /** 150 * Config name algorithms 151 * @syscap SystemCapability.Multimedia.Drm.Core 152 * @since 11 153 */ 154 /** 155 * Config name algorithms 156 * @syscap SystemCapability.Multimedia.Drm.Core 157 * @atomicservice 158 * @since 14 159 */ 160 CONFIG_DEVICE_ALGORITHMS = 'algorithms', 161 /** 162 * Config name deviceUniqueId 163 * @syscap SystemCapability.Multimedia.Drm.Core 164 * @since 11 165 */ 166 /** 167 * Config name deviceUniqueId 168 * @syscap SystemCapability.Multimedia.Drm.Core 169 * @atomicservice 170 * @since 14 171 */ 172 CONFIG_DEVICE_UNIQUE_ID = 'deviceUniqueId', 173 /** 174 * Config name maxSessionNum 175 * @syscap SystemCapability.Multimedia.Drm.Core 176 * @since 11 177 */ 178 /** 179 * Config name maxSessionNum 180 * @syscap SystemCapability.Multimedia.Drm.Core 181 * @atomicservice 182 * @since 14 183 */ 184 CONFIG_SESSION_MAX = 'maxSessionNum', 185 /** 186 * Config name currentSessionNum 187 * @syscap SystemCapability.Multimedia.Drm.Core 188 * @since 11 189 */ 190 /** 191 * Config name currentSessionNum 192 * @syscap SystemCapability.Multimedia.Drm.Core 193 * @atomicservice 194 * @since 14 195 */ 196 CONFIG_SESSION_CURRENT = 'currentSessionNum', 197 } 198 199 /** 200 * Enumerates media key type. 201 * @enum { number } 202 * @syscap SystemCapability.Multimedia.Drm.Core 203 * @since 11 204 */ 205 /** 206 * Enumerates media key type. 207 * @enum { number } 208 * @syscap SystemCapability.Multimedia.Drm.Core 209 * @atomicservice 210 * @since 14 211 */ 212 enum MediaKeyType { 213 /** 214 * Offline media key type. 215 * @syscap SystemCapability.Multimedia.Drm.Core 216 * @since 11 217 */ 218 /** 219 * Offline media key type. 220 * @syscap SystemCapability.Multimedia.Drm.Core 221 * @atomicservice 222 * @since 14 223 */ 224 MEDIA_KEY_TYPE_OFFLINE = 0, 225 /** 226 * Online media key type. 227 * @syscap SystemCapability.Multimedia.Drm.Core 228 * @since 11 229 */ 230 /** 231 * Online media key type. 232 * @syscap SystemCapability.Multimedia.Drm.Core 233 * @atomicservice 234 * @since 14 235 */ 236 MEDIA_KEY_TYPE_ONLINE, 237 } 238 239 /** 240 * Enumerates offline media key status. 241 * @enum { number } 242 * @syscap SystemCapability.Multimedia.Drm.Core 243 * @since 11 244 */ 245 /** 246 * Enumerates offline media key status. 247 * @enum { number } 248 * @syscap SystemCapability.Multimedia.Drm.Core 249 * @atomicservice 250 * @since 14 251 */ 252 enum OfflineMediaKeyStatus { 253 /** 254 * Offline media key status unknown. 255 * @syscap SystemCapability.Multimedia.Drm.Core 256 * @since 11 257 */ 258 /** 259 * Offline media key status unknown. 260 * @syscap SystemCapability.Multimedia.Drm.Core 261 * @atomicservice 262 * @since 14 263 */ 264 OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, 265 /** 266 * Offline media key status usable. 267 * @syscap SystemCapability.Multimedia.Drm.Core 268 * @since 11 269 */ 270 /** 271 * Offline media key status usable. 272 * @syscap SystemCapability.Multimedia.Drm.Core 273 * @atomicservice 274 * @since 14 275 */ 276 OFFLINE_MEDIA_KEY_STATUS_USABLE = 1, 277 /** 278 * Offline media key status inactive. 279 * @syscap SystemCapability.Multimedia.Drm.Core 280 * @since 11 281 */ 282 /** 283 * Offline media key status inactive. 284 * @syscap SystemCapability.Multimedia.Drm.Core 285 * @atomicservice 286 * @since 14 287 */ 288 OFFLINE_MEDIA_KEY_STATUS_INACTIVE = 2, 289 } 290 291 /** 292 * Enumerates certificate status. 293 * @enum { number } 294 * @syscap SystemCapability.Multimedia.Drm.Core 295 * @since 11 296 */ 297 /** 298 * Enumerates certificate status. 299 * @enum { number } 300 * @syscap SystemCapability.Multimedia.Drm.Core 301 * @atomicservice 302 * @since 14 303 */ 304 enum CertificateStatus { 305 /** 306 * Device already provisioned. 307 * @syscap SystemCapability.Multimedia.Drm.Core 308 * @since 11 309 */ 310 /** 311 * Device already provisioned. 312 * @syscap SystemCapability.Multimedia.Drm.Core 313 * @atomicservice 314 * @since 14 315 */ 316 CERT_STATUS_PROVISIONED = 0, 317 /** 318 * Device not provisioned. 319 * @syscap SystemCapability.Multimedia.Drm.Core 320 * @since 11 321 */ 322 /** 323 * Device not provisioned. 324 * @syscap SystemCapability.Multimedia.Drm.Core 325 * @atomicservice 326 * @since 14 327 */ 328 CERT_STATUS_NOT_PROVISIONED, 329 /** 330 * Cert already expired. 331 * @syscap SystemCapability.Multimedia.Drm.Core 332 * @since 11 333 */ 334 /** 335 * Cert already expired. 336 * @syscap SystemCapability.Multimedia.Drm.Core 337 * @atomicservice 338 * @since 14 339 */ 340 CERT_STATUS_EXPIRED, 341 /** 342 * Certs are invalid. 343 * @syscap SystemCapability.Multimedia.Drm.Core 344 * @since 11 345 */ 346 /** 347 * Certs are invalid. 348 * @syscap SystemCapability.Multimedia.Drm.Core 349 * @atomicservice 350 * @since 14 351 */ 352 CERT_STATUS_INVALID, 353 /** 354 * Get certs status failed. 355 * @syscap SystemCapability.Multimedia.Drm.Core 356 * @since 11 357 */ 358 /** 359 * Get certs status failed. 360 * @syscap SystemCapability.Multimedia.Drm.Core 361 * @atomicservice 362 * @since 14 363 */ 364 CERT_STATUS_UNAVAILABLE, 365 } 366 367 /** 368 * Enumerates media key request types. 369 * @enum { number } 370 * @syscap SystemCapability.Multimedia.Drm.Core 371 * @since 11 372 */ 373 /** 374 * Enumerates media key request types. 375 * @enum { number } 376 * @syscap SystemCapability.Multimedia.Drm.Core 377 * @atomicservice 378 * @since 12 379 */ 380 enum MediaKeyRequestType { 381 /** 382 * Media key request type unknown. 383 * @syscap SystemCapability.Multimedia.Drm.Core 384 * @since 11 385 */ 386 /** 387 * Media key request type unknown. 388 * @syscap SystemCapability.Multimedia.Drm.Core 389 * @atomicservice 390 * @since 12 391 */ 392 MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, 393 /** 394 * Media key request type initial. 395 * @syscap SystemCapability.Multimedia.Drm.Core 396 * @since 11 397 */ 398 /** 399 * Media key request type initial. 400 * @syscap SystemCapability.Multimedia.Drm.Core 401 * @atomicservice 402 * @since 12 403 */ 404 MEDIA_KEY_REQUEST_TYPE_INITIAL = 1, 405 /** 406 * Media key request type renewal. 407 * @syscap SystemCapability.Multimedia.Drm.Core 408 * @since 11 409 */ 410 /** 411 * Media key request type renewal. 412 * @syscap SystemCapability.Multimedia.Drm.Core 413 * @atomicservice 414 * @since 12 415 */ 416 MEDIA_KEY_REQUEST_TYPE_RENEWAL = 2, 417 /** 418 * Media key request type release. 419 * @syscap SystemCapability.Multimedia.Drm.Core 420 * @since 11 421 */ 422 /** 423 * Media key request type release. 424 * @syscap SystemCapability.Multimedia.Drm.Core 425 * @atomicservice 426 * @since 12 427 */ 428 MEDIA_KEY_REQUEST_TYPE_RELEASE = 3, 429 /** 430 * Media key request type none. 431 * @syscap SystemCapability.Multimedia.Drm.Core 432 * @since 11 433 */ 434 /** 435 * Media key request type none. 436 * @syscap SystemCapability.Multimedia.Drm.Core 437 * @atomicservice 438 * @since 12 439 */ 440 MEDIA_KEY_REQUEST_TYPE_NONE = 4, 441 /** 442 * Media key request type update. 443 * @syscap SystemCapability.Multimedia.Drm.Core 444 * @since 11 445 */ 446 /** 447 * Media key request type update. 448 * @syscap SystemCapability.Multimedia.Drm.Core 449 * @atomicservice 450 * @since 12 451 */ 452 MEDIA_KEY_REQUEST_TYPE_UPDATE = 5, 453 } 454 455 /** 456 * Enumerates content protection level. 457 * @enum { number } 458 * @syscap SystemCapability.Multimedia.Drm.Core 459 * @since 11 460 */ 461 /** 462 * Enumerates content protection level. 463 * @enum { number } 464 * @syscap SystemCapability.Multimedia.Drm.Core 465 * @atomicservice 466 * @since 12 467 */ 468 enum ContentProtectionLevel { 469 /** 470 * Device decrypt and decode type unknown. 471 * @syscap SystemCapability.Multimedia.Drm.Core 472 * @since 11 473 */ 474 /** 475 * Device decrypt and decode type unknown. 476 * @syscap SystemCapability.Multimedia.Drm.Core 477 * @atomicservice 478 * @since 12 479 */ 480 CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, 481 /** 482 * Device using software level. 483 * @syscap SystemCapability.Multimedia.Drm.Core 484 * @since 11 485 */ 486 /** 487 * Device using software level. 488 * @syscap SystemCapability.Multimedia.Drm.Core 489 * @atomicservice 490 * @since 12 491 */ 492 CONTENT_PROTECTION_LEVEL_SW_CRYPTO, 493 /** 494 * Device using hardware level. 495 * @syscap SystemCapability.Multimedia.Drm.Core 496 * @since 11 497 */ 498 /** 499 * Device using hardware level. 500 * @syscap SystemCapability.Multimedia.Drm.Core 501 * @atomicservice 502 * @since 12 503 */ 504 CONTENT_PROTECTION_LEVEL_HW_CRYPTO, 505 /** 506 * Device using enhanced hardware level. 507 * @syscap SystemCapability.Multimedia.Drm.Core 508 * @since 11 509 */ 510 /** 511 * Device using enhanced hardware level. 512 * @syscap SystemCapability.Multimedia.Drm.Core 513 * @atomicservice 514 * @since 12 515 */ 516 CONTENT_PROTECTION_LEVEL_ENHANCED_HW, 517 /** 518 * Max mode. 519 * @syscap SystemCapability.Multimedia.Drm.Core 520 * @since 11 521 */ 522 /** 523 * Max mode. 524 * @syscap SystemCapability.Multimedia.Drm.Core 525 * @atomicservice 526 * @since 12 527 */ 528 CONTENT_PROTECTION_LEVEL_MAX, 529 } 530 531 /** 532 * Provides the drm provision request definitions. 533 * @interface ProvisionRequest 534 * @syscap SystemCapability.Multimedia.Drm.Core 535 * @since 11 536 */ 537 /** 538 * Provides the drm provision request definitions. 539 * @interface ProvisionRequest 540 * @syscap SystemCapability.Multimedia.Drm.Core 541 * @atomicservice 542 * @since 14 543 */ 544 interface ProvisionRequest { 545 /** 546 * Provision request data sent to provision server. 547 * @type { Uint8Array } 548 * @syscap SystemCapability.Multimedia.Drm.Core 549 * @since 11 550 */ 551 /** 552 * Provision request data sent to provision server. 553 * @type { Uint8Array } 554 * @syscap SystemCapability.Multimedia.Drm.Core 555 * @atomicservice 556 * @since 14 557 */ 558 data: Uint8Array; 559 /** 560 * Provision server URL. 561 * @type { string } 562 * @syscap SystemCapability.Multimedia.Drm.Core 563 * @since 11 564 */ 565 /** 566 * Provision server URL. 567 * @type { string } 568 * @syscap SystemCapability.Multimedia.Drm.Core 569 * @atomicservice 570 * @since 14 571 */ 572 defaultURL: string; 573 } 574 575 /** 576 * Provides the drm media key request info optional data. 577 * @interface OptionsData 578 * @syscap SystemCapability.Multimedia.Drm.Core 579 * @since 11 580 */ 581 /** 582 * Provides the drm media key request info optional data. 583 * @interface OptionsData 584 * @syscap SystemCapability.Multimedia.Drm.Core 585 * @atomicservice 586 * @since 12 587 */ 588 interface OptionsData { 589 /** 590 * App defined optional data name. 591 * @type { string } 592 * @syscap SystemCapability.Multimedia.Drm.Core 593 * @since 11 594 */ 595 /** 596 * App defined optional data name. 597 * @type { string } 598 * @syscap SystemCapability.Multimedia.Drm.Core 599 * @atomicservice 600 * @since 12 601 */ 602 name: string; 603 /** 604 * App defined optional data value. 605 * @type { string } 606 * @syscap SystemCapability.Multimedia.Drm.Core 607 * @since 11 608 */ 609 /** 610 * App defined optional data value. 611 * @type { string } 612 * @syscap SystemCapability.Multimedia.Drm.Core 613 * @atomicservice 614 * @since 12 615 */ 616 value: string; 617 } 618 619 /** 620 * Provides the drm media key request definitions. 621 * @interface MediaKeyRequest 622 * @syscap SystemCapability.Multimedia.Drm.Core 623 * @since 11 624 */ 625 /** 626 * Provides the drm media key request definitions. 627 * @interface MediaKeyRequest 628 * @syscap SystemCapability.Multimedia.Drm.Core 629 * @atomicservice 630 * @since 12 631 */ 632 interface MediaKeyRequest { 633 /** 634 * Media key request type. 635 * @type { MediaKeyRequestType } 636 * @syscap SystemCapability.Multimedia.Drm.Core 637 * @since 11 638 */ 639 /** 640 * Media key request type. 641 * @type { MediaKeyRequestType } 642 * @syscap SystemCapability.Multimedia.Drm.Core 643 * @atomicservice 644 * @since 12 645 */ 646 mediaKeyRequestType: MediaKeyRequestType; 647 /** 648 * Media key request data sent to media key server. 649 * @type { Uint8Array } 650 * @syscap SystemCapability.Multimedia.Drm.Core 651 * @since 11 652 */ 653 /** 654 * Media key request data sent to media key server. 655 * @type { Uint8Array } 656 * @syscap SystemCapability.Multimedia.Drm.Core 657 * @atomicservice 658 * @since 12 659 */ 660 data: Uint8Array; 661 /** 662 * Media key server URL. 663 * @type { string } 664 * @syscap SystemCapability.Multimedia.Drm.Core 665 * @since 11 666 */ 667 /** 668 * Media key server URL. 669 * @type { string } 670 * @syscap SystemCapability.Multimedia.Drm.Core 671 * @atomicservice 672 * @since 12 673 */ 674 defaultURL: string; 675 } 676 677 /** 678 * Used to indicates the event info attached to specific event type. 679 * @interface EventInfo 680 * @syscap SystemCapability.Multimedia.Drm.Core 681 * @since 11 682 */ 683 /** 684 * Used to indicates the event info attached to specific event type. 685 * @interface EventInfo 686 * @syscap SystemCapability.Multimedia.Drm.Core 687 * @atomicservice 688 * @since 12 689 */ 690 interface EventInfo { 691 /** 692 * Event info. 693 * @type { Uint8Array } 694 * @syscap SystemCapability.Multimedia.Drm.Core 695 * @since 11 696 */ 697 /** 698 * Event info. 699 * @type { Uint8Array } 700 * @syscap SystemCapability.Multimedia.Drm.Core 701 * @atomicservice 702 * @since 12 703 */ 704 info: Uint8Array; 705 /** 706 * Event extra info. 707 * @type { string } 708 * @syscap SystemCapability.Multimedia.Drm.Core 709 * @since 11 710 */ 711 /** 712 * Event extra info. 713 * @type { string } 714 * @syscap SystemCapability.Multimedia.Drm.Core 715 * @atomicservice 716 * @since 12 717 */ 718 extraInfo: string; 719 } 720 721 /** 722 * Used to indicates the statistic info. 723 * @interface StatisticKeyValue 724 * @syscap SystemCapability.Multimedia.Drm.Core 725 * @since 11 726 */ 727 /** 728 * Used to indicates the statistic info. 729 * @interface StatisticKeyValue 730 * @syscap SystemCapability.Multimedia.Drm.Core 731 * @atomicservice 732 * @since 14 733 */ 734 interface StatisticKeyValue { 735 /** 736 * Statistic info name. 737 * @type { string } 738 * @syscap SystemCapability.Multimedia.Drm.Core 739 * @since 11 740 */ 741 /** 742 * Statistic info name. 743 * @type { string } 744 * @syscap SystemCapability.Multimedia.Drm.Core 745 * @atomicservice 746 * @since 14 747 */ 748 name: string; 749 /** 750 * Statistic info value. 751 * @type { string } 752 * @syscap SystemCapability.Multimedia.Drm.Core 753 * @since 11 754 */ 755 /** 756 * Statistic info value. 757 * @type { string } 758 * @syscap SystemCapability.Multimedia.Drm.Core 759 * @atomicservice 760 * @since 14 761 */ 762 value: string; 763 } 764 765 /** 766 * Used to indicates the media key status. 767 * @interface MediaKeyStatus 768 * @syscap SystemCapability.Multimedia.Drm.Core 769 * @since 11 770 */ 771 /** 772 * Used to indicates the media key status. 773 * @interface MediaKeyStatus 774 * @syscap SystemCapability.Multimedia.Drm.Core 775 * @atomicservice 776 * @since 12 777 */ 778 interface MediaKeyStatus { 779 /** 780 * Media key Id in string. 781 * @type { string } 782 * @syscap SystemCapability.Multimedia.Drm.Core 783 * @since 11 784 */ 785 /** 786 * Media key Id in string. 787 * @type { string } 788 * @syscap SystemCapability.Multimedia.Drm.Core 789 * @atomicservice 790 * @since 12 791 */ 792 name: string; 793 /** 794 * Media key status description. 795 * @type { string } 796 * @syscap SystemCapability.Multimedia.Drm.Core 797 * @since 11 798 */ 799 /** 800 * Media key status description. 801 * @type { string } 802 * @syscap SystemCapability.Multimedia.Drm.Core 803 * @atomicservice 804 * @since 12 805 */ 806 value: string; 807 } 808 809 /** 810 * Used to indicates the media key status with a key and its value. 811 * @interface KeysInfo 812 * @syscap SystemCapability.Multimedia.Drm.Core 813 * @since 11 814 */ 815 /** 816 * Used to indicates the media key status with a key and its value. 817 * @interface KeysInfo 818 * @syscap SystemCapability.Multimedia.Drm.Core 819 * @atomicservice 820 * @since 12 821 */ 822 interface KeysInfo { 823 /** 824 * Keys Id in media key. 825 * @type { Uint8Array } 826 * @syscap SystemCapability.Multimedia.Drm.Core 827 * @since 11 828 */ 829 /** 830 * Keys Id in media key. 831 * @type { Uint8Array } 832 * @syscap SystemCapability.Multimedia.Drm.Core 833 * @atomicservice 834 * @since 12 835 */ 836 keyId: Uint8Array; 837 /** 838 * Keys status description. 839 * @type { string } 840 * @syscap SystemCapability.Multimedia.Drm.Core 841 * @since 11 842 */ 843 /** 844 * Keys status description. 845 * @type { string } 846 * @syscap SystemCapability.Multimedia.Drm.Core 847 * @atomicservice 848 * @since 12 849 */ 850 value: string; 851 } 852 853 /** 854 * Used to indicates the media key system info of media source. 855 * @interface MediaKeySystemInfo 856 * @syscap SystemCapability.Multimedia.Drm.Core 857 * @since 11 858 */ 859 /** 860 * Used to indicates the media key system info of media source. 861 * @interface MediaKeySystemInfo 862 * @syscap SystemCapability.Multimedia.Drm.Core 863 * @atomicservice 864 * @since 12 865 */ 866 interface MediaKeySystemInfo { 867 /** 868 * Drm system ID. 869 * @type { string } 870 * @syscap SystemCapability.Multimedia.Drm.Core 871 * @since 11 872 */ 873 /** 874 * Drm system ID. 875 * @type { string } 876 * @syscap SystemCapability.Multimedia.Drm.Core 877 * @atomicservice 878 * @since 12 879 */ 880 uuid: string; 881 /** 882 * PSSH(protection scheme specific header) contain drm info. 883 * @type { Uint8Array } 884 * @syscap SystemCapability.Multimedia.Drm.Core 885 * @since 11 886 */ 887 /** 888 * PSSH(protection scheme specific header) contain drm info. 889 * @type { Uint8Array } 890 * @syscap SystemCapability.Multimedia.Drm.Core 891 * @atomicservice 892 * @since 12 893 */ 894 pssh: Uint8Array; 895 } 896 897/** 898 * Name and UUID of DRM plugin. 899 * @interface MediaKeySystemDescription 900 * @syscap SystemCapability.Multimedia.Drm.Core 901 * @since 12 902 */ 903/** 904 * Name and UUID of DRM plugin. 905 * @interface MediaKeySystemDescription 906 * @syscap SystemCapability.Multimedia.Drm.Core 907 * @atomicservice 908 * @since 14 909 */ 910 interface MediaKeySystemDescription { 911 /** 912 * Name of DRM plugin. 913 * @type { string } 914 * @syscap SystemCapability.Multimedia.Drm.Core 915 * @since 12 916 */ 917 /** 918 * Name of DRM plugin. 919 * @type { string } 920 * @syscap SystemCapability.Multimedia.Drm.Core 921 * @atomicservice 922 * @since 14 923 */ 924 name: string; 925 /** 926 * UUID supported by DRM plugin. 927 * @type { string } 928 * @syscap SystemCapability.Multimedia.Drm.Core 929 * @since 12 930 */ 931 /** 932 * UUID supported by DRM plugin. 933 * @type { string } 934 * @syscap SystemCapability.Multimedia.Drm.Core 935 * @atomicservice 936 * @since 14 937 */ 938 uuid: string; 939 } 940 941 /** 942 * Get a MediaKeySystem's UUID. 943 * @param { string } name - The Digital Right Management solution name. 944 * @returns { string } The MediaKeySystem uuid. 945 * @throws { BusinessError } 401 - The parameter check failed.Possibly because: 946 * <br>1.Mandatory parameters are left unspecified. 2.Parameter verification failed. 947 * @throws { BusinessError } 24700101 - All unknown errors. 948 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 949 * @syscap SystemCapability.Multimedia.Drm.Core 950 * @since 12 951 */ 952 /** 953 * Get a MediaKeySystem's UUID. 954 * @param { string } name - The Digital Right Management solution name. 955 * @returns { string } The MediaKeySystem uuid. 956 * @throws { BusinessError } 401 - The parameter check failed.Possibly because: 957 * <br>1.Mandatory parameters are left unspecified. 2.Parameter verification failed. 958 * @throws { BusinessError } 24700101 - All unknown errors. 959 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 960 * @syscap SystemCapability.Multimedia.Drm.Core 961 * @atomicservice 962 * @since 14 963 */ 964 function getMediaKeySystemUuid(name: string): string; 965 966 /** 967 * Get all media key systems supported. 968 * @returns { MediaKeySystemDescription[] } The MediaKeySystem name and uuid info list. 969 * @throws { BusinessError } 24700101 - All unknown errors. 970 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 971 * @syscap SystemCapability.Multimedia.Drm.Core 972 * @since 12 973 */ 974 /** 975 * Get all media key systems supported. 976 * @returns { MediaKeySystemDescription[] } The MediaKeySystem name and uuid info list. 977 * @throws { BusinessError } 24700101 - All unknown errors. 978 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 979 * @syscap SystemCapability.Multimedia.Drm.Core 980 * @atomicservice 981 * @since 14 982 */ 983 function getMediaKeySystems(): MediaKeySystemDescription[]; 984 985 /** 986 * Creates a MediaKeySystem instance. 987 * @param { string } name - Used to point a Digital Right Management solution. 988 * @returns { MediaKeySystem } The MediaKeySystem instance. 989 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 990 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed. 991 * @throws { BusinessError } 24700101 - All unknown errors. 992 * @throws { BusinessError } 24700103 - Meet max MediaKeySystem num limit. 993 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 994 * @syscap SystemCapability.Multimedia.Drm.Core 995 * @since 11 996 */ 997 /** 998 * Creates a MediaKeySystem instance. 999 * @param { string } name - Used to point a Digital Right Management solution. 1000 * @returns { MediaKeySystem } The MediaKeySystem instance. 1001 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1002 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed. 1003 * @throws { BusinessError } 24700101 - All unknown errors. 1004 * @throws { BusinessError } 24700103 - Meet max MediaKeySystem num limit. 1005 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1006 * @syscap SystemCapability.Multimedia.Drm.Core 1007 * @atomicservice 1008 * @since 14 1009 */ 1010 function createMediaKeySystem(name: string): MediaKeySystem; 1011 1012 /** 1013 * Judge whether a system that specifies name, mimetype and content protection level is supported. 1014 * @param { string } name - Used to point a Digital Right Management solution. 1015 * @param { string } mimeType - Used to specifies the media type. 1016 * @param { ContentProtectionLevel } level - Used to specifies the ContentProtectionLevel. 1017 * @returns { boolean } Whether these conditions will be met. 1018 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1019 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1020 * 3.Parameter verification failed. 1021 * @throws { BusinessError } 24700101 - All unknown errors. 1022 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1023 * @syscap SystemCapability.Multimedia.Drm.Core 1024 * @since 11 1025 */ 1026 /** 1027 * Judge whether a system that specifies name, mimetype and content protection level is supported. 1028 * @param { string } name - Used to point a Digital Right Management solution. 1029 * @param { string } mimeType - Used to specifies the media type. 1030 * @param { ContentProtectionLevel } level - Used to specifies the ContentProtectionLevel. 1031 * @returns { boolean } Whether these conditions will be met. 1032 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1033 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1034 * 3.Parameter verification failed. 1035 * @throws { BusinessError } 24700101 - All unknown errors. 1036 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1037 * @syscap SystemCapability.Multimedia.Drm.Core 1038 * @atomicservice 1039 * @since 14 1040 */ 1041 function isMediaKeySystemSupported(name: string, mimeType: string, level: ContentProtectionLevel): boolean; 1042 1043 /** 1044 * Judge whether a system that specifies name, mimetype is supported. 1045 * @param { string } name - Used to point a Digital Right Management solution. 1046 * @param { string } mimeType - Used to specifies the media type. 1047 * @returns { boolean } Whether these conditions will be met. 1048 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1049 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1050 * 3.Parameter verification failed. 1051 * @throws { BusinessError } 24700101 - All unknown errors. 1052 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1053 * @syscap SystemCapability.Multimedia.Drm.Core 1054 * @since 11 1055 */ 1056 /** 1057 * Judge whether a system that specifies name, mimetype is supported. 1058 * @param { string } name - Used to point a Digital Right Management solution. 1059 * @param { string } mimeType - Used to specifies the media type. 1060 * @returns { boolean } Whether these conditions will be met. 1061 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1062 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1063 * 3.Parameter verification failed. 1064 * @throws { BusinessError } 24700101 - All unknown errors. 1065 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1066 * @syscap SystemCapability.Multimedia.Drm.Core 1067 * @atomicservice 1068 * @since 14 1069 */ 1070 function isMediaKeySystemSupported(name: string, mimeType: string): boolean; 1071 1072 /** 1073 * Judge whether a system that specifies name is supported. 1074 * @param { string } name - Used to point a Digital Right Management solution. 1075 * @returns { boolean } Whether these conditions will be met. 1076 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1077 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed, 1078 * the param name's length is zero or too big(exceeds 4096 Bytes). 1079 * @throws { BusinessError } 24700101 - All unknown errors. 1080 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1081 * @syscap SystemCapability.Multimedia.Drm.Core 1082 * @since 11 1083 */ 1084 /** 1085 * Judge whether a system that specifies name is supported. 1086 * @param { string } name - Used to point a Digital Right Management solution. 1087 * @returns { boolean } Whether these conditions will be met. 1088 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1089 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed, 1090 * the param name's length is zero or too big(exceeds 4096 Bytes). 1091 * @throws { BusinessError } 24700101 - All unknown errors. 1092 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1093 * @syscap SystemCapability.Multimedia.Drm.Core 1094 * @atomicservice 1095 * @since 14 1096 */ 1097 function isMediaKeySystemSupported(name: string): boolean; 1098 1099 /** 1100 * Manages and record MediaKeySessions. Before calling an MediaKeySystem method, we must use getMediaKeySystem 1101 * to get a MediaKeySystem instance, then we can call functions. 1102 * @interface MediaKeySystem 1103 * @syscap SystemCapability.Multimedia.Drm.Core 1104 * @since 11 1105 */ 1106 /** 1107 * Manages and record MediaKeySessions. Before calling an MediaKeySystem method, we must use getMediaKeySystem 1108 * to get a MediaKeySystem instance, then we can call functions. 1109 * @interface MediaKeySystem 1110 * @syscap SystemCapability.Multimedia.Drm.Core 1111 * @atomicservice 1112 * @since 14 1113 */ 1114 interface MediaKeySystem { 1115 /** 1116 * Get the specified configuration. 1117 * @param { string } configName - Used to specify the config name. 1118 * @returns { string } The config value string. 1119 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1120 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed, 1121 * the param's length is zero or too big(exceeds 4096 Bytes). 1122 * @throws { BusinessError } 24700101 - All unknown errors. 1123 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1124 * @syscap SystemCapability.Multimedia.Drm.Core 1125 * @since 11 1126 */ 1127 /** 1128 * Get the specified configuration. 1129 * @param { string } configName - Used to specify the config name. 1130 * @returns { string } The config value string. 1131 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1132 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed, 1133 * the param's length is zero or too big(exceeds 4096 Bytes). 1134 * @throws { BusinessError } 24700101 - All unknown errors. 1135 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1136 * @syscap SystemCapability.Multimedia.Drm.Core 1137 * @atomicservice 1138 * @since 14 1139 */ 1140 getConfigurationString(configName: string): string; 1141 1142 /** 1143 * Set the specified configuration. 1144 * @param { string } configName - Used to specify the config name. 1145 * @param { string } value - The value to be set. 1146 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1147 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1148 * 3.Parameter verification failed. 1149 * @throws { BusinessError } 24700101 - All unknown errors. 1150 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1151 * @syscap SystemCapability.Multimedia.Drm.Core 1152 * @since 11 1153 */ 1154 /** 1155 * Set the specified configuration. 1156 * @param { string } configName - Used to specify the config name. 1157 * @param { string } value - The value to be set. 1158 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1159 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1160 * 3.Parameter verification failed. 1161 * @throws { BusinessError } 24700101 - All unknown errors. 1162 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1163 * @syscap SystemCapability.Multimedia.Drm.Core 1164 * @atomicservice 1165 * @since 14 1166 */ 1167 setConfigurationString(configName: string, value: string): void; 1168 1169 /** 1170 * Get the specified configuration. 1171 * @param { string } configName - Used to specify the config name. 1172 * @returns { Uint8Array } The config value. 1173 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1174 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed. 1175 * @throws { BusinessError } 24700101 - All unknown errors. 1176 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1177 * @syscap SystemCapability.Multimedia.Drm.Core 1178 * @since 11 1179 */ 1180 /** 1181 * Get the specified configuration. 1182 * @param { string } configName - Used to specify the config name. 1183 * @returns { Uint8Array } The config value. 1184 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1185 * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed. 1186 * @throws { BusinessError } 24700101 - All unknown errors. 1187 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1188 * @syscap SystemCapability.Multimedia.Drm.Core 1189 * @atomicservice 1190 * @since 14 1191 */ 1192 getConfigurationByteArray(configName: string): Uint8Array; 1193 1194 /** 1195 * Set the specified configuration. 1196 * @param { string } configName - Used to specify the config name. 1197 * @param { Uint8Array } value - The value to be set. 1198 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1199 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1200 * 3.Parameter verification failed. 1201 * @throws { BusinessError } 24700101 - All unknown errors. 1202 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1203 * @syscap SystemCapability.Multimedia.Drm.Core 1204 * @since 11 1205 */ 1206 /** 1207 * Set the specified configuration. 1208 * @param { string } configName - Used to specify the config name. 1209 * @param { Uint8Array } value - The value to be set. 1210 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1211 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1212 * 3.Parameter verification failed. 1213 * @throws { BusinessError } 24700101 - All unknown errors. 1214 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1215 * @syscap SystemCapability.Multimedia.Drm.Core 1216 * @atomicservice 1217 * @since 14 1218 */ 1219 setConfigurationByteArray(configName: string, value: Uint8Array): void; 1220 1221 /** 1222 * Get performance statistics information.That includes currentSessionNum, version, decryptNumber, 1223 * and errorDecryptNumber. 1224 * @returns { StatisticKeyValue[] } A list that includes performance index and corresponding statistics. 1225 * @throws { BusinessError } 24700101 - All unknown errors. 1226 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1227 * @syscap SystemCapability.Multimedia.Drm.Core 1228 * @since 11 1229 */ 1230 /** 1231 * Get performance statistics information.That includes currentSessionNum, version, decryptNumber, 1232 * and errorDecryptNumber. 1233 * @returns { StatisticKeyValue[] } A list that includes performance index and corresponding statistics. 1234 * @throws { BusinessError } 24700101 - All unknown errors. 1235 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1236 * @syscap SystemCapability.Multimedia.Drm.Core 1237 * @atomicservice 1238 * @since 14 1239 */ 1240 getStatistics(): StatisticKeyValue[]; 1241 1242 /** 1243 * Get max content protection level the device supports. 1244 * @returns { ContentProtectionLevel } The max content protection level of the MediaKeySystem instance. 1245 * @throws { BusinessError } 24700101 - All unknown errors. 1246 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1247 * @syscap SystemCapability.Multimedia.Drm.Core 1248 * @since 11 1249 */ 1250 /** 1251 * Get max content protection level the device supports. 1252 * @returns { ContentProtectionLevel } The max content protection level of the MediaKeySystem instance. 1253 * @throws { BusinessError } 24700101 - All unknown errors. 1254 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1255 * @syscap SystemCapability.Multimedia.Drm.Core 1256 * @atomicservice 1257 * @since 14 1258 */ 1259 getMaxContentProtectionLevel(): ContentProtectionLevel; 1260 1261 /** 1262 * Generate a media key system provision request. 1263 * @returns { Promise<ProvisionRequest> } Promise with ProvisionRequest used to return the result. 1264 * @throws { BusinessError } 24700101 - All unknown errors. 1265 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1266 * @syscap SystemCapability.Multimedia.Drm.Core 1267 * @since 11 1268 */ 1269 /** 1270 * Generate a media key system provision request. 1271 * @returns { Promise<ProvisionRequest> } Promise with ProvisionRequest used to return the result. 1272 * @throws { BusinessError } 24700101 - All unknown errors. 1273 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1274 * @syscap SystemCapability.Multimedia.Drm.Core 1275 * @atomicservice 1276 * @since 14 1277 */ 1278 generateKeySystemRequest(): Promise<ProvisionRequest>; 1279 1280 /** 1281 * Process the response corresponding the key system request obtained by the application. 1282 * @param { Uint8Array } response - Response corresponding to the request. 1283 * @returns { Promise<void> } Promise used to return the result. 1284 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1285 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1286 * 3.Parameter verification failed. 1287 * @throws { BusinessError } 24700101 - All unknown errors. 1288 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1289 * @syscap SystemCapability.Multimedia.Drm.Core 1290 * @since 11 1291 */ 1292 /** 1293 * Process the response corresponding the key system request obtained by the application. 1294 * @param { Uint8Array } response - Response corresponding to the request. 1295 * @returns { Promise<void> } Promise used to return the result. 1296 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1297 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1298 * 3.Parameter verification failed. 1299 * @throws { BusinessError } 24700101 - All unknown errors. 1300 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1301 * @syscap SystemCapability.Multimedia.Drm.Core 1302 * @atomicservice 1303 * @since 14 1304 */ 1305 processKeySystemResponse(response: Uint8Array): Promise<void>; 1306 1307 /** 1308 * Get certificate status of the MediaKeySystem. 1309 * @returns { CertificateStatus } Certificate Status of the MediaKeySystem instance. 1310 * @throws { BusinessError } 24700101 - All unknown errors. 1311 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1312 * @syscap SystemCapability.Multimedia.Drm.Core 1313 * @since 11 1314 */ 1315 /** 1316 * Get certificate status of the MediaKeySystem. 1317 * @returns { CertificateStatus } Certificate Status of the MediaKeySystem instance. 1318 * @throws { BusinessError } 24700101 - All unknown errors. 1319 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1320 * @syscap SystemCapability.Multimedia.Drm.Core 1321 * @atomicservice 1322 * @since 14 1323 */ 1324 getCertificateStatus(): CertificateStatus; 1325 1326 /** 1327 * Register keySystemRequired events. 1328 * @param { 'keySystemRequired' } type - Type of the drm event to listen for. 1329 * @param { function } callback - Used to listen for the key system required event. 1330 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1331 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1332 * @throws { BusinessError } 24700101 - All unknown errors. 1333 * @syscap SystemCapability.Multimedia.Drm.Core 1334 * @since 11 1335 */ 1336 /** 1337 * Register keySystemRequired events. 1338 * @param { 'keySystemRequired' } type - Type of the drm event to listen for. 1339 * @param { function } callback - Used to listen for the key system required event. 1340 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1341 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1342 * @throws { BusinessError } 24700101 - All unknown errors. 1343 * @syscap SystemCapability.Multimedia.Drm.Core 1344 * @atomicservice 1345 * @since 14 1346 */ 1347 on(type: 'keySystemRequired', callback: (eventInfo: EventInfo) => void): void; 1348 1349 /** 1350 * Unregister keySystemRequired events. 1351 * @param { 'keySystemRequired' } type - Type of the drm event to listen for. 1352 * @param { function } callback - Used to listen for the key system required event. 1353 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1354 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1355 * @throws { BusinessError } 24700101 - All unknown errors. 1356 * @syscap SystemCapability.Multimedia.Drm.Core 1357 * @since 11 1358 */ 1359 /** 1360 * Unregister keySystemRequired events. 1361 * @param { 'keySystemRequired' } type - Type of the drm event to listen for. 1362 * @param { function } callback - Used to listen for the key system required event. 1363 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1364 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1365 * @throws { BusinessError } 24700101 - All unknown errors. 1366 * @syscap SystemCapability.Multimedia.Drm.Core 1367 * @atomicservice 1368 * @since 14 1369 */ 1370 off(type: 'keySystemRequired', callback?: (eventInfo: EventInfo) => void): void; 1371 1372 /** 1373 * Create a MediaKeySession instance with level. 1374 * @param { ContentProtectionLevel } level - Used to specify the content protection level. 1375 * @returns { MediaKeySession } A MediaKeySession instance. 1376 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1377 * 1.Mandatory parameters are left unspecified. 2.The param level exceeds reasonable range, 1378 * please use value in ContentProtectionLevel. 1379 * @throws { BusinessError } 24700101 - All unknown errors. 1380 * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit. 1381 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1382 * @syscap SystemCapability.Multimedia.Drm.Core 1383 * @since 11 1384 */ 1385 /** 1386 * Create a MediaKeySession instance with level. 1387 * @param { ContentProtectionLevel } level - Used to specify the content protection level. 1388 * @returns { MediaKeySession } A MediaKeySession instance. 1389 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1390 * 1.Mandatory parameters are left unspecified. 2.The param level exceeds reasonable range, 1391 * please use value in ContentProtectionLevel. 1392 * @throws { BusinessError } 24700101 - All unknown errors. 1393 * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit. 1394 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1395 * @syscap SystemCapability.Multimedia.Drm.Core 1396 * @atomicservice 1397 * @since 14 1398 */ 1399 createMediaKeySession(level: ContentProtectionLevel): MediaKeySession; 1400 1401 /** 1402 * Create a MediaKeySession instance. 1403 * @returns { MediaKeySession } A MediaKeySession instance. 1404 * @throws { BusinessError } 24700101 - All unknown errors. 1405 * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit. 1406 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1407 * @syscap SystemCapability.Multimedia.Drm.Core 1408 * @since 11 1409 */ 1410 /** 1411 * Create a MediaKeySession instance. 1412 * @returns { MediaKeySession } A MediaKeySession instance. 1413 * @throws { BusinessError } 24700101 - All unknown errors. 1414 * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit. 1415 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1416 * @syscap SystemCapability.Multimedia.Drm.Core 1417 * @atomicservice 1418 * @since 14 1419 */ 1420 createMediaKeySession(): MediaKeySession; 1421 1422 /** 1423 * Get the list of offline MediaKeyIds. 1424 * @returns { Uint8Array[] } The list of offline MediaKeyIds. 1425 * @throws { BusinessError } 24700101 - All unknown errors. 1426 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1427 * @syscap SystemCapability.Multimedia.Drm.Core 1428 * @since 11 1429 */ 1430 /** 1431 * Get the list of offline MediaKeyIds. 1432 * @returns { Uint8Array[] } The list of offline MediaKeyIds. 1433 * @throws { BusinessError } 24700101 - All unknown errors. 1434 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1435 * @syscap SystemCapability.Multimedia.Drm.Core 1436 * @atomicservice 1437 * @since 14 1438 */ 1439 getOfflineMediaKeyIds(): Uint8Array[]; 1440 1441 /** 1442 * Get offline media key status corresponding to the mediaKeyId. 1443 * @param { Uint8Array } mediaKeyId - The media key identifier. 1444 * @returns { OfflineMediaKeyStatus } Offline media key Status. 1445 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1446 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1447 * 3.Parameter verification failed. 1448 * @throws { BusinessError } 24700101 - All unknown errors. 1449 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1450 * @syscap SystemCapability.Multimedia.Drm.Core 1451 * @since 11 1452 */ 1453 /** 1454 * Get offline media key status corresponding to the mediaKeyId. 1455 * @param { Uint8Array } mediaKeyId - The media key identifier. 1456 * @returns { OfflineMediaKeyStatus } Offline media key Status. 1457 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1458 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1459 * 3.Parameter verification failed. 1460 * @throws { BusinessError } 24700101 - All unknown errors. 1461 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1462 * @syscap SystemCapability.Multimedia.Drm.Core 1463 * @atomicservice 1464 * @since 14 1465 */ 1466 getOfflineMediaKeyStatus(mediaKeyId: Uint8Array): OfflineMediaKeyStatus; 1467 1468 /** 1469 * Remove media key corresponding to the mediaKeyId. 1470 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be clear. 1471 * @throws { BusinessError } 401 - The parameter check failed.Possibly because: 1472 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1473 * @throws { BusinessError } 24700101 - All unknown errors. 1474 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1475 * @syscap SystemCapability.Multimedia.Drm.Core 1476 * @since 11 1477 */ 1478 /** 1479 * Remove media key corresponding to the mediaKeyId. 1480 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be clear. 1481 * @throws { BusinessError } 401 - The parameter check failed.Possibly because: 1482 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1483 * @throws { BusinessError } 24700101 - All unknown errors. 1484 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1485 * @syscap SystemCapability.Multimedia.Drm.Core 1486 * @atomicservice 1487 * @since 14 1488 */ 1489 clearOfflineMediaKeys(mediaKeyId: Uint8Array): void; 1490 /** 1491 * Release the resource before the MediaKeySystem gonna be unused. 1492 * @throws { BusinessError } 24700101 - All unknown errors. 1493 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1494 * @syscap SystemCapability.Multimedia.Drm.Core 1495 * @since 11 1496 */ 1497 /** 1498 * Release the resource before the MediaKeySystem gonna be unused. 1499 * @throws { BusinessError } 24700101 - All unknown errors. 1500 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1501 * @syscap SystemCapability.Multimedia.Drm.Core 1502 * @atomicservice 1503 * @since 14 1504 */ 1505 destroy(): void; 1506 } 1507 1508 /** 1509 * Provide functions and keep a decrypt module. Before calling an MediaKeySession method, we must 1510 * use MediaKeySystem's createMediaKeySession to get a MediaKeySession instance. 1511 * @interface MediaKeySession 1512 * @syscap SystemCapability.Multimedia.Drm.Core 1513 * @since 11 1514 */ 1515 /** 1516 * Provide functions and keep a decrypt module. Before calling an MediaKeySession method, we must 1517 * use MediaKeySystem's createMediaKeySession to get a MediaKeySession instance. 1518 * @interface MediaKeySession 1519 * @syscap SystemCapability.Multimedia.Drm.Core 1520 * @atomicservice 1521 * @since 12 1522 */ 1523 interface MediaKeySession { 1524 1525 /** 1526 * Generate the media key request. 1527 * @param { string } mimeType - Media type. 1528 * @param { Uint8Array } initData - PSSH info. 1529 * @param { number } mediaKeyType - Offline or online. 1530 * @param { OptionsData[] } options - Optional data the application set to drm framework. 1531 * @returns { Promise<MediaKeyRequest> } Promise with MediaKeyRequest used to return the result. 1532 * @throws { BusinessError } 401 -The parameter check failed. Possibly because: 1533 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1534 * 3.Parameter verification failed. 1535 * @throws { BusinessError } 24700101 - All unknown errors. 1536 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1537 * @syscap SystemCapability.Multimedia.Drm.Core 1538 * @since 11 1539 */ 1540 /** 1541 * Generate the media key request. 1542 * @param { string } mimeType - Media type. 1543 * @param { Uint8Array } initData - PSSH info. 1544 * @param { number } mediaKeyType - Offline or online. 1545 * @param { OptionsData[] } options - Optional data the application set to drm framework. 1546 * @returns { Promise<MediaKeyRequest> } Promise with MediaKeyRequest used to return the result. 1547 * @throws { BusinessError } 401 -The parameter check failed. Possibly because: 1548 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1549 * 3.Parameter verification failed. 1550 * @throws { BusinessError } 24700101 - All unknown errors. 1551 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1552 * @syscap SystemCapability.Multimedia.Drm.Core 1553 * @atomicservice 1554 * @since 12 1555 */ 1556 generateMediaKeyRequest(mimeType: string, initData: Uint8Array, mediaKeyType: number, options?: OptionsData[]): Promise<MediaKeyRequest>; 1557 1558 /** 1559 * Process the response corresponding to the media key request obtained by the application. 1560 * @param { Uint8Array } response - The response. 1561 * @returns { Promise<Uint8Array> } Promise with media key identifier in Uint8ARRY used to return the result. 1562 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1563 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1564 * 3.Parameter verification failed. 1565 * @throws { BusinessError } 24700101 - All unknown errors. 1566 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1567 * @syscap SystemCapability.Multimedia.Drm.Core 1568 * @since 11 1569 */ 1570 /** 1571 * Process the response corresponding to the media key request obtained by the application. 1572 * @param { Uint8Array } response - The response. 1573 * @returns { Promise<Uint8Array> } Promise with media key identifier in Uint8ARRY used to return the result. 1574 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1575 * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 1576 * 3.Parameter verification failed. 1577 * @throws { BusinessError } 24700101 - All unknown errors. 1578 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1579 * @syscap SystemCapability.Multimedia.Drm.Core 1580 * @atomicservice 1581 * @since 12 1582 */ 1583 processMediaKeyResponse(response: Uint8Array): Promise<Uint8Array>; 1584 1585 /** 1586 * Check the media key status 1587 * @returns { MediaKeyStatus[] } A list of media key status description pairs. 1588 * @throws { BusinessError } 24700101 - All unknown errors. 1589 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1590 * @syscap SystemCapability.Multimedia.Drm.Core 1591 * @since 11 1592 */ 1593 /** 1594 * Check the media key status 1595 * @returns { MediaKeyStatus[] } A list of media key status description pairs. 1596 * @throws { BusinessError } 24700101 - All unknown errors. 1597 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1598 * @syscap SystemCapability.Multimedia.Drm.Core 1599 * @atomicservice 1600 * @since 12 1601 */ 1602 checkMediaKeyStatus(): MediaKeyStatus[]; 1603 1604 /** 1605 * Remove media key. 1606 * @throws { BusinessError } 24700101 - All unknown errors. 1607 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1608 * @syscap SystemCapability.Multimedia.Drm.Core 1609 * @since 11 1610 */ 1611 /** 1612 * Remove media key. 1613 * @throws { BusinessError } 24700101 - All unknown errors. 1614 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1615 * @syscap SystemCapability.Multimedia.Drm.Core 1616 * @atomicservice 1617 * @since 12 1618 */ 1619 clearMediaKeys(): void; 1620 1621 /** 1622 * Generate offline media key request. 1623 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key request 1624 * should be generated. 1625 * @returns { Promise<Uint8Array> } Promise with media key request in Uint8Array used to return the result. 1626 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1627 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1628 * 3.Parameter verification failed. 1629 * @throws { BusinessError } 24700101 - All unknown errors. 1630 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1631 * @syscap SystemCapability.Multimedia.Drm.Core 1632 * @since 11 1633 */ 1634 /** 1635 * Generate offline media key request. 1636 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key request 1637 * should be generated. 1638 * @returns { Promise<Uint8Array> } Promise with media key request in Uint8Array used to return the result. 1639 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1640 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1641 * 3.Parameter verification failed. 1642 * @throws { BusinessError } 24700101 - All unknown errors. 1643 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1644 * @syscap SystemCapability.Multimedia.Drm.Core 1645 * @atomicservice 1646 * @since 12 1647 */ 1648 generateOfflineReleaseRequest(mediaKeyId: Uint8Array): Promise<Uint8Array>; 1649 1650 /** 1651 * Process offline media key response. 1652 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key it is. 1653 * @param { Uint8Array } response - The offline media key. 1654 * @returns { Promise<void> } Promise used to return the result. 1655 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1656 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1657 * 3.Parameter verification failed. 1658 * @throws { BusinessError } 24700101 - All unknown errors. 1659 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1660 * @syscap SystemCapability.Multimedia.Drm.Core 1661 * @since 11 1662 */ 1663 /** 1664 * Process offline media key response. 1665 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key it is. 1666 * @param { Uint8Array } response - The offline media key. 1667 * @returns { Promise<void> } Promise used to return the result. 1668 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1669 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1670 * 3.Parameter verification failed. 1671 * @throws { BusinessError } 24700101 - All unknown errors. 1672 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1673 * @syscap SystemCapability.Multimedia.Drm.Core 1674 * @atomicservice 1675 * @since 12 1676 */ 1677 processOfflineReleaseResponse(mediaKeyId: Uint8Array, response: Uint8Array): Promise<void>; 1678 1679 /** 1680 * Restore offline media key. 1681 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be restore. 1682 * @returns { Promise<void> } Promise used to return the result. 1683 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1684 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1685 * 3.Parameter verification failed. 1686 * @throws { BusinessError } 24700101 - All unknown errors. 1687 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1688 * @syscap SystemCapability.Multimedia.Drm.Core 1689 * @since 11 1690 */ 1691 /** 1692 * Restore offline media key. 1693 * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be restore. 1694 * @returns { Promise<void> } Promise used to return the result. 1695 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1696 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1697 * 3.Parameter verification failed. 1698 * @throws { BusinessError } 24700101 - All unknown errors. 1699 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1700 * @syscap SystemCapability.Multimedia.Drm.Core 1701 * @atomicservice 1702 * @since 12 1703 */ 1704 restoreOfflineMediaKeys(mediaKeyId: Uint8Array): Promise<void>; 1705 1706 /** 1707 * Get content protection level. 1708 * @returns { ContentProtectionLevel } MediaKeySession content protection level. 1709 * @throws { BusinessError } 24700101 - All unknown errors. 1710 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1711 * @syscap SystemCapability.Multimedia.Drm.Core 1712 * @since 11 1713 */ 1714 /** 1715 * Get content protection level. 1716 * @returns { ContentProtectionLevel } MediaKeySession content protection level. 1717 * @throws { BusinessError } 24700101 - All unknown errors. 1718 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1719 * @syscap SystemCapability.Multimedia.Drm.Core 1720 * @atomicservice 1721 * @since 12 1722 */ 1723 getContentProtectionLevel(): ContentProtectionLevel; 1724 1725 /** 1726 * Whether the encrypted content require a secure decoder or not. 1727 * @param { string } mimeType - The media type. 1728 * @returns { boolean } Whether secure decoder is required. 1729 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1730 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1731 * 3.Parameter verification failed. 1732 * @throws { BusinessError } 24700101 - All unknown errors. 1733 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1734 * @syscap SystemCapability.Multimedia.Drm.Core 1735 * @since 11 1736 */ 1737 /** 1738 * Whether the encrypted content require a secure decoder or not. 1739 * @param { string } mimeType - The media type. 1740 * @returns { boolean } Whether secure decoder is required. 1741 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1742 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1743 * 3.Parameter verification failed. 1744 * @throws { BusinessError } 24700101 - All unknown errors. 1745 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 1746 * @syscap SystemCapability.Multimedia.Drm.Core 1747 * @atomicservice 1748 * @since 12 1749 */ 1750 requireSecureDecoderModule(mimeType: string): boolean; 1751 1752 /** 1753 * Register keyRequired event. 1754 * @param { 'keyRequired' } type - Type of the drm event to listen for. 1755 * @param { function } callback used to listen for the key required event. 1756 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1757 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1758 * 3.Parameter verification failed. 1759 * @throws { BusinessError } 24700101 - All unknown errors. 1760 * @syscap SystemCapability.Multimedia.Drm.Core 1761 * @since 11 1762 */ 1763 /** 1764 * Register keyRequired event. 1765 * @param { 'keyRequired' } type - Type of the drm event to listen for. 1766 * @param { function } callback used to listen for the key required event. 1767 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1768 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1769 * 3.Parameter verification failed. 1770 * @throws { BusinessError } 24700101 - All unknown errors. 1771 * @syscap SystemCapability.Multimedia.Drm.Core 1772 * @atomicservice 1773 * @since 12 1774 */ 1775 on(type: 'keyRequired', callback: (eventInfo: EventInfo) => void): void; 1776 1777 /** 1778 * Unregister keyRequired event. 1779 * @param { 'keyRequired' } type - Type of the drm event to listen for. 1780 * @param { function } callback used to listen for the key required event. 1781 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1782 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1783 * 3.Parameter verification failed. 1784 * @throws { BusinessError } 24700101 - All unknown errors. 1785 * @syscap SystemCapability.Multimedia.Drm.Core 1786 * @since 11 1787 */ 1788 /** 1789 * Unregister keyRequired event. 1790 * @param { 'keyRequired' } type - Type of the drm event to listen for. 1791 * @param { function } callback used to listen for the key required event. 1792 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1793 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1794 * 3.Parameter verification failed. 1795 * @throws { BusinessError } 24700101 - All unknown errors. 1796 * @syscap SystemCapability.Multimedia.Drm.Core 1797 * @atomicservice 1798 * @since 12 1799 */ 1800 off(type: 'keyRequired', callback?: (eventInfo: EventInfo) => void): void; 1801 1802 /** 1803 * Register keyExpired event. 1804 * @param { 'keyExpired' } type - Type of the drm event to listen for. 1805 * @param { function } callback - Used to listen for the key required event. 1806 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1807 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1808 * 3.Parameter verification failed. 1809 * @throws { BusinessError } 24700101 - All unknown errors. 1810 * @syscap SystemCapability.Multimedia.Drm.Core 1811 * @since 11 1812 */ 1813 /** 1814 * Register keyExpired event. 1815 * @param { 'keyExpired' } type - Type of the drm event to listen for. 1816 * @param { function } callback - Used to listen for the key required event. 1817 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1818 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1819 * 3.Parameter verification failed. 1820 * @throws { BusinessError } 24700101 - All unknown errors. 1821 * @syscap SystemCapability.Multimedia.Drm.Core 1822 * @atomicservice 1823 * @since 12 1824 */ 1825 on(type: 'keyExpired', callback: (eventInfo: EventInfo) => void): void; 1826 1827 /** 1828 * Unregister keyExpired event. 1829 * @param { 'keyExpired' } type - Type of the drm event to listen for. 1830 * @param { function } callback - Used to listen for the key required event. 1831 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1832 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1833 * 3.Parameter verification failed. 1834 * @throws { BusinessError } 24700101 - All unknown errors. 1835 * @syscap SystemCapability.Multimedia.Drm.Core 1836 * @since 11 1837 */ 1838 /** 1839 * Unregister keyExpired event. 1840 * @param { 'keyExpired' } type - Type of the drm event to listen for. 1841 * @param { function } callback - Used to listen for the key required event. 1842 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1843 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1844 * 3.Parameter verification failed. 1845 * @throws { BusinessError } 24700101 - All unknown errors. 1846 * @syscap SystemCapability.Multimedia.Drm.Core 1847 * @atomicservice 1848 * @since 12 1849 */ 1850 off(type: 'keyExpired', callback?: (eventInfo: EventInfo) => void): void; 1851 1852 /** 1853 * Register vendorDefined event. 1854 * @param { 'vendorDefined' } type - Type of the drm event to listen for. 1855 * @param { function } callback - Used to listen for the vendor defined event. 1856 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1857 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1858 * 3.Parameter verification failed. 1859 * @throws { BusinessError } 24700101 - All unknown errors. 1860 * @syscap SystemCapability.Multimedia.Drm.Core 1861 * @since 11 1862 */ 1863 /** 1864 * Register vendorDefined event. 1865 * @param { 'vendorDefined' } type - Type of the drm event to listen for. 1866 * @param { function } callback - Used to listen for the vendor defined event. 1867 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1868 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1869 * 3.Parameter verification failed. 1870 * @throws { BusinessError } 24700101 - All unknown errors. 1871 * @syscap SystemCapability.Multimedia.Drm.Core 1872 * @atomicservice 1873 * @since 12 1874 */ 1875 on(type: 'vendorDefined', callback: (eventInfo: EventInfo) => void): void; 1876 1877 /** 1878 * Unregister vendorDefined event. 1879 * @param { 'vendorDefined' } type - Type of the drm event to listen for. 1880 * @param { function } callback - Used to listen for the vendor defined event. 1881 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1882 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1883 * 3.Parameter verification failed. 1884 * @throws { BusinessError } 24700101 - All unknown errors. 1885 * @syscap SystemCapability.Multimedia.Drm.Core 1886 * @since 11 1887 */ 1888 /** 1889 * Unregister vendorDefined event. 1890 * @param { 'vendorDefined' } type - Type of the drm event to listen for. 1891 * @param { function } callback - Used to listen for the vendor defined event. 1892 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1893 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1894 * 3.Parameter verification failed. 1895 * @throws { BusinessError } 24700101 - All unknown errors. 1896 * @syscap SystemCapability.Multimedia.Drm.Core 1897 * @atomicservice 1898 * @since 12 1899 */ 1900 off(type: 'vendorDefined', callback?: (eventInfo: EventInfo) => void): void; 1901 1902 /** 1903 * Register expirationUpdate event. 1904 * @param { 'expirationUpdate' } type - Type of the drm event to listen for. 1905 * @param { function } callback - Used to listen for expiration update event. 1906 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1907 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1908 * 3.Parameter verification failed. 1909 * @throws { BusinessError } 24700101 - All unknown errors. 1910 * @syscap SystemCapability.Multimedia.Drm.Core 1911 * @since 11 1912 */ 1913 /** 1914 * Register expirationUpdate event. 1915 * @param { 'expirationUpdate' } type - Type of the drm event to listen for. 1916 * @param { function } callback - Used to listen for expiration update event. 1917 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1918 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1919 * 3.Parameter verification failed. 1920 * @throws { BusinessError } 24700101 - All unknown errors. 1921 * @syscap SystemCapability.Multimedia.Drm.Core 1922 * @atomicservice 1923 * @since 12 1924 */ 1925 on(type: 'expirationUpdate', callback: (eventInfo: EventInfo) => void): void; 1926 1927 /** 1928 * Unregister expirationUpdate event. 1929 * @param { 'expirationUpdate' } type - Type of the drm event to listen for. 1930 * @param { function } callback - Used to listen for expiration update event. 1931 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1932 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1933 * 3.Parameter verification failed. 1934 * @throws { BusinessError } 24700101 - All unknown errors. 1935 * @syscap SystemCapability.Multimedia.Drm.Core 1936 * @since 11 1937 */ 1938 /** 1939 * Unregister expirationUpdate event. 1940 * @param { 'expirationUpdate' } type - Type of the drm event to listen for. 1941 * @param { function } callback - Used to listen for expiration update event. 1942 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1943 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1944 * 3.Parameter verification failed. 1945 * @throws { BusinessError } 24700101 - All unknown errors. 1946 * @syscap SystemCapability.Multimedia.Drm.Core 1947 * @atomicservice 1948 * @since 12 1949 */ 1950 off(type: 'expirationUpdate', callback?: (eventInfo: EventInfo) => void): void; 1951 1952 /** 1953 * Register keysChange event. 1954 * @param { 'keysChange' } type - Type of the drm event to listen for. 1955 * @param { function } callback - Used to listen for keys change event. 1956 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1957 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1958 * 3.Parameter verification failed. 1959 * @throws { BusinessError } 24700101 - All unknown errors. 1960 * @syscap SystemCapability.Multimedia.Drm.Core 1961 * @since 11 1962 */ 1963 /** 1964 * Register keysChange event. 1965 * @param { 'keysChange' } type - Type of the drm event to listen for. 1966 * @param { function } callback - Used to listen for keys change event. 1967 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1968 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1969 * 3.Parameter verification failed. 1970 * @throws { BusinessError } 24700101 - All unknown errors. 1971 * @syscap SystemCapability.Multimedia.Drm.Core 1972 * @atomicservice 1973 * @since 12 1974 */ 1975 on(type: 'keysChange', callback: (keyInfo: KeysInfo[], newKeyAvailable: boolean) => void): void; 1976 1977 /** 1978 * Unregister keysChange event. 1979 * @param { 'keysChange' } type - Type of the drm event to listen for. 1980 * @param { function } callback - Used to listen for keys change event. 1981 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1982 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1983 * 3.Parameter verification failed. 1984 * @throws { BusinessError } 24700101 - All unknown errors. 1985 * @syscap SystemCapability.Multimedia.Drm.Core 1986 * @since 11 1987 */ 1988 /** 1989 * Unregister keysChange event. 1990 * @param { 'keysChange' } type - Type of the drm event to listen for. 1991 * @param { function } callback - Used to listen for keys change event. 1992 * @throws { BusinessError } 401 - The parameter check failed. Possibly because: 1993 * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. 1994 * 3.Parameter verification failed. 1995 * @throws { BusinessError } 24700101 - All unknown errors. 1996 * @syscap SystemCapability.Multimedia.Drm.Core 1997 * @atomicservice 1998 * @since 12 1999 */ 2000 off(type: 'keysChange', callback?: (keyInfo: KeysInfo[], newKeyAvailable: boolean) => void): void; 2001 2002 /** 2003 * Release the resource before the session gonna be unused. 2004 * @throws { BusinessError } 24700101 - All unknown errors. 2005 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 2006 * @syscap SystemCapability.Multimedia.Drm.Core 2007 * @since 11 2008 */ 2009 /** 2010 * Release the resource before the session gonna be unused. 2011 * @throws { BusinessError } 24700101 - All unknown errors. 2012 * @throws { BusinessError } 24700201 - Fatal service error, for example, service died. 2013 * @syscap SystemCapability.Multimedia.Drm.Core 2014 * @atomicservice 2015 * @since 12 2016 */ 2017 destroy(): void; 2018 2019 } 2020} 2021 2022export default drm; 2023