@gcorevideo/player 2.20.12 → 2.20.14
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/assets/error-screen/error_screen.ejs +1 -1
- package/dist/core.js +26 -2
- package/dist/index.css +1191 -1191
- package/dist/index.js +35 -20
- package/dist/player.d.ts +8 -10
- package/dist/plugins/index.css +1606 -1606
- package/dist/plugins/index.js +10 -14
- package/docs/api/player.md +1 -1
- package/docs/api/player.mediacontrol.md +2 -11
- package/docs/api/player.playbackerror.md +2 -2
- package/docs/api/player.playbackerror.origin.md +1 -1
- package/docs/api/player.playbackerror.scope.md +1 -1
- package/docs/api/player.poster.md +1 -1
- package/docs/api/player.sourcecontroller.md +2 -33
- package/lib/Player.js +1 -1
- package/lib/playback/HTML5Video.d.ts +5 -0
- package/lib/playback/HTML5Video.d.ts.map +1 -1
- package/lib/playback/HTML5Video.js +21 -0
- package/lib/playback/hls-playback/HlsPlayback.d.ts +2 -2
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +4 -0
- package/lib/playback.types.d.ts +2 -2
- package/lib/plugins/click-to-pause/ClickToPause.d.ts.map +1 -1
- package/lib/plugins/click-to-pause/ClickToPause.js +0 -4
- package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
- package/lib/plugins/dvr-controls/DvrControls.js +0 -1
- package/lib/plugins/error-screen/ErrorScreen.d.ts.map +1 -1
- package/lib/plugins/error-screen/ErrorScreen.js +1 -0
- package/lib/plugins/media-control/MediaControl.d.ts +1 -8
- package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
- package/lib/plugins/media-control/MediaControl.js +2 -9
- package/lib/plugins/poster/Poster.d.ts +2 -0
- package/lib/plugins/poster/Poster.d.ts.map +1 -1
- package/lib/plugins/poster/Poster.js +3 -3
- package/lib/plugins/source-controller/SourceController.d.ts +3 -0
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +3 -0
- package/package.json +1 -1
- package/src/Player.ts +1 -1
- package/src/playback/HTML5Video.ts +29 -1
- package/src/playback/__tests__/HTML5Video.test.ts +47 -0
- package/src/playback/hls-playback/HlsPlayback.ts +5 -1
- package/src/playback.types.ts +2 -2
- package/src/plugins/click-to-pause/ClickToPause.ts +0 -5
- package/src/plugins/dvr-controls/DvrControls.ts +0 -1
- package/src/plugins/error-screen/ErrorScreen.ts +1 -0
- package/src/plugins/error-screen/__tests__/__snapshots__/ErrorScreen.test.ts.snap +1 -1
- package/src/plugins/media-control/MediaControl.ts +2 -9
- package/src/plugins/poster/Poster.ts +4 -3
- package/src/plugins/source-controller/SourceController.ts +3 -0
- package/temp/player.api.json +6 -40
- package/tsconfig.tsbuildinfo +1 -1
- package/docs/api/player.sourcecontroller._constructor_.md +0 -50
package/dist/plugins/index.js
CHANGED
|
@@ -33094,17 +33094,10 @@ function orderByOrderPattern(arr, order) {
|
|
|
33094
33094
|
return [...ordered, ...rest];
|
|
33095
33095
|
}
|
|
33096
33096
|
/**
|
|
33097
|
-
* `PLUGIN` that provides a foundation for developing custom
|
|
33097
|
+
* `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
|
|
33098
33098
|
* @beta
|
|
33099
33099
|
* @remarks
|
|
33100
33100
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
33101
|
-
* The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.
|
|
33102
|
-
* @example
|
|
33103
|
-
* ```ts
|
|
33104
|
-
* Player.registerPlugin(MediaControl) // <--- This must go first
|
|
33105
|
-
* Player.registerPlugin(LevelSelector) // a media control plugin
|
|
33106
|
-
* Player.registerPlugin(NerdStats) // another media control plugin
|
|
33107
|
-
* ```
|
|
33108
33101
|
*/
|
|
33109
33102
|
class MediaControl extends UICorePlugin {
|
|
33110
33103
|
advertisementPlaying = false;
|
|
@@ -34034,7 +34027,6 @@ class MediaControl extends UICorePlugin {
|
|
|
34034
34027
|
return super.destroy();
|
|
34035
34028
|
}
|
|
34036
34029
|
configure() {
|
|
34037
|
-
// this.advertisementPlaying ? this.disable() : this.enable()
|
|
34038
34030
|
this.trigger(Events$1.MEDIACONTROL_OPTIONS_CHANGE);
|
|
34039
34031
|
}
|
|
34040
34032
|
/**
|
|
@@ -37257,7 +37249,7 @@ class ClipsPlugin extends UICorePlugin {
|
|
|
37257
37249
|
|
|
37258
37250
|
const templateHtml$1 = "<ul class=\"context-menu-list\">\n <% if(options) { %>\n <% for (var i = 0; i < options.length; i++) { %>\n <li class=\"context-menu-list-item <%= options[i].class %>\"\n data-<%= options[i].name %>><%= options[i].label %></li>\n <% } %>\n <% } %>\n</ul>\n";
|
|
37259
37251
|
|
|
37260
|
-
var version$1 = "2.20.
|
|
37252
|
+
var version$1 = "2.20.14";
|
|
37261
37253
|
|
|
37262
37254
|
var packages = {
|
|
37263
37255
|
"node_modules/@clappr/core": {
|
|
@@ -37514,7 +37506,7 @@ class DvrControls extends UICorePlugin {
|
|
|
37514
37506
|
|
|
37515
37507
|
const reloadIcon = "<svg fill=\"#FFFFFF\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z\"/>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"/>\n</svg>";
|
|
37516
37508
|
|
|
37517
|
-
const templateHtml = "<div class=\"player-error-screen__content\" data-error-screen>\n <% if (icon) { %>\n <div class=\"player-error-screen__icon\" data-error-screen><%= icon %></div>\n <% } %>\n <div class=\"player-error-screen__title\" data-error-screen><%= title %></div>\n <% if (message) { %>\n <div class=\"player-error-screen__message\" data-error-screen><%= message %></div>\n <% } %>\n <% if (code) { %>\n <div class=\"player-error-screen__code\" data-error-screen
|
|
37509
|
+
const templateHtml = "<div class=\"player-error-screen__content\" data-error-screen>\n <% if (icon) { %>\n <div class=\"player-error-screen__icon\" data-error-screen><%= icon %></div>\n <% } %>\n <div class=\"player-error-screen__title\" data-error-screen><%= title %></div>\n <% if (message) { %>\n <div class=\"player-error-screen__message\" data-error-screen><%= message %></div>\n <% } %>\n <% if (code) { %>\n <div class=\"player-error-screen__code\" data-error-screen><%= i18n.t('error_code') %>: <%= code %></div>\n <% } %>\n <% if (reloadIcon) { %>\n <div class=\"player-error-screen__reload\" data-error-screen><%= reloadIcon %></div>\n <% } %>\n</div>\n";
|
|
37518
37510
|
|
|
37519
37511
|
const T$a = 'plugins.error_screen';
|
|
37520
37512
|
/**
|
|
@@ -37616,6 +37608,7 @@ class ErrorScreen extends UICorePlugin {
|
|
|
37616
37608
|
this.$el.html(ErrorScreen.template({
|
|
37617
37609
|
...this.err,
|
|
37618
37610
|
reloadIcon: this.options.errorScreen?.noReload ? null : reloadIcon,
|
|
37611
|
+
i18n: this.core.i18n,
|
|
37619
37612
|
}));
|
|
37620
37613
|
if (!this.el.parentElement) {
|
|
37621
37614
|
this.core.$el.append(this.el);
|
|
@@ -39028,6 +39021,8 @@ const T$5 = 'plugins.poster';
|
|
|
39028
39021
|
* @beta
|
|
39029
39022
|
* @remarks
|
|
39030
39023
|
* When the playback is stopped, media control UI is disabled.
|
|
39024
|
+
* Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
|
|
39025
|
+
* HTML5-video-based playback module.
|
|
39031
39026
|
*
|
|
39032
39027
|
* Configuration options:
|
|
39033
39028
|
*
|
|
@@ -39051,6 +39046,7 @@ const T$5 = 'plugins.poster';
|
|
|
39051
39046
|
* ```
|
|
39052
39047
|
*/
|
|
39053
39048
|
class Poster extends UIContainerPlugin {
|
|
39049
|
+
// TODO merge non-poster related functionality into the ClickToPause plugin
|
|
39054
39050
|
hasFatalError = false;
|
|
39055
39051
|
hasStartedPlaying = false;
|
|
39056
39052
|
playRequested = false;
|
|
@@ -39201,9 +39197,6 @@ class Poster extends UIContainerPlugin {
|
|
|
39201
39197
|
this.container.playback.play();
|
|
39202
39198
|
}
|
|
39203
39199
|
}
|
|
39204
|
-
else {
|
|
39205
|
-
this.container.trigger('container:start');
|
|
39206
|
-
}
|
|
39207
39200
|
return false;
|
|
39208
39201
|
}
|
|
39209
39202
|
shouldHideOnPlay() {
|
|
@@ -39924,6 +39917,9 @@ class SourceController extends CorePlugin {
|
|
|
39924
39917
|
get supportedVersion() {
|
|
39925
39918
|
return { min: CLAPPR_VERSION };
|
|
39926
39919
|
}
|
|
39920
|
+
/**
|
|
39921
|
+
* @internal
|
|
39922
|
+
*/
|
|
39927
39923
|
constructor(core) {
|
|
39928
39924
|
super(core);
|
|
39929
39925
|
this.sourcesList = this.core.options.sources;
|
package/docs/api/player.md
CHANGED
|
@@ -204,7 +204,7 @@ Description
|
|
|
204
204
|
|
|
205
205
|
</td><td>
|
|
206
206
|
|
|
207
|
-
**_(BETA)_** `PLUGIN` that provides a foundation for developing custom
|
|
207
|
+
**_(BETA)_** `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
|
|
208
208
|
|
|
209
209
|
|
|
210
210
|
</td></tr>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
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
8
|
>
|
|
9
9
|
|
|
10
|
-
`PLUGIN` that provides a foundation for developing custom
|
|
10
|
+
`PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
|
|
11
11
|
|
|
12
12
|
**Signature:**
|
|
13
13
|
|
|
@@ -18,16 +18,7 @@ export declare class MediaControl extends UICorePlugin
|
|
|
18
18
|
|
|
19
19
|
## Remarks
|
|
20
20
|
|
|
21
|
-
The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
22
|
-
|
|
23
|
-
## Example
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
Player.registerPlugin(MediaControl) // <--- This must go first
|
|
28
|
-
Player.registerPlugin(LevelSelector) // a media control plugin
|
|
29
|
-
Player.registerPlugin(NerdStats) // another media control plugin
|
|
30
|
-
```
|
|
21
|
+
The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
31
22
|
|
|
32
23
|
## Constructors
|
|
33
24
|
|
|
@@ -126,7 +126,7 @@ string
|
|
|
126
126
|
|
|
127
127
|
</td><td>
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
Name of the component that originated the error.
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
</td></tr>
|
|
@@ -145,7 +145,7 @@ Exact component that originated the error.
|
|
|
145
145
|
|
|
146
146
|
</td><td>
|
|
147
147
|
|
|
148
|
-
Component subsystem of the error origin
|
|
148
|
+
Component subsystem of the error origin, together with the `origin` uniquely identifies the originating component.
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
</td></tr>
|
|
@@ -18,7 +18,7 @@ export declare class Poster extends UIContainerPlugin
|
|
|
18
18
|
|
|
19
19
|
## Remarks
|
|
20
20
|
|
|
21
|
-
When the playback is stopped, media control UI is disabled.
|
|
21
|
+
When the playback is stopped, media control UI is disabled. Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the HTML5-video-based playback module.
|
|
22
22
|
|
|
23
23
|
Configuration options:
|
|
24
24
|
|
|
@@ -22,6 +22,8 @@ Have a look at the [source failover diagram](https://miro.com/app/board/uXjVLiN1
|
|
|
22
22
|
|
|
23
23
|
This plugin does not expose any public methods apart from required by the Clappr plugin interface. It is supposed to work autonomously.
|
|
24
24
|
|
|
25
|
+
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SourceController` class.
|
|
26
|
+
|
|
25
27
|
## Example
|
|
26
28
|
|
|
27
29
|
|
|
@@ -31,36 +33,3 @@ import { SourceController } from '@gcorevideo/player'
|
|
|
31
33
|
Player.registerPlugin(SourceController)
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
## Constructors
|
|
35
|
-
|
|
36
|
-
<table><thead><tr><th>
|
|
37
|
-
|
|
38
|
-
Constructor
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</th><th>
|
|
42
|
-
|
|
43
|
-
Modifiers
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</th><th>
|
|
47
|
-
|
|
48
|
-
Description
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</th></tr></thead>
|
|
52
|
-
<tbody><tr><td>
|
|
53
|
-
|
|
54
|
-
[(constructor)(core)](./player.sourcecontroller._constructor_.md)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</td><td>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</td><td>
|
|
61
|
-
|
|
62
|
-
**_(BETA)_** Constructs a new instance of the `SourceController` class
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</td></tr>
|
|
66
|
-
</tbody></table>
|
package/lib/Player.js
CHANGED
|
@@ -101,7 +101,7 @@ export class Player {
|
|
|
101
101
|
const coreOpts = this.buildCoreOptions(playerElement);
|
|
102
102
|
const { core, container } = Player.getRegisteredPlugins();
|
|
103
103
|
trace(`${T} init`, {
|
|
104
|
-
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.name),
|
|
104
|
+
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.prototype.name),
|
|
105
105
|
});
|
|
106
106
|
coreOpts.plugins = {
|
|
107
107
|
core: Object.values(core),
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { ErrorOptions } from '@clappr/core';
|
|
1
2
|
import { BasePlayback } from './BasePlayback.js';
|
|
2
3
|
export default class HTML5Video extends BasePlayback {
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
createError(errorData: any, options?: ErrorOptions): Error;
|
|
3
8
|
}
|
|
4
9
|
//# sourceMappingURL=HTML5Video.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML5Video.d.ts","sourceRoot":"","sources":["../../src/playback/HTML5Video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"HTML5Video.d.ts","sourceRoot":"","sources":["../../src/playback/HTML5Video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;IAClD;;OAEG;IACM,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY;CAqB5D"}
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import { PlaybackErrorCode } from '../playback.types.js';
|
|
1
2
|
import { BasePlayback } from './BasePlayback.js';
|
|
2
3
|
export default class HTML5Video extends BasePlayback {
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
createError(errorData, options) {
|
|
8
|
+
const i18n = this.i18n ||
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
(this.core && this.core.i18n) ||
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
(this.container && this.container.i18n);
|
|
13
|
+
if (i18n &&
|
|
14
|
+
!errorData.UI &&
|
|
15
|
+
errorData.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
|
|
16
|
+
errorData.UI = {
|
|
17
|
+
title: i18n.t('no_broadcast'),
|
|
18
|
+
message: errorData.message,
|
|
19
|
+
};
|
|
20
|
+
errorData.code = PlaybackErrorCode.MediaSourceUnavailable;
|
|
21
|
+
}
|
|
22
|
+
return super.createError(errorData, { ...options, useCodePrefix: false });
|
|
23
|
+
}
|
|
3
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import HLSJS, { Events as HlsEvents, type ErrorData as HlsErrorData, type FragChangedData, type FragLoadedData, type FragParsingMetadataData, type LevelSwitchingData } from 'hls.js';
|
|
2
|
-
import {
|
|
2
|
+
import { QualityLevel } from '../../playback.types.js';
|
|
3
3
|
import { PlaybackType } from '../../types.js';
|
|
4
4
|
import { BasePlayback } from '../BasePlayback.js';
|
|
5
5
|
export default class HlsPlayback extends BasePlayback {
|
|
@@ -64,7 +64,7 @@ export default class HlsPlayback extends BasePlayback {
|
|
|
64
64
|
_onFragmentParsingMetadata(evt: HlsEvents.FRAG_PARSING_METADATA, data: FragParsingMetadataData): void;
|
|
65
65
|
render(): this;
|
|
66
66
|
_ready(): void;
|
|
67
|
-
_recover
|
|
67
|
+
private _recover;
|
|
68
68
|
protected _setupSrc(srcUrl: string): void;
|
|
69
69
|
_startTimeUpdateTimer(): void;
|
|
70
70
|
_stopTimeUpdateTimer(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HlsPlayback.d.ts","sourceRoot":"","sources":["../../../src/playback/hls-playback/HlsPlayback.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EACZ,MAAM,IAAI,SAAS,EAEnB,KAAK,SAAS,IAAI,YAAY,EAE9B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAG5B,KAAK,kBAAkB,EACxB,MAAM,QAAQ,CAAA;AAEf,OAAO,
|
|
1
|
+
{"version":3,"file":"HlsPlayback.d.ts","sourceRoot":"","sources":["../../../src/playback/hls-playback/HlsPlayback.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EACZ,MAAM,IAAI,SAAS,EAEnB,KAAK,SAAS,IAAI,YAAY,EAE9B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAG5B,KAAK,kBAAkB,EACxB,MAAM,QAAQ,CAAA;AAEf,OAAO,EAIL,YAAY,EAGb,MAAM,yBAAyB,CAAA;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,eAAe;IAMrE,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,cAAc;IAIlE,iBAAiB;IAajB,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,kBAAkB;IAOvE,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAmBvE,IAAI,UAAU,YAUb;IAED,eAAe;IAIf,aAAa;IAIb,OAAO,CAAC,YAAY;CASrB"}
|
|
@@ -484,6 +484,10 @@ export default class HlsPlayback extends BasePlayback {
|
|
|
484
484
|
details: data.details,
|
|
485
485
|
});
|
|
486
486
|
error.level = PlayerError.Levels.WARN;
|
|
487
|
+
// TODO check
|
|
488
|
+
// if (data.error instanceof MediaError && data.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
|
|
489
|
+
// error.code = PlaybackErrorCode.MediaSourceUnavailable
|
|
490
|
+
// }
|
|
487
491
|
this._recover(evt, data, error);
|
|
488
492
|
break;
|
|
489
493
|
default:
|
package/lib/playback.types.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface PlaybackError {
|
|
|
103
103
|
*/
|
|
104
104
|
message: string;
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
106
|
+
* Name of the component that originated the error.
|
|
107
107
|
* @example
|
|
108
108
|
* - 'core'
|
|
109
109
|
* - 'dash'
|
|
@@ -111,7 +111,7 @@ export interface PlaybackError {
|
|
|
111
111
|
*/
|
|
112
112
|
origin: string;
|
|
113
113
|
/**
|
|
114
|
-
* Component subsystem of the error origin
|
|
114
|
+
* Component subsystem of the error origin, together with the `origin` uniquely identifies the originating component.
|
|
115
115
|
*/
|
|
116
116
|
scope: PlayerComponentType;
|
|
117
117
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToPause.d.ts","sourceRoot":"","sources":["../../../src/plugins/click-to-pause/ClickToPause.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAA;AAShE;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,OAAO,CAAC,cAAc,CAAQ;IAE9B,OAAO,CAAC,KAAK,CAAqB;IAElC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"ClickToPause.d.ts","sourceRoot":"","sources":["../../../src/plugins/click-to-pause/ClickToPause.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAA;AAShE;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,OAAO,CAAC,cAAc,CAAQ;IAE9B,OAAO,CAAC,KAAK,CAAqB;IAElC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,UAAU;CAMnB"}
|
|
@@ -52,10 +52,6 @@ export class ClickToPause extends ContainerPlugin {
|
|
|
52
52
|
settingsUpdate() {
|
|
53
53
|
const isLivePlayback = this.container.getPlaybackType() === Playback.LIVE;
|
|
54
54
|
const pointerEnabled = !isLivePlayback || this.container.isDvrEnabled();
|
|
55
|
-
trace(`${T} settingsUpdate`, {
|
|
56
|
-
isLivePlayback,
|
|
57
|
-
pointerEnabled,
|
|
58
|
-
});
|
|
59
55
|
if (pointerEnabled === this.pointerEnabled) {
|
|
60
56
|
return;
|
|
61
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DvrControls.d.ts","sourceRoot":"","sources":["../../../src/plugins/dvr-controls/DvrControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,YAAY,EAAY,MAAM,cAAc,CAAA;AAM7E,OAAO,gDAAgD,CAAA;AAMvD;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAEpD;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACM,UAAU;IAUnB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"DvrControls.d.ts","sourceRoot":"","sources":["../../../src/plugins/dvr-controls/DvrControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,YAAY,EAAY,MAAM,cAAc,CAAA;AAM7E,OAAO,gDAAgD,CAAA;AAMvD;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAEpD;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACM,UAAU;IAUnB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,YAAY;IAKpB;;OAEG;IACM,MAAM;CAoBhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorScreen.d.ts","sourceRoot":"","sources":["../../../src/plugins/error-screen/ErrorScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,cAAc,CAAA;AAO7D,OAAO,gDAAgD,CAAA;AAUvD;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAID;;;GAGG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,GAAG,CAA+B;IAE1C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAEzD;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,OAAO;IAMf;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,wBAAwB;IAqBhC,OAAO,CAAC,OAAO;IAgBf;;OAEG;IACM,MAAM;
|
|
1
|
+
{"version":3,"file":"ErrorScreen.d.ts","sourceRoot":"","sources":["../../../src/plugins/error-screen/ErrorScreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,cAAc,CAAA;AAO7D,OAAO,gDAAgD,CAAA;AAUvD;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAID;;;GAGG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,CAAC,GAAG,CAA+B;IAE1C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAEzD;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACM,UAAU;IASnB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,OAAO;IAMf;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,wBAAwB;IAqBhC,OAAO,CAAC,OAAO;IAgBf;;OAEG;IACM,MAAM;CAkBhB"}
|
|
@@ -107,6 +107,7 @@ export class ErrorScreen extends UICorePlugin {
|
|
|
107
107
|
this.$el.html(ErrorScreen.template({
|
|
108
108
|
...this.err,
|
|
109
109
|
reloadIcon: this.options.errorScreen?.noReload ? null : reloadIcon,
|
|
110
|
+
i18n: this.core.i18n,
|
|
110
111
|
}));
|
|
111
112
|
if (!this.el.parentElement) {
|
|
112
113
|
this.core.$el.append(this.el);
|
|
@@ -18,17 +18,10 @@ export declare enum MediaControlEvents {
|
|
|
18
18
|
MEDIACONTROL_GEAR_RENDERED = "mediacontrol:gear:rendered"
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* `PLUGIN` that provides a foundation for developing custom
|
|
21
|
+
* `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
|
|
22
22
|
* @beta
|
|
23
23
|
* @remarks
|
|
24
24
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
25
|
-
* The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* Player.registerPlugin(MediaControl) // <--- This must go first
|
|
29
|
-
* Player.registerPlugin(LevelSelector) // a media control plugin
|
|
30
|
-
* Player.registerPlugin(NerdStats) // another media control plugin
|
|
31
|
-
* ```
|
|
32
25
|
*/
|
|
33
26
|
export declare class MediaControl extends UICorePlugin {
|
|
34
27
|
private advertisementPlaying;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaControl.d.ts","sourceRoot":"","sources":["../../../src/plugins/media-control/MediaControl.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uB;IAc/B,OAAO,CAAC,IAAI;IAkBZ,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,IAAI;IAgCZ,OAAO,CAAC,IAAI;IAmCZ,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,cAAc;IAkDtB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,oBAAoB;IAgD5B;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,IAAI,EAAE,mBAAmB,GAAG,WAAW,GAAG,IAAI;IAoBzD;;;OAGG;IACH,aAAa;IAIb;;;OAGG;IACH,YAAY;IAIZ,cAAc;IAId,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,WAAW;IAiCnB,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACM,OAAO;IAShB,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACM,MAAM;IAoEf,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAcvB;;OAEG;IACH,mBAAmB;IAMnB;;OAEG;IACH,qBAAqB;IAMrB,OAAO,CAAC,6BAA6B;CAOtC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import assert from 'assert';
|
|
7
7
|
import { Events, UICorePlugin, Browser, Playback, Utils, template, $, } from '@clappr/core';
|
|
8
8
|
import { reportError, trace } from '@gcorevideo/utils';
|
|
9
|
+
// TODO replace Kibo with mousetrap
|
|
9
10
|
import { Kibo } from '../kibo/index.js';
|
|
10
11
|
import { CLAPPR_VERSION } from '../../build.js';
|
|
11
12
|
import { getPageX, isFullscreen } from '../utils.js';
|
|
@@ -47,17 +48,10 @@ function orderByOrderPattern(arr, order) {
|
|
|
47
48
|
return [...ordered, ...rest];
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
|
-
* `PLUGIN` that provides a foundation for developing custom
|
|
51
|
+
* `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
|
|
51
52
|
* @beta
|
|
52
53
|
* @remarks
|
|
53
54
|
* The methods exposed are to be used by the other plugins that extend the media control UI.
|
|
54
|
-
* The plugin registration should be arranged so that MediaControl is initialized before every other `PLUGIN` that depends on it.
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* Player.registerPlugin(MediaControl) // <--- This must go first
|
|
58
|
-
* Player.registerPlugin(LevelSelector) // a media control plugin
|
|
59
|
-
* Player.registerPlugin(NerdStats) // another media control plugin
|
|
60
|
-
* ```
|
|
61
55
|
*/
|
|
62
56
|
export class MediaControl extends UICorePlugin {
|
|
63
57
|
advertisementPlaying = false;
|
|
@@ -990,7 +984,6 @@ export class MediaControl extends UICorePlugin {
|
|
|
990
984
|
return super.destroy();
|
|
991
985
|
}
|
|
992
986
|
configure() {
|
|
993
|
-
// this.advertisementPlaying ? this.disable() : this.enable()
|
|
994
987
|
this.trigger(Events.MEDIACONTROL_OPTIONS_CHANGE);
|
|
995
988
|
}
|
|
996
989
|
/**
|
|
@@ -5,6 +5,8 @@ import '../../../assets/poster/poster.scss';
|
|
|
5
5
|
* @beta
|
|
6
6
|
* @remarks
|
|
7
7
|
* When the playback is stopped, media control UI is disabled.
|
|
8
|
+
* Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
|
|
9
|
+
* HTML5-video-based playback module.
|
|
8
10
|
*
|
|
9
11
|
* Configuration options:
|
|
10
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Poster.d.ts","sourceRoot":"","sources":["../../../src/plugins/poster/Poster.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAMrB,OAAO,oCAAoC,CAAA;AAO3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,MAAO,SAAQ,iBAAiB;IAG3C,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,YAAY,CAA2B;IAE/C;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAEvD,OAAO,KAAK,YAAY,GAUvB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED;;OAEG;IACH,IAAa,MAAM;;MAIlB;IAED,OAAO,KAAK,cAAc,GAEzB;IAED;;OAEG;IACM,UAAU;IAiBnB;;OAEG;IACM,MAAM;IAMf;;OAEG;IACM,OAAO;IAOhB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,MAAM;IAiBd,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,UAAU;IAYlB;;OAEG;IACM,MAAM;IAuCf;;OAEG;IACM,OAAO;CAIjB"}
|
|
@@ -13,6 +13,8 @@ const T = 'plugins.poster';
|
|
|
13
13
|
* @beta
|
|
14
14
|
* @remarks
|
|
15
15
|
* When the playback is stopped, media control UI is disabled.
|
|
16
|
+
* Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
|
|
17
|
+
* HTML5-video-based playback module.
|
|
16
18
|
*
|
|
17
19
|
* Configuration options:
|
|
18
20
|
*
|
|
@@ -36,6 +38,7 @@ const T = 'plugins.poster';
|
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
40
|
export class Poster extends UIContainerPlugin {
|
|
41
|
+
// TODO merge non-poster related functionality into the ClickToPause plugin
|
|
39
42
|
hasFatalError = false;
|
|
40
43
|
hasStartedPlaying = false;
|
|
41
44
|
playRequested = false;
|
|
@@ -191,9 +194,6 @@ export class Poster extends UIContainerPlugin {
|
|
|
191
194
|
this.container.playback.play();
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
|
-
else {
|
|
195
|
-
this.container.trigger('container:start');
|
|
196
|
-
}
|
|
197
197
|
return false;
|
|
198
198
|
}
|
|
199
199
|
shouldHideOnPlay() {
|
|
@@ -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;AAwBrB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAuC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;
|
|
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;AAwBrB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAuC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,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;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,2BAA2B;IAwCnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;CACF"}
|
package/package.json
CHANGED
package/src/Player.ts
CHANGED
|
@@ -168,7 +168,7 @@ export class Player {
|
|
|
168
168
|
const coreOpts = this.buildCoreOptions(playerElement)
|
|
169
169
|
const { core, container } = Player.getRegisteredPlugins()
|
|
170
170
|
trace(`${T} init`, {
|
|
171
|
-
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.name),
|
|
171
|
+
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.prototype.name),
|
|
172
172
|
})
|
|
173
173
|
coreOpts.plugins = {
|
|
174
174
|
core: Object.values(core),
|
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
import { ErrorOptions } from '@clappr/core'
|
|
2
|
+
|
|
3
|
+
import { PlaybackErrorCode } from '../playback.types.js'
|
|
1
4
|
import { BasePlayback } from './BasePlayback.js'
|
|
2
5
|
|
|
3
|
-
export default class HTML5Video extends BasePlayback {
|
|
6
|
+
export default class HTML5Video extends BasePlayback {
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
override createError(errorData: any, options?: ErrorOptions) {
|
|
11
|
+
const i18n =
|
|
12
|
+
this.i18n ||
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
(this.core && this.core.i18n) ||
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
(this.container && this.container.i18n)
|
|
17
|
+
|
|
18
|
+
if (
|
|
19
|
+
i18n &&
|
|
20
|
+
!errorData.UI &&
|
|
21
|
+
errorData.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
|
|
22
|
+
) {
|
|
23
|
+
errorData.UI = {
|
|
24
|
+
title: i18n.t('no_broadcast'),
|
|
25
|
+
message: errorData.message,
|
|
26
|
+
}
|
|
27
|
+
errorData.code = PlaybackErrorCode.MediaSourceUnavailable
|
|
28
|
+
}
|
|
29
|
+
return super.createError(errorData, { ...options, useCodePrefix: false })
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import HTML5Video from '../HTML5Video.js'
|
|
4
|
+
import { PlaybackErrorCode } from '../../playback.types.js'
|
|
5
|
+
|
|
6
|
+
let savedMediaError: any
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
savedMediaError = globalThis.MediaError
|
|
10
|
+
if (!globalThis.MediaError) {
|
|
11
|
+
globalThis.MediaError = {
|
|
12
|
+
MEDIA_ERR_ABORTED: 1,
|
|
13
|
+
MEDIA_ERR_NETWORK: 2,
|
|
14
|
+
MEDIA_ERR_DECODE: 3,
|
|
15
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: 4,
|
|
16
|
+
} as any
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
globalThis.MediaError = savedMediaError
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
describe('HTML5Video', () => {
|
|
25
|
+
describe('errors', () => {
|
|
26
|
+
describe('when the media element emits MEDIA_ERR_SRC_NOT_SUPPORTED', () => {
|
|
27
|
+
it('should trigger MEDIA_SOURCE_UNAVAILABLE error', () => {
|
|
28
|
+
const i18n = {
|
|
29
|
+
t: vi.fn().mockImplementation((key: string) => key),
|
|
30
|
+
}
|
|
31
|
+
const playerError = {
|
|
32
|
+
createError: vi.fn(),
|
|
33
|
+
}
|
|
34
|
+
const html5Video = new HTML5Video({}, i18n, playerError)
|
|
35
|
+
html5Video.load('https://example.com/video.mp4')
|
|
36
|
+
;(html5Video.el as any).error = {
|
|
37
|
+
code: MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,
|
|
38
|
+
message: 'Media source not supported',
|
|
39
|
+
}
|
|
40
|
+
html5Video.el.dispatchEvent(new Event('error', { bubbles: true }))
|
|
41
|
+
expect(playerError.createError).toHaveBeenCalledWith(expect.objectContaining({
|
|
42
|
+
code: PlaybackErrorCode.MediaSourceUnavailable,
|
|
43
|
+
}))
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
})
|