@byteplus/veplayer 2.3.1-rc.4 → 2.4.0-rc.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/esm/index.d.ts +17 -8
- package/esm/veplayer.biz.live.development.js +91 -20
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +143 -16
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +227 -101
- package/esm/veplayer.live.d.ts +143 -16
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +227 -101
- package/esm/veplayer.live.production.css +1 -1
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.css +1 -1
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +17 -8
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +168 -69
- package/esm/veplayer.vod.production.css +1 -1
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +17 -8
- package/umd/veplayer.biz.live.development.js +91 -20
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +143 -16
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +227 -101
- package/umd/veplayer.live.d.ts +143 -16
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +227 -101
- package/umd/veplayer.live.production.css +1 -1
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.css +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +17 -8
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +168 -69
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +143 -16
- package/veplayer.live.d.ts +143 -16
- package/veplayer.vod.d.ts +17 -8
package/esm/index.d.ts
CHANGED
|
@@ -2164,11 +2164,11 @@ declare enum DynamicModule {
|
|
|
2164
2164
|
PluginFlv = "plugin:flv",
|
|
2165
2165
|
PluginMp4 = "plugin:mp4",
|
|
2166
2166
|
PluginHls = "plugin:hls",
|
|
2167
|
-
PluginHlsJs = "plugin:hlsjs",
|
|
2168
2167
|
PluginShaka = "plugin:shaka",
|
|
2169
2168
|
PluginRtm = "plugin:rtm",
|
|
2170
2169
|
PluginXgvideo = "plugin:xgvideo",
|
|
2171
|
-
PluginDrm = "plugin:drm"
|
|
2170
|
+
PluginDrm = "plugin:drm",
|
|
2171
|
+
PluginAbr = "plugin:abr"
|
|
2172
2172
|
}
|
|
2173
2173
|
type ModulesMap = {
|
|
2174
2174
|
[DynamicModule.BizVod]: Exports;
|
|
@@ -2176,11 +2176,11 @@ type ModulesMap = {
|
|
|
2176
2176
|
[DynamicModule.PluginFlv]: Exports;
|
|
2177
2177
|
[DynamicModule.PluginMp4]: Exports;
|
|
2178
2178
|
[DynamicModule.PluginHls]: Exports;
|
|
2179
|
-
[DynamicModule.PluginHlsJs]: Exports;
|
|
2180
2179
|
[DynamicModule.PluginShaka]: Exports;
|
|
2181
2180
|
[DynamicModule.PluginRtm]: Exports;
|
|
2182
2181
|
[DynamicModule.PluginXgvideo]: Exports;
|
|
2183
2182
|
[DynamicModule.PluginDrm]: Exports;
|
|
2183
|
+
[DynamicModule.PluginAbr]: Exports;
|
|
2184
2184
|
};
|
|
2185
2185
|
declare const register: (exports: {
|
|
2186
2186
|
[x: string]: any;
|
|
@@ -3896,11 +3896,11 @@ declare namespace strategy {
|
|
|
3896
3896
|
readonly "plugin:flv": "veplayer.plugin.flv.[env].[ext]";
|
|
3897
3897
|
readonly "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]";
|
|
3898
3898
|
readonly "plugin:hls": "veplayer.plugin.hls.[env].[ext]";
|
|
3899
|
-
readonly "plugin:hlsjs": "veplayer.plugin.hlsjs.[env].[ext]";
|
|
3900
3899
|
readonly "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]";
|
|
3901
3900
|
readonly "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]";
|
|
3902
3901
|
readonly "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]";
|
|
3903
3902
|
readonly "plugin:drm": "veplayer.plugin.drm.[env].[ext]";
|
|
3903
|
+
readonly "plugin:abr": "veplayer.plugin.abr.[env].[ext]";
|
|
3904
3904
|
};
|
|
3905
3905
|
const enum State {
|
|
3906
3906
|
Fetching = 0,
|
|
@@ -3927,11 +3927,11 @@ declare namespace strategy {
|
|
|
3927
3927
|
PluginFlv = "plugin:flv",
|
|
3928
3928
|
PluginMp4 = "plugin:mp4",
|
|
3929
3929
|
PluginHls = "plugin:hls",
|
|
3930
|
-
PluginHlsJs = "plugin:hlsjs",
|
|
3931
3930
|
PluginShaka = "plugin:shaka",
|
|
3932
3931
|
PluginRtm = "plugin:rtm",
|
|
3933
3932
|
PluginXgvideo = "plugin:xgvideo",
|
|
3934
|
-
PluginDrm = "plugin:drm"
|
|
3933
|
+
PluginDrm = "plugin:drm",
|
|
3934
|
+
PluginAbr = "plugin:abr"
|
|
3935
3935
|
}
|
|
3936
3936
|
type ModulesMap = {
|
|
3937
3937
|
[DynamicModule.BizVod]: Exports;
|
|
@@ -3939,11 +3939,11 @@ declare namespace strategy {
|
|
|
3939
3939
|
[DynamicModule.PluginFlv]: Exports;
|
|
3940
3940
|
[DynamicModule.PluginMp4]: Exports;
|
|
3941
3941
|
[DynamicModule.PluginHls]: Exports;
|
|
3942
|
-
[DynamicModule.PluginHlsJs]: Exports;
|
|
3943
3942
|
[DynamicModule.PluginShaka]: Exports;
|
|
3944
3943
|
[DynamicModule.PluginRtm]: Exports;
|
|
3945
3944
|
[DynamicModule.PluginXgvideo]: Exports;
|
|
3946
3945
|
[DynamicModule.PluginDrm]: Exports;
|
|
3946
|
+
[DynamicModule.PluginAbr]: Exports;
|
|
3947
3947
|
};
|
|
3948
3948
|
class Loader {
|
|
3949
3949
|
readonly modules: Record<string, Module>;
|
|
@@ -3981,7 +3981,7 @@ declare namespace strategy {
|
|
|
3981
3981
|
}
|
|
3982
3982
|
type StrategyCreator<T, R extends keyof ModulesMap = any> = (options?: T) => Strategy<T, R>;
|
|
3983
3983
|
const createFlvMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginFlv>;
|
|
3984
|
-
const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls
|
|
3984
|
+
const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls>;
|
|
3985
3985
|
const createSoftDecodeH264Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
|
|
3986
3986
|
const createSoftDecodeH265Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
|
|
3987
3987
|
function getCodec(options: VePlayerBaseOptions): Promise<"unknown" | Codec>;
|
|
@@ -4607,6 +4607,9 @@ declare namespace event {
|
|
|
4607
4607
|
AUTOPLAY_SUCCESS: string;
|
|
4608
4608
|
ERROR_REFRESH_CLICK: string;
|
|
4609
4609
|
SOURCE_CHANGE: string;
|
|
4610
|
+
SWITCH_DEFINITION_START: string;
|
|
4611
|
+
SWITCH_DEFINITION_SUCCESS: string;
|
|
4612
|
+
DOWN_DEFINITION: string;
|
|
4610
4613
|
};
|
|
4611
4614
|
const Events: {
|
|
4612
4615
|
SEI: string;
|
|
@@ -4632,6 +4635,9 @@ declare namespace event {
|
|
|
4632
4635
|
AUTOPLAY_SUCCESS: string;
|
|
4633
4636
|
ERROR_REFRESH_CLICK: string;
|
|
4634
4637
|
SOURCE_CHANGE: string;
|
|
4638
|
+
SWITCH_DEFINITION_START: string;
|
|
4639
|
+
SWITCH_DEFINITION_SUCCESS: string;
|
|
4640
|
+
DOWN_DEFINITION: string;
|
|
4635
4641
|
REPLAY: string;
|
|
4636
4642
|
ERROR: string;
|
|
4637
4643
|
PLAY: string;
|
|
@@ -4663,6 +4669,9 @@ declare namespace event {
|
|
|
4663
4669
|
COMPLETE: string;
|
|
4664
4670
|
DESTROY: string;
|
|
4665
4671
|
URL_CHANGE: string;
|
|
4672
|
+
LEAVE_PLAYER: string;
|
|
4673
|
+
ENTER_PLAYER: string;
|
|
4674
|
+
LOADING: string;
|
|
4666
4675
|
SEI_PARSED: string;
|
|
4667
4676
|
RETRY: string;
|
|
4668
4677
|
ROTATE: string;
|
|
@@ -28,27 +28,27 @@ const ERRORS = {
|
|
|
28
28
|
function create(errorCode, i18n) {
|
|
29
29
|
return new VeError(ERRORS[errorCode], i18n);
|
|
30
30
|
}
|
|
31
|
-
const DynamicModule$
|
|
32
|
-
const load$
|
|
31
|
+
const DynamicModule$4 = window["VePlayer"].DynamicModule;
|
|
32
|
+
const load$4 = window["VePlayer"].load;
|
|
33
33
|
async function isRTMSupported() {
|
|
34
|
-
const { RtmPlugin } = await load$
|
|
34
|
+
const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
|
|
35
35
|
return RtmPlugin.isSupported();
|
|
36
36
|
}
|
|
37
37
|
async function isRTMSupportCodec(codec = RTMCodec.H264) {
|
|
38
|
-
const { RtmPlugin } = await load$
|
|
38
|
+
const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
|
|
39
39
|
if (codec === RTMCodec.H264)
|
|
40
40
|
return RtmPlugin.isSupportedH264();
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
43
|
const strategy$1 = window["VePlayer"].strategy;
|
|
44
44
|
const util$4 = window["VePlayer"].util;
|
|
45
|
-
const DynamicModule$
|
|
46
|
-
const load$
|
|
45
|
+
const DynamicModule$3 = window["VePlayer"].DynamicModule;
|
|
46
|
+
const load$3 = window["VePlayer"].load;
|
|
47
47
|
const Codec$1 = window["VePlayer"].Codec;
|
|
48
48
|
const Sniffer$3 = window["VePlayer"].Sniffer;
|
|
49
49
|
const rtmStrategy = {
|
|
50
50
|
options: {},
|
|
51
|
-
module: DynamicModule$
|
|
51
|
+
module: DynamicModule$3.PluginRtm
|
|
52
52
|
};
|
|
53
53
|
const generateFallbackUrl = (url) => {
|
|
54
54
|
if (Sniffer$3.device === "pc") {
|
|
@@ -75,13 +75,13 @@ const getRtmStrategy = async (options, player) => {
|
|
|
75
75
|
backupStrategy = strategy$1.createHlsMseStrategy(options);
|
|
76
76
|
}
|
|
77
77
|
const [rtmCdn, backupCdn] = await Promise.all([
|
|
78
|
-
load$
|
|
78
|
+
load$3(rtmStrategy.module).then((module) => {
|
|
79
79
|
return module.RtmPlugin;
|
|
80
80
|
}).catch(() => void 0),
|
|
81
|
-
backupStrategy && load$
|
|
82
|
-
if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$
|
|
81
|
+
backupStrategy && load$3(backupStrategy.module).then((module) => {
|
|
82
|
+
if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
|
|
83
83
|
return module.FlvPlugin;
|
|
84
|
-
} else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$
|
|
84
|
+
} else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
|
|
85
85
|
return module.HlsPlugin;
|
|
86
86
|
}
|
|
87
87
|
}).catch(() => void 0)
|
|
@@ -2931,8 +2931,8 @@ class Logger extends Plugin$2 {
|
|
|
2931
2931
|
device_id: this._deviceId,
|
|
2932
2932
|
ext: {
|
|
2933
2933
|
veplayer_version: "2.3.1-rc.2",
|
|
2934
|
-
flv_version: "3.0.
|
|
2935
|
-
hls_version: "3.0.
|
|
2934
|
+
flv_version: "3.0.17",
|
|
2935
|
+
hls_version: "3.0.17",
|
|
2936
2936
|
rts_version: "0.2.0-alpha.5"
|
|
2937
2937
|
}
|
|
2938
2938
|
});
|
|
@@ -3201,8 +3201,8 @@ const ZH_CN$1 = {
|
|
|
3201
3201
|
DECODE_INFO: "软解信息",
|
|
3202
3202
|
REFRESH: "刷新"
|
|
3203
3203
|
};
|
|
3204
|
-
const DynamicModule$
|
|
3205
|
-
const load$
|
|
3204
|
+
const DynamicModule$2 = window["VePlayer"].DynamicModule;
|
|
3205
|
+
const load$2 = window["VePlayer"].load;
|
|
3206
3206
|
const getDrmStrategy = async (options, player) => {
|
|
3207
3207
|
var _a;
|
|
3208
3208
|
const drmType = getDrmType(options.drm);
|
|
@@ -3210,7 +3210,7 @@ const getDrmStrategy = async (options, player) => {
|
|
|
3210
3210
|
try {
|
|
3211
3211
|
const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
|
|
3212
3212
|
const [drmPlugin, drmConfig] = await Promise.all([
|
|
3213
|
-
load$
|
|
3213
|
+
load$2(DynamicModule$2.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
|
|
3214
3214
|
getDrmConfig == null ? void 0 : getDrmConfig({
|
|
3215
3215
|
url: options.url
|
|
3216
3216
|
})
|
|
@@ -3234,6 +3234,55 @@ const getDrmStrategy = async (options, player) => {
|
|
|
3234
3234
|
}
|
|
3235
3235
|
return {};
|
|
3236
3236
|
};
|
|
3237
|
+
function isType(suffix) {
|
|
3238
|
+
return function(url) {
|
|
3239
|
+
return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
|
|
3240
|
+
};
|
|
3241
|
+
}
|
|
3242
|
+
const isHls = isType(".m3u8");
|
|
3243
|
+
const isMp4 = isType(".mp4");
|
|
3244
|
+
const isFlv = isType(".flv");
|
|
3245
|
+
const isRtm = isType(".sdp");
|
|
3246
|
+
const isDash = isType(".mpd");
|
|
3247
|
+
function getStreamType(url) {
|
|
3248
|
+
if (isHls(url)) {
|
|
3249
|
+
return "hls";
|
|
3250
|
+
}
|
|
3251
|
+
if (isFlv(url)) {
|
|
3252
|
+
return "flv";
|
|
3253
|
+
}
|
|
3254
|
+
if (isRtm(url)) {
|
|
3255
|
+
return "rtm";
|
|
3256
|
+
}
|
|
3257
|
+
if (isMp4(url)) {
|
|
3258
|
+
return "mp4";
|
|
3259
|
+
}
|
|
3260
|
+
if (isDash(url)) {
|
|
3261
|
+
return "dash";
|
|
3262
|
+
}
|
|
3263
|
+
return "unknown";
|
|
3264
|
+
}
|
|
3265
|
+
const DynamicModule$1 = window["VePlayer"].DynamicModule;
|
|
3266
|
+
const load$1 = window["VePlayer"].load;
|
|
3267
|
+
const getAbrStrategy = async (options) => {
|
|
3268
|
+
var _a, _b;
|
|
3269
|
+
const streamType = options.url && getStreamType(options.url);
|
|
3270
|
+
if (streamType === "rtm")
|
|
3271
|
+
return {};
|
|
3272
|
+
const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
|
|
3273
|
+
if (!abrOptions) {
|
|
3274
|
+
return {};
|
|
3275
|
+
}
|
|
3276
|
+
const abrPlugin = await load$1(DynamicModule$1.PluginAbr).catch(() => void 0);
|
|
3277
|
+
return {
|
|
3278
|
+
options: {
|
|
3279
|
+
[streamType === "flv" ? "abr" : "hlsabr"]: abrOptions
|
|
3280
|
+
},
|
|
3281
|
+
plugins: [
|
|
3282
|
+
streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
|
|
3283
|
+
]
|
|
3284
|
+
};
|
|
3285
|
+
};
|
|
3237
3286
|
const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
|
|
3238
3287
|
const VePlayerBase = window["VePlayer"].VePlayerBase;
|
|
3239
3288
|
const VeI18n = window["VePlayer"].VeI18n;
|
|
@@ -3309,6 +3358,14 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3309
3358
|
var _a;
|
|
3310
3359
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
3311
3360
|
}
|
|
3361
|
+
openAbr() {
|
|
3362
|
+
var _a, _b;
|
|
3363
|
+
(_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
|
|
3364
|
+
}
|
|
3365
|
+
closeAbr() {
|
|
3366
|
+
var _a, _b;
|
|
3367
|
+
(_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
|
|
3368
|
+
}
|
|
3312
3369
|
/** {zh}
|
|
3313
3370
|
* @brief 调用此方法更新 DRM 鉴权配置。
|
|
3314
3371
|
* @hidden
|
|
@@ -3317,6 +3374,14 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3317
3374
|
var _a, _b, _c;
|
|
3318
3375
|
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
3319
3376
|
}
|
|
3377
|
+
async switch(target, options) {
|
|
3378
|
+
var _a, _b, _c;
|
|
3379
|
+
const { abr, ...rest } = options ?? {};
|
|
3380
|
+
if (abr) {
|
|
3381
|
+
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
|
|
3382
|
+
}
|
|
3383
|
+
return super.switch(target, rest);
|
|
3384
|
+
}
|
|
3320
3385
|
}
|
|
3321
3386
|
async function createLivePlayer(options) {
|
|
3322
3387
|
var _a, _b;
|
|
@@ -3341,15 +3406,21 @@ async function createLivePlayer(options) {
|
|
|
3341
3406
|
};
|
|
3342
3407
|
},
|
|
3343
3408
|
async preparePlugins(url) {
|
|
3344
|
-
const [typeStrategy, drmStrategy] = await Promise.all([
|
|
3409
|
+
const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
|
|
3345
3410
|
getTypeStrategy({ ...finalOptions, url }, player),
|
|
3346
|
-
getDrmStrategy({ ...finalOptions, url }, player)
|
|
3411
|
+
getDrmStrategy({ ...finalOptions, url }, player),
|
|
3412
|
+
getAbrStrategy({ ...finalOptions, url })
|
|
3347
3413
|
]);
|
|
3348
3414
|
const { options: options2, plugins } = typeStrategy ?? {};
|
|
3349
3415
|
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
3416
|
+
const { options: abrOptions, plugins: abrPlugins } = abrStrategy ?? {};
|
|
3350
3417
|
return {
|
|
3351
|
-
options: Object.assign({}, options2, drmOptions),
|
|
3352
|
-
plugins: [
|
|
3418
|
+
options: Object.assign({}, options2, drmOptions, abrOptions),
|
|
3419
|
+
plugins: [
|
|
3420
|
+
...plugins ?? [],
|
|
3421
|
+
...drmPlugins ?? [],
|
|
3422
|
+
...abrPlugins ?? []
|
|
3423
|
+
]
|
|
3353
3424
|
};
|
|
3354
3425
|
}
|
|
3355
3426
|
},
|