@gcorevideo/player 2.26.9 → 2.28.0
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/core.js +25 -1
- package/dist/index.css +1392 -1392
- package/dist/index.embed.js +46 -6
- package/dist/index.js +47 -7
- package/dist/player.d.ts +16 -3
- package/docs/api/player.player.load.md +56 -0
- package/docs/api/player.player.md +14 -0
- package/docs/api/player.sourcecontroller.md +34 -1
- package/docs/api/player.sourcecontroller.setmediasource.md +60 -0
- package/lib/Player.d.ts +7 -1
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +23 -0
- package/lib/playback/HTML5Video.d.ts.map +1 -1
- package/lib/playback/HTML5Video.js +1 -0
- package/lib/plugins/cmcd-config/CmcdConfig.d.ts +1 -0
- package/lib/plugins/cmcd-config/CmcdConfig.d.ts.map +1 -1
- package/lib/plugins/cmcd-config/CmcdConfig.js +9 -3
- package/lib/plugins/source-controller/SourceController.d.ts +10 -3
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +13 -3
- package/package.json +1 -1
- package/src/Player.ts +31 -1
- package/src/playback/HTML5Video.ts +1 -0
- package/src/plugins/cmcd-config/CmcdConfig.ts +10 -5
- package/src/plugins/source-controller/SourceController.ts +14 -3
- package/temp/player.api.json +107 -1
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/plugins/telemetry/{Statistics copy.xts → Statistics copy.js} +0 -0
package/dist/index.embed.js
CHANGED
|
@@ -42579,6 +42579,7 @@ class HTML5Video extends BasePlayback {
|
|
|
42579
42579
|
super._onEnded();
|
|
42580
42580
|
}
|
|
42581
42581
|
_handleBufferingEvents() {
|
|
42582
|
+
// TODO use the logic from the base class to detect if it's stalled or resumed, because in the latter case the current behavior is not correct
|
|
42582
42583
|
if (!this.stallTimerId) {
|
|
42583
42584
|
this.stallTimerId = setTimeout(() => {
|
|
42584
42585
|
this.stallTimerId = null;
|
|
@@ -42830,6 +42831,29 @@ class Player {
|
|
|
42830
42831
|
isPlaying() {
|
|
42831
42832
|
return this.player?.isPlaying() ?? false;
|
|
42832
42833
|
}
|
|
42834
|
+
/**
|
|
42835
|
+
* Loads new media source
|
|
42836
|
+
* @param mediaSources - list of media sources to use
|
|
42837
|
+
* @beta
|
|
42838
|
+
*/
|
|
42839
|
+
load(mediaSources) {
|
|
42840
|
+
if (mediaSources.length === 0) {
|
|
42841
|
+
throw new Error('No media sources provided');
|
|
42842
|
+
}
|
|
42843
|
+
const ms = mediaSources.map((s) => wrapSource(s));
|
|
42844
|
+
const sourceController = this.player?.core.activePlayback.getPlugin('source_controller');
|
|
42845
|
+
if (sourceController) {
|
|
42846
|
+
sourceController.setMediaSource(ms);
|
|
42847
|
+
return;
|
|
42848
|
+
}
|
|
42849
|
+
if (this.player) {
|
|
42850
|
+
this.player.load(ms, ms[0].mimeType ?? '');
|
|
42851
|
+
return;
|
|
42852
|
+
}
|
|
42853
|
+
this.configure({
|
|
42854
|
+
sources: mediaSources,
|
|
42855
|
+
});
|
|
42856
|
+
}
|
|
42833
42857
|
/**
|
|
42834
42858
|
* Mutes the sound of the video.
|
|
42835
42859
|
*/
|
|
@@ -45407,13 +45431,16 @@ class CmcdConfig extends CorePlugin {
|
|
|
45407
45431
|
constructor(core) {
|
|
45408
45432
|
super(core);
|
|
45409
45433
|
this.sid = this.options.cmcd?.sessionId ?? generateSessionId();
|
|
45410
|
-
this.
|
|
45434
|
+
this.setContentId();
|
|
45411
45435
|
}
|
|
45412
45436
|
/**
|
|
45413
45437
|
* @internal
|
|
45414
45438
|
*/
|
|
45415
45439
|
bindEvents() {
|
|
45416
|
-
this.listenTo(this.core, Events$1.CORE_CONTAINERS_CREATED, () =>
|
|
45440
|
+
this.listenTo(this.core, Events$1.CORE_CONTAINERS_CREATED, () => {
|
|
45441
|
+
this.setContentId();
|
|
45442
|
+
this.updateSettings(this.core.containers[0]);
|
|
45443
|
+
});
|
|
45417
45444
|
}
|
|
45418
45445
|
/**
|
|
45419
45446
|
* Returns the current `sid` and `cid` values.
|
|
@@ -45438,7 +45465,7 @@ class CmcdConfig extends CorePlugin {
|
|
|
45438
45465
|
sid: this.sid,
|
|
45439
45466
|
cid: this.cid,
|
|
45440
45467
|
},
|
|
45441
|
-
}
|
|
45468
|
+
},
|
|
45442
45469
|
},
|
|
45443
45470
|
});
|
|
45444
45471
|
break;
|
|
@@ -45460,6 +45487,9 @@ class CmcdConfig extends CorePlugin {
|
|
|
45460
45487
|
generateContentId() {
|
|
45461
45488
|
return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
|
|
45462
45489
|
}
|
|
45490
|
+
setContentId() {
|
|
45491
|
+
this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
|
|
45492
|
+
}
|
|
45463
45493
|
}
|
|
45464
45494
|
|
|
45465
45495
|
var mousetrap = {exports: {}};
|
|
@@ -49934,9 +49964,6 @@ function noSync(cb) {
|
|
|
49934
49964
|
*
|
|
49935
49965
|
* ```
|
|
49936
49966
|
*
|
|
49937
|
-
* This plugin does not expose any public methods apart from required by the Clappr plugin interface.
|
|
49938
|
-
* It is supposed to work autonomously.
|
|
49939
|
-
*
|
|
49940
49967
|
* @example
|
|
49941
49968
|
* ```ts
|
|
49942
49969
|
* import { SourceController } from '@gcorevideo/player'
|
|
@@ -50012,11 +50039,24 @@ class SourceController extends CorePlugin {
|
|
|
50012
50039
|
if (this.core.options.source !== undefined) {
|
|
50013
50040
|
// prevent Clappr from loading all sources simultaneously
|
|
50014
50041
|
this.core.options.sources = [this.core.options.source];
|
|
50042
|
+
this.core.options.source = undefined; // TODO test
|
|
50015
50043
|
}
|
|
50016
50044
|
else {
|
|
50017
50045
|
this.core.options.sources = this.core.options.sources.slice(0, 1);
|
|
50018
50046
|
}
|
|
50019
50047
|
}
|
|
50048
|
+
/**
|
|
50049
|
+
* Set new media source.
|
|
50050
|
+
*
|
|
50051
|
+
* @param sourcesList - The list of new media source URLs
|
|
50052
|
+
* @beta
|
|
50053
|
+
* @remarks
|
|
50054
|
+
* Triggers a reload of the playback module, container and all container plugins.
|
|
50055
|
+
*/
|
|
50056
|
+
setMediaSource(sourcesList) {
|
|
50057
|
+
this.sourcesList = sourcesList;
|
|
50058
|
+
this.core.load(sourcesList, this.core.options.mimeType);
|
|
50059
|
+
}
|
|
50020
50060
|
/**
|
|
50021
50061
|
* @internal
|
|
50022
50062
|
*/
|
package/dist/index.js
CHANGED
|
@@ -42740,6 +42740,7 @@ class HTML5Video extends BasePlayback {
|
|
|
42740
42740
|
super._onEnded();
|
|
42741
42741
|
}
|
|
42742
42742
|
_handleBufferingEvents() {
|
|
42743
|
+
// TODO use the logic from the base class to detect if it's stalled or resumed, because in the latter case the current behavior is not correct
|
|
42743
42744
|
if (!this.stallTimerId) {
|
|
42744
42745
|
this.stallTimerId = setTimeout(() => {
|
|
42745
42746
|
this.stallTimerId = null;
|
|
@@ -42994,6 +42995,29 @@ class Player {
|
|
|
42994
42995
|
isPlaying() {
|
|
42995
42996
|
return this.player?.isPlaying() ?? false;
|
|
42996
42997
|
}
|
|
42998
|
+
/**
|
|
42999
|
+
* Loads new media source
|
|
43000
|
+
* @param mediaSources - list of media sources to use
|
|
43001
|
+
* @beta
|
|
43002
|
+
*/
|
|
43003
|
+
load(mediaSources) {
|
|
43004
|
+
if (mediaSources.length === 0) {
|
|
43005
|
+
throw new Error('No media sources provided');
|
|
43006
|
+
}
|
|
43007
|
+
const ms = mediaSources.map((s) => wrapSource(s));
|
|
43008
|
+
const sourceController = this.player?.core.activePlayback.getPlugin('source_controller');
|
|
43009
|
+
if (sourceController) {
|
|
43010
|
+
sourceController.setMediaSource(ms);
|
|
43011
|
+
return;
|
|
43012
|
+
}
|
|
43013
|
+
if (this.player) {
|
|
43014
|
+
this.player.load(ms, ms[0].mimeType ?? '');
|
|
43015
|
+
return;
|
|
43016
|
+
}
|
|
43017
|
+
this.configure({
|
|
43018
|
+
sources: mediaSources,
|
|
43019
|
+
});
|
|
43020
|
+
}
|
|
42997
43021
|
/**
|
|
42998
43022
|
* Mutes the sound of the video.
|
|
42999
43023
|
*/
|
|
@@ -43265,7 +43289,7 @@ class Player {
|
|
|
43265
43289
|
}
|
|
43266
43290
|
}
|
|
43267
43291
|
|
|
43268
|
-
var version$1 = "2.
|
|
43292
|
+
var version$1 = "2.28.0";
|
|
43269
43293
|
|
|
43270
43294
|
var packages = {
|
|
43271
43295
|
"node_modules/@clappr/core": {
|
|
@@ -45843,13 +45867,16 @@ class CmcdConfig extends CorePlugin {
|
|
|
45843
45867
|
constructor(core) {
|
|
45844
45868
|
super(core);
|
|
45845
45869
|
this.sid = this.options.cmcd?.sessionId ?? generateSessionId();
|
|
45846
|
-
this.
|
|
45870
|
+
this.setContentId();
|
|
45847
45871
|
}
|
|
45848
45872
|
/**
|
|
45849
45873
|
* @internal
|
|
45850
45874
|
*/
|
|
45851
45875
|
bindEvents() {
|
|
45852
|
-
this.listenTo(this.core, Events$1.CORE_CONTAINERS_CREATED, () =>
|
|
45876
|
+
this.listenTo(this.core, Events$1.CORE_CONTAINERS_CREATED, () => {
|
|
45877
|
+
this.setContentId();
|
|
45878
|
+
this.updateSettings(this.core.containers[0]);
|
|
45879
|
+
});
|
|
45853
45880
|
}
|
|
45854
45881
|
/**
|
|
45855
45882
|
* Returns the current `sid` and `cid` values.
|
|
@@ -45874,7 +45901,7 @@ class CmcdConfig extends CorePlugin {
|
|
|
45874
45901
|
sid: this.sid,
|
|
45875
45902
|
cid: this.cid,
|
|
45876
45903
|
},
|
|
45877
|
-
}
|
|
45904
|
+
},
|
|
45878
45905
|
},
|
|
45879
45906
|
});
|
|
45880
45907
|
break;
|
|
@@ -45896,6 +45923,9 @@ class CmcdConfig extends CorePlugin {
|
|
|
45896
45923
|
generateContentId() {
|
|
45897
45924
|
return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
|
|
45898
45925
|
}
|
|
45926
|
+
setContentId() {
|
|
45927
|
+
this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
|
|
45928
|
+
}
|
|
45899
45929
|
}
|
|
45900
45930
|
|
|
45901
45931
|
var mousetrap = {exports: {}};
|
|
@@ -51283,9 +51313,6 @@ function noSync(cb) {
|
|
|
51283
51313
|
*
|
|
51284
51314
|
* ```
|
|
51285
51315
|
*
|
|
51286
|
-
* This plugin does not expose any public methods apart from required by the Clappr plugin interface.
|
|
51287
|
-
* It is supposed to work autonomously.
|
|
51288
|
-
*
|
|
51289
51316
|
* @example
|
|
51290
51317
|
* ```ts
|
|
51291
51318
|
* import { SourceController } from '@gcorevideo/player'
|
|
@@ -51361,11 +51388,24 @@ class SourceController extends CorePlugin {
|
|
|
51361
51388
|
if (this.core.options.source !== undefined) {
|
|
51362
51389
|
// prevent Clappr from loading all sources simultaneously
|
|
51363
51390
|
this.core.options.sources = [this.core.options.source];
|
|
51391
|
+
this.core.options.source = undefined; // TODO test
|
|
51364
51392
|
}
|
|
51365
51393
|
else {
|
|
51366
51394
|
this.core.options.sources = this.core.options.sources.slice(0, 1);
|
|
51367
51395
|
}
|
|
51368
51396
|
}
|
|
51397
|
+
/**
|
|
51398
|
+
* Set new media source.
|
|
51399
|
+
*
|
|
51400
|
+
* @param sourcesList - The list of new media source URLs
|
|
51401
|
+
* @beta
|
|
51402
|
+
* @remarks
|
|
51403
|
+
* Triggers a reload of the playback module, container and all container plugins.
|
|
51404
|
+
*/
|
|
51405
|
+
setMediaSource(sourcesList) {
|
|
51406
|
+
this.sourcesList = sourcesList;
|
|
51407
|
+
this.core.load(sourcesList, this.core.options.mimeType);
|
|
51408
|
+
}
|
|
51369
51409
|
/**
|
|
51370
51410
|
* @internal
|
|
51371
51411
|
*/
|
package/dist/player.d.ts
CHANGED
|
@@ -777,6 +777,7 @@ export declare class ClapprStats extends ContainerPlugin {
|
|
|
777
777
|
};
|
|
778
778
|
private updateSettings;
|
|
779
779
|
private generateContentId;
|
|
780
|
+
private setContentId;
|
|
780
781
|
}
|
|
781
782
|
|
|
782
783
|
/**
|
|
@@ -2059,6 +2060,12 @@ export declare class ClapprStats extends ContainerPlugin {
|
|
|
2059
2060
|
* Indicates the playing state.
|
|
2060
2061
|
*/
|
|
2061
2062
|
isPlaying(): boolean;
|
|
2063
|
+
/**
|
|
2064
|
+
* Loads new media source
|
|
2065
|
+
* @param mediaSources - list of media sources to use
|
|
2066
|
+
* @beta
|
|
2067
|
+
*/
|
|
2068
|
+
load(mediaSources: PlayerMediaSource[]): void;
|
|
2062
2069
|
/**
|
|
2063
2070
|
* Mutes the sound of the video.
|
|
2064
2071
|
*/
|
|
@@ -2808,9 +2815,6 @@ export declare class ClapprStats extends ContainerPlugin {
|
|
|
2808
2815
|
*
|
|
2809
2816
|
* ```
|
|
2810
2817
|
*
|
|
2811
|
-
* This plugin does not expose any public methods apart from required by the Clappr plugin interface.
|
|
2812
|
-
* It is supposed to work autonomously.
|
|
2813
|
-
*
|
|
2814
2818
|
* @example
|
|
2815
2819
|
* ```ts
|
|
2816
2820
|
* import { SourceController } from '@gcorevideo/player'
|
|
@@ -2840,6 +2844,15 @@ export declare class ClapprStats extends ContainerPlugin {
|
|
|
2840
2844
|
* @param core - The Clappr core instance.
|
|
2841
2845
|
*/
|
|
2842
2846
|
constructor(core: Core);
|
|
2847
|
+
/**
|
|
2848
|
+
* Set new media source.
|
|
2849
|
+
*
|
|
2850
|
+
* @param sourcesList - The list of new media source URLs
|
|
2851
|
+
* @beta
|
|
2852
|
+
* @remarks
|
|
2853
|
+
* Triggers a reload of the playback module, container and all container plugins.
|
|
2854
|
+
*/
|
|
2855
|
+
setMediaSource(sourcesList: PlayerMediaSourceDesc[]): void;
|
|
2843
2856
|
/**
|
|
2844
2857
|
* @internal
|
|
2845
2858
|
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [Player](./player.player.md) > [load](./player.player.load.md)
|
|
4
|
+
|
|
5
|
+
## Player.load() 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
|
+
Loads new media source
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
load(mediaSources: PlayerMediaSource[]): void;
|
|
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
|
+
mediaSources
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</td><td>
|
|
42
|
+
|
|
43
|
+
[PlayerMediaSource](./player.playermediasource.md)<!-- -->\[\]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
list of media sources to use
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</td></tr>
|
|
52
|
+
</tbody></table>
|
|
53
|
+
**Returns:**
|
|
54
|
+
|
|
55
|
+
void
|
|
56
|
+
|
|
@@ -207,6 +207,20 @@ Indicates muted state of the video.
|
|
|
207
207
|
Indicates the playing state.
|
|
208
208
|
|
|
209
209
|
|
|
210
|
+
</td></tr>
|
|
211
|
+
<tr><td>
|
|
212
|
+
|
|
213
|
+
[load(mediaSources)](./player.player.load.md)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
</td><td>
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
</td><td>
|
|
220
|
+
|
|
221
|
+
**_(BETA)_** Loads new media source
|
|
222
|
+
|
|
223
|
+
|
|
210
224
|
</td></tr>
|
|
211
225
|
<tr><td>
|
|
212
226
|
|
|
@@ -52,7 +52,6 @@ sources_list:
|
|
|
52
52
|
+-------------------+
|
|
53
53
|
|
|
54
54
|
```
|
|
55
|
-
This plugin does not expose any public methods apart from required by the Clappr plugin interface. It is supposed to work autonomously.
|
|
56
55
|
|
|
57
56
|
## Example
|
|
58
57
|
|
|
@@ -94,5 +93,39 @@ Description
|
|
|
94
93
|
Constructs a new instance of the `SourceController` class
|
|
95
94
|
|
|
96
95
|
|
|
96
|
+
</td></tr>
|
|
97
|
+
</tbody></table>
|
|
98
|
+
|
|
99
|
+
## Methods
|
|
100
|
+
|
|
101
|
+
<table><thead><tr><th>
|
|
102
|
+
|
|
103
|
+
Method
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</th><th>
|
|
107
|
+
|
|
108
|
+
Modifiers
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</th><th>
|
|
112
|
+
|
|
113
|
+
Description
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</th></tr></thead>
|
|
117
|
+
<tbody><tr><td>
|
|
118
|
+
|
|
119
|
+
[setMediaSource(sourcesList)](./player.sourcecontroller.setmediasource.md)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
</td><td>
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
</td><td>
|
|
126
|
+
|
|
127
|
+
**_(BETA)_** Set new media source.
|
|
128
|
+
|
|
129
|
+
|
|
97
130
|
</td></tr>
|
|
98
131
|
</tbody></table>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [SourceController](./player.sourcecontroller.md) > [setMediaSource](./player.sourcecontroller.setmediasource.md)
|
|
4
|
+
|
|
5
|
+
## SourceController.setMediaSource() 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
|
+
Set new media source.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
setMediaSource(sourcesList: PlayerMediaSourceDesc[]): void;
|
|
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
|
+
sourcesList
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</td><td>
|
|
42
|
+
|
|
43
|
+
[PlayerMediaSourceDesc](./player.playermediasourcedesc.md)<!-- -->\[\]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
The list of new media source URLs
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</td></tr>
|
|
52
|
+
</tbody></table>
|
|
53
|
+
**Returns:**
|
|
54
|
+
|
|
55
|
+
void
|
|
56
|
+
|
|
57
|
+
## Remarks
|
|
58
|
+
|
|
59
|
+
Triggers a reload of the playback module, container and all container plugins.
|
|
60
|
+
|
package/lib/Player.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContainerSize, PlayerPluginConstructor } from './types.js';
|
|
1
|
+
import type { ContainerSize, PlayerMediaSource, PlayerPluginConstructor } from './types.js';
|
|
2
2
|
import { PlayerConfig, PlayerEvent } from './types.js';
|
|
3
3
|
import { PlaybackError, TimePosition } from './playback.types.js';
|
|
4
4
|
/**
|
|
@@ -126,6 +126,12 @@ export declare class Player {
|
|
|
126
126
|
* Indicates the playing state.
|
|
127
127
|
*/
|
|
128
128
|
isPlaying(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Loads new media source
|
|
131
|
+
* @param mediaSources - list of media sources to use
|
|
132
|
+
* @beta
|
|
133
|
+
*/
|
|
134
|
+
load(mediaSources: PlayerMediaSource[]): void;
|
|
129
135
|
/**
|
|
130
136
|
* Mutes the sound of the video.
|
|
131
137
|
*/
|
package/lib/Player.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,aAAa,
|
|
1
|
+
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":"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"}
|
package/lib/Player.js
CHANGED
|
@@ -172,6 +172,29 @@ export class Player {
|
|
|
172
172
|
isPlaying() {
|
|
173
173
|
return this.player?.isPlaying() ?? false;
|
|
174
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Loads new media source
|
|
177
|
+
* @param mediaSources - list of media sources to use
|
|
178
|
+
* @beta
|
|
179
|
+
*/
|
|
180
|
+
load(mediaSources) {
|
|
181
|
+
if (mediaSources.length === 0) {
|
|
182
|
+
throw new Error('No media sources provided');
|
|
183
|
+
}
|
|
184
|
+
const ms = mediaSources.map((s) => wrapSource(s));
|
|
185
|
+
const sourceController = this.player?.core.activePlayback.getPlugin('source_controller');
|
|
186
|
+
if (sourceController) {
|
|
187
|
+
sourceController.setMediaSource(ms);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (this.player) {
|
|
191
|
+
this.player.load(ms, ms[0].mimeType ?? '');
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.configure({
|
|
195
|
+
sources: mediaSources,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
175
198
|
/**
|
|
176
199
|
* Mutes the sound of the video.
|
|
177
200
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML5Video.d.ts","sourceRoot":"","sources":["../../src/playback/HTML5Video.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAA;AAMzE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;IAClD,OAAO,CAAC,YAAY,CAAuB;IAE3C;;OAEG;IACM,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY;IAkBlD,UAAU;IAIV,QAAQ;IAQR,sBAAsB;
|
|
1
|
+
{"version":3,"file":"HTML5Video.d.ts","sourceRoot":"","sources":["../../src/playback/HTML5Video.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAA;AAMzE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;IAClD,OAAO,CAAC,YAAY,CAAuB;IAE3C;;OAEG;IACM,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY;IAkBlD,UAAU;IAIV,QAAQ;IAQR,sBAAsB;IAkBtB,UAAU;IAQV,QAAQ;IAQjB,IAAI,WAAW,IAAI,UAAU,EAAE,CAgB9B;IAGD,IAAI,iBAAiB,sBAiBpB;IAED,gBAAgB,CAAC,EAAE,EAAE,MAAM;CAa5B"}
|
|
@@ -33,6 +33,7 @@ export default class HTML5Video extends BasePlayback {
|
|
|
33
33
|
super._onEnded();
|
|
34
34
|
}
|
|
35
35
|
_handleBufferingEvents() {
|
|
36
|
+
// TODO use the logic from the base class to detect if it's stalled or resumed, because in the latter case the current behavior is not correct
|
|
36
37
|
if (!this.stallTimerId) {
|
|
37
38
|
this.stallTimerId = setTimeout(() => {
|
|
38
39
|
this.stallTimerId = null;
|
|
@@ -1 +1 @@
|
|
|
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;AA4BrE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO,CAAC,GAAG,CAAK;IAEhB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,OAAO,WAEV;IAED;;OAEG;IACH,IAAI,gBAAgB,WAEnB;gBAEW,IAAI,EAAE,IAAI;IAMtB;;OAEG;IACM,UAAU;
|
|
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;AA4BrE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO,CAAC,GAAG,CAAK;IAEhB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,OAAO,WAEV;IAED;;OAEG;IACH,IAAI,gBAAgB,WAEnB;gBAEW,IAAI,EAAE,IAAI;IAMtB;;OAEG;IACM,UAAU;IAOnB;;;;OAIG;IACH,SAAS,IAAI;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;YAO3B,cAAc;IAgC5B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -66,13 +66,16 @@ export class CmcdConfig extends CorePlugin {
|
|
|
66
66
|
constructor(core) {
|
|
67
67
|
super(core);
|
|
68
68
|
this.sid = this.options.cmcd?.sessionId ?? generateSessionId();
|
|
69
|
-
this.
|
|
69
|
+
this.setContentId();
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @internal
|
|
73
73
|
*/
|
|
74
74
|
bindEvents() {
|
|
75
|
-
this.listenTo(this.core, Events.CORE_CONTAINERS_CREATED, () =>
|
|
75
|
+
this.listenTo(this.core, Events.CORE_CONTAINERS_CREATED, () => {
|
|
76
|
+
this.setContentId();
|
|
77
|
+
this.updateSettings(this.core.containers[0]);
|
|
78
|
+
});
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
81
|
* Returns the current `sid` and `cid` values.
|
|
@@ -97,7 +100,7 @@ export class CmcdConfig extends CorePlugin {
|
|
|
97
100
|
sid: this.sid,
|
|
98
101
|
cid: this.cid,
|
|
99
102
|
},
|
|
100
|
-
}
|
|
103
|
+
},
|
|
101
104
|
},
|
|
102
105
|
});
|
|
103
106
|
break;
|
|
@@ -119,4 +122,7 @@ export class CmcdConfig extends CorePlugin {
|
|
|
119
122
|
generateContentId() {
|
|
120
123
|
return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
|
|
121
124
|
}
|
|
125
|
+
setContentId() {
|
|
126
|
+
this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
|
|
127
|
+
}
|
|
122
128
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CorePlugin, type Core as ClapprCore } from '@clappr/core';
|
|
2
|
+
import { type PlayerMediaSourceDesc } from '../../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* `PLUGIN` that is managing the automatic failover between media sources.
|
|
4
5
|
* @public
|
|
@@ -42,9 +43,6 @@ import { CorePlugin, type Core as ClapprCore } from '@clappr/core';
|
|
|
42
43
|
*
|
|
43
44
|
* ```
|
|
44
45
|
*
|
|
45
|
-
* This plugin does not expose any public methods apart from required by the Clappr plugin interface.
|
|
46
|
-
* It is supposed to work autonomously.
|
|
47
|
-
*
|
|
48
46
|
* @example
|
|
49
47
|
* ```ts
|
|
50
48
|
* import { SourceController } from '@gcorevideo/player'
|
|
@@ -74,6 +72,15 @@ export declare class SourceController extends CorePlugin {
|
|
|
74
72
|
* @param core - The Clappr core instance.
|
|
75
73
|
*/
|
|
76
74
|
constructor(core: ClapprCore);
|
|
75
|
+
/**
|
|
76
|
+
* Set new media source.
|
|
77
|
+
*
|
|
78
|
+
* @param sourcesList - The list of new media source URLs
|
|
79
|
+
* @beta
|
|
80
|
+
* @remarks
|
|
81
|
+
* Triggers a reload of the playback module, container and all container plugins.
|
|
82
|
+
*/
|
|
83
|
+
setMediaSource(sourcesList: PlayerMediaSourceDesc[]): void;
|
|
77
84
|
/**
|
|
78
85
|
* @internal
|
|
79
86
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAsB3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAwC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;gBACS,IAAI,EAAE,UAAU;IAY5B;;;;;;;OAOG;IACH,cAAc,CAAC,WAAW,EAAE,qBAAqB,EAAE;IAKnD;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,2BAA2B;IAiDnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;CACF"}
|
|
@@ -54,9 +54,6 @@ function noSync(cb) {
|
|
|
54
54
|
*
|
|
55
55
|
* ```
|
|
56
56
|
*
|
|
57
|
-
* This plugin does not expose any public methods apart from required by the Clappr plugin interface.
|
|
58
|
-
* It is supposed to work autonomously.
|
|
59
|
-
*
|
|
60
57
|
* @example
|
|
61
58
|
* ```ts
|
|
62
59
|
* import { SourceController } from '@gcorevideo/player'
|
|
@@ -132,11 +129,24 @@ export class SourceController extends CorePlugin {
|
|
|
132
129
|
if (this.core.options.source !== undefined) {
|
|
133
130
|
// prevent Clappr from loading all sources simultaneously
|
|
134
131
|
this.core.options.sources = [this.core.options.source];
|
|
132
|
+
this.core.options.source = undefined; // TODO test
|
|
135
133
|
}
|
|
136
134
|
else {
|
|
137
135
|
this.core.options.sources = this.core.options.sources.slice(0, 1);
|
|
138
136
|
}
|
|
139
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Set new media source.
|
|
140
|
+
*
|
|
141
|
+
* @param sourcesList - The list of new media source URLs
|
|
142
|
+
* @beta
|
|
143
|
+
* @remarks
|
|
144
|
+
* Triggers a reload of the playback module, container and all container plugins.
|
|
145
|
+
*/
|
|
146
|
+
setMediaSource(sourcesList) {
|
|
147
|
+
this.sourcesList = sourcesList;
|
|
148
|
+
this.core.load(sourcesList, this.core.options.mimeType);
|
|
149
|
+
}
|
|
140
150
|
/**
|
|
141
151
|
* @internal
|
|
142
152
|
*/
|