@gcorevideo/player 2.30.0 → 2.30.2
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/audio-tracks/template.ejs +1 -1
- package/dist/core.js +65 -21
- package/dist/index.css +265 -265
- package/dist/index.embed.js +99 -34
- package/dist/index.js +125 -53
- package/docs/api/player.md +37 -0
- package/docs/api/player.player.getplugin.md +59 -0
- package/docs/api/player.player.md +14 -0
- package/docs/api/player.tokenrefreshoptions.gettoken.md +13 -0
- package/docs/api/player.tokenrefreshoptions.ipbound.md +13 -0
- package/docs/api/player.tokenrefreshoptions.md +115 -0
- package/docs/api/player.tokenrefreshoptions.ontokenrefreshed.md +13 -0
- package/docs/api/player.tokenrefreshoptions.refreshleadseconds.md +13 -0
- package/docs/api/player.tokenrefreshplugin.md +50 -0
- package/docs/api/player.tokenresponse.client_ip.md +13 -0
- package/docs/api/player.tokenresponse.expires.md +13 -0
- package/docs/api/player.tokenresponse.md +153 -0
- package/docs/api/player.tokenresponse.token.md +13 -0
- package/docs/api/player.tokenresponse.token_ip.md +13 -0
- package/docs/api/player.tokenresponse.url.md +13 -0
- package/docs/api/player.tokenresponse.url_ip.md +13 -0
- package/lib/playback/hls-playback/HlsPlayback.d.ts +1 -1
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +23 -20
- package/lib/playback/hls-playback/RangesList.d.ts +7 -0
- package/lib/playback/hls-playback/RangesList.d.ts.map +1 -0
- package/lib/playback/hls-playback/RangesList.js +41 -0
- package/lib/plugins/audio-selector/AudioTracks.d.ts +4 -0
- package/lib/plugins/audio-selector/AudioTracks.d.ts.map +1 -1
- package/lib/plugins/audio-selector/AudioTracks.js +42 -12
- package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
- package/lib/plugins/subtitles/ClosedCaptions.js +0 -2
- package/package.json +1 -1
- package/src/playback/hls-playback/HlsPlayback.ts +40 -37
- package/src/playback/hls-playback/RangesList.ts +45 -0
- package/src/playback/hls-playback/__tests__/RangesList.test.ts +60 -0
- package/src/plugins/audio-selector/AudioTracks.ts +51 -16
- package/src/plugins/audio-selector/__tests__/__snapshots__/AudioTracks.test.ts.snap +9 -9
- package/src/plugins/subtitles/ClosedCaptions.ts +0 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<% for (const track of tracks) { %>
|
|
7
7
|
<li>
|
|
8
8
|
<a href="#" class="gcore-skin-text-color" data-item="<%= track.id %>" role="menuitemradio" aria-checked="<%= track.id === current %>">
|
|
9
|
-
<%= track.label %>
|
|
9
|
+
<%= track.label || track.language %>
|
|
10
10
|
</a>
|
|
11
11
|
</li>
|
|
12
12
|
<% }; %>
|
package/dist/core.js
CHANGED
|
@@ -50000,6 +50000,48 @@ Hls.defaultConfig = void 0;
|
|
|
50000
50000
|
// export const CLAPPR_VERSION: string = process.env.CLAPPR_VERSION || '0.11.3';
|
|
50001
50001
|
const CLAPPR_VERSION = '0.13.0';
|
|
50002
50002
|
|
|
50003
|
+
class RangesList {
|
|
50004
|
+
// TODO write an efficient implementation
|
|
50005
|
+
items = [];
|
|
50006
|
+
insert(start, end, value) {
|
|
50007
|
+
const index = this.findIndex((start + end) / 2);
|
|
50008
|
+
this.items.splice(index, 0, [start, end, value]);
|
|
50009
|
+
}
|
|
50010
|
+
find(position) {
|
|
50011
|
+
const index = this.findIndex(position);
|
|
50012
|
+
const item = this.items[index];
|
|
50013
|
+
if (!item || item[0] > position || item[1] < position) {
|
|
50014
|
+
return null;
|
|
50015
|
+
}
|
|
50016
|
+
return item[2];
|
|
50017
|
+
}
|
|
50018
|
+
findIndex(position) {
|
|
50019
|
+
let low = 0;
|
|
50020
|
+
let high = this.items.length;
|
|
50021
|
+
let index = 0;
|
|
50022
|
+
while (low < high) {
|
|
50023
|
+
index = low + Math.floor((high - low) / 2);
|
|
50024
|
+
const item = this.items[index];
|
|
50025
|
+
if (item[0] > position) {
|
|
50026
|
+
if (index === low) {
|
|
50027
|
+
return index;
|
|
50028
|
+
}
|
|
50029
|
+
high = index;
|
|
50030
|
+
continue;
|
|
50031
|
+
}
|
|
50032
|
+
if (item[1] <= position) {
|
|
50033
|
+
if (index === high - 1) {
|
|
50034
|
+
return index + 1;
|
|
50035
|
+
}
|
|
50036
|
+
low = index + 1;
|
|
50037
|
+
continue;
|
|
50038
|
+
}
|
|
50039
|
+
break;
|
|
50040
|
+
}
|
|
50041
|
+
return index;
|
|
50042
|
+
}
|
|
50043
|
+
}
|
|
50044
|
+
|
|
50003
50045
|
// Copyright 2014 Globo.com Player authors. All rights reserved.
|
|
50004
50046
|
// Use of this source code is governed by a BSD-style
|
|
50005
50047
|
// license that can be found on https://github.com/clappr/hlsjs-playback/blob/main/LICENSE
|
|
@@ -50009,7 +50051,6 @@ const DEFAULT_RECOVER_ATTEMPTS = 16;
|
|
|
50009
50051
|
Events$1.register('PLAYBACK_FRAGMENT_PARSING_METADATA');
|
|
50010
50052
|
const T$2 = 'playback.hls';
|
|
50011
50053
|
class HlsPlayback extends BasePlayback {
|
|
50012
|
-
_ccTracksUpdated = false;
|
|
50013
50054
|
_currentFragment = null;
|
|
50014
50055
|
_currentLevel = null;
|
|
50015
50056
|
_durationExcludesAfterLiveSyncPoint = false;
|
|
@@ -50034,7 +50075,8 @@ class HlsPlayback extends BasePlayback {
|
|
|
50034
50075
|
_timeUpdateTimer = null;
|
|
50035
50076
|
oncueenter = null;
|
|
50036
50077
|
oncueexit = null;
|
|
50037
|
-
cues =
|
|
50078
|
+
cues = null;
|
|
50079
|
+
cuesByTrack = {};
|
|
50038
50080
|
currentCueId = null;
|
|
50039
50081
|
/**
|
|
50040
50082
|
* @internal
|
|
@@ -50231,7 +50273,6 @@ class HlsPlayback extends BasePlayback {
|
|
|
50231
50273
|
}
|
|
50232
50274
|
this._manifestParsed = false;
|
|
50233
50275
|
// this._ccIsSetup = false
|
|
50234
|
-
this._ccTracksUpdated = false;
|
|
50235
50276
|
this._setInitialState();
|
|
50236
50277
|
this._hls.destroy();
|
|
50237
50278
|
this._hls = null;
|
|
@@ -50285,12 +50326,20 @@ class HlsPlayback extends BasePlayback {
|
|
|
50285
50326
|
this._hls.on(Events.AUDIO_TRACK_SWITCHED, (evt, data) => this._onAudioTrackSwitched(evt, data));
|
|
50286
50327
|
this._hls.on(Events.CUES_PARSED, (evt, data) => {
|
|
50287
50328
|
data.cues?.forEach((cue) => {
|
|
50288
|
-
this.cues
|
|
50329
|
+
if (!this.cues) {
|
|
50330
|
+
const trackId = this._hls.subtitleTrack;
|
|
50331
|
+
if (!this.cuesByTrack[trackId]) {
|
|
50332
|
+
this.cuesByTrack[trackId] = new RangesList();
|
|
50333
|
+
}
|
|
50334
|
+
this.cues = this.cuesByTrack[trackId];
|
|
50335
|
+
}
|
|
50336
|
+
const cueInfo = {
|
|
50289
50337
|
id: cue.id,
|
|
50290
50338
|
start: cue.startTime,
|
|
50291
50339
|
end: cue.endTime,
|
|
50292
50340
|
text: cue.text,
|
|
50293
|
-
}
|
|
50341
|
+
};
|
|
50342
|
+
this.cues.insert(cue.startTime, cue.endTime, cueInfo);
|
|
50294
50343
|
});
|
|
50295
50344
|
});
|
|
50296
50345
|
this.bindCustomListeners();
|
|
@@ -50517,7 +50566,7 @@ class HlsPlayback extends BasePlayback {
|
|
|
50517
50566
|
}
|
|
50518
50567
|
}
|
|
50519
50568
|
reload() {
|
|
50520
|
-
this.cues =
|
|
50569
|
+
this.cues = null;
|
|
50521
50570
|
this.currentCueId = null;
|
|
50522
50571
|
this._hls?.startLoad(-1);
|
|
50523
50572
|
}
|
|
@@ -50582,9 +50631,7 @@ class HlsPlayback extends BasePlayback {
|
|
|
50582
50631
|
}
|
|
50583
50632
|
triggerCues() {
|
|
50584
50633
|
const currentTime = this.getCurrentTime();
|
|
50585
|
-
|
|
50586
|
-
// TODO build a search tree
|
|
50587
|
-
const cue = this.cues.find((cue) => currentTime >= cue.start && currentTime <= cue.end);
|
|
50634
|
+
const cue = this.cues?.find(currentTime);
|
|
50588
50635
|
if (cue) {
|
|
50589
50636
|
this.currentCueId = cue.id;
|
|
50590
50637
|
this.oncueenter?.(cue);
|
|
@@ -50627,20 +50674,14 @@ class HlsPlayback extends BasePlayback {
|
|
|
50627
50674
|
destroy() {
|
|
50628
50675
|
this._stopTimeUpdateTimer();
|
|
50629
50676
|
this._destroyHLSInstance();
|
|
50677
|
+
this.cues = null;
|
|
50678
|
+
this.cuesByTrack = {};
|
|
50630
50679
|
return super.destroy();
|
|
50631
50680
|
}
|
|
50632
50681
|
_updatePlaybackType(evt, data) {
|
|
50633
50682
|
const prevPlaybackType = this._playbackType;
|
|
50634
50683
|
this._playbackType = (data.details.live ? Playback.LIVE : Playback.VOD);
|
|
50635
50684
|
this._onLevelUpdated(evt, data);
|
|
50636
|
-
// Live stream subtitle tracks detection hack (may not immediately available)
|
|
50637
|
-
// if (
|
|
50638
|
-
// this._ccTracksUpdated &&
|
|
50639
|
-
// this._playbackType === Playback.LIVE &&
|
|
50640
|
-
// this.hasClosedCaptionsTracks
|
|
50641
|
-
// ) {
|
|
50642
|
-
// this._onSubtitleLoaded()
|
|
50643
|
-
// }
|
|
50644
50685
|
if (prevPlaybackType !== this._playbackType) {
|
|
50645
50686
|
this._updateSettings();
|
|
50646
50687
|
}
|
|
@@ -50861,7 +50902,10 @@ class HlsPlayback extends BasePlayback {
|
|
|
50861
50902
|
return;
|
|
50862
50903
|
}
|
|
50863
50904
|
this._hls.subtitleTrack = id;
|
|
50864
|
-
this.
|
|
50905
|
+
if (!this.cuesByTrack[id]) {
|
|
50906
|
+
this.cuesByTrack[id] = new RangesList();
|
|
50907
|
+
}
|
|
50908
|
+
this.cues = this.cuesByTrack[id];
|
|
50865
50909
|
}
|
|
50866
50910
|
/**
|
|
50867
50911
|
* @override
|
|
@@ -50870,7 +50914,7 @@ class HlsPlayback extends BasePlayback {
|
|
|
50870
50914
|
return this.getTextTracks();
|
|
50871
50915
|
}
|
|
50872
50916
|
getTextTracks() {
|
|
50873
|
-
return this._hls?.subtitleTracks.map((t) => ({
|
|
50917
|
+
return (this._hls?.subtitleTracks.map((t) => ({
|
|
50874
50918
|
id: t.id,
|
|
50875
50919
|
name: t.name,
|
|
50876
50920
|
track: {
|
|
@@ -50878,7 +50922,7 @@ class HlsPlayback extends BasePlayback {
|
|
|
50878
50922
|
label: t.name,
|
|
50879
50923
|
language: t.lang,
|
|
50880
50924
|
},
|
|
50881
|
-
})) || [];
|
|
50925
|
+
})) || []);
|
|
50882
50926
|
}
|
|
50883
50927
|
}
|
|
50884
50928
|
HlsPlayback.canPlay = function (resource, mimeType) {
|
|
@@ -51492,7 +51536,7 @@ class Player {
|
|
|
51492
51536
|
}
|
|
51493
51537
|
}
|
|
51494
51538
|
|
|
51495
|
-
var version$1 = "2.30.
|
|
51539
|
+
var version$1 = "2.30.2";
|
|
51496
51540
|
|
|
51497
51541
|
var packages = {
|
|
51498
51542
|
"node_modules/@clappr/core": {
|