eb-player 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/ebplayer.bundle.js +66 -32
- package/dist/build/ebplayer.bundle.js.map +1 -1
- package/dist/build/types/src/engines/hls.d.ts.map +1 -1
- package/dist/build/types/src/engines/segment-token-loader.d.ts +16 -3
- package/dist/build/types/src/engines/segment-token-loader.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EBPlayer = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var __EB_PLAYER_VERSION__ = "2.1.
|
|
7
|
+
var __EB_PLAYER_VERSION__ = "2.1.1";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Finite State Machine for player playback state transitions.
|
|
@@ -5852,9 +5852,22 @@
|
|
|
5852
5852
|
}
|
|
5853
5853
|
}
|
|
5854
5854
|
/**
|
|
5855
|
-
* Returns a loader
|
|
5856
|
-
*
|
|
5857
|
-
*
|
|
5855
|
+
* Returns a loader constructor extending `BaseLoader`: construct the base,
|
|
5856
|
+
* bind the inherited `load`, then assign an own `load` property that reads
|
|
5857
|
+
* `context.frag?.baseurl`.
|
|
5858
|
+
*
|
|
5859
|
+
* NOT a native `class`: this constructor is registered in the base
|
|
5860
|
+
* `config.loader` slot, which the EasyBroadcast P2P SDK's hls adapter
|
|
5861
|
+
* subclasses with transpiled ES5 inheritance — its wrapper constructor
|
|
5862
|
+
* invokes the parent as `Parent.apply(this, arguments)`, which throws
|
|
5863
|
+
* "Class constructor ... cannot be invoked without 'new'" on a native
|
|
5864
|
+
* class (hls.js's own dist loaders are function-based for the same
|
|
5865
|
+
* reason). The function below therefore supports both invocation modes:
|
|
5866
|
+
* under `new` (hls.js pLoader/fLoader/loader slots) it defers to
|
|
5867
|
+
* `Reflect.construct` so a native-class base still works; under an
|
|
5868
|
+
* `.apply()`-style super call it initializes the wrapper's `this` in
|
|
5869
|
+
* place, which requires the base to be function-based — true of every
|
|
5870
|
+
* hls.js dist build this player loads.
|
|
5858
5871
|
*
|
|
5859
5872
|
* `tokenSource` is captured by closure — never stored on `this` and never
|
|
5860
5873
|
* used to acquire or refresh a token.
|
|
@@ -5868,37 +5881,46 @@
|
|
|
5868
5881
|
// hls.js needs the error signal each time to drive its own retry/fatal
|
|
5869
5882
|
// escalation; only the console spam is deduplicated.
|
|
5870
5883
|
let unsupportedTokenTypeLogged = false;
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
const
|
|
5883
|
-
if (!
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
unsupportedTokenTypeLogged = true;
|
|
5887
|
-
console.error(message);
|
|
5888
|
-
}
|
|
5889
|
-
callbacks.onError({ code: 0, text: message }, context, null, createEmptySegmentLoaderStats());
|
|
5890
|
-
return;
|
|
5891
|
-
}
|
|
5892
|
-
const baseUrl = context.frag?.baseurl;
|
|
5893
|
-
if (!baseUrl || !context.url) {
|
|
5894
|
-
originalLoad(context, loadConfig, callbacks);
|
|
5895
|
-
return;
|
|
5884
|
+
function attachSigningLoad(instance) {
|
|
5885
|
+
const originalLoad = instance.load.bind(instance);
|
|
5886
|
+
instance.load = function (context, loadConfig, callbacks) {
|
|
5887
|
+
// D-03/D-04: a token type outside the query-param family (akamai, or
|
|
5888
|
+
// none configured) must fail visibly rather than emit an unsigned
|
|
5889
|
+
// request. A silent passthrough here is the same undiagnosable 403
|
|
5890
|
+
// from the edge that D-04 forbids, so it gets the same treatment as
|
|
5891
|
+
// the akamai case: no delegation to the base loader, and a named
|
|
5892
|
+
// error surfaced through hls.js's own error callback.
|
|
5893
|
+
const tokenType = tokenSource.tokenType;
|
|
5894
|
+
if (!tokenType || !SEGMENT_SIGNING_TOKEN_TYPES.includes(tokenType)) {
|
|
5895
|
+
const message = segmentSigningUnsupportedMessage(tokenType);
|
|
5896
|
+
if (!unsupportedTokenTypeLogged) {
|
|
5897
|
+
unsupportedTokenTypeLogged = true;
|
|
5898
|
+
console.error(message);
|
|
5896
5899
|
}
|
|
5897
|
-
|
|
5900
|
+
callbacks.onError({ code: 0, text: message }, context, null, createEmptySegmentLoaderStats());
|
|
5901
|
+
return;
|
|
5902
|
+
}
|
|
5903
|
+
const baseUrl = context.frag?.baseurl;
|
|
5904
|
+
if (!baseUrl || !context.url) {
|
|
5898
5905
|
originalLoad(context, loadConfig, callbacks);
|
|
5899
|
-
|
|
5906
|
+
return;
|
|
5907
|
+
}
|
|
5908
|
+
context.url = signSegmentUrlFromPlaylist(context.url, baseUrl);
|
|
5909
|
+
originalLoad(context, loadConfig, callbacks);
|
|
5910
|
+
};
|
|
5911
|
+
}
|
|
5912
|
+
function SegmentTokenLoader(loaderConfig) {
|
|
5913
|
+
if (new.target) {
|
|
5914
|
+
const instance = Reflect.construct(BaseLoader, [loaderConfig], new.target);
|
|
5915
|
+
attachSigningLoad(instance);
|
|
5916
|
+
return instance;
|
|
5900
5917
|
}
|
|
5918
|
+
BaseLoader.call(this, loaderConfig);
|
|
5919
|
+
attachSigningLoad(this);
|
|
5920
|
+
return undefined;
|
|
5901
5921
|
}
|
|
5922
|
+
SegmentTokenLoader.prototype = Object.create(BaseLoader.prototype);
|
|
5923
|
+
SegmentTokenLoader.prototype.constructor = SegmentTokenLoader;
|
|
5902
5924
|
return SegmentTokenLoader;
|
|
5903
5925
|
}
|
|
5904
5926
|
|
|
@@ -6133,7 +6155,19 @@
|
|
|
6133
6155
|
// own parent playlist. Off by default so segment request shapes stay
|
|
6134
6156
|
// byte-identical to today's when the flag is unset.
|
|
6135
6157
|
if (config.engineSettings.signSegmentsWithCdnToken === true) {
|
|
6136
|
-
|
|
6158
|
+
const SegmentTokenLoader = createSegmentTokenLoaderClass(Hls.DefaultConfig.loader, tm);
|
|
6159
|
+
driverConfig.fLoader = SegmentTokenLoader;
|
|
6160
|
+
// The base `loader` slot must sign too: the EasyBroadcast P2P SDK's
|
|
6161
|
+
// hls adapter replaces `config.fLoader` at integrate() time with a
|
|
6162
|
+
// wrapper class that extends `config.loader` and overrides only
|
|
6163
|
+
// loadInternal(), routing segment fetches through its own
|
|
6164
|
+
// resource manager (V2V + CDN-fallback fetch of context.url
|
|
6165
|
+
// verbatim). Signing lives in load(), which the wrapper inherits,
|
|
6166
|
+
// so every URL entering that path — and hls.js's key loader, which
|
|
6167
|
+
// also instantiates `config.loader` — is signed before any request
|
|
6168
|
+
// is issued. Without this, V2V CDN fallbacks go out unsigned (403
|
|
6169
|
+
// on token-protected origins).
|
|
6170
|
+
driverConfig.loader = SegmentTokenLoader;
|
|
6137
6171
|
}
|
|
6138
6172
|
}
|
|
6139
6173
|
// Inject custom ABR controller unless disabled
|