@gcorevideo/player 2.24.0 → 2.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -43303,7 +43303,7 @@ class Player {
43303
43303
  }
43304
43304
  }
43305
43305
 
43306
- var version$1 = "2.24.0";
43306
+ var version$1 = "2.24.1";
43307
43307
 
43308
43308
  var packages = {
43309
43309
  "node_modules/@clappr/core": {
@@ -45703,15 +45703,6 @@ class ClapprStats extends ContainerPlugin {
45703
45703
  function generateSessionId() {
45704
45704
  return window.crypto.randomUUID();
45705
45705
  }
45706
- function generateContentId(sourceUrl) {
45707
- return window.crypto.subtle.digest('SHA-1', new TextEncoder().encode(sourceUrl))
45708
- .then(buffer => {
45709
- const hex = Array.from(new Uint8Array(buffer))
45710
- .map(b => b.toString(16).padStart(2, '0'))
45711
- .join('');
45712
- return hex;
45713
- });
45714
- }
45715
45706
 
45716
45707
  const CMCD_KEYS = [
45717
45708
  'br',
@@ -45733,6 +45724,7 @@ const CMCD_KEYS = [
45733
45724
  'st',
45734
45725
  'v',
45735
45726
  ];
45727
+ // const T = 'plugins.cmcd'
45736
45728
  /**
45737
45729
  * A `PLUGIN` that configures CMCD for playback
45738
45730
  * @beta
@@ -45749,56 +45741,62 @@ class CmcdConfig extends CorePlugin {
45749
45741
  get name() {
45750
45742
  return 'cmcd';
45751
45743
  }
45744
+ get version() {
45745
+ return '0.1.0';
45746
+ }
45747
+ get supportedVersion() {
45748
+ return CLAPPR_VERSION$1;
45749
+ }
45752
45750
  constructor(core) {
45753
45751
  super(core);
45754
45752
  this.sid = this.options.cmcd?.sessionId ?? generateSessionId();
45753
+ this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
45755
45754
  }
45756
45755
  /**
45757
45756
  * @inheritdocs
45758
45757
  */
45759
45758
  bindEvents() {
45760
- this.listenTo(this.core, Events$1.CORE_ACTIVE_CONTAINER_CHANGED, () => this.updateSettings());
45759
+ this.listenTo(this.core, Events$1.CORE_CONTAINERS_CREATED, () => this.updateSettings(this.core.containers[0]));
45761
45760
  }
45762
- async getIds() {
45761
+ exportIds() {
45763
45762
  return {
45764
45763
  sid: this.sid,
45765
- cid: await this.ensureContentId(),
45764
+ cid: this.cid,
45766
45765
  };
45767
45766
  }
45768
- updateSettings() {
45769
- switch (this.core.activeContainer.playback.name) {
45767
+ async updateSettings(container) {
45768
+ switch (container.playback.name) {
45770
45769
  case 'dash':
45771
- this.updateDashjsSettings();
45770
+ $.extend(true, container.playback.options, {
45771
+ dash: {
45772
+ cmcd: {
45773
+ enabled: true,
45774
+ enabledKeys: CMCD_KEYS,
45775
+ sid: this.sid,
45776
+ cid: this.cid,
45777
+ },
45778
+ },
45779
+ });
45772
45780
  break;
45773
45781
  case 'hls':
45774
- this.updateHlsjsSettings();
45782
+ $.extend(true, container.playback.options, {
45783
+ playback: {
45784
+ hlsjsConfig: {
45785
+ cmcd: {
45786
+ includeKeys: CMCD_KEYS,
45787
+ sessionId: this.sid,
45788
+ contentId: this.cid,
45789
+ },
45790
+ },
45791
+ },
45792
+ });
45775
45793
  break;
45776
45794
  }
45777
45795
  }
45778
- async updateDashjsSettings() {
45779
- const { cid, sid } = await this.getIds();
45780
- const options = this.core.activePlayback.options;
45781
- this.core.activePlayback.options = {
45782
- ...options,
45783
- dash: {
45784
- ...(options.dash ?? {}),
45785
- cmcd: {
45786
- enabled: true,
45787
- enabledKeys: CMCD_KEYS,
45788
- sid,
45789
- cid,
45790
- },
45791
- },
45792
- };
45793
- }
45794
- async updateHlsjsSettings() {
45795
- const { cid, sid } = await this.getIds();
45796
- const options = this.core.activePlayback.options;
45797
- this.core.activePlayback.options = {
45798
- ...options,
45796
+ updateHlsjsSettings(options, { cid, sid }) {
45797
+ $.extend(true, options, {
45799
45798
  playback: {
45800
45799
  hlsjsConfig: {
45801
- ...(options.playback?.hlsjsConfig ?? {}),
45802
45800
  cmcd: {
45803
45801
  includeKeys: CMCD_KEYS,
45804
45802
  sessionId: sid,
@@ -45806,23 +45804,10 @@ class CmcdConfig extends CorePlugin {
45806
45804
  },
45807
45805
  },
45808
45806
  },
45809
- };
45810
- }
45811
- async ensureContentId() {
45812
- if (!this.cid) {
45813
- this.cid = await this.evalContentId();
45814
- }
45815
- return this.cid;
45807
+ });
45816
45808
  }
45817
- async evalContentId() {
45818
- if (!this.core.activeContainer.options.cmcd?.contentId) {
45819
- return generateContentId(this.core.activePlayback.options.src);
45820
- }
45821
- const contentId = this.core.activeContainer.options.cmcd.contentId;
45822
- if (typeof contentId === 'string') {
45823
- return contentId;
45824
- }
45825
- return Promise.resolve(contentId(this.core.activePlayback.options.src));
45809
+ generateContentId() {
45810
+ return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
45826
45811
  }
45827
45812
  }
45828
45813
 
package/dist/player.d.ts CHANGED
@@ -155,7 +155,7 @@ export declare class BigMuteButton extends UICorePlugin {
155
155
  private hideBigMuteBtn;
156
156
  private showBigMuteBtn;
157
157
  private destroyBigMuteBtn;
158
- private handleBigMuteBtnClick;
158
+ private clicked;
159
159
  }
160
160
 
161
161
  /**
@@ -703,6 +703,51 @@ export declare type ClosedCaptionsPluginSettings = {
703
703
  language?: string;
704
704
  };
705
705
 
706
+ /**
707
+ * A `PLUGIN` that configures CMCD for playback
708
+ * @beta
709
+ * @remarks
710
+ * Configuration options
711
+ * `cmcd`: {@link CmcdConfigPluginSettings}
712
+ */
713
+ export declare class CmcdConfig extends CorePlugin {
714
+ private sid;
715
+ private cid;
716
+ /**
717
+ * @inheritdocs
718
+ */
719
+ get name(): string;
720
+ get version(): string;
721
+ get supportedVersion(): string;
722
+ constructor(core: Core);
723
+ /**
724
+ * @inheritdocs
725
+ */
726
+ bindEvents(): void;
727
+ exportIds(): {
728
+ sid: string;
729
+ cid: string;
730
+ };
731
+ private updateSettings;
732
+ private updateHlsjsSettings;
733
+ private generateContentId;
734
+ }
735
+
736
+ /**
737
+ * @beta
738
+ */
739
+ export declare type CmcdConfigPluginSettings = {
740
+ /**
741
+ * Session ID. If ommitted, a random UUID will be generated
742
+ */
743
+ sessionId: string;
744
+ /**
745
+ * Content ID,
746
+ * If ommitted, the pathname part of the first source URL will be used
747
+ */
748
+ contentId?: string;
749
+ };
750
+
706
751
  /**
707
752
  * @public
708
753
  */
@@ -0,0 +1,50 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md) &gt; [(constructor)](./player.cmcdconfig._constructor_.md)
4
+
5
+ ## CmcdConfig.(constructor)
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ Constructs a new instance of the `CmcdConfig` class
11
+
12
+ **Signature:**
13
+
14
+ ```typescript
15
+ constructor(core: Core);
16
+ ```
17
+
18
+ ## Parameters
19
+
20
+ <table><thead><tr><th>
21
+
22
+ Parameter
23
+
24
+
25
+ </th><th>
26
+
27
+ Type
28
+
29
+
30
+ </th><th>
31
+
32
+ Description
33
+
34
+
35
+ </th></tr></thead>
36
+ <tbody><tr><td>
37
+
38
+ core
39
+
40
+
41
+ </td><td>
42
+
43
+ Core
44
+
45
+
46
+ </td><td>
47
+
48
+
49
+ </td></tr>
50
+ </tbody></table>
@@ -0,0 +1,19 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md) &gt; [bindEvents](./player.cmcdconfig.bindevents.md)
4
+
5
+ ## CmcdConfig.bindEvents() method
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+
11
+ **Signature:**
12
+
13
+ ```typescript
14
+ bindEvents(): void;
15
+ ```
16
+ **Returns:**
17
+
18
+ void
19
+
@@ -0,0 +1,21 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md) &gt; [exportIds](./player.cmcdconfig.exportids.md)
4
+
5
+ ## CmcdConfig.exportIds() method
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ **Signature:**
11
+
12
+ ```typescript
13
+ exportIds(): {
14
+ sid: string;
15
+ cid: string;
16
+ };
17
+ ```
18
+ **Returns:**
19
+
20
+ { sid: string; cid: string; }
21
+
@@ -0,0 +1,191 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md)
4
+
5
+ ## CmcdConfig class
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ A `PLUGIN` that configures CMCD for playback
11
+
12
+ **Signature:**
13
+
14
+ ```typescript
15
+ export declare class CmcdConfig extends CorePlugin
16
+ ```
17
+ **Extends:** CorePlugin
18
+
19
+ ## Remarks
20
+
21
+ Configuration options `cmcd`<!-- -->: [CmcdConfigPluginSettings](./player.cmcdconfigpluginsettings.md)
22
+
23
+ ## Constructors
24
+
25
+ <table><thead><tr><th>
26
+
27
+ Constructor
28
+
29
+
30
+ </th><th>
31
+
32
+ Modifiers
33
+
34
+
35
+ </th><th>
36
+
37
+ Description
38
+
39
+
40
+ </th></tr></thead>
41
+ <tbody><tr><td>
42
+
43
+ [(constructor)(core)](./player.cmcdconfig._constructor_.md)
44
+
45
+
46
+ </td><td>
47
+
48
+
49
+ </td><td>
50
+
51
+ **_(BETA)_** Constructs a new instance of the `CmcdConfig` class
52
+
53
+
54
+ </td></tr>
55
+ </tbody></table>
56
+
57
+ ## Properties
58
+
59
+ <table><thead><tr><th>
60
+
61
+ Property
62
+
63
+
64
+ </th><th>
65
+
66
+ Modifiers
67
+
68
+
69
+ </th><th>
70
+
71
+ Type
72
+
73
+
74
+ </th><th>
75
+
76
+ Description
77
+
78
+
79
+ </th></tr></thead>
80
+ <tbody><tr><td>
81
+
82
+ [name](./player.cmcdconfig.name.md)
83
+
84
+
85
+ </td><td>
86
+
87
+ `readonly`
88
+
89
+
90
+ </td><td>
91
+
92
+ string
93
+
94
+
95
+ </td><td>
96
+
97
+ **_(BETA)_**
98
+
99
+
100
+ </td></tr>
101
+ <tr><td>
102
+
103
+ [supportedVersion](./player.cmcdconfig.supportedversion.md)
104
+
105
+
106
+ </td><td>
107
+
108
+ `readonly`
109
+
110
+
111
+ </td><td>
112
+
113
+ string
114
+
115
+
116
+ </td><td>
117
+
118
+ **_(BETA)_**
119
+
120
+
121
+ </td></tr>
122
+ <tr><td>
123
+
124
+ [version](./player.cmcdconfig.version.md)
125
+
126
+
127
+ </td><td>
128
+
129
+ `readonly`
130
+
131
+
132
+ </td><td>
133
+
134
+ string
135
+
136
+
137
+ </td><td>
138
+
139
+ **_(BETA)_**
140
+
141
+
142
+ </td></tr>
143
+ </tbody></table>
144
+
145
+ ## Methods
146
+
147
+ <table><thead><tr><th>
148
+
149
+ Method
150
+
151
+
152
+ </th><th>
153
+
154
+ Modifiers
155
+
156
+
157
+ </th><th>
158
+
159
+ Description
160
+
161
+
162
+ </th></tr></thead>
163
+ <tbody><tr><td>
164
+
165
+ [bindEvents()](./player.cmcdconfig.bindevents.md)
166
+
167
+
168
+ </td><td>
169
+
170
+
171
+ </td><td>
172
+
173
+ **_(BETA)_**
174
+
175
+
176
+ </td></tr>
177
+ <tr><td>
178
+
179
+ [exportIds()](./player.cmcdconfig.exportids.md)
180
+
181
+
182
+ </td><td>
183
+
184
+
185
+ </td><td>
186
+
187
+ **_(BETA)_**
188
+
189
+
190
+ </td></tr>
191
+ </tbody></table>
@@ -0,0 +1,15 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md) &gt; [name](./player.cmcdconfig.name.md)
4
+
5
+ ## CmcdConfig.name property
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+
11
+ **Signature:**
12
+
13
+ ```typescript
14
+ get name(): string;
15
+ ```
@@ -0,0 +1,14 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md) &gt; [supportedVersion](./player.cmcdconfig.supportedversion.md)
4
+
5
+ ## CmcdConfig.supportedVersion property
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ **Signature:**
11
+
12
+ ```typescript
13
+ get supportedVersion(): string;
14
+ ```
@@ -0,0 +1,14 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfig](./player.cmcdconfig.md) &gt; [version](./player.cmcdconfig.version.md)
4
+
5
+ ## CmcdConfig.version property
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+ **Signature:**
11
+
12
+ ```typescript
13
+ get version(): string;
14
+ ```
@@ -0,0 +1,18 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@gcorevideo/player](./player.md) &gt; [CmcdConfigPluginSettings](./player.cmcdconfigpluginsettings.md)
4
+
5
+ ## CmcdConfigPluginSettings type
6
+
7
+ > This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
+ >
9
+
10
+
11
+ **Signature:**
12
+
13
+ ```typescript
14
+ export type CmcdConfigPluginSettings = {
15
+ sessionId: string;
16
+ contentId?: string;
17
+ };
18
+ ```
@@ -119,6 +119,17 @@ Description
119
119
  **_(BETA)_** `PLUGIN` that provides a UI to select the subtitles when available.
120
120
 
121
121
 
122
+ </td></tr>
123
+ <tr><td>
124
+
125
+ [CmcdConfig](./player.cmcdconfig.md)
126
+
127
+
128
+ </td><td>
129
+
130
+ **_(BETA)_** A `PLUGIN` that configures CMCD for playback
131
+
132
+
122
133
  </td></tr>
123
134
  <tr><td>
124
135
 
@@ -736,6 +747,17 @@ Description
736
747
  **_(BETA)_** Configuration options for the [ClosedCaptions](./player.closedcaptions.md) plugin.
737
748
 
738
749
 
750
+ </td></tr>
751
+ <tr><td>
752
+
753
+ [CmcdConfigPluginSettings](./player.cmcdconfigpluginsettings.md)
754
+
755
+
756
+ </td><td>
757
+
758
+ **_(BETA)_**
759
+
760
+
739
761
  </td></tr>
740
762
  <tr><td>
741
763
 
@@ -8,10 +8,10 @@ export type CmcdConfigPluginSettings = {
8
8
  */
9
9
  sessionId: string;
10
10
  /**
11
- * Content ID, either constant or derived from current source.
12
- * If ommitted, a SHA-1 hash of current source URL will be used
11
+ * Content ID,
12
+ * If ommitted, the pathname part of the first source URL will be used
13
13
  */
14
- contentId?: string | ((sourceUrl: string, mimeType?: string) => (string | Promise<string>));
14
+ contentId?: string;
15
15
  };
16
16
  /**
17
17
  * A `PLUGIN` that configures CMCD for playback
@@ -27,19 +27,19 @@ export declare class CmcdConfig extends CorePlugin {
27
27
  * @inheritdocs
28
28
  */
29
29
  get name(): string;
30
+ get version(): string;
31
+ get supportedVersion(): string;
30
32
  constructor(core: Core);
31
33
  /**
32
34
  * @inheritdocs
33
35
  */
34
36
  bindEvents(): void;
35
- getIds(): Promise<{
37
+ exportIds(): {
36
38
  sid: string;
37
39
  cid: string;
38
- }>;
40
+ };
39
41
  private updateSettings;
40
- private updateDashjsSettings;
41
42
  private updateHlsjsSettings;
42
- private ensureContentId;
43
- private evalContentId;
43
+ private generateContentId;
44
44
  }
45
45
  //# sourceMappingURL=CmcdConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CmcdConfig.d.ts","sourceRoot":"","sources":["../../../src/plugins/cmcd-config/CmcdConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EAEX,MAAM,cAAc,CAAA;AAyBrB;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;CAC5F,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO,CAAC,GAAG,CAAK;IAEhB;;OAEG;IACH,IAAI,IAAI,WAEP;gBAEW,IAAI,EAAE,IAAI;IAKtB;;OAEG;IACM,UAAU;IAMb,MAAM,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAOrD,OAAO,CAAC,cAAc;YAWR,oBAAoB;YAiBpB,mBAAmB;YAkBnB,eAAe;YAOf,aAAa;CAU5B"}
1
+ {"version":3,"file":"CmcdConfig.d.ts","sourceRoot":"","sources":["../../../src/plugins/cmcd-config/CmcdConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,IAAI,EAAE,UAAU,EAAU,MAAM,cAAc,CAAA;AA6BrE;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAID;;;;;;GAMG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO,CAAC,GAAG,CAAK;IAEhB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED,IAAI,OAAO,WAEV;IAED,IAAI,gBAAgB,WAEnB;gBAEW,IAAI,EAAE,IAAI;IAMtB;;OAEG;IACM,UAAU;IAMnB,SAAS,IAAI;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;YAO3B,cAAc;IA8B5B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,iBAAiB;CAK1B"}