• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  enum DrmErrorCode {
42    /**
43     * All unknown errors.
44     * @syscap SystemCapability.Multimedia.Drm.Core
45     * @since 11
46     */
47    ERROR_UNKNOWN = 24700101,
48    /**
49     * Meet max MediaKeySystem num limit.
50     * @syscap SystemCapability.Multimedia.Drm.Core
51     * @since 11
52     */
53    MAX_SYSTEM_NUM_REACHED = 24700103,
54    /**
55     * Meet max MediaKeySession num limit.
56     * @syscap SystemCapability.Multimedia.Drm.Core
57     * @since 11
58     */
59    MAX_SESSION_NUM_REACHED = 24700104,
60    /**
61     * Fatal service error, for example, service died.
62     * @syscap SystemCapability.Multimedia.Drm.Core
63     * @since 11
64     */
65    SERVICE_FATAL_ERROR = 24700201
66  }
67
68  /**
69   * Enumerates which config name we can get.
70   * @enum { string }
71   * @syscap SystemCapability.Multimedia.Drm.Core
72   * @since 11
73   */
74  enum PreDefinedConfigName {
75    /**
76     * Config name vendor
77     * @syscap SystemCapability.Multimedia.Drm.Core
78     * @since 11
79     */
80    CONFIG_DEVICE_VENDOR = 'vendor',
81    /**
82     * Config name version
83     * @syscap SystemCapability.Multimedia.Drm.Core
84     * @since 11
85     */
86    CONFIG_DEVICE_VERSION = 'version',
87    /**
88     * Config name description
89     * @syscap SystemCapability.Multimedia.Drm.Core
90     * @since 11
91     */
92    CONFIG_DEVICE_DESCRIPTION = 'description',
93    /**
94     * Config name algorithms
95     * @syscap SystemCapability.Multimedia.Drm.Core
96     * @since 11
97     */
98    CONFIG_DEVICE_ALGORITHMS = 'algorithms',
99    /**
100     * Config name deviceUniqueId
101     * @syscap SystemCapability.Multimedia.Drm.Core
102     * @since 11
103     */
104    CONFIG_DEVICE_UNIQUE_ID = 'deviceUniqueId',
105    /**
106     * Config name maxSessionNum
107     * @syscap SystemCapability.Multimedia.Drm.Core
108     * @since 11
109     */
110    CONFIG_SESSION_MAX = 'maxSessionNum',
111    /**
112     * Config name currentSessionNum
113     * @syscap SystemCapability.Multimedia.Drm.Core
114     * @since 11
115     */
116    CONFIG_SESSION_CURRENT = 'currentSessionNum',
117  }
118
119  /**
120   * Enumerates media key type.
121   * @enum { number }
122   * @syscap SystemCapability.Multimedia.Drm.Core
123   * @since 11
124   */
125  enum MediaKeyType {
126    /**
127     * Offline media key type.
128     * @syscap SystemCapability.Multimedia.Drm.Core
129     * @since 11
130     */
131    MEDIA_KEY_TYPE_OFFLINE = 0,
132    /**
133     * Online media key type.
134     * @syscap SystemCapability.Multimedia.Drm.Core
135     * @since 11
136     */
137    MEDIA_KEY_TYPE_ONLINE,
138  }
139
140  /**
141   * Enumerates offline media key status.
142   * @enum { number }
143   * @syscap SystemCapability.Multimedia.Drm.Core
144   * @since 11
145   */
146  enum OfflineMediaKeyStatus {
147    /**
148     * Offline media key status unknown.
149     * @syscap SystemCapability.Multimedia.Drm.Core
150     * @since 11
151     */
152    OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0,
153    /**
154     * Offline media key status usable.
155     * @syscap SystemCapability.Multimedia.Drm.Core
156     * @since 11
157     */
158    OFFLINE_MEDIA_KEY_STATUS_USABLE = 1,
159    /**
160     * Offline media key status inactive.
161     * @syscap SystemCapability.Multimedia.Drm.Core
162     * @since 11
163     */
164    OFFLINE_MEDIA_KEY_STATUS_INACTIVE = 2,
165  }
166
167  /**
168   * Enumerates certificate status.
169   * @enum { number }
170   * @syscap SystemCapability.Multimedia.Drm.Core
171   * @since 11
172   */
173  enum CertificateStatus {
174    /**
175     * Device already provisioned.
176     * @syscap SystemCapability.Multimedia.Drm.Core
177     * @since 11
178     */
179    CERT_STATUS_PROVISIONED = 0,
180    /**
181     * Device not provisioned.
182     * @syscap SystemCapability.Multimedia.Drm.Core
183     * @since 11
184     */
185    CERT_STATUS_NOT_PROVISIONED,
186    /**
187     * Cert already expired.
188     * @syscap SystemCapability.Multimedia.Drm.Core
189     * @since 11
190     */
191    CERT_STATUS_EXPIRED,
192    /**
193     * Certs are invalid.
194     * @syscap SystemCapability.Multimedia.Drm.Core
195     * @since 11
196     */
197    CERT_STATUS_INVALID,
198    /**
199     * Get certs status failed.
200     * @syscap SystemCapability.Multimedia.Drm.Core
201     * @since 11
202     */
203    CERT_STATUS_UNAVAILABLE,
204  }
205
206  /**
207   * Enumerates media key request types.
208   * @enum { number }
209   * @syscap SystemCapability.Multimedia.Drm.Core
210   * @since 11
211   */
212  /**
213   * Enumerates media key request types.
214   * @enum { number }
215   * @syscap SystemCapability.Multimedia.Drm.Core
216   * @atomicservice
217   * @since 12
218   */
219  enum MediaKeyRequestType {
220    /**
221     * Media key request type unknown.
222     * @syscap SystemCapability.Multimedia.Drm.Core
223     * @since 11
224     */
225    /**
226     * Media key request type unknown.
227     * @syscap SystemCapability.Multimedia.Drm.Core
228     * @atomicservice
229     * @since 12
230     */
231    MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0,
232    /**
233     * Media key request type initial.
234     * @syscap SystemCapability.Multimedia.Drm.Core
235     * @since 11
236     */
237    /**
238     * Media key request type initial.
239     * @syscap SystemCapability.Multimedia.Drm.Core
240     * @atomicservice
241     * @since 12
242     */
243    MEDIA_KEY_REQUEST_TYPE_INITIAL = 1,
244    /**
245     * Media key request type renewal.
246     * @syscap SystemCapability.Multimedia.Drm.Core
247     * @since 11
248     */
249    /**
250     * Media key request type renewal.
251     * @syscap SystemCapability.Multimedia.Drm.Core
252     * @atomicservice
253     * @since 12
254     */
255    MEDIA_KEY_REQUEST_TYPE_RENEWAL = 2,
256    /**
257     * Media key request type release.
258     * @syscap SystemCapability.Multimedia.Drm.Core
259     * @since 11
260     */
261    /**
262     * Media key request type release.
263     * @syscap SystemCapability.Multimedia.Drm.Core
264     * @atomicservice
265     * @since 12
266     */
267    MEDIA_KEY_REQUEST_TYPE_RELEASE = 3,
268    /**
269     * Media key request type none.
270     * @syscap SystemCapability.Multimedia.Drm.Core
271     * @since 11
272     */
273    /**
274     * Media key request type none.
275     * @syscap SystemCapability.Multimedia.Drm.Core
276     * @atomicservice
277     * @since 12
278     */
279    MEDIA_KEY_REQUEST_TYPE_NONE = 4,
280    /**
281     * Media key request type update.
282     * @syscap SystemCapability.Multimedia.Drm.Core
283     * @since 11
284     */
285    /**
286     * Media key request type update.
287     * @syscap SystemCapability.Multimedia.Drm.Core
288     * @atomicservice
289     * @since 12
290     */
291    MEDIA_KEY_REQUEST_TYPE_UPDATE = 5,
292  }
293
294  /**
295   * Enumerates content protection level.
296   * @enum { number }
297   * @syscap SystemCapability.Multimedia.Drm.Core
298   * @since 11
299   */
300  /**
301   * Enumerates content protection level.
302   * @enum { number }
303   * @syscap SystemCapability.Multimedia.Drm.Core
304   * @atomicservice
305   * @since 12
306   */
307  enum ContentProtectionLevel {
308    /**
309     * Device decrypt and decode type unknown.
310     * @syscap SystemCapability.Multimedia.Drm.Core
311     * @since 11
312     */
313    /**
314     * Device decrypt and decode type unknown.
315     * @syscap SystemCapability.Multimedia.Drm.Core
316     * @atomicservice
317     * @since 12
318     */
319    CONTENT_PROTECTION_LEVEL_UNKNOWN = 0,
320    /**
321     * Device using software level.
322     * @syscap SystemCapability.Multimedia.Drm.Core
323     * @since 11
324     */
325    /**
326     * Device using software level.
327     * @syscap SystemCapability.Multimedia.Drm.Core
328     * @atomicservice
329     * @since 12
330     */
331    CONTENT_PROTECTION_LEVEL_SW_CRYPTO,
332    /**
333     * Device using hardware level.
334     * @syscap SystemCapability.Multimedia.Drm.Core
335     * @since 11
336     */
337    /**
338     * Device using hardware level.
339     * @syscap SystemCapability.Multimedia.Drm.Core
340     * @atomicservice
341     * @since 12
342     */
343    CONTENT_PROTECTION_LEVEL_HW_CRYPTO,
344    /**
345     * Device using enhanced hardware level.
346     * @syscap SystemCapability.Multimedia.Drm.Core
347     * @since 11
348     */
349    /**
350     * Device using enhanced hardware level.
351     * @syscap SystemCapability.Multimedia.Drm.Core
352     * @atomicservice
353     * @since 12
354     */
355    CONTENT_PROTECTION_LEVEL_ENHANCED_HW,
356    /**
357     * Max mode.
358     * @syscap SystemCapability.Multimedia.Drm.Core
359     * @since 11
360     */
361    /**
362     * Max mode.
363     * @syscap SystemCapability.Multimedia.Drm.Core
364     * @atomicservice
365     * @since 12
366     */
367    CONTENT_PROTECTION_LEVEL_MAX,
368  }
369
370  /**
371   * Provides the drm provision request definitions.
372   * @interface ProvisionRequest
373   * @syscap SystemCapability.Multimedia.Drm.Core
374   * @since 11
375   */
376  interface ProvisionRequest {
377    /**
378     * Provision request data sent to provision server.
379     * @type { Uint8Array }
380     * @syscap SystemCapability.Multimedia.Drm.Core
381     * @since 11
382     */
383    data: Uint8Array;
384    /**
385     * Provision server URL.
386     * @type { string }
387     * @syscap SystemCapability.Multimedia.Drm.Core
388     * @since 11
389     */
390    defaultURL: string;
391  }
392
393  /**
394   * Provides the drm media key request info optional data.
395   * @interface OptionsData
396   * @syscap SystemCapability.Multimedia.Drm.Core
397   * @since 11
398   */
399  /**
400   * Provides the drm media key request info optional data.
401   * @interface OptionsData
402   * @syscap SystemCapability.Multimedia.Drm.Core
403   * @atomicservice
404   * @since 12
405   */
406  interface OptionsData {
407    /**
408     * App defined optional data name.
409     * @type { string }
410     * @syscap SystemCapability.Multimedia.Drm.Core
411     * @since 11
412     */
413    /**
414     * App defined optional data name.
415     * @type { string }
416     * @syscap SystemCapability.Multimedia.Drm.Core
417     * @atomicservice
418     * @since 12
419     */
420    name: string;
421    /**
422     * App defined optional data value.
423     * @type { string }
424     * @syscap SystemCapability.Multimedia.Drm.Core
425     * @since 11
426     */
427    /**
428     * App defined optional data value.
429     * @type { string }
430     * @syscap SystemCapability.Multimedia.Drm.Core
431     * @atomicservice
432     * @since 12
433     */
434    value: string;
435  }
436
437  /**
438   * Provides the drm media key request definitions.
439   * @interface MediaKeyRequest
440   * @syscap SystemCapability.Multimedia.Drm.Core
441   * @since 11
442   */
443  /**
444   * Provides the drm media key request definitions.
445   * @interface MediaKeyRequest
446   * @syscap SystemCapability.Multimedia.Drm.Core
447   * @atomicservice
448   * @since 12
449   */
450  interface MediaKeyRequest {
451    /**
452     * Media key request type.
453     * @type { MediaKeyRequestType }
454     * @syscap SystemCapability.Multimedia.Drm.Core
455     * @since 11
456     */
457    /**
458     * Media key request type.
459     * @type { MediaKeyRequestType }
460     * @syscap SystemCapability.Multimedia.Drm.Core
461     * @atomicservice
462     * @since 12
463     */
464    mediaKeyRequestType: MediaKeyRequestType;
465    /**
466     * Media key request data sent to media key server.
467     * @type { Uint8Array }
468     * @syscap SystemCapability.Multimedia.Drm.Core
469     * @since 11
470     */
471    /**
472     * Media key request data sent to media key server.
473     * @type { Uint8Array }
474     * @syscap SystemCapability.Multimedia.Drm.Core
475     * @atomicservice
476     * @since 12
477     */
478    data: Uint8Array;
479    /**
480     * Media key server URL.
481     * @type { string }
482     * @syscap SystemCapability.Multimedia.Drm.Core
483     * @since 11
484     */
485    /**
486     * Media key server URL.
487     * @type { string }
488     * @syscap SystemCapability.Multimedia.Drm.Core
489     * @atomicservice
490     * @since 12
491     */
492    defaultURL: string;
493  }
494
495  /**
496   * Used to indicates the event info attached to specific event type.
497   * @interface EventInfo
498   * @syscap SystemCapability.Multimedia.Drm.Core
499   * @since 11
500   */
501  /**
502   * Used to indicates the event info attached to specific event type.
503   * @interface EventInfo
504   * @syscap SystemCapability.Multimedia.Drm.Core
505   * @atomicservice
506   * @since 12
507   */
508  interface EventInfo {
509    /**
510     * Event info.
511     * @type { Uint8Array }
512     * @syscap SystemCapability.Multimedia.Drm.Core
513     * @since 11
514     */
515    /**
516     * Event info.
517     * @type { Uint8Array }
518     * @syscap SystemCapability.Multimedia.Drm.Core
519     * @atomicservice
520     * @since 12
521     */
522    info: Uint8Array;
523    /**
524     * Event extra info.
525     * @type { string }
526     * @syscap SystemCapability.Multimedia.Drm.Core
527     * @since 11
528     */
529    /**
530     * Event extra info.
531     * @type { string }
532     * @syscap SystemCapability.Multimedia.Drm.Core
533     * @atomicservice
534     * @since 12
535     */
536    extraInfo: string;
537  }
538
539  /**
540   * Used to indicates the statistic info.
541   * @interface StatisticKeyValue
542   * @syscap SystemCapability.Multimedia.Drm.Core
543   * @since 11
544   */
545  interface StatisticKeyValue {
546    /**
547     * Statistic info name.
548     * @type { string }
549     * @syscap SystemCapability.Multimedia.Drm.Core
550     * @since 11
551     */
552    name: string;
553    /**
554     * Statistic info value.
555     * @type { string }
556     * @syscap SystemCapability.Multimedia.Drm.Core
557     * @since 11
558     */
559    value: string;
560  }
561
562  /**
563   * Used to indicates the media key status.
564   * @interface MediaKeyStatus
565   * @syscap SystemCapability.Multimedia.Drm.Core
566   * @since 11
567   */
568  /**
569   * Used to indicates the media key status.
570   * @interface MediaKeyStatus
571   * @syscap SystemCapability.Multimedia.Drm.Core
572   * @atomicservice
573   * @since 12
574   */
575  interface MediaKeyStatus {
576    /**
577     * Media key Id in string.
578     * @type { string }
579     * @syscap SystemCapability.Multimedia.Drm.Core
580     * @since 11
581     */
582    /**
583     * Media key Id in string.
584     * @type { string }
585     * @syscap SystemCapability.Multimedia.Drm.Core
586     * @atomicservice
587     * @since 12
588     */
589    name: string;
590    /**
591     * Media key status description.
592     * @type { string }
593     * @syscap SystemCapability.Multimedia.Drm.Core
594     * @since 11
595     */
596    /**
597     * Media key status description.
598     * @type { string }
599     * @syscap SystemCapability.Multimedia.Drm.Core
600     * @atomicservice
601     * @since 12
602     */
603    value: string;
604  }
605
606  /**
607   * Used to indicates the media key status with a key and its value.
608   * @interface KeysInfo
609   * @syscap SystemCapability.Multimedia.Drm.Core
610   * @since 11
611   */
612  /**
613   * Used to indicates the media key status with a key and its value.
614   * @interface KeysInfo
615   * @syscap SystemCapability.Multimedia.Drm.Core
616   * @atomicservice
617   * @since 12
618   */
619  interface KeysInfo {
620    /**
621     * Keys Id in media key.
622     * @type { Uint8Array }
623     * @syscap SystemCapability.Multimedia.Drm.Core
624     * @since 11
625     */
626    /**
627     * Keys Id in media key.
628     * @type { Uint8Array }
629     * @syscap SystemCapability.Multimedia.Drm.Core
630     * @atomicservice
631     * @since 12
632     */
633    keyId: Uint8Array;
634    /**
635     * Keys status description.
636     * @type { string }
637     * @syscap SystemCapability.Multimedia.Drm.Core
638     * @since 11
639     */
640    /**
641     * Keys status description.
642     * @type { string }
643     * @syscap SystemCapability.Multimedia.Drm.Core
644     * @atomicservice
645     * @since 12
646     */
647    value: string;
648  }
649
650  /**
651   * Used to indicates the media key system info of media source.
652   * @interface MediaKeySystemInfo
653   * @syscap SystemCapability.Multimedia.Drm.Core
654   * @since 11
655   */
656  /**
657   * Used to indicates the media key system info of media source.
658   * @interface MediaKeySystemInfo
659   * @syscap SystemCapability.Multimedia.Drm.Core
660   * @atomicservice
661   * @since 12
662   */
663  interface MediaKeySystemInfo {
664    /**
665     * Drm system ID.
666     * @type { string }
667     * @syscap SystemCapability.Multimedia.Drm.Core
668     * @since 11
669     */
670    /**
671     * Drm system ID.
672     * @type { string }
673     * @syscap SystemCapability.Multimedia.Drm.Core
674     * @atomicservice
675     * @since 12
676     */
677    uuid: string;
678    /**
679     * PSSH(protection scheme specific header) contain drm info.
680     * @type { Uint8Array }
681     * @syscap SystemCapability.Multimedia.Drm.Core
682     * @since 11
683     */
684    /**
685     * PSSH(protection scheme specific header) contain drm info.
686     * @type { Uint8Array }
687     * @syscap SystemCapability.Multimedia.Drm.Core
688     * @atomicservice
689     * @since 12
690     */
691    pssh: Uint8Array;
692  }
693
694/**
695   * Name and UUID of DRM plugin.
696   * @interface MediaKeySystemDescription
697   * @syscap SystemCapability.Multimedia.Drm.Core
698   * @since 12
699   */
700  interface MediaKeySystemDescription {
701    /**
702     * Name of DRM plugin.
703     * @type { string }
704     * @syscap SystemCapability.Multimedia.Drm.Core
705     * @since 12
706     */
707    name: string;
708    /**
709     * UUID supported by DRM plugin.
710     * @type { string }
711     * @syscap SystemCapability.Multimedia.Drm.Core
712     * @since 12
713     */
714    uuid: string;
715  }
716
717  /**
718   * Get a MediaKeySystem's UUID.
719   * @param { string } name - The Digital Right Management solution name.
720   * @returns { string } The MediaKeySystem uuid.
721   * @throws { BusinessError } 401 - The parameter check failed.Possibly because:
722   * <br>1.Mandatory parameters are left unspecified. 2.Parameter verification failed.
723   * @throws { BusinessError } 24700101 - All unknown errors.
724   * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
725   * @syscap SystemCapability.Multimedia.Drm.Core
726   * @since 12
727   */
728  function getMediaKeySystemUuid(name: string): string;
729
730  /**
731   * Get all media key systems supported.
732   * @returns { MediaKeySystemDescription[] } The MediaKeySystem name and uuid info list.
733   * @throws { BusinessError } 24700101 - All unknown errors.
734   * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
735   * @syscap SystemCapability.Multimedia.Drm.Core
736   * @since 12
737   */
738  function getMediaKeySystems(): MediaKeySystemDescription[];
739
740  /**
741   * Creates a MediaKeySystem instance.
742   * @param { string } name - Used to point a Digital Right Management solution.
743   * @returns { MediaKeySystem } The MediaKeySystem instance.
744   * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
745   * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed.
746   * @throws { BusinessError } 24700101 - All unknown errors.
747   * @throws { BusinessError } 24700103 - Meet max MediaKeySystem num limit.
748   * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
749   * @syscap SystemCapability.Multimedia.Drm.Core
750   * @since 11
751   */
752  function createMediaKeySystem(name: string): MediaKeySystem;
753
754  /**
755   * Judge whether a system that specifies name, mimetype and content protection level is supported.
756   * @param { string } name - Used to point a Digital Right Management solution.
757   * @param { string } mimeType - Used to specifies the media type.
758   * @param { ContentProtectionLevel } level - Used to specifies the ContentProtectionLevel.
759   * @returns { boolean } Whether these conditions will be met.
760   * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
761   * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
762   * 3.Parameter verification failed.
763   * @throws { BusinessError } 24700101 - All unknown errors.
764   * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
765   * @syscap SystemCapability.Multimedia.Drm.Core
766   * @since 11
767   */
768  function isMediaKeySystemSupported(name: string, mimeType: string, level: ContentProtectionLevel): boolean;
769
770  /**
771   * Judge whether a system that specifies name, mimetype is supported.
772   * @param { string } name - Used to point a Digital Right Management solution.
773   * @param { string } mimeType - Used to specifies the media type.
774   * @returns { boolean } Whether these conditions will be met.
775   * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
776   * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
777   * 3.Parameter verification failed.
778   * @throws { BusinessError } 24700101 - All unknown errors.
779   * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
780   * @syscap SystemCapability.Multimedia.Drm.Core
781   * @since 11
782   */
783  function isMediaKeySystemSupported(name: string, mimeType: string): boolean;
784
785  /**
786   * Judge whether a system that specifies name is supported.
787   * @param { string } name - Used to point a Digital Right Management solution.
788   * @returns { boolean } Whether these conditions will be met.
789   * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
790   * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed,
791   * the param name's length is zero or too big(exceeds 4096 Bytes).
792   * @throws { BusinessError } 24700101 - All unknown errors.
793   * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
794   * @syscap SystemCapability.Multimedia.Drm.Core
795   * @since 11
796   */
797  function isMediaKeySystemSupported(name: string): boolean;
798
799  /**
800   * Manages and record MediaKeySessions. Before calling an MediaKeySystem method, we must use getMediaKeySystem
801   * to get a MediaKeySystem instance, then we can call functions.
802   * @interface MediaKeySystem
803   * @syscap SystemCapability.Multimedia.Drm.Core
804   * @since 11
805   *
806   */
807  interface MediaKeySystem {
808    /**
809     * Get the specified configuration.
810     * @param { string } configName - Used to specify the config name.
811     * @returns { string } The config value string.
812     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
813     * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed,
814     * the param's length is zero or too big(exceeds 4096 Bytes).
815     * @throws { BusinessError } 24700101 - All unknown errors.
816     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
817     * @syscap SystemCapability.Multimedia.Drm.Core
818     * @since 11
819     */
820    getConfigurationString(configName: string): string;
821
822    /**
823     * Set the specified configuration.
824     * @param { string } configName - Used to specify the config name.
825     * @param { string } value - The value to be set.
826     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
827     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
828     * 3.Parameter verification failed.
829     * @throws { BusinessError } 24700101 - All unknown errors.
830     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
831     * @syscap SystemCapability.Multimedia.Drm.Core
832     * @since 11
833     */
834    setConfigurationString(configName: string, value: string): void;
835
836    /**
837     * Get the specified configuration.
838     * @param { string } configName - Used to specify the config name.
839     * @returns { Uint8Array } The config value.
840     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
841     * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed.
842     * @throws { BusinessError } 24700101 - All unknown errors.
843     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
844     * @syscap SystemCapability.Multimedia.Drm.Core
845     * @since 11
846     */
847    getConfigurationByteArray(configName: string): Uint8Array;
848
849    /**
850     * Set the specified configuration.
851     * @param { string } configName - Used to specify the config name.
852     * @param { Uint8Array } value - The value to be set.
853     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
854     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
855     * 3.Parameter verification failed.
856     * @throws { BusinessError } 24700101 - All unknown errors.
857     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
858     * @syscap SystemCapability.Multimedia.Drm.Core
859     * @since 11
860     */
861    setConfigurationByteArray(configName: string, value: Uint8Array): void;
862
863    /**
864     * Get performance statistics information.That includes currentSessionNum, version, decryptNumber,
865     * and errorDecryptNumber.
866     * @returns { StatisticKeyValue[] } A list that includes performance index and corresponding statistics.
867     * @throws { BusinessError } 24700101 - All unknown errors.
868     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
869     * @syscap SystemCapability.Multimedia.Drm.Core
870     * @since 11
871     */
872    getStatistics(): StatisticKeyValue[];
873
874    /**
875     * Get max content protection level the device supports.
876     * @returns { ContentProtectionLevel } The max content protection level of the MediaKeySystem instance.
877     * @throws { BusinessError } 24700101 - All unknown errors.
878     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
879     * @syscap SystemCapability.Multimedia.Drm.Core
880     * @since 11
881     */
882    getMaxContentProtectionLevel(): ContentProtectionLevel;
883
884    /**
885     * Generate a media key system provision request.
886     * @returns { Promise<ProvisionRequest> } Promise with ProvisionRequest used to return the result.
887     * @throws { BusinessError } 24700101 - All unknown errors.
888     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
889     * @syscap SystemCapability.Multimedia.Drm.Core
890     * @since 11
891     */
892
893    generateKeySystemRequest(): Promise<ProvisionRequest>;
894
895    /**
896     * Process the response corresponding the key system request obtained by the application.
897     * @param { Uint8Array } response - Response corresponding to the request.
898     * @returns { Promise<void> } Promise used to return the result.
899     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
900     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
901     * 3.Parameter verification failed.
902     * @throws { BusinessError } 24700101 - All unknown errors.
903     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
904     * @syscap SystemCapability.Multimedia.Drm.Core
905     * @since 11
906     */
907    processKeySystemResponse(response: Uint8Array): Promise<void>;
908
909    /**
910     * Get certificate status of the MediaKeySystem.
911     * @returns { CertificateStatus } Certificate Status of the MediaKeySystem instance.
912     * @throws { BusinessError } 24700101 - All unknown errors.
913     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
914     * @syscap SystemCapability.Multimedia.Drm.Core
915     * @since 11
916     */
917    getCertificateStatus(): CertificateStatus;
918
919    /**
920     * Register keySystemRequired events.
921     * @param { 'keySystemRequired' } type - Type of the drm event to listen for.
922     * @param { function } callback - Used to listen for the key system required event.
923     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
924     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
925     * @throws { BusinessError } 24700101 - All unknown errors.
926     * @syscap SystemCapability.Multimedia.Drm.Core
927     * @since 11
928     */
929    on(type: 'keySystemRequired', callback: (eventInfo: EventInfo) => void): void;
930
931    /**
932     * Unregister keySystemRequired events.
933     * @param { 'keySystemRequired' } type - Type of the drm event to listen for.
934     * @param { function } callback - Used to listen for the key system required event.
935     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
936     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
937     * @throws { BusinessError } 24700101 - All unknown errors.
938     * @syscap SystemCapability.Multimedia.Drm.Core
939     * @since 11
940     */
941    off(type: 'keySystemRequired', callback?: (eventInfo: EventInfo) => void): void;
942
943    /**
944     * Create a MediaKeySession instance with level.
945     * @param { ContentProtectionLevel } level - Used to specify the content protection level.
946     * @returns { MediaKeySession } A MediaKeySession instance.
947     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
948     * 1.Mandatory parameters are left unspecified. 2.The param level exceeds reasonable range,
949     * please use value in ContentProtectionLevel.
950     * @throws { BusinessError } 24700101 - All unknown errors.
951     * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit.
952     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
953     * @syscap SystemCapability.Multimedia.Drm.Core
954     * @since 11
955     */
956    createMediaKeySession(level: ContentProtectionLevel): MediaKeySession;
957
958    /**
959     * Create a MediaKeySession instance.
960     * @returns { MediaKeySession } A MediaKeySession instance.
961     * @throws { BusinessError } 24700101 - All unknown errors.
962     * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit.
963     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
964     * @syscap SystemCapability.Multimedia.Drm.Core
965     * @since 11
966     */
967    createMediaKeySession(): MediaKeySession;
968
969    /**
970     * Get the list of offline MediaKeyIds.
971     * @returns { Uint8Array[] } The list of offline MediaKeyIds.
972     * @throws { BusinessError } 24700101 - All unknown errors.
973     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
974     * @syscap SystemCapability.Multimedia.Drm.Core
975     * @since 11
976     */
977    getOfflineMediaKeyIds(): Uint8Array[];
978
979    /**
980     * Get offline media key status corresponding to the mediaKeyId.
981     * @param { Uint8Array } mediaKeyId - The media key identifier.
982     * @returns { OfflineMediaKeyStatus } Offline media key Status.
983     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
984     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
985     * 3.Parameter verification failed.
986     * @throws { BusinessError } 24700101 - All unknown errors.
987     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
988     * @syscap SystemCapability.Multimedia.Drm.Core
989     * @since 11
990     */
991    getOfflineMediaKeyStatus(mediaKeyId: Uint8Array): OfflineMediaKeyStatus;
992
993    /**
994     * Remove media key corresponding to the mediaKeyId.
995     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be clear.
996     * @throws { BusinessError } 401 - The parameter check failed.Possibly because:
997     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
998     * @throws { BusinessError } 24700101 - All unknown errors.
999     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1000     * @syscap SystemCapability.Multimedia.Drm.Core
1001     * @since 11
1002     */
1003    clearOfflineMediaKeys(mediaKeyId: Uint8Array): void;
1004    /**
1005     * Release the resource before the MediaKeySystem gonna be unused.
1006     * @throws { BusinessError } 24700101 - All unknown errors.
1007     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1008     * @syscap SystemCapability.Multimedia.Drm.Core
1009     * @since 11
1010     */
1011    destroy(): void;
1012  }
1013
1014  /**
1015   * Provide functions and keep a decrypt module. Before calling an MediaKeySession method, we must
1016   * use MediaKeySystem's createMediaKeySession to get a MediaKeySession instance.
1017   * @interface MediaKeySession
1018   * @syscap SystemCapability.Multimedia.Drm.Core
1019   * @since 11
1020   */
1021  /**
1022   * Provide functions and keep a decrypt module. Before calling an MediaKeySession method, we must
1023   * use MediaKeySystem's createMediaKeySession to get a MediaKeySession instance.
1024   * @interface MediaKeySession
1025   * @syscap SystemCapability.Multimedia.Drm.Core
1026   * @atomicservice
1027   * @since 12
1028   */
1029  interface MediaKeySession {
1030
1031    /**
1032     * Generate the media key request.
1033     * @param { string } mimeType - Media type.
1034     * @param { Uint8Array } initData - PSSH info.
1035     * @param { number } mediaKeyType - Offline or online.
1036     * @param { OptionsData[] } options - Optional data the application set to drm framework.
1037     * @returns { Promise<MediaKeyRequest> } Promise with MediaKeyRequest used to return the result.
1038     * @throws { BusinessError } 401 -The parameter check failed. Possibly because:
1039     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1040     * 3.Parameter verification failed.
1041     * @throws { BusinessError } 24700101 - All unknown errors.
1042     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1043     * @syscap SystemCapability.Multimedia.Drm.Core
1044     * @since 11
1045     */
1046    /**
1047     * Generate the media key request.
1048     * @param { string } mimeType - Media type.
1049     * @param { Uint8Array } initData - PSSH info.
1050     * @param { number } mediaKeyType - Offline or online.
1051     * @param { OptionsData[] } options - Optional data the application set to drm framework.
1052     * @returns { Promise<MediaKeyRequest> } Promise with MediaKeyRequest used to return the result.
1053     * @throws { BusinessError } 401 -The parameter check failed. Possibly because:
1054     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1055     * 3.Parameter verification failed.
1056     * @throws { BusinessError } 24700101 - All unknown errors.
1057     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1058     * @syscap SystemCapability.Multimedia.Drm.Core
1059     * @atomicservice
1060     * @since 12
1061     */
1062    generateMediaKeyRequest(mimeType: string, initData: Uint8Array, mediaKeyType: number, options?: OptionsData[]): Promise<MediaKeyRequest>;
1063
1064    /**
1065     * Process the response corresponding to the media key request obtained by the application.
1066     * @param { Uint8Array } response - The response.
1067     * @returns { Promise<Uint8Array> } Promise with media key identifier in Uint8ARRY used to return the result.
1068     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1069     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
1070     * 3.Parameter verification failed.
1071     * @throws { BusinessError } 24700101 - All unknown errors.
1072     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1073     * @syscap SystemCapability.Multimedia.Drm.Core
1074     * @since 11
1075     */
1076    /**
1077     * Process the response corresponding to the media key request obtained by the application.
1078     * @param { Uint8Array } response - The response.
1079     * @returns { Promise<Uint8Array> } Promise with media key identifier in Uint8ARRY used to return the result.
1080     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1081     * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
1082     * 3.Parameter verification failed.
1083     * @throws { BusinessError } 24700101 - All unknown errors.
1084     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1085     * @syscap SystemCapability.Multimedia.Drm.Core
1086     * @atomicservice
1087     * @since 12
1088     */
1089    processMediaKeyResponse(response: Uint8Array): Promise<Uint8Array>;
1090
1091    /**
1092     * Check the media key status
1093     * @returns { MediaKeyStatus[] } A list of media key status description pairs.
1094     * @throws { BusinessError } 24700101 - All unknown errors.
1095     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1096     * @syscap SystemCapability.Multimedia.Drm.Core
1097     * @since 11
1098     */
1099    /**
1100     * Check the media key status
1101     * @returns { MediaKeyStatus[] } A list of media key status description pairs.
1102     * @throws { BusinessError } 24700101 - All unknown errors.
1103     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1104     * @syscap SystemCapability.Multimedia.Drm.Core
1105     * @atomicservice
1106     * @since 12
1107     */
1108    checkMediaKeyStatus(): MediaKeyStatus[];
1109
1110    /**
1111     * Remove media key.
1112     * @throws { BusinessError } 24700101 - All unknown errors.
1113     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1114     * @syscap SystemCapability.Multimedia.Drm.Core
1115     * @since 11
1116     */
1117    /**
1118     * Remove media key.
1119     * @throws { BusinessError } 24700101 - All unknown errors.
1120     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1121     * @syscap SystemCapability.Multimedia.Drm.Core
1122     * @atomicservice
1123     * @since 12
1124     */
1125    clearMediaKeys(): void;
1126
1127    /**
1128     * Generate offline media key request.
1129     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key request
1130     * should be generated.
1131     * @returns { Promise<Uint8Array> } Promise with media key request in Uint8Array used to return the result.
1132     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1133     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1134     * 3.Parameter verification failed.
1135     * @throws { BusinessError } 24700101 - All unknown errors.
1136     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1137     * @syscap SystemCapability.Multimedia.Drm.Core
1138     * @since 11
1139     */
1140    /**
1141     * Generate offline media key request.
1142     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key request
1143     * should be generated.
1144     * @returns { Promise<Uint8Array> } Promise with media key request in Uint8Array used to return the result.
1145     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1146     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1147     * 3.Parameter verification failed.
1148     * @throws { BusinessError } 24700101 - All unknown errors.
1149     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1150     * @syscap SystemCapability.Multimedia.Drm.Core
1151     * @atomicservice
1152     * @since 12
1153     */
1154    generateOfflineReleaseRequest(mediaKeyId: Uint8Array): Promise<Uint8Array>;
1155
1156    /**
1157     * Process offline media key response.
1158     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key it is.
1159     * @param { Uint8Array } response - The offline media key.
1160     * @returns { Promise<void> } Promise used to return the result.
1161     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1162     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1163     * 3.Parameter verification failed.
1164     * @throws { BusinessError } 24700101 - All unknown errors.
1165     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1166     * @syscap SystemCapability.Multimedia.Drm.Core
1167     * @since 11
1168     */
1169    /**
1170     * Process offline media key response.
1171     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key it is.
1172     * @param { Uint8Array } response - The offline media key.
1173     * @returns { Promise<void> } Promise used to return the result.
1174     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1175     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1176     * 3.Parameter verification failed.
1177     * @throws { BusinessError } 24700101 - All unknown errors.
1178     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1179     * @syscap SystemCapability.Multimedia.Drm.Core
1180     * @atomicservice
1181     * @since 12
1182     */
1183    processOfflineReleaseResponse(mediaKeyId: Uint8Array, response: Uint8Array): Promise<void>;
1184
1185    /**
1186     * Restore offline media key.
1187     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be restore.
1188     * @returns { Promise<void> } Promise used to return the result.
1189     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1190     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1191     * 3.Parameter verification failed.
1192     * @throws { BusinessError } 24700101 - All unknown errors.
1193     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1194     * @syscap SystemCapability.Multimedia.Drm.Core
1195     * @since 11
1196     */
1197    /**
1198     * Restore offline media key.
1199     * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be restore.
1200     * @returns { Promise<void> } Promise used to return the result.
1201     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1202     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1203     * 3.Parameter verification failed.
1204     * @throws { BusinessError } 24700101 - All unknown errors.
1205     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1206     * @syscap SystemCapability.Multimedia.Drm.Core
1207     * @atomicservice
1208     * @since 12
1209     */
1210    restoreOfflineMediaKeys(mediaKeyId: Uint8Array): Promise<void>;
1211
1212    /**
1213     * Get content protection level.
1214     * @returns { ContentProtectionLevel } MediaKeySession content protection level.
1215     * @throws { BusinessError } 24700101 - All unknown errors.
1216     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1217     * @syscap SystemCapability.Multimedia.Drm.Core
1218     * @since 11
1219     */
1220    /**
1221     * Get content protection level.
1222     * @returns { ContentProtectionLevel } MediaKeySession content protection level.
1223     * @throws { BusinessError } 24700101 - All unknown errors.
1224     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1225     * @syscap SystemCapability.Multimedia.Drm.Core
1226     * @atomicservice
1227     * @since 12
1228     */
1229    getContentProtectionLevel(): ContentProtectionLevel;
1230
1231    /**
1232     * Whether the encrypted content require a secure decoder or not.
1233     * @param { string } mimeType - The media type.
1234     * @returns { boolean } Whether secure decoder is required.
1235     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1236     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1237     * 3.Parameter verification failed.
1238     * @throws { BusinessError } 24700101 - All unknown errors.
1239     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1240     * @syscap SystemCapability.Multimedia.Drm.Core
1241     * @since 11
1242     */
1243    /**
1244     * Whether the encrypted content require a secure decoder or not.
1245     * @param { string } mimeType - The media type.
1246     * @returns { boolean } Whether secure decoder is required.
1247     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1248     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1249     * 3.Parameter verification failed.
1250     * @throws { BusinessError } 24700101 - All unknown errors.
1251     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1252     * @syscap SystemCapability.Multimedia.Drm.Core
1253     * @atomicservice
1254     * @since 12
1255     */
1256    requireSecureDecoderModule(mimeType: string): boolean;
1257
1258    /**
1259     * Register keyRequired event.
1260     * @param { 'keyRequired' } type - Type of the drm event to listen for.
1261     * @param { function } callback used to listen for the key required event.
1262     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1263     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1264     * 3.Parameter verification failed.
1265     * @throws { BusinessError } 24700101 - All unknown errors.
1266     * @syscap SystemCapability.Multimedia.Drm.Core
1267     * @since 11
1268     */
1269    /**
1270     * Register keyRequired event.
1271     * @param { 'keyRequired' } type - Type of the drm event to listen for.
1272     * @param { function } callback used to listen for the key required event.
1273     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1274     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1275     * 3.Parameter verification failed.
1276     * @throws { BusinessError } 24700101 - All unknown errors.
1277     * @syscap SystemCapability.Multimedia.Drm.Core
1278     * @atomicservice
1279     * @since 12
1280     */
1281    on(type: 'keyRequired', callback: (eventInfo: EventInfo) => void): void;
1282
1283    /**
1284     * Unregister keyRequired event.
1285     * @param { 'keyRequired' } type - Type of the drm event to listen for.
1286     * @param { function } callback used to listen for the key required event.
1287     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1288     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1289     * 3.Parameter verification failed.
1290     * @throws { BusinessError } 24700101 - All unknown errors.
1291     * @syscap SystemCapability.Multimedia.Drm.Core
1292     * @since 11
1293     */
1294    /**
1295     * Unregister keyRequired event.
1296     * @param { 'keyRequired' } type - Type of the drm event to listen for.
1297     * @param { function } callback used to listen for the key required event.
1298     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1299     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1300     * 3.Parameter verification failed.
1301     * @throws { BusinessError } 24700101 - All unknown errors.
1302     * @syscap SystemCapability.Multimedia.Drm.Core
1303     * @atomicservice
1304     * @since 12
1305     */
1306    off(type: 'keyRequired', callback?: (eventInfo: EventInfo) => void): void;
1307
1308    /**
1309     * Register keyExpired event.
1310     * @param { 'keyExpired' } type - Type of the drm event to listen for.
1311     * @param { function } callback - Used to listen for the key required event.
1312     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1313     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1314     * 3.Parameter verification failed.
1315     * @throws { BusinessError } 24700101 - All unknown errors.
1316     * @syscap SystemCapability.Multimedia.Drm.Core
1317     * @since 11
1318     */
1319    /**
1320     * Register keyExpired event.
1321     * @param { 'keyExpired' } type - Type of the drm event to listen for.
1322     * @param { function } callback - Used to listen for the key required event.
1323     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1324     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1325     * 3.Parameter verification failed.
1326     * @throws { BusinessError } 24700101 - All unknown errors.
1327     * @syscap SystemCapability.Multimedia.Drm.Core
1328     * @atomicservice
1329     * @since 12
1330     */
1331    on(type: 'keyExpired', callback: (eventInfo: EventInfo) => void): void;
1332
1333    /**
1334     * Unregister keyExpired event.
1335     * @param { 'keyExpired' } type - Type of the drm event to listen for.
1336     * @param { function } callback - Used to listen for the key required event.
1337     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1338     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1339     * 3.Parameter verification failed.
1340     * @throws { BusinessError } 24700101 - All unknown errors.
1341     * @syscap SystemCapability.Multimedia.Drm.Core
1342     * @since 11
1343     */
1344    /**
1345     * Unregister keyExpired event.
1346     * @param { 'keyExpired' } type - Type of the drm event to listen for.
1347     * @param { function } callback - Used to listen for the key required event.
1348     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1349     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1350     * 3.Parameter verification failed.
1351     * @throws { BusinessError } 24700101 - All unknown errors.
1352     * @syscap SystemCapability.Multimedia.Drm.Core
1353     * @atomicservice
1354     * @since 12
1355     */
1356    off(type: 'keyExpired', callback?: (eventInfo: EventInfo) => void): void;
1357
1358    /**
1359     * Register vendorDefined event.
1360     * @param { 'vendorDefined' } type - Type of the drm event to listen for.
1361     * @param { function } callback - Used to listen for the vendor defined event.
1362     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1363     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1364     * 3.Parameter verification failed.
1365     * @throws { BusinessError } 24700101 - All unknown errors.
1366     * @syscap SystemCapability.Multimedia.Drm.Core
1367     * @since 11
1368     */
1369    /**
1370     * Register vendorDefined event.
1371     * @param { 'vendorDefined' } type - Type of the drm event to listen for.
1372     * @param { function } callback - Used to listen for the vendor defined event.
1373     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1374     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1375     * 3.Parameter verification failed.
1376     * @throws { BusinessError } 24700101 - All unknown errors.
1377     * @syscap SystemCapability.Multimedia.Drm.Core
1378     * @atomicservice
1379     * @since 12
1380     */
1381    on(type: 'vendorDefined', callback: (eventInfo: EventInfo) => void): void;
1382
1383    /**
1384     * Unregister vendorDefined event.
1385     * @param { 'vendorDefined' } type - Type of the drm event to listen for.
1386     * @param { function } callback - Used to listen for the vendor defined event.
1387     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1388     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1389     * 3.Parameter verification failed.
1390     * @throws { BusinessError } 24700101 - All unknown errors.
1391     * @syscap SystemCapability.Multimedia.Drm.Core
1392     * @since 11
1393     */
1394    /**
1395     * Unregister vendorDefined event.
1396     * @param { 'vendorDefined' } type - Type of the drm event to listen for.
1397     * @param { function } callback - Used to listen for the vendor defined event.
1398     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1399     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1400     * 3.Parameter verification failed.
1401     * @throws { BusinessError } 24700101 - All unknown errors.
1402     * @syscap SystemCapability.Multimedia.Drm.Core
1403     * @atomicservice
1404     * @since 12
1405     */
1406    off(type: 'vendorDefined', callback?: (eventInfo: EventInfo) => void): void;
1407
1408    /**
1409     * Register expirationUpdate event.
1410     * @param { 'expirationUpdate' } type - Type of the drm event to listen for.
1411     * @param { function } callback - Used to listen for expiration update event.
1412     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1413     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1414     * 3.Parameter verification failed.
1415     * @throws { BusinessError } 24700101 - All unknown errors.
1416     * @syscap SystemCapability.Multimedia.Drm.Core
1417     * @since 11
1418     */
1419    /**
1420     * Register expirationUpdate event.
1421     * @param { 'expirationUpdate' } type - Type of the drm event to listen for.
1422     * @param { function } callback - Used to listen for expiration update event.
1423     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1424     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1425     * 3.Parameter verification failed.
1426     * @throws { BusinessError } 24700101 - All unknown errors.
1427     * @syscap SystemCapability.Multimedia.Drm.Core
1428     * @atomicservice
1429     * @since 12
1430     */
1431    on(type: 'expirationUpdate', callback: (eventInfo: EventInfo) => void): void;
1432
1433    /**
1434     * Unregister expirationUpdate event.
1435     * @param { 'expirationUpdate' } type - Type of the drm event to listen for.
1436     * @param { function } callback - Used to listen for expiration update event.
1437     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1438     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1439     * 3.Parameter verification failed.
1440     * @throws { BusinessError } 24700101 - All unknown errors.
1441     * @syscap SystemCapability.Multimedia.Drm.Core
1442     * @since 11
1443     */
1444    /**
1445     * Unregister expirationUpdate event.
1446     * @param { 'expirationUpdate' } type - Type of the drm event to listen for.
1447     * @param { function } callback - Used to listen for expiration update event.
1448     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1449     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1450     * 3.Parameter verification failed.
1451     * @throws { BusinessError } 24700101 - All unknown errors.
1452     * @syscap SystemCapability.Multimedia.Drm.Core
1453     * @atomicservice
1454     * @since 12
1455     */
1456    off(type: 'expirationUpdate', callback?: (eventInfo: EventInfo) => void): void;
1457
1458    /**
1459     * Register keysChange event.
1460     * @param { 'keysChange' } type - Type of the drm event to listen for.
1461     * @param { function } callback - Used to listen for keys change event.
1462     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1463     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1464     * 3.Parameter verification failed.
1465     * @throws { BusinessError } 24700101 - All unknown errors.
1466     * @syscap SystemCapability.Multimedia.Drm.Core
1467     * @since 11
1468     */
1469    /**
1470     * Register keysChange event.
1471     * @param { 'keysChange' } type - Type of the drm event to listen for.
1472     * @param { function } callback - Used to listen for keys change event.
1473     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1474     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1475     * 3.Parameter verification failed.
1476     * @throws { BusinessError } 24700101 - All unknown errors.
1477     * @syscap SystemCapability.Multimedia.Drm.Core
1478     * @atomicservice
1479     * @since 12
1480     */
1481    on(type: 'keysChange', callback: (keyInfo: KeysInfo[], newKeyAvailable: boolean) => void): void;
1482
1483    /**
1484     * Unregister keysChange event.
1485     * @param { 'keysChange' } type - Type of the drm event to listen for.
1486     * @param { function } callback - Used to listen for keys change event.
1487     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1488     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1489     * 3.Parameter verification failed.
1490     * @throws { BusinessError } 24700101 - All unknown errors.
1491     * @syscap SystemCapability.Multimedia.Drm.Core
1492     * @since 11
1493     */
1494    /**
1495     * Unregister keysChange event.
1496     * @param { 'keysChange' } type - Type of the drm event to listen for.
1497     * @param { function } callback - Used to listen for keys change event.
1498     * @throws { BusinessError } 401 - The parameter check failed. Possibly because:
1499     * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types.
1500     * 3.Parameter verification failed.
1501     * @throws { BusinessError } 24700101 - All unknown errors.
1502     * @syscap SystemCapability.Multimedia.Drm.Core
1503     * @atomicservice
1504     * @since 12
1505     */
1506    off(type: 'keysChange', callback?: (keyInfo: KeysInfo[], newKeyAvailable: boolean) => void): void;
1507
1508    /**
1509     * Release the resource before the session gonna be unused.
1510     * @throws { BusinessError } 24700101 - All unknown errors.
1511     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1512     * @syscap SystemCapability.Multimedia.Drm.Core
1513     * @since 11
1514     */
1515    /**
1516     * Release the resource before the session gonna be unused.
1517     * @throws { BusinessError } 24700101 - All unknown errors.
1518     * @throws { BusinessError } 24700201 - Fatal service error, for example, service died.
1519     * @syscap SystemCapability.Multimedia.Drm.Core
1520     * @atomicservice
1521     * @since 12
1522     */
1523    destroy(): void;
1524
1525  }
1526}
1527
1528export default drm;
1529