@volcengine/veplayer 2.6.2 → 2.7.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/esm/index.d.ts +16 -19
- package/esm/veplayer.biz.live.development.js +950 -327
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +255 -27
- package/esm/veplayer.development.js +911 -316
- package/esm/veplayer.live.d.ts +255 -27
- package/esm/veplayer.live.development.js +910 -315
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +16 -19
- package/esm/veplayer.vod.development.js +36 -20
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +16 -19
- package/umd/veplayer.biz.live.development.js +950 -327
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +255 -27
- package/umd/veplayer.development.js +911 -316
- package/umd/veplayer.live.d.ts +255 -27
- package/umd/veplayer.live.development.js +910 -315
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +16 -19
- package/umd/veplayer.vod.development.js +36 -20
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +255 -27
- package/veplayer.live.d.ts +255 -27
- package/veplayer.vod.d.ts +16 -19
package/umd/veplayer.vod.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Player from "xgplayer";
|
|
2
2
|
import { IXGI18nText, Plugin, IPluginOptions } from "xgplayer";
|
|
3
3
|
import { IPlayerOptions as PlayerOptions } from "xgplayer";
|
|
4
|
-
import { IDefinition as XGDefinition } from "xgplayer";
|
|
5
4
|
import { default as Player$0 } from "xgplayer";
|
|
6
5
|
import { IError as XGError } from "xgplayer";
|
|
7
6
|
import { IBasePluginOptions as XGPluginOptions } from "xgplayer";
|
|
@@ -92,8 +91,8 @@ interface DefinitionUrl {
|
|
|
92
91
|
url: string;
|
|
93
92
|
next: DefinitionUrl | null;
|
|
94
93
|
}
|
|
95
|
-
declare class Definition
|
|
96
|
-
readonly definition
|
|
94
|
+
declare class Definition {
|
|
95
|
+
readonly definition?: string;
|
|
97
96
|
readonly source: Source;
|
|
98
97
|
readonly text?: Record<Lang, string> | string;
|
|
99
98
|
readonly fallbackUrl: DefinitionUrl;
|
|
@@ -101,7 +100,7 @@ declare class Definition implements XGDefinition {
|
|
|
101
100
|
private _currentUrlRef;
|
|
102
101
|
constructor(definitionSetting: {
|
|
103
102
|
url: string;
|
|
104
|
-
definition
|
|
103
|
+
definition?: string;
|
|
105
104
|
source: Source;
|
|
106
105
|
text?: Record<Lang, string> | string;
|
|
107
106
|
fallbackUrls?: string[];
|
|
@@ -139,7 +138,7 @@ interface ExposedDefinition {
|
|
|
139
138
|
* @brief The resolution ID. This value must be unique.
|
|
140
139
|
*
|
|
141
140
|
*/
|
|
142
|
-
definition
|
|
141
|
+
definition?: string;
|
|
143
142
|
/** {zh}
|
|
144
143
|
* @brief 清晰度展示名称。可设置多语言 `{text: {'zh-cn': '高清', 'en': 'HD'}}`。
|
|
145
144
|
*/
|
|
@@ -155,6 +154,7 @@ interface ExposedDefinition {
|
|
|
155
154
|
*
|
|
156
155
|
*/
|
|
157
156
|
fallbackUrls?: string[];
|
|
157
|
+
type?: string;
|
|
158
158
|
}
|
|
159
159
|
/** {zh}
|
|
160
160
|
* @list option
|
|
@@ -1482,9 +1482,10 @@ type PrepareResult = {
|
|
|
1482
1482
|
options?: Partial<VePlayerBaseOptions>;
|
|
1483
1483
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1484
1484
|
plugins?: any[];
|
|
1485
|
+
protocol?: string;
|
|
1485
1486
|
useSrc?: boolean;
|
|
1486
1487
|
};
|
|
1487
|
-
type PreparePlugins = (url
|
|
1488
|
+
type PreparePlugins = (url?: string) => Promise<PrepareResult | undefined> | undefined;
|
|
1488
1489
|
/** {zh}
|
|
1489
1490
|
* @detail option
|
|
1490
1491
|
* @brief 视频的实际编码格式。如果您在 degradation 设置了 SoftFirst 属性(即硬解不支持降级软解),建议您传入该参数,省去探测实际编码格式的操作。
|
|
@@ -1571,6 +1572,7 @@ declare class VePlayerBase {
|
|
|
1571
1572
|
private _events;
|
|
1572
1573
|
private _customMedia?;
|
|
1573
1574
|
private _errorCallback;
|
|
1575
|
+
private _beforeFallbackError;
|
|
1574
1576
|
/** {zh}
|
|
1575
1577
|
* @hidden
|
|
1576
1578
|
*/
|
|
@@ -1721,7 +1723,7 @@ declare class VePlayerBase {
|
|
|
1721
1723
|
/** {en}
|
|
1722
1724
|
* @brief Gets the current resolution ID.
|
|
1723
1725
|
*/
|
|
1724
|
-
get definition(): string;
|
|
1726
|
+
get definition(): string | undefined;
|
|
1725
1727
|
/** {zh}
|
|
1726
1728
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
1727
1729
|
*/
|
|
@@ -2333,8 +2335,8 @@ declare namespace strategy {
|
|
|
2333
2335
|
next: DefinitionUrl | null;
|
|
2334
2336
|
}
|
|
2335
2337
|
function arrayToList(urls?: string[]): DefinitionUrl;
|
|
2336
|
-
class Definition
|
|
2337
|
-
readonly definition
|
|
2338
|
+
class Definition {
|
|
2339
|
+
readonly definition?: string;
|
|
2338
2340
|
readonly source: Source;
|
|
2339
2341
|
readonly text?: Record<Lang, string> | string;
|
|
2340
2342
|
readonly fallbackUrl: DefinitionUrl;
|
|
@@ -2342,7 +2344,7 @@ declare namespace strategy {
|
|
|
2342
2344
|
private _currentUrlRef;
|
|
2343
2345
|
constructor(definitionSetting: {
|
|
2344
2346
|
url: string;
|
|
2345
|
-
definition
|
|
2347
|
+
definition?: string;
|
|
2346
2348
|
source: Source;
|
|
2347
2349
|
text?: Record<Lang, string> | string;
|
|
2348
2350
|
fallbackUrls?: string[];
|
|
@@ -2380,7 +2382,7 @@ declare namespace strategy {
|
|
|
2380
2382
|
* @brief The resolution ID. This value must be unique.
|
|
2381
2383
|
*
|
|
2382
2384
|
*/
|
|
2383
|
-
definition
|
|
2385
|
+
definition?: string;
|
|
2384
2386
|
/** {zh}
|
|
2385
2387
|
* @brief 清晰度展示名称。可设置多语言 `{text: {'zh-cn': '高清', 'en': 'HD'}}`。
|
|
2386
2388
|
*/
|
|
@@ -2396,6 +2398,7 @@ declare namespace strategy {
|
|
|
2396
2398
|
*
|
|
2397
2399
|
*/
|
|
2398
2400
|
fallbackUrls?: string[];
|
|
2401
|
+
type?: string;
|
|
2399
2402
|
}
|
|
2400
2403
|
/** {zh}
|
|
2401
2404
|
* @list option
|
|
@@ -3783,9 +3786,10 @@ declare namespace strategy {
|
|
|
3783
3786
|
options?: Partial<VePlayerBaseOptions>;
|
|
3784
3787
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3785
3788
|
plugins?: any[];
|
|
3789
|
+
protocol?: string;
|
|
3786
3790
|
useSrc?: boolean;
|
|
3787
3791
|
};
|
|
3788
|
-
type PreparePlugins = (url
|
|
3792
|
+
type PreparePlugins = (url?: string) => Promise<PrepareResult | undefined> | undefined;
|
|
3789
3793
|
/** {zh}
|
|
3790
3794
|
* @detail option
|
|
3791
3795
|
* @brief 视频的实际编码格式。如果您在 degradation 设置了 SoftFirst 属性(即硬解不支持降级软解),建议您传入该参数,省去探测实际编码格式的操作。
|
|
@@ -3965,13 +3969,6 @@ declare namespace strategy {
|
|
|
3965
3969
|
function detectCodec(url: string): Promise<"unknown" | Codec>;
|
|
3966
3970
|
function isSoftDecode(options: VePlayerBaseOptions, currentCodec?: Codec | "unknown"): Promise<boolean>;
|
|
3967
3971
|
function combineOptions<T = VePlayerBaseOptions>(strategyList: (Strategy<T> | undefined)[]): Partial<T>;
|
|
3968
|
-
const getHlsStrategy: (options: VePlayerBaseOptions) => Promise<{
|
|
3969
|
-
options?: undefined;
|
|
3970
|
-
plugins?: undefined;
|
|
3971
|
-
} | {
|
|
3972
|
-
options: Partial<VePlayerBaseOptions>;
|
|
3973
|
-
plugins: any[];
|
|
3974
|
-
}>;
|
|
3975
3972
|
}
|
|
3976
3973
|
declare namespace error {
|
|
3977
3974
|
const EN: {
|
|
@@ -11737,14 +11737,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11737
11737
|
const sourceManager = args.player.config.sources.sourceManager;
|
|
11738
11738
|
args.config.list = sourceManager.sources;
|
|
11739
11739
|
}
|
|
11740
|
-
afterCreate() {
|
|
11741
|
-
super.afterCreate();
|
|
11742
|
-
if (this.config.sourceManager.sources.length < 2) {
|
|
11743
|
-
this.hide();
|
|
11744
|
-
} else {
|
|
11745
|
-
this.renderItemList();
|
|
11746
|
-
}
|
|
11747
|
-
}
|
|
11748
11740
|
registerIcons() {
|
|
11749
11741
|
return {
|
|
11750
11742
|
source: { icon: SourceIcon }
|
|
@@ -11753,6 +11745,10 @@ var __publicField = (obj, key, value) => {
|
|
|
11753
11745
|
renderItemList() {
|
|
11754
11746
|
const { sources, source } = this.config.sourceManager;
|
|
11755
11747
|
const i18nManager = this.player.config.i18nManager;
|
|
11748
|
+
if (sources.length < 2) {
|
|
11749
|
+
this.hide();
|
|
11750
|
+
return;
|
|
11751
|
+
}
|
|
11756
11752
|
const renderItems = sources.map((source2) => {
|
|
11757
11753
|
return {
|
|
11758
11754
|
...source2,
|
|
@@ -12434,6 +12430,10 @@ var __publicField = (obj, key, value) => {
|
|
|
12434
12430
|
var _a, _b;
|
|
12435
12431
|
const sourceManager = this.player.config.sourceManager;
|
|
12436
12432
|
const definitions = ((_a = sourceManager.source) == null ? void 0 : _a.definitions) ?? [];
|
|
12433
|
+
if (definitions.length < 2) {
|
|
12434
|
+
this.hide();
|
|
12435
|
+
return;
|
|
12436
|
+
}
|
|
12437
12437
|
const renderItems = definitions.map((definition) => {
|
|
12438
12438
|
const showItem = {
|
|
12439
12439
|
url: definition.url,
|
|
@@ -14068,10 +14068,12 @@ var __publicField = (obj, key, value) => {
|
|
|
14068
14068
|
__publicField(this, "_events", {});
|
|
14069
14069
|
__publicField(this, "_customMedia");
|
|
14070
14070
|
__publicField(this, "_errorCallback");
|
|
14071
|
+
__publicField(this, "_beforeFallbackError");
|
|
14071
14072
|
var _a, _b, _c, _d, _e, _f;
|
|
14072
14073
|
this._sourceManager = options.sourceManager;
|
|
14073
14074
|
this._preparePlugins = options.preparePlugins;
|
|
14074
14075
|
this._previousPrepareResult = options.prepareResult;
|
|
14076
|
+
this._beforeFallbackError = options.beforeFallbackError;
|
|
14075
14077
|
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
14076
14078
|
i18n: options.i18n
|
|
14077
14079
|
});
|
|
@@ -14096,6 +14098,9 @@ var __publicField = (obj, key, value) => {
|
|
|
14096
14098
|
...DEFAULT_OPTIONS,
|
|
14097
14099
|
...xgOptions,
|
|
14098
14100
|
definition: {
|
|
14101
|
+
// TODO: ts
|
|
14102
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14103
|
+
// @ts-ignore
|
|
14099
14104
|
list: ((_d = this._sourceManager.source) == null ? void 0 : _d.definitions) ?? [],
|
|
14100
14105
|
defaultDefinition: (_e = this._sourceManager.definition) == null ? void 0 : _e.definition,
|
|
14101
14106
|
...options.definition ?? {}
|
|
@@ -14280,7 +14285,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14280
14285
|
* @brief Retrieve the player SDK version number.
|
|
14281
14286
|
*/
|
|
14282
14287
|
get playerVersion() {
|
|
14283
|
-
return "2.
|
|
14288
|
+
return "2.7.0";
|
|
14284
14289
|
}
|
|
14285
14290
|
/** {zh}
|
|
14286
14291
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -14766,13 +14771,18 @@ var __publicField = (obj, key, value) => {
|
|
|
14766
14771
|
* @hidden
|
|
14767
14772
|
*/
|
|
14768
14773
|
async prepare(url) {
|
|
14769
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14774
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
14770
14775
|
const result = await ((_a = this._preparePlugins) == null ? void 0 : _a.call(this, url));
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14776
|
+
let isSameProtocol;
|
|
14777
|
+
if ((result == null ? void 0 : result.protocol) && ((_b = this._previousPrepareResult) == null ? void 0 : _b.protocol)) {
|
|
14778
|
+
isSameProtocol = result.protocol === ((_c = this._previousPrepareResult) == null ? void 0 : _c.protocol);
|
|
14779
|
+
} else {
|
|
14780
|
+
const newUrl = ((_d = result == null ? void 0 : result.options) == null ? void 0 : _d.url) ?? url;
|
|
14781
|
+
const oldUrl = (_f = (_e = this._player) == null ? void 0 : _e.config) == null ? void 0 : _f.url;
|
|
14782
|
+
isSameProtocol = oldUrl && getStreamType(newUrl) === getStreamType(oldUrl);
|
|
14783
|
+
}
|
|
14774
14784
|
if (!isSameProtocol) {
|
|
14775
|
-
(
|
|
14785
|
+
(_h = (_g = this._previousPrepareResult) == null ? void 0 : _g.plugins) == null ? void 0 : _h.forEach((plugin) => {
|
|
14776
14786
|
this._player.unRegisterPlugin(plugin.pluginName);
|
|
14777
14787
|
});
|
|
14778
14788
|
}
|
|
@@ -14781,7 +14791,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14781
14791
|
this._player.setConfig(result.options);
|
|
14782
14792
|
}
|
|
14783
14793
|
return {
|
|
14784
|
-
plugins: isSameProtocol ? [] : (
|
|
14794
|
+
plugins: isSameProtocol ? [] : (_i = result == null ? void 0 : result.plugins) == null ? void 0 : _i.map((plugin) => {
|
|
14785
14795
|
return this._player.registerPlugin(plugin);
|
|
14786
14796
|
}),
|
|
14787
14797
|
options: result == null ? void 0 : result.options,
|
|
@@ -14794,11 +14804,18 @@ var __publicField = (obj, key, value) => {
|
|
|
14794
14804
|
const preUrl = this._sourceManager.url;
|
|
14795
14805
|
const url = this._sourceManager.fallback();
|
|
14796
14806
|
if (!url) {
|
|
14807
|
+
const transformedError = transform$1(err, this._i18nManager);
|
|
14808
|
+
try {
|
|
14809
|
+
const { canEmitError } = await this._beforeFallbackError(
|
|
14810
|
+
transformedError
|
|
14811
|
+
);
|
|
14812
|
+
if (!canEmitError) {
|
|
14813
|
+
return;
|
|
14814
|
+
}
|
|
14815
|
+
} catch (error2) {
|
|
14816
|
+
}
|
|
14797
14817
|
this._player.removeClass(STATE_CLASS.ENTER);
|
|
14798
|
-
this.emit(
|
|
14799
|
-
Events.FALLBACK_ERROR,
|
|
14800
|
-
transform$1(err, this._i18nManager)
|
|
14801
|
-
);
|
|
14818
|
+
this.emit(Events.FALLBACK_ERROR, transformedError);
|
|
14802
14819
|
return;
|
|
14803
14820
|
}
|
|
14804
14821
|
this._player.once("canplay", () => {
|
|
@@ -14878,7 +14895,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14878
14895
|
return new Promise((resolve) => {
|
|
14879
14896
|
const curTime = this._player.currentTime;
|
|
14880
14897
|
const _canplay = () => {
|
|
14881
|
-
console.log("canplay canplay");
|
|
14882
14898
|
this._player.currentTime = curTime;
|
|
14883
14899
|
if (isPaused) {
|
|
14884
14900
|
this._player.once(CANPLAY, () => {
|