@gcorevideo/player 2.17.0 → 2.18.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/index.js +182 -109
- package/dist/player.d.ts +150 -24
- package/docs/api/player.containersize.md +19 -0
- package/docs/api/player.dashsettings.md +2 -0
- package/docs/api/player.errorlevel.md +1 -0
- package/docs/api/player.langtag.md +6 -0
- package/docs/api/player.md +57 -22
- package/docs/api/player.mediatransport.md +1 -0
- package/docs/api/player.playbackerror.code.md +2 -0
- package/docs/api/player.playbackerror.description.md +2 -0
- package/docs/api/player.playbackerror.level.md +2 -0
- package/docs/api/player.playbackerror.md +43 -4
- package/docs/api/player.playbackerror.message.md +2 -0
- package/docs/api/player.playbackerror.origin.md +21 -0
- package/docs/api/player.playbackerror.scope.md +16 -0
- package/docs/api/player.playbackerrorcode.md +4 -3
- package/docs/api/player.playbackmodule.md +1 -0
- package/docs/api/player.player.isdvrinuse.md +24 -0
- package/docs/api/player.player.isplaying.md +1 -1
- package/docs/api/player.player.md +15 -1
- package/docs/api/player.player.off.md +4 -4
- package/docs/api/player.player.on.md +5 -5
- package/docs/api/player.player.resize.md +3 -6
- package/docs/api/player.playercomponenttype.md +16 -0
- package/docs/api/player.playerdebugsettings.md +1 -1
- package/docs/api/player.playerdebugtag.md +1 -0
- package/docs/api/player.playerevent.md +96 -0
- package/docs/api/player.playereventhandler.md +3 -2
- package/docs/api/player.playereventparams.md +20 -0
- package/docs/api/player.playermediasourcedesc.md +1 -1
- package/docs/api/player.playermediasourcedesc.mimetype.md +1 -1
- package/docs/api/player.qualitylevel.bitrate.md +16 -0
- package/docs/api/player.qualitylevel.height.md +16 -0
- package/docs/api/player.qualitylevel.level.md +16 -0
- package/docs/api/player.qualitylevel.md +104 -7
- package/docs/api/player.qualitylevel.width.md +16 -0
- package/docs/api/player.timeposition.current.md +16 -0
- package/docs/api/player.timeposition.md +65 -7
- package/docs/api/player.timeposition.total.md +16 -0
- package/docs/api/player.timevalue.md +1 -1
- package/docs/api/player.translationsettings.md +7 -1
- package/docs/api/player.transportpreference.md +1 -0
- package/lib/Player.d.ts +30 -14
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +72 -65
- package/lib/internal.types.d.ts +3 -5
- package/lib/internal.types.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.d.ts +2 -0
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +37 -25
- package/lib/playback/hls-playback/HlsPlayback.d.ts +3 -0
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +33 -18
- package/lib/playback.types.d.ts +65 -6
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/playback.types.js +10 -0
- package/lib/types.d.ts +54 -5
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +31 -2
- package/package.json +1 -1
- package/src/Player.ts +109 -78
- package/src/internal.types.ts +3 -2
- package/src/playback/dash-playback/DashPlayback.ts +64 -35
- package/src/playback/hls-playback/HlsPlayback.ts +46 -22
- package/src/playback.types.ts +65 -5
- package/src/types.ts +56 -6
- package/temp/player.api.json +611 -87
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/DashPlayback-BRJzl8D8.js +0 -901
package/dist/index.js
CHANGED
|
@@ -12215,6 +12215,20 @@ function EventLite() {
|
|
|
12215
12215
|
*/
|
|
12216
12216
|
var PlayerEvent;
|
|
12217
12217
|
(function (PlayerEvent) {
|
|
12218
|
+
/**
|
|
12219
|
+
* Playback has reached the end of the media.
|
|
12220
|
+
*/
|
|
12221
|
+
PlayerEvent["Ended"] = "ended";
|
|
12222
|
+
/**
|
|
12223
|
+
* An error occurred.
|
|
12224
|
+
* Parameters: {@link PlaybackError}
|
|
12225
|
+
*/
|
|
12226
|
+
PlayerEvent["Error"] = "error";
|
|
12227
|
+
/**
|
|
12228
|
+
* The player has switched to or from the fullscreen mode.
|
|
12229
|
+
* Parameters:`boolean` isFullscreen
|
|
12230
|
+
*/
|
|
12231
|
+
PlayerEvent["Fullscreen"] = "fullscreen";
|
|
12218
12232
|
/**
|
|
12219
12233
|
* The player is ready to use.
|
|
12220
12234
|
*/
|
|
@@ -12227,14 +12241,29 @@ var PlayerEvent;
|
|
|
12227
12241
|
* Playback has been paused.
|
|
12228
12242
|
*/
|
|
12229
12243
|
PlayerEvent["Pause"] = "pause";
|
|
12244
|
+
/**
|
|
12245
|
+
* The player's container has been resized.
|
|
12246
|
+
* Parameters: {@link ContainerSize}
|
|
12247
|
+
*/
|
|
12248
|
+
PlayerEvent["Resize"] = "resize";
|
|
12249
|
+
/**
|
|
12250
|
+
* The player is seeking to a new position.
|
|
12251
|
+
*/
|
|
12252
|
+
PlayerEvent["Seek"] = "seek";
|
|
12230
12253
|
/**
|
|
12231
12254
|
* Playback has been stopped.
|
|
12232
12255
|
*/
|
|
12233
12256
|
PlayerEvent["Stop"] = "stop";
|
|
12234
12257
|
/**
|
|
12235
|
-
*
|
|
12258
|
+
* The current playback time has changed.
|
|
12259
|
+
* Parameters: {@link TimePosition}
|
|
12236
12260
|
*/
|
|
12237
|
-
PlayerEvent["
|
|
12261
|
+
PlayerEvent["TimeUpdate"] = "timeupdate";
|
|
12262
|
+
/**
|
|
12263
|
+
* The volume has changed.
|
|
12264
|
+
* Parameters: `number` volume in the range 0..1
|
|
12265
|
+
*/
|
|
12266
|
+
PlayerEvent["VolumeUpdate"] = "volumeupdate";
|
|
12238
12267
|
})(PlayerEvent || (PlayerEvent = {}));
|
|
12239
12268
|
|
|
12240
12269
|
// TODO rewrite using the Playback classes and canPlay static methods
|
|
@@ -12320,12 +12349,22 @@ var dash_all_minExports = requireDash_all_min();
|
|
|
12320
12349
|
const DASHJS = /*@__PURE__*/getDefaultExportFromCjs$1(dash_all_minExports);
|
|
12321
12350
|
|
|
12322
12351
|
/**
|
|
12352
|
+
* Codes of errors occurring within the playback component.
|
|
12323
12353
|
* @beta
|
|
12324
12354
|
*/
|
|
12325
12355
|
var PlaybackErrorCode;
|
|
12326
12356
|
(function (PlaybackErrorCode) {
|
|
12357
|
+
/**
|
|
12358
|
+
* An unknown or uncategorised error.
|
|
12359
|
+
*/
|
|
12327
12360
|
PlaybackErrorCode[PlaybackErrorCode["Generic"] = 0] = "Generic";
|
|
12361
|
+
/**
|
|
12362
|
+
* The media source is not available. Typically a network error.
|
|
12363
|
+
*/
|
|
12328
12364
|
PlaybackErrorCode[PlaybackErrorCode["MediaSourceUnavailable"] = 1] = "MediaSourceUnavailable";
|
|
12365
|
+
/**
|
|
12366
|
+
* The media source is not accessible due to some protection policy.
|
|
12367
|
+
*/
|
|
12329
12368
|
PlaybackErrorCode[PlaybackErrorCode["MediaSourceAccessDenied"] = 3] = "MediaSourceAccessDenied";
|
|
12330
12369
|
})(PlaybackErrorCode || (PlaybackErrorCode = {}));
|
|
12331
12370
|
|
|
@@ -12394,13 +12433,15 @@ class DashPlayback extends HTML5Video {
|
|
|
12394
12433
|
this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH_START);
|
|
12395
12434
|
assert.ok(this._dash, 'An instance of dashjs MediaPlayer is required to switch levels');
|
|
12396
12435
|
const dash = this._dash;
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12436
|
+
const settings = $.extend(true, {}, this.options.dash, {
|
|
12437
|
+
streaming: {
|
|
12438
|
+
abr: {
|
|
12439
|
+
autoSwitchBitrate: {
|
|
12440
|
+
video: id === -1,
|
|
12441
|
+
},
|
|
12442
|
+
},
|
|
12443
|
+
},
|
|
12444
|
+
});
|
|
12404
12445
|
dash.updateSettings(settings);
|
|
12405
12446
|
if (id !== -1) {
|
|
12406
12447
|
this._dash.setQualityFor('video', id);
|
|
@@ -12468,16 +12509,14 @@ class DashPlayback extends HTML5Video {
|
|
|
12468
12509
|
this._dash.initialize();
|
|
12469
12510
|
if (this.options.dash) {
|
|
12470
12511
|
// TODO use $.extend
|
|
12471
|
-
const settings =
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
}
|
|
12480
|
-
this._dash.updateSettings(this.options.dash);
|
|
12512
|
+
const settings = $.extend({}, this.options.dash, {
|
|
12513
|
+
streaming: {
|
|
12514
|
+
text: {
|
|
12515
|
+
defaultEnabled: false,
|
|
12516
|
+
},
|
|
12517
|
+
},
|
|
12518
|
+
});
|
|
12519
|
+
this._dash.updateSettings(settings);
|
|
12481
12520
|
}
|
|
12482
12521
|
this._dash.attachView(this.el);
|
|
12483
12522
|
this._dash.setAutoPlay(false);
|
|
@@ -12489,13 +12528,14 @@ class DashPlayback extends HTML5Video {
|
|
|
12489
12528
|
this._updatePlaybackType();
|
|
12490
12529
|
this._fillLevels(bitrates);
|
|
12491
12530
|
dash.on(DASHJS.MediaPlayer.events.QUALITY_CHANGE_REQUESTED, (evt) => {
|
|
12492
|
-
|
|
12493
|
-
assert.ok(this._levels, 'An array of levels is required to change quality');
|
|
12494
|
-
const newLevel = this._levels.find((level) => level.level === evt.newQuality); // TODO or simply this._levels[evt.newQuality]?
|
|
12495
|
-
assert.ok(newLevel, 'A valid level is required to change quality');
|
|
12531
|
+
const newLevel = this.getLevel(evt.newQuality);
|
|
12496
12532
|
this.onLevelSwitch(newLevel);
|
|
12497
12533
|
});
|
|
12498
12534
|
});
|
|
12535
|
+
this._dash.on(DASHJS.MediaPlayer.events.QUALITY_CHANGE_RENDERED, (evt) => {
|
|
12536
|
+
const currentLevel = this.getLevel(evt.newQuality);
|
|
12537
|
+
this.onLevelSwitchEnd(currentLevel);
|
|
12538
|
+
});
|
|
12499
12539
|
this._dash.on(DASHJS.MediaPlayer.events.METRIC_ADDED, (e) => {
|
|
12500
12540
|
// Listen for the first manifest request in order to update player UI
|
|
12501
12541
|
if (e.metric === 'DVRInfo') {
|
|
@@ -12639,7 +12679,11 @@ class DashPlayback extends HTML5Video {
|
|
|
12639
12679
|
};
|
|
12640
12680
|
triggerError(error) {
|
|
12641
12681
|
trace(`${T$2} triggerError`, { error });
|
|
12642
|
-
this.trigger(Events$1.PLAYBACK_ERROR,
|
|
12682
|
+
this.trigger(Events$1.PLAYBACK_ERROR, {
|
|
12683
|
+
...error,
|
|
12684
|
+
origin: this.name,
|
|
12685
|
+
scope: DashPlayback.type,
|
|
12686
|
+
});
|
|
12643
12687
|
// only reset the dash player in 10ms async, so that the rest of the
|
|
12644
12688
|
// calling function finishes
|
|
12645
12689
|
setTimeout(() => {
|
|
@@ -12754,8 +12798,10 @@ class DashPlayback extends HTML5Video {
|
|
|
12754
12798
|
onLevelSwitch(currentLevel) {
|
|
12755
12799
|
// TODO check the two below
|
|
12756
12800
|
this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH, currentLevel);
|
|
12801
|
+
}
|
|
12802
|
+
onLevelSwitchEnd(currentLevel) {
|
|
12757
12803
|
this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH_END);
|
|
12758
|
-
const isHD =
|
|
12804
|
+
const isHD = currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000;
|
|
12759
12805
|
this.trigger(Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, isHD);
|
|
12760
12806
|
this.trigger(Events$1.PLAYBACK_BITRATE, currentLevel);
|
|
12761
12807
|
}
|
|
@@ -12765,6 +12811,11 @@ class DashPlayback extends HTML5Video {
|
|
|
12765
12811
|
isSeekEnabled() {
|
|
12766
12812
|
return this._playbackType === Playback.VOD || this.dvrEnabled;
|
|
12767
12813
|
}
|
|
12814
|
+
getLevel(quality) {
|
|
12815
|
+
const ret = this.levels.find((level) => level.level === quality);
|
|
12816
|
+
assert.ok(ret, 'Invalid quality level');
|
|
12817
|
+
return ret;
|
|
12818
|
+
}
|
|
12768
12819
|
}
|
|
12769
12820
|
DashPlayback.canPlay = function (resource, mimeType) {
|
|
12770
12821
|
if (!isDashSource(resource, mimeType)) {
|
|
@@ -41697,6 +41748,7 @@ class HlsPlayback extends HTML5Video {
|
|
|
41697
41748
|
this._hls.on(Hls.Events.LEVEL_LOADED, (evt, data) => this._updatePlaybackType(evt, data));
|
|
41698
41749
|
this._hls.on(Hls.Events.LEVEL_UPDATED, (evt, data) => this._onLevelUpdated(evt, data));
|
|
41699
41750
|
this._hls.on(Hls.Events.LEVEL_SWITCHING, (evt, data) => this._onLevelSwitch(evt, data));
|
|
41751
|
+
this._hls.on(Hls.Events.LEVEL_SWITCHED, (evt, data) => this._onLevelSwitched(evt, data));
|
|
41700
41752
|
this._hls.on(Hls.Events.FRAG_CHANGED, (evt, data) => this._onFragmentChanged(evt, data));
|
|
41701
41753
|
this._hls.on(Hls.Events.FRAG_LOADED, (evt, data) => this._onFragmentLoaded(evt, data));
|
|
41702
41754
|
this._hls.on(Hls.Events.FRAG_PARSING_METADATA, (evt, data) => this._onFragmentParsingMetadata(evt, data));
|
|
@@ -41754,7 +41806,10 @@ class HlsPlayback extends HTML5Video {
|
|
|
41754
41806
|
}
|
|
41755
41807
|
else {
|
|
41756
41808
|
Log.error('hlsjs: failed to recover', { evt, data });
|
|
41757
|
-
trace(`${T$1} _recover failed to recover`, {
|
|
41809
|
+
trace(`${T$1} _recover failed to recover`, {
|
|
41810
|
+
type: data.type,
|
|
41811
|
+
details: data.details,
|
|
41812
|
+
});
|
|
41758
41813
|
error.level = PlayerError.Levels.FATAL;
|
|
41759
41814
|
this.triggerError(error);
|
|
41760
41815
|
}
|
|
@@ -41837,12 +41892,18 @@ class HlsPlayback extends HTML5Video {
|
|
|
41837
41892
|
this.trigger(Events$1.PLAYBACK_SETTINGSUPDATE);
|
|
41838
41893
|
}
|
|
41839
41894
|
_onHLSJSError(evt, data) {
|
|
41840
|
-
trace(`${T$1} _onHLSJSError`, {
|
|
41895
|
+
trace(`${T$1} _onHLSJSError`, {
|
|
41896
|
+
fatal: data.fatal,
|
|
41897
|
+
type: data.type,
|
|
41898
|
+
details: data.details,
|
|
41899
|
+
});
|
|
41841
41900
|
const error = {
|
|
41842
41901
|
code: PlaybackErrorCode.Generic,
|
|
41843
41902
|
description: `${this.name} error: type: ${data.type}, details: ${data.details} fatal: ${data.fatal}`,
|
|
41844
41903
|
level: data.fatal ? PlayerError.Levels.FATAL : PlayerError.Levels.WARN,
|
|
41845
41904
|
message: `${this.name} error: type: ${data.type}, details: ${data.details}`,
|
|
41905
|
+
origin: this.name,
|
|
41906
|
+
scope: HlsPlayback.type,
|
|
41846
41907
|
};
|
|
41847
41908
|
if (data.response) {
|
|
41848
41909
|
error.description += `, response: ${JSON.stringify(data.response)}`;
|
|
@@ -41922,7 +41983,10 @@ class HlsPlayback extends HTML5Video {
|
|
|
41922
41983
|
return;
|
|
41923
41984
|
}
|
|
41924
41985
|
Log.warn('hlsjs: non-fatal error occurred', { evt, data });
|
|
41925
|
-
trace(`${T$1} _onHLSJSError non-fatal error occurred`, {
|
|
41986
|
+
trace(`${T$1} _onHLSJSError non-fatal error occurred`, {
|
|
41987
|
+
type: data.type,
|
|
41988
|
+
details: data.details,
|
|
41989
|
+
});
|
|
41926
41990
|
}
|
|
41927
41991
|
}
|
|
41928
41992
|
_keyIsDenied(data) {
|
|
@@ -42195,22 +42259,24 @@ class HlsPlayback extends HTML5Video {
|
|
|
42195
42259
|
if (!this.levels.length) {
|
|
42196
42260
|
this._fillLevels();
|
|
42197
42261
|
}
|
|
42198
|
-
this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH_END);
|
|
42199
42262
|
this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH, data);
|
|
42200
|
-
|
|
42201
|
-
|
|
42202
|
-
|
|
42203
|
-
|
|
42204
|
-
|
|
42205
|
-
|
|
42206
|
-
|
|
42207
|
-
|
|
42208
|
-
|
|
42209
|
-
|
|
42210
|
-
|
|
42211
|
-
|
|
42212
|
-
|
|
42213
|
-
|
|
42263
|
+
}
|
|
42264
|
+
_onLevelSwitched(evt, data) {
|
|
42265
|
+
// @ts-ignore
|
|
42266
|
+
const currentLevel = this._hls.levels[data.level]; // TODO or find by .id == level?
|
|
42267
|
+
assert.ok(currentLevel, 'Invalid quality level');
|
|
42268
|
+
this._currentLevel = data.level;
|
|
42269
|
+
// TODO should highDefinition be private and maybe have a read only accessor if it's used somewhere
|
|
42270
|
+
this.highDefinition =
|
|
42271
|
+
currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000;
|
|
42272
|
+
this.trigger(Events$1.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition);
|
|
42273
|
+
this.trigger(Events$1.PLAYBACK_BITRATE, {
|
|
42274
|
+
height: currentLevel.height,
|
|
42275
|
+
width: currentLevel.width,
|
|
42276
|
+
bitrate: currentLevel.bitrate,
|
|
42277
|
+
level: data.level,
|
|
42278
|
+
});
|
|
42279
|
+
this.trigger(Events$1.PLAYBACK_LEVEL_SWITCH_END);
|
|
42214
42280
|
}
|
|
42215
42281
|
get dvrEnabled() {
|
|
42216
42282
|
// enabled when:
|
|
@@ -42258,11 +42324,11 @@ const DEFAULT_OPTIONS = {
|
|
|
42258
42324
|
};
|
|
42259
42325
|
/**
|
|
42260
42326
|
* The main component to use in the application code.
|
|
42327
|
+
* @beta
|
|
42261
42328
|
* @remarks
|
|
42262
42329
|
* The Player object provides very basic API to control playback.
|
|
42263
42330
|
* To build a sophisticated UI, use the plugins framework to tap into the Clappr core.
|
|
42264
42331
|
* {@link https://github.com/clappr/clappr/wiki/Architecture}
|
|
42265
|
-
* @beta
|
|
42266
42332
|
*/
|
|
42267
42333
|
class Player {
|
|
42268
42334
|
config = DEFAULT_OPTIONS;
|
|
@@ -42280,8 +42346,8 @@ class Player {
|
|
|
42280
42346
|
}
|
|
42281
42347
|
/**
|
|
42282
42348
|
* Adds a listener to a player event
|
|
42283
|
-
* @param event -
|
|
42284
|
-
* @param handler -
|
|
42349
|
+
* @param event - event type, see {@link PlayerEvent}
|
|
42350
|
+
* @param handler - a callback function to handle the event
|
|
42285
42351
|
*/
|
|
42286
42352
|
on(event, handler) {
|
|
42287
42353
|
this.emitter.on(event, handler);
|
|
@@ -42289,7 +42355,7 @@ class Player {
|
|
|
42289
42355
|
/**
|
|
42290
42356
|
* Removes a previously added event listener
|
|
42291
42357
|
* @param event - See {@link PlayerEvent}
|
|
42292
|
-
* @param handler -
|
|
42358
|
+
* @param handler - a callback attached earlier to that event type
|
|
42293
42359
|
*/
|
|
42294
42360
|
off(event, handler) {
|
|
42295
42361
|
this.emitter.off(event, handler);
|
|
@@ -42403,7 +42469,15 @@ class Player {
|
|
|
42403
42469
|
return this.player?.isDvrEnabled() ?? false;
|
|
42404
42470
|
}
|
|
42405
42471
|
/**
|
|
42406
|
-
* Indicates
|
|
42472
|
+
* Indicates whether DVR is in use.
|
|
42473
|
+
* @remarks
|
|
42474
|
+
* DVR mode, if it is enabled, is triggered we a user seeks behind the live edge.
|
|
42475
|
+
*/
|
|
42476
|
+
isDvrInUse() {
|
|
42477
|
+
return this.player?.isDvrInUse() ?? false;
|
|
42478
|
+
}
|
|
42479
|
+
/**
|
|
42480
|
+
* Indicates the playing state.
|
|
42407
42481
|
*/
|
|
42408
42482
|
isPlaying() {
|
|
42409
42483
|
return this.player?.isPlaying() ?? false;
|
|
@@ -42436,7 +42510,7 @@ class Player {
|
|
|
42436
42510
|
* Resizes the player container element and everything within it.
|
|
42437
42511
|
* @param newSize - new size of the player
|
|
42438
42512
|
* @remarks
|
|
42439
|
-
* Use this method when the player itself does not detect the change in size of its container element.
|
|
42513
|
+
* Use this method when the player itself does not detect properly the change in size of its container element.
|
|
42440
42514
|
* It can be a case for orientation change on some mobile devices.
|
|
42441
42515
|
*/
|
|
42442
42516
|
resize(newSize) {
|
|
@@ -42533,32 +42607,7 @@ class Player {
|
|
|
42533
42607
|
const player = this.player;
|
|
42534
42608
|
this.bindContainerEventListeners(player);
|
|
42535
42609
|
player.core.on(Events$1.CORE_ACTIVE_CONTAINER_CHANGED, () => this.bindContainerEventListeners(player), null);
|
|
42536
|
-
|
|
42537
|
-
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
42538
|
-
orientation,
|
|
42539
|
-
rootNode: {
|
|
42540
|
-
width: this.rootNode?.clientWidth,
|
|
42541
|
-
height: this.rootNode?.clientHeight,
|
|
42542
|
-
},
|
|
42543
|
-
});
|
|
42544
|
-
if (Browser.isiOS && this.rootNode) {
|
|
42545
|
-
player.core.resize({
|
|
42546
|
-
width: this.rootNode.clientWidth,
|
|
42547
|
-
height: this.rootNode.clientHeight,
|
|
42548
|
-
});
|
|
42549
|
-
}
|
|
42550
|
-
}, null);
|
|
42551
|
-
player.core.on(Events$1.CORE_RESIZE, ({ width, height }) => {
|
|
42552
|
-
trace(`${T} CORE_RESIZE`, {
|
|
42553
|
-
width,
|
|
42554
|
-
height,
|
|
42555
|
-
});
|
|
42556
|
-
}, null);
|
|
42557
|
-
player.core.on(Events$1.CORE_FULLSCREEN, (isFullscreen) => {
|
|
42558
|
-
trace(`${T} CORE_FULLSCREEN`, {
|
|
42559
|
-
isFullscreen,
|
|
42560
|
-
});
|
|
42561
|
-
}, null);
|
|
42610
|
+
this.bindSizeManagementListeners(player);
|
|
42562
42611
|
if (this.config.autoPlay) {
|
|
42563
42612
|
setTimeout(() => {
|
|
42564
42613
|
trace(`${T} autoPlay`, {
|
|
@@ -42576,6 +42625,15 @@ class Player {
|
|
|
42576
42625
|
reportError(e);
|
|
42577
42626
|
}
|
|
42578
42627
|
}
|
|
42628
|
+
safeTriggerEvent(event, ...args) {
|
|
42629
|
+
try {
|
|
42630
|
+
this.emitter.emit(event, ...args);
|
|
42631
|
+
}
|
|
42632
|
+
catch (e) {
|
|
42633
|
+
reportError(e);
|
|
42634
|
+
}
|
|
42635
|
+
}
|
|
42636
|
+
// TODO test
|
|
42579
42637
|
events = {
|
|
42580
42638
|
onReady: () => {
|
|
42581
42639
|
trace(`${T} onReady`, {
|
|
@@ -42592,42 +42650,29 @@ class Player {
|
|
|
42592
42650
|
// TODO ensure that CORE_ACTIVE_CONTAINER_CHANGED does not get caught before onReady
|
|
42593
42651
|
setTimeout(() => this.tuneIn(), 0);
|
|
42594
42652
|
},
|
|
42595
|
-
onResize: (newSize) => {
|
|
42596
|
-
trace(`${T} onResize`, {
|
|
42597
|
-
newSize,
|
|
42598
|
-
});
|
|
42599
|
-
},
|
|
42600
42653
|
onPlay: () => {
|
|
42601
|
-
|
|
42602
|
-
this.emitter.emit(PlayerEvent.Play);
|
|
42603
|
-
}
|
|
42604
|
-
catch (e) {
|
|
42605
|
-
reportError(e);
|
|
42606
|
-
}
|
|
42654
|
+
this.safeTriggerEvent(PlayerEvent.Play);
|
|
42607
42655
|
},
|
|
42608
42656
|
onPause: () => {
|
|
42609
|
-
|
|
42610
|
-
this.emitter.emit(PlayerEvent.Pause);
|
|
42611
|
-
}
|
|
42612
|
-
catch (e) {
|
|
42613
|
-
reportError(e);
|
|
42614
|
-
}
|
|
42657
|
+
this.safeTriggerEvent(PlayerEvent.Pause);
|
|
42615
42658
|
},
|
|
42616
42659
|
onEnded: () => {
|
|
42617
|
-
|
|
42618
|
-
|
|
42619
|
-
|
|
42620
|
-
|
|
42621
|
-
reportError(e);
|
|
42622
|
-
}
|
|
42660
|
+
this.safeTriggerEvent(PlayerEvent.Ended);
|
|
42661
|
+
},
|
|
42662
|
+
onSeek: (time) => {
|
|
42663
|
+
this.safeTriggerEvent(PlayerEvent.Seek, time);
|
|
42623
42664
|
},
|
|
42624
42665
|
onStop: () => {
|
|
42625
|
-
|
|
42626
|
-
|
|
42627
|
-
|
|
42628
|
-
|
|
42629
|
-
|
|
42630
|
-
|
|
42666
|
+
this.safeTriggerEvent(PlayerEvent.Stop);
|
|
42667
|
+
},
|
|
42668
|
+
onVolumeUpdate: (volume) => {
|
|
42669
|
+
this.safeTriggerEvent(PlayerEvent.VolumeUpdate, volume);
|
|
42670
|
+
},
|
|
42671
|
+
onTimeUpdate: (time) => {
|
|
42672
|
+
this.safeTriggerEvent(PlayerEvent.TimeUpdate, time);
|
|
42673
|
+
},
|
|
42674
|
+
onError: (error) => {
|
|
42675
|
+
this.safeTriggerEvent(PlayerEvent.Error, error);
|
|
42631
42676
|
},
|
|
42632
42677
|
};
|
|
42633
42678
|
buildCoreOptions(rootNode) {
|
|
@@ -42655,6 +42700,7 @@ class Player {
|
|
|
42655
42700
|
mute: this.config.mute,
|
|
42656
42701
|
crossOrigin: 'anonymous', // TODO
|
|
42657
42702
|
hlsjsConfig: {
|
|
42703
|
+
// TODO
|
|
42658
42704
|
debug: this.config.debug === 'all' || this.config.debug === 'hls',
|
|
42659
42705
|
},
|
|
42660
42706
|
},
|
|
@@ -42663,7 +42709,7 @@ class Player {
|
|
|
42663
42709
|
width: rootNode.clientWidth,
|
|
42664
42710
|
source: source ? source.source : undefined,
|
|
42665
42711
|
mimeType: source ? source.mimeType : undefined,
|
|
42666
|
-
sources,
|
|
42712
|
+
sources,
|
|
42667
42713
|
strings: this.config.strings,
|
|
42668
42714
|
};
|
|
42669
42715
|
return coreOptions;
|
|
@@ -42677,9 +42723,6 @@ class Player {
|
|
|
42677
42723
|
this.config.sources.map((s) => wrapSource(s)), this.config.priorityTransport);
|
|
42678
42724
|
}
|
|
42679
42725
|
bindContainerEventListeners(player) {
|
|
42680
|
-
trace(`${T} bindContainerEventListeners`, {
|
|
42681
|
-
activePlayback: player.core.activePlayback?.name,
|
|
42682
|
-
});
|
|
42683
42726
|
if (Browser.isiOS && player.core.activePlayback) {
|
|
42684
42727
|
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
42685
42728
|
try {
|
|
@@ -42691,9 +42734,39 @@ class Player {
|
|
|
42691
42734
|
});
|
|
42692
42735
|
}
|
|
42693
42736
|
}
|
|
42737
|
+
bindSizeManagementListeners(player) {
|
|
42738
|
+
player.core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
42739
|
+
trace(`${T} on CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
42740
|
+
orientation,
|
|
42741
|
+
rootNode: {
|
|
42742
|
+
width: this.rootNode?.clientWidth,
|
|
42743
|
+
height: this.rootNode?.clientHeight,
|
|
42744
|
+
},
|
|
42745
|
+
});
|
|
42746
|
+
if (Browser.isiOS && this.rootNode) {
|
|
42747
|
+
player.core.resize({
|
|
42748
|
+
width: this.rootNode.clientWidth,
|
|
42749
|
+
height: this.rootNode.clientHeight,
|
|
42750
|
+
});
|
|
42751
|
+
}
|
|
42752
|
+
}, null);
|
|
42753
|
+
player.core.on(Events$1.CORE_RESIZE, ({ width, height }) => {
|
|
42754
|
+
trace(`${T} on CORE_RESIZE`, {
|
|
42755
|
+
width,
|
|
42756
|
+
height,
|
|
42757
|
+
});
|
|
42758
|
+
this.safeTriggerEvent(PlayerEvent.Resize, { width, height });
|
|
42759
|
+
}, null);
|
|
42760
|
+
player.core.on(Events$1.CORE_FULLSCREEN, (isFullscreen) => {
|
|
42761
|
+
trace(`${T} CORE_FULLSCREEN`, {
|
|
42762
|
+
isFullscreen,
|
|
42763
|
+
});
|
|
42764
|
+
this.safeTriggerEvent(PlayerEvent.Fullscreen, isFullscreen);
|
|
42765
|
+
}, null);
|
|
42766
|
+
}
|
|
42694
42767
|
}
|
|
42695
42768
|
|
|
42696
|
-
var version$1 = "2.
|
|
42769
|
+
var version$1 = "2.18.0";
|
|
42697
42770
|
|
|
42698
42771
|
var packages = {
|
|
42699
42772
|
"node_modules/@clappr/core": {
|