@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
|
@@ -32,30 +32,30 @@ var __publicField = (obj, key, value) => {
|
|
|
32
32
|
function create(errorCode, i18n) {
|
|
33
33
|
return new VeError(ERRORS[errorCode], i18n);
|
|
34
34
|
}
|
|
35
|
-
const DynamicModule$
|
|
36
|
-
const load$
|
|
35
|
+
const DynamicModule$3 = window["VePlayer"].DynamicModule;
|
|
36
|
+
const load$3 = window["VePlayer"].load;
|
|
37
37
|
async function isRTMSupported() {
|
|
38
|
-
const { RtmPlugin } = await load$
|
|
38
|
+
const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
|
|
39
39
|
return RtmPlugin.isSupported();
|
|
40
40
|
}
|
|
41
41
|
async function isRTMSupportCodec(codec = RTMCodec.H264) {
|
|
42
|
-
const { RtmPlugin } = await load$
|
|
42
|
+
const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
|
|
43
43
|
if (codec === RTMCodec.H264)
|
|
44
44
|
return RtmPlugin.isSupportedH264();
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
const strategy$1 = window["VePlayer"].strategy;
|
|
48
48
|
const util$4 = window["VePlayer"].util;
|
|
49
|
-
const DynamicModule$
|
|
50
|
-
const load$
|
|
49
|
+
const DynamicModule$2 = window["VePlayer"].DynamicModule;
|
|
50
|
+
const load$2 = window["VePlayer"].load;
|
|
51
51
|
const Codec$1 = window["VePlayer"].Codec;
|
|
52
|
-
const Sniffer$
|
|
52
|
+
const Sniffer$3 = window["VePlayer"].Sniffer;
|
|
53
53
|
const rtmStrategy = {
|
|
54
54
|
options: {},
|
|
55
|
-
module: DynamicModule$
|
|
55
|
+
module: DynamicModule$2.PluginRtm
|
|
56
56
|
};
|
|
57
57
|
const generateFallbackUrl = (url) => {
|
|
58
|
-
if (Sniffer$
|
|
58
|
+
if (Sniffer$3.device === "pc") {
|
|
59
59
|
return url.replace(".sdp", ".flv");
|
|
60
60
|
} else {
|
|
61
61
|
return url.replace(".sdp", ".m3u8");
|
|
@@ -75,17 +75,17 @@ var __publicField = (obj, key, value) => {
|
|
|
75
75
|
const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
|
|
76
76
|
if (backupType === "flv" && util$4.isMseSupported(Codec$1.H264)) {
|
|
77
77
|
backupStrategy = strategy$1.createFlvMseStrategy(options);
|
|
78
|
-
} else if (backupType === "hls" && (Sniffer$
|
|
78
|
+
} 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)) {
|
|
79
79
|
backupStrategy = strategy$1.createHlsMseStrategy(options);
|
|
80
80
|
}
|
|
81
81
|
const [rtmCdn, backupCdn] = await Promise.all([
|
|
82
|
-
load$
|
|
82
|
+
load$2(rtmStrategy.module).then((module2) => {
|
|
83
83
|
return module2.RtmPlugin;
|
|
84
84
|
}).catch(() => void 0),
|
|
85
|
-
backupStrategy && load$
|
|
86
|
-
if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$
|
|
85
|
+
backupStrategy && load$2(backupStrategy.module).then((module2) => {
|
|
86
|
+
if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginFlv) {
|
|
87
87
|
return module2.FlvPlugin;
|
|
88
|
-
} else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$
|
|
88
|
+
} else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls) {
|
|
89
89
|
return module2.HlsPlugin;
|
|
90
90
|
}
|
|
91
91
|
}).catch(() => void 0)
|
|
@@ -133,6 +133,30 @@ var __publicField = (obj, key, value) => {
|
|
|
133
133
|
plugins: rtmCdn ? [rtmCdn] : []
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
|
+
const Sniffer$2 = window["VePlayer"].Sniffer;
|
|
137
|
+
var DrmType = /* @__PURE__ */ ((DrmType2) => {
|
|
138
|
+
DrmType2["Fairplay"] = "fairplay";
|
|
139
|
+
return DrmType2;
|
|
140
|
+
})(DrmType || {});
|
|
141
|
+
function getDrmType(drm) {
|
|
142
|
+
if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$2.browser === "safari" || Sniffer$2.os.isIos)) {
|
|
143
|
+
return "fairplay";
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
function isMseSupportedWithDrm({
|
|
148
|
+
drm,
|
|
149
|
+
streamType
|
|
150
|
+
}) {
|
|
151
|
+
const drmType = getDrmType(drm);
|
|
152
|
+
if (!drmType) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
if (drmType === "fairplay" && streamType === "hls") {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
136
160
|
const util$3 = window["VePlayer"].util;
|
|
137
161
|
const strategy = window["VePlayer"].strategy;
|
|
138
162
|
const getTypeStrategy = async (options, player) => {
|
|
@@ -147,6 +171,9 @@ var __publicField = (obj, key, value) => {
|
|
|
147
171
|
return await strategy.getFlvStrategy(options);
|
|
148
172
|
}
|
|
149
173
|
if (type === "hls") {
|
|
174
|
+
if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
|
|
175
|
+
return { options: {}, plugins: [] };
|
|
176
|
+
}
|
|
150
177
|
return await strategy.getHlsStrategy(options);
|
|
151
178
|
}
|
|
152
179
|
return { options: {}, plugins: [] };
|
|
@@ -286,9 +313,9 @@ var __publicField = (obj, key, value) => {
|
|
|
286
313
|
const Events = {
|
|
287
314
|
...event.Events,
|
|
288
315
|
// 直播的Events
|
|
289
|
-
TIME_SHIFT_CHANGE: "
|
|
316
|
+
TIME_SHIFT_CHANGE: "timeShiftChange",
|
|
290
317
|
// 切换时移状态
|
|
291
|
-
REFRESH_CLICK: "
|
|
318
|
+
REFRESH_CLICK: "refreshClick"
|
|
292
319
|
// 触发刷新
|
|
293
320
|
};
|
|
294
321
|
function RefreshIcon() {
|
|
@@ -2833,9 +2860,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2833
2860
|
return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
|
|
2834
2861
|
};
|
|
2835
2862
|
const Plugin$2 = window["VePlayer"].Plugin;
|
|
2836
|
-
const CN_APPID = 468759;
|
|
2837
|
-
const CHANNEL = "cn";
|
|
2838
|
-
const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
|
|
2839
2863
|
class Logger extends Plugin$2 {
|
|
2840
2864
|
constructor() {
|
|
2841
2865
|
super(...arguments);
|
|
@@ -2890,9 +2914,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2890
2914
|
}
|
|
2891
2915
|
_createTea() {
|
|
2892
2916
|
q.init({
|
|
2893
|
-
app_id:
|
|
2894
|
-
channel:
|
|
2895
|
-
channel_domain: CHANNEL_DOMAIN
|
|
2917
|
+
app_id: 468759,
|
|
2918
|
+
channel: "cn"
|
|
2896
2919
|
});
|
|
2897
2920
|
q.start();
|
|
2898
2921
|
q.config({
|
|
@@ -2911,9 +2934,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2911
2934
|
user_id: this._userId,
|
|
2912
2935
|
device_id: this._deviceId,
|
|
2913
2936
|
ext: {
|
|
2914
|
-
veplayer_version: "2.
|
|
2915
|
-
flv_version: "3.0.
|
|
2916
|
-
hls_version: "3.0.
|
|
2937
|
+
veplayer_version: "2.3.0-rc.0",
|
|
2938
|
+
flv_version: "3.0.12",
|
|
2939
|
+
hls_version: "3.0.12",
|
|
2917
2940
|
rts_version: "0.2.0-alpha.5"
|
|
2918
2941
|
}
|
|
2919
2942
|
});
|
|
@@ -3064,7 +3087,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3064
3087
|
_tick() {
|
|
3065
3088
|
clearTimeout(this._pollTimer);
|
|
3066
3089
|
this._renderPanel();
|
|
3067
|
-
this._pollTimer = setTimeout(() => {
|
|
3090
|
+
this._pollTimer = window.setTimeout(() => {
|
|
3068
3091
|
this._tick();
|
|
3069
3092
|
}, this.config.interval);
|
|
3070
3093
|
}
|
|
@@ -3182,6 +3205,39 @@ var __publicField = (obj, key, value) => {
|
|
|
3182
3205
|
DECODE_INFO: "软解信息",
|
|
3183
3206
|
REFRESH: "刷新"
|
|
3184
3207
|
};
|
|
3208
|
+
const DynamicModule$1 = window["VePlayer"].DynamicModule;
|
|
3209
|
+
const load$1 = window["VePlayer"].load;
|
|
3210
|
+
const getDrmStrategy = async (options, player) => {
|
|
3211
|
+
var _a;
|
|
3212
|
+
const drmType = getDrmType(options.drm);
|
|
3213
|
+
if (options.url && drmType === DrmType.Fairplay) {
|
|
3214
|
+
try {
|
|
3215
|
+
const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
|
|
3216
|
+
const [drmPlugin, drmConfig] = await Promise.all([
|
|
3217
|
+
load$1(DynamicModule$1.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
|
|
3218
|
+
getDrmConfig == null ? void 0 : getDrmConfig({
|
|
3219
|
+
url: options.url
|
|
3220
|
+
})
|
|
3221
|
+
]);
|
|
3222
|
+
const fairplayDrmConfig = Object.assign(
|
|
3223
|
+
{},
|
|
3224
|
+
originFairplayConfig,
|
|
3225
|
+
options == null ? void 0 : options.drm,
|
|
3226
|
+
drmConfig
|
|
3227
|
+
);
|
|
3228
|
+
drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
|
|
3229
|
+
return {
|
|
3230
|
+
options: {
|
|
3231
|
+
drm: fairplayDrmConfig
|
|
3232
|
+
},
|
|
3233
|
+
plugins: drmPlugin ? [drmPlugin] : []
|
|
3234
|
+
};
|
|
3235
|
+
} catch (error2) {
|
|
3236
|
+
console.log(error2);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
return {};
|
|
3240
|
+
};
|
|
3185
3241
|
const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
|
|
3186
3242
|
const VePlayerBase = window["VePlayer"].VePlayerBase;
|
|
3187
3243
|
const VeI18n = window["VePlayer"].VeI18n;
|
|
@@ -3204,7 +3260,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3204
3260
|
return RTMCodec2;
|
|
3205
3261
|
})(RTMCodec || {});
|
|
3206
3262
|
class VePlayerLive extends VePlayerBase {
|
|
3207
|
-
/**
|
|
3263
|
+
/** {zh}
|
|
3264
|
+
* @hidden
|
|
3265
|
+
* @param options
|
|
3266
|
+
*/
|
|
3267
|
+
/** {en}
|
|
3208
3268
|
* @hidden
|
|
3209
3269
|
* @param options
|
|
3210
3270
|
*/
|
|
@@ -3214,6 +3274,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3214
3274
|
/** {zh}
|
|
3215
3275
|
* @brief 调用此方法开启直播日志上报。
|
|
3216
3276
|
*/
|
|
3277
|
+
/** {en}
|
|
3278
|
+
* @brief Enables log upload.
|
|
3279
|
+
*/
|
|
3217
3280
|
openLog() {
|
|
3218
3281
|
var _a;
|
|
3219
3282
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.open();
|
|
@@ -3221,6 +3284,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3221
3284
|
/** {zh}
|
|
3222
3285
|
* @brief 调用此方法关闭直播日志上报。
|
|
3223
3286
|
*/
|
|
3287
|
+
/** {en}
|
|
3288
|
+
* @brief Disables log upload.
|
|
3289
|
+
*/
|
|
3224
3290
|
closeLog() {
|
|
3225
3291
|
var _a;
|
|
3226
3292
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.close();
|
|
@@ -3228,6 +3294,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3228
3294
|
/** {zh}
|
|
3229
3295
|
* @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
|
|
3230
3296
|
*/
|
|
3297
|
+
/** {en}
|
|
3298
|
+
* @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.
|
|
3299
|
+
*/
|
|
3231
3300
|
openInfoPanel() {
|
|
3232
3301
|
var _a;
|
|
3233
3302
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
|
|
@@ -3236,10 +3305,22 @@ var __publicField = (obj, key, value) => {
|
|
|
3236
3305
|
* @brief 调用此方法关闭直播信息面板。
|
|
3237
3306
|
*
|
|
3238
3307
|
*/
|
|
3308
|
+
/** {en}
|
|
3309
|
+
* @brief Turns off the information panel.
|
|
3310
|
+
*
|
|
3311
|
+
*/
|
|
3239
3312
|
closeInfoPanel() {
|
|
3240
3313
|
var _a;
|
|
3241
3314
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
3242
3315
|
}
|
|
3316
|
+
/** {zh}
|
|
3317
|
+
* @brief 调用此方法更新 DRM 鉴权配置。
|
|
3318
|
+
* @hidden
|
|
3319
|
+
*/
|
|
3320
|
+
updateDrmConfig(config) {
|
|
3321
|
+
var _a, _b, _c;
|
|
3322
|
+
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
3323
|
+
}
|
|
3243
3324
|
}
|
|
3244
3325
|
async function createLivePlayer(options) {
|
|
3245
3326
|
var _a, _b;
|
|
@@ -3264,7 +3345,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3264
3345
|
};
|
|
3265
3346
|
},
|
|
3266
3347
|
async preparePlugins(url) {
|
|
3267
|
-
|
|
3348
|
+
const [typeStrategy, drmStrategy] = await Promise.all([
|
|
3349
|
+
getTypeStrategy({ ...finalOptions, url }, player),
|
|
3350
|
+
getDrmStrategy({ ...finalOptions, url }, player)
|
|
3351
|
+
]);
|
|
3352
|
+
const { options: options2, plugins } = typeStrategy ?? {};
|
|
3353
|
+
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
3354
|
+
return {
|
|
3355
|
+
options: Object.assign({}, options2, drmOptions),
|
|
3356
|
+
plugins: [...plugins ?? [], ...drmPlugins ?? []]
|
|
3357
|
+
};
|
|
3268
3358
|
}
|
|
3269
3359
|
},
|
|
3270
3360
|
VePlayerLive
|
|
@@ -3294,6 +3384,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3294
3384
|
const Degradation = window["VePlayer"].Degradation;
|
|
3295
3385
|
const POSITIONS = window["VePlayer"].POSITIONS;
|
|
3296
3386
|
const register = window["VePlayer"].register;
|
|
3387
|
+
const registerPlugin = window["VePlayer"].registerPlugin;
|
|
3297
3388
|
const EN = window["VePlayer"].EN;
|
|
3298
3389
|
const ZH_CN = window["VePlayer"].ZH_CN;
|
|
3299
3390
|
const Plugin = window["VePlayer"].Plugin;
|
|
@@ -3301,15 +3392,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3301
3392
|
const DynamicModule = window["VePlayer"].DynamicModule;
|
|
3302
3393
|
const util = window["VePlayer"].util;
|
|
3303
3394
|
const load = window["VePlayer"].load;
|
|
3395
|
+
const ListType = window["VePlayer"].ListType;
|
|
3304
3396
|
setModuleSystem("umd");
|
|
3305
3397
|
const isMseSupported = util.isMseSupported;
|
|
3306
3398
|
const isSoftDecodeSupported = util.isSoftDecodeSupported;
|
|
3307
|
-
if (typeof VePlayer.
|
|
3308
|
-
VePlayer.
|
|
3399
|
+
if (typeof VePlayer.registerPlugin !== "undefined") {
|
|
3400
|
+
VePlayer.registerPlugin(DynamicModule.BizLive, {
|
|
3309
3401
|
createLivePlayer
|
|
3310
3402
|
});
|
|
3311
3403
|
} else {
|
|
3312
|
-
|
|
3404
|
+
registerPlugin(DynamicModule.BizLive, {
|
|
3313
3405
|
createLivePlayer
|
|
3314
3406
|
});
|
|
3315
3407
|
}
|
|
@@ -3318,6 +3410,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3318
3410
|
exports2.Degradation = Degradation;
|
|
3319
3411
|
exports2.DynamicModule = DynamicModule;
|
|
3320
3412
|
exports2.EN = EN;
|
|
3413
|
+
exports2.ListType = ListType;
|
|
3321
3414
|
exports2.POSITIONS = POSITIONS;
|
|
3322
3415
|
exports2.Plugin = Plugin;
|
|
3323
3416
|
exports2.RTMCodec = RTMCodec;
|
|
@@ -3331,5 +3424,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3331
3424
|
exports2.live = live;
|
|
3332
3425
|
exports2.load = load;
|
|
3333
3426
|
exports2.register = register;
|
|
3427
|
+
exports2.registerPlugin = registerPlugin;
|
|
3334
3428
|
exports2.util = util;
|
|
3335
3429
|
});
|