@volcengine/veplayer 2.2.1-rc.0 → 2.3.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/LICENSE +20 -0
- package/esm/index.d.ts +1752 -294
- package/esm/veplayer.biz.live.development.js +122 -28
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +3888 -648
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +729 -194
- package/esm/veplayer.live.d.ts +3888 -648
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +729 -194
- 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 +1752 -294
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +620 -176
- 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 +1752 -294
- package/umd/veplayer.biz.live.development.js +125 -31
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.biz.vod.development.js +3 -2
- package/umd/veplayer.biz.vod.production.js +1 -1
- package/umd/veplayer.d.ts +3888 -648
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +728 -193
- package/umd/veplayer.live.d.ts +3888 -648
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +731 -196
- 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 +1752 -294
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +625 -181
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +3888 -648
- package/veplayer.live.d.ts +3888 -648
- package/veplayer.vod.d.ts +1752 -294
|
@@ -28,30 +28,30 @@ 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$3 = window["VePlayer"].DynamicModule;
|
|
32
|
+
const load$3 = window["VePlayer"].load;
|
|
33
33
|
async function isRTMSupported() {
|
|
34
|
-
const { RtmPlugin } = await load$
|
|
34
|
+
const { RtmPlugin } = await load$3(DynamicModule$3.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$3(DynamicModule$3.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$2 = window["VePlayer"].DynamicModule;
|
|
46
|
+
const load$2 = window["VePlayer"].load;
|
|
47
47
|
const Codec$1 = window["VePlayer"].Codec;
|
|
48
|
-
const Sniffer$
|
|
48
|
+
const Sniffer$3 = window["VePlayer"].Sniffer;
|
|
49
49
|
const rtmStrategy = {
|
|
50
50
|
options: {},
|
|
51
|
-
module: DynamicModule$
|
|
51
|
+
module: DynamicModule$2.PluginRtm
|
|
52
52
|
};
|
|
53
53
|
const generateFallbackUrl = (url) => {
|
|
54
|
-
if (Sniffer$
|
|
54
|
+
if (Sniffer$3.device === "pc") {
|
|
55
55
|
return url.replace(".sdp", ".flv");
|
|
56
56
|
} else {
|
|
57
57
|
return url.replace(".sdp", ".m3u8");
|
|
@@ -71,17 +71,17 @@ const getRtmStrategy = async (options, player) => {
|
|
|
71
71
|
const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
|
|
72
72
|
if (backupType === "flv" && util$4.isMseSupported(Codec$1.H264)) {
|
|
73
73
|
backupStrategy = strategy$1.createFlvMseStrategy(options);
|
|
74
|
-
} else if (backupType === "hls" && (Sniffer$
|
|
74
|
+
} else if (backupType === "hls" && (Sniffer$3.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$4.isMseSupported(Codec$1.H264)) {
|
|
75
75
|
backupStrategy = strategy$1.createHlsMseStrategy(options);
|
|
76
76
|
}
|
|
77
77
|
const [rtmCdn, backupCdn] = await Promise.all([
|
|
78
|
-
load$
|
|
78
|
+
load$2(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$2(backupStrategy.module).then((module) => {
|
|
82
|
+
if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.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$2.PluginHls) {
|
|
85
85
|
return module.HlsPlugin;
|
|
86
86
|
}
|
|
87
87
|
}).catch(() => void 0)
|
|
@@ -129,6 +129,30 @@ const getRtmStrategy = async (options, player) => {
|
|
|
129
129
|
plugins: rtmCdn ? [rtmCdn] : []
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
+
const Sniffer$2 = window["VePlayer"].Sniffer;
|
|
133
|
+
var DrmType = /* @__PURE__ */ ((DrmType2) => {
|
|
134
|
+
DrmType2["Fairplay"] = "fairplay";
|
|
135
|
+
return DrmType2;
|
|
136
|
+
})(DrmType || {});
|
|
137
|
+
function getDrmType(drm) {
|
|
138
|
+
if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$2.browser === "safari" || Sniffer$2.os.isIos)) {
|
|
139
|
+
return "fairplay";
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
function isMseSupportedWithDrm({
|
|
144
|
+
drm,
|
|
145
|
+
streamType
|
|
146
|
+
}) {
|
|
147
|
+
const drmType = getDrmType(drm);
|
|
148
|
+
if (!drmType) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (drmType === "fairplay" && streamType === "hls") {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
132
156
|
const util$3 = window["VePlayer"].util;
|
|
133
157
|
const strategy = window["VePlayer"].strategy;
|
|
134
158
|
const getTypeStrategy = async (options, player) => {
|
|
@@ -143,6 +167,9 @@ const getTypeStrategy = async (options, player) => {
|
|
|
143
167
|
return await strategy.getFlvStrategy(options);
|
|
144
168
|
}
|
|
145
169
|
if (type === "hls") {
|
|
170
|
+
if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
|
|
171
|
+
return { options: {}, plugins: [] };
|
|
172
|
+
}
|
|
146
173
|
return await strategy.getHlsStrategy(options);
|
|
147
174
|
}
|
|
148
175
|
return { options: {}, plugins: [] };
|
|
@@ -282,9 +309,9 @@ const event = window["VePlayer"].event;
|
|
|
282
309
|
const Events = {
|
|
283
310
|
...event.Events,
|
|
284
311
|
// 直播的Events
|
|
285
|
-
TIME_SHIFT_CHANGE: "
|
|
312
|
+
TIME_SHIFT_CHANGE: "timeShiftChange",
|
|
286
313
|
// 切换时移状态
|
|
287
|
-
REFRESH_CLICK: "
|
|
314
|
+
REFRESH_CLICK: "refreshClick"
|
|
288
315
|
// 触发刷新
|
|
289
316
|
};
|
|
290
317
|
function RefreshIcon() {
|
|
@@ -2829,9 +2856,6 @@ const generateSessionId = () => {
|
|
|
2829
2856
|
return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
|
|
2830
2857
|
};
|
|
2831
2858
|
const Plugin$2 = window["VePlayer"].Plugin;
|
|
2832
|
-
const CN_APPID = 468759;
|
|
2833
|
-
const CHANNEL = "cn";
|
|
2834
|
-
const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
|
|
2835
2859
|
class Logger extends Plugin$2 {
|
|
2836
2860
|
constructor() {
|
|
2837
2861
|
super(...arguments);
|
|
@@ -2886,9 +2910,8 @@ class Logger extends Plugin$2 {
|
|
|
2886
2910
|
}
|
|
2887
2911
|
_createTea() {
|
|
2888
2912
|
q.init({
|
|
2889
|
-
app_id:
|
|
2890
|
-
channel:
|
|
2891
|
-
channel_domain: CHANNEL_DOMAIN
|
|
2913
|
+
app_id: 468759,
|
|
2914
|
+
channel: "cn"
|
|
2892
2915
|
});
|
|
2893
2916
|
q.start();
|
|
2894
2917
|
q.config({
|
|
@@ -2907,9 +2930,9 @@ class Logger extends Plugin$2 {
|
|
|
2907
2930
|
user_id: this._userId,
|
|
2908
2931
|
device_id: this._deviceId,
|
|
2909
2932
|
ext: {
|
|
2910
|
-
veplayer_version: "2.
|
|
2911
|
-
flv_version: "3.0.
|
|
2912
|
-
hls_version: "3.0.
|
|
2933
|
+
veplayer_version: "2.3.0-rc.0",
|
|
2934
|
+
flv_version: "3.0.12",
|
|
2935
|
+
hls_version: "3.0.12",
|
|
2913
2936
|
rts_version: "0.2.0-alpha.5"
|
|
2914
2937
|
}
|
|
2915
2938
|
});
|
|
@@ -3060,7 +3083,7 @@ class InfoPanel extends Plugin$1 {
|
|
|
3060
3083
|
_tick() {
|
|
3061
3084
|
clearTimeout(this._pollTimer);
|
|
3062
3085
|
this._renderPanel();
|
|
3063
|
-
this._pollTimer = setTimeout(() => {
|
|
3086
|
+
this._pollTimer = window.setTimeout(() => {
|
|
3064
3087
|
this._tick();
|
|
3065
3088
|
}, this.config.interval);
|
|
3066
3089
|
}
|
|
@@ -3178,6 +3201,39 @@ const ZH_CN$1 = {
|
|
|
3178
3201
|
DECODE_INFO: "软解信息",
|
|
3179
3202
|
REFRESH: "刷新"
|
|
3180
3203
|
};
|
|
3204
|
+
const DynamicModule$1 = window["VePlayer"].DynamicModule;
|
|
3205
|
+
const load$1 = window["VePlayer"].load;
|
|
3206
|
+
const getDrmStrategy = async (options, player) => {
|
|
3207
|
+
var _a;
|
|
3208
|
+
const drmType = getDrmType(options.drm);
|
|
3209
|
+
if (options.url && drmType === DrmType.Fairplay) {
|
|
3210
|
+
try {
|
|
3211
|
+
const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
|
|
3212
|
+
const [drmPlugin, drmConfig] = await Promise.all([
|
|
3213
|
+
load$1(DynamicModule$1.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
|
|
3214
|
+
getDrmConfig == null ? void 0 : getDrmConfig({
|
|
3215
|
+
url: options.url
|
|
3216
|
+
})
|
|
3217
|
+
]);
|
|
3218
|
+
const fairplayDrmConfig = Object.assign(
|
|
3219
|
+
{},
|
|
3220
|
+
originFairplayConfig,
|
|
3221
|
+
options == null ? void 0 : options.drm,
|
|
3222
|
+
drmConfig
|
|
3223
|
+
);
|
|
3224
|
+
drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
|
|
3225
|
+
return {
|
|
3226
|
+
options: {
|
|
3227
|
+
drm: fairplayDrmConfig
|
|
3228
|
+
},
|
|
3229
|
+
plugins: drmPlugin ? [drmPlugin] : []
|
|
3230
|
+
};
|
|
3231
|
+
} catch (error2) {
|
|
3232
|
+
console.log(error2);
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
return {};
|
|
3236
|
+
};
|
|
3181
3237
|
const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
|
|
3182
3238
|
const VePlayerBase = window["VePlayer"].VePlayerBase;
|
|
3183
3239
|
const VeI18n = window["VePlayer"].VeI18n;
|
|
@@ -3200,7 +3256,11 @@ var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
|
|
|
3200
3256
|
return RTMCodec2;
|
|
3201
3257
|
})(RTMCodec || {});
|
|
3202
3258
|
class VePlayerLive extends VePlayerBase {
|
|
3203
|
-
/**
|
|
3259
|
+
/** {zh}
|
|
3260
|
+
* @hidden
|
|
3261
|
+
* @param options
|
|
3262
|
+
*/
|
|
3263
|
+
/** {en}
|
|
3204
3264
|
* @hidden
|
|
3205
3265
|
* @param options
|
|
3206
3266
|
*/
|
|
@@ -3210,6 +3270,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3210
3270
|
/** {zh}
|
|
3211
3271
|
* @brief 调用此方法开启直播日志上报。
|
|
3212
3272
|
*/
|
|
3273
|
+
/** {en}
|
|
3274
|
+
* @brief Enables log upload.
|
|
3275
|
+
*/
|
|
3213
3276
|
openLog() {
|
|
3214
3277
|
var _a;
|
|
3215
3278
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.open();
|
|
@@ -3217,6 +3280,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3217
3280
|
/** {zh}
|
|
3218
3281
|
* @brief 调用此方法关闭直播日志上报。
|
|
3219
3282
|
*/
|
|
3283
|
+
/** {en}
|
|
3284
|
+
* @brief Disables log upload.
|
|
3285
|
+
*/
|
|
3220
3286
|
closeLog() {
|
|
3221
3287
|
var _a;
|
|
3222
3288
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.close();
|
|
@@ -3224,6 +3290,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3224
3290
|
/** {zh}
|
|
3225
3291
|
* @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
|
|
3226
3292
|
*/
|
|
3293
|
+
/** {en}
|
|
3294
|
+
* @brief Turns on the information panel, which displays basic information including stream format, frame rate, bitrate, GOP, video resolution, codec, buffer time, and playback progress. If software decoding is used, the software decoding efficiency and CPU consumption will also be displayed.
|
|
3295
|
+
*/
|
|
3227
3296
|
openInfoPanel() {
|
|
3228
3297
|
var _a;
|
|
3229
3298
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
|
|
@@ -3232,10 +3301,22 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3232
3301
|
* @brief 调用此方法关闭直播信息面板。
|
|
3233
3302
|
*
|
|
3234
3303
|
*/
|
|
3304
|
+
/** {en}
|
|
3305
|
+
* @brief Turns off the information panel.
|
|
3306
|
+
*
|
|
3307
|
+
*/
|
|
3235
3308
|
closeInfoPanel() {
|
|
3236
3309
|
var _a;
|
|
3237
3310
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
3238
3311
|
}
|
|
3312
|
+
/** {zh}
|
|
3313
|
+
* @brief 调用此方法更新 DRM 鉴权配置。
|
|
3314
|
+
* @hidden
|
|
3315
|
+
*/
|
|
3316
|
+
updateDrmConfig(config) {
|
|
3317
|
+
var _a, _b, _c;
|
|
3318
|
+
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
3319
|
+
}
|
|
3239
3320
|
}
|
|
3240
3321
|
async function createLivePlayer(options) {
|
|
3241
3322
|
var _a, _b;
|
|
@@ -3260,7 +3341,16 @@ async function createLivePlayer(options) {
|
|
|
3260
3341
|
};
|
|
3261
3342
|
},
|
|
3262
3343
|
async preparePlugins(url) {
|
|
3263
|
-
|
|
3344
|
+
const [typeStrategy, drmStrategy] = await Promise.all([
|
|
3345
|
+
getTypeStrategy({ ...finalOptions, url }, player),
|
|
3346
|
+
getDrmStrategy({ ...finalOptions, url }, player)
|
|
3347
|
+
]);
|
|
3348
|
+
const { options: options2, plugins } = typeStrategy ?? {};
|
|
3349
|
+
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
3350
|
+
return {
|
|
3351
|
+
options: Object.assign({}, options2, drmOptions),
|
|
3352
|
+
plugins: [...plugins ?? [], ...drmPlugins ?? []]
|
|
3353
|
+
};
|
|
3264
3354
|
}
|
|
3265
3355
|
},
|
|
3266
3356
|
VePlayerLive
|
|
@@ -3290,6 +3380,7 @@ const DecodeType = window["VePlayer"].DecodeType;
|
|
|
3290
3380
|
const Degradation = window["VePlayer"].Degradation;
|
|
3291
3381
|
const POSITIONS = window["VePlayer"].POSITIONS;
|
|
3292
3382
|
const register = window["VePlayer"].register;
|
|
3383
|
+
const registerPlugin = window["VePlayer"].registerPlugin;
|
|
3293
3384
|
const EN = window["VePlayer"].EN;
|
|
3294
3385
|
const ZH_CN = window["VePlayer"].ZH_CN;
|
|
3295
3386
|
const Plugin = window["VePlayer"].Plugin;
|
|
@@ -3297,6 +3388,7 @@ const Sniffer = window["VePlayer"].Sniffer;
|
|
|
3297
3388
|
const DynamicModule = window["VePlayer"].DynamicModule;
|
|
3298
3389
|
const util = window["VePlayer"].util;
|
|
3299
3390
|
const load = window["VePlayer"].load;
|
|
3391
|
+
const ListType = window["VePlayer"].ListType;
|
|
3300
3392
|
setModuleSystem("esm");
|
|
3301
3393
|
const isMseSupported = util.isMseSupported;
|
|
3302
3394
|
const isSoftDecodeSupported = util.isSoftDecodeSupported;
|
|
@@ -3306,6 +3398,7 @@ export {
|
|
|
3306
3398
|
Degradation,
|
|
3307
3399
|
DynamicModule,
|
|
3308
3400
|
EN,
|
|
3401
|
+
ListType,
|
|
3309
3402
|
POSITIONS,
|
|
3310
3403
|
Plugin,
|
|
3311
3404
|
RTMCodec,
|
|
@@ -3319,5 +3412,6 @@ export {
|
|
|
3319
3412
|
live,
|
|
3320
3413
|
load,
|
|
3321
3414
|
register,
|
|
3415
|
+
registerPlugin,
|
|
3322
3416
|
util
|
|
3323
3417
|
};
|