@volcengine/veplayer 2.2.0-rc.2 → 2.3.0-rc.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/LICENSE +20 -0
- package/esm/index.d.ts +84 -88
- package/esm/veplayer.biz.live.development.js +104 -27
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +327 -178
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +458 -143
- package/esm/veplayer.live.d.ts +327 -178
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +458 -143
- 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 +84 -88
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +366 -125
- 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 +84 -88
- package/umd/veplayer.biz.live.development.js +107 -30
- 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 +327 -178
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +457 -142
- package/umd/veplayer.live.d.ts +327 -178
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +460 -145
- 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 +84 -88
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +371 -130
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +327 -178
- package/veplayer.live.d.ts +327 -178
- package/veplayer.vod.d.ts +84 -88
|
@@ -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;
|
|
@@ -3236,6 +3292,14 @@ class VePlayerLive extends VePlayerBase {
|
|
|
3236
3292
|
var _a;
|
|
3237
3293
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
3238
3294
|
}
|
|
3295
|
+
/** {zh}
|
|
3296
|
+
* @brief 调用此方法更新 DRM 鉴权配置。
|
|
3297
|
+
* @hidden
|
|
3298
|
+
*/
|
|
3299
|
+
updateDrmConfig(config) {
|
|
3300
|
+
var _a, _b, _c;
|
|
3301
|
+
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
3302
|
+
}
|
|
3239
3303
|
}
|
|
3240
3304
|
async function createLivePlayer(options) {
|
|
3241
3305
|
var _a, _b;
|
|
@@ -3260,7 +3324,16 @@ async function createLivePlayer(options) {
|
|
|
3260
3324
|
};
|
|
3261
3325
|
},
|
|
3262
3326
|
async preparePlugins(url) {
|
|
3263
|
-
|
|
3327
|
+
const [typeStrategy, drmStrategy] = await Promise.all([
|
|
3328
|
+
getTypeStrategy({ ...finalOptions, url }, player),
|
|
3329
|
+
getDrmStrategy({ ...finalOptions, url }, player)
|
|
3330
|
+
]);
|
|
3331
|
+
const { options: options2, plugins } = typeStrategy ?? {};
|
|
3332
|
+
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
3333
|
+
return {
|
|
3334
|
+
options: Object.assign({}, options2, drmOptions),
|
|
3335
|
+
plugins: [...plugins ?? [], ...drmPlugins ?? []]
|
|
3336
|
+
};
|
|
3264
3337
|
}
|
|
3265
3338
|
},
|
|
3266
3339
|
VePlayerLive
|
|
@@ -3290,6 +3363,7 @@ const DecodeType = window["VePlayer"].DecodeType;
|
|
|
3290
3363
|
const Degradation = window["VePlayer"].Degradation;
|
|
3291
3364
|
const POSITIONS = window["VePlayer"].POSITIONS;
|
|
3292
3365
|
const register = window["VePlayer"].register;
|
|
3366
|
+
const registerPlugin = window["VePlayer"].registerPlugin;
|
|
3293
3367
|
const EN = window["VePlayer"].EN;
|
|
3294
3368
|
const ZH_CN = window["VePlayer"].ZH_CN;
|
|
3295
3369
|
const Plugin = window["VePlayer"].Plugin;
|
|
@@ -3297,6 +3371,7 @@ const Sniffer = window["VePlayer"].Sniffer;
|
|
|
3297
3371
|
const DynamicModule = window["VePlayer"].DynamicModule;
|
|
3298
3372
|
const util = window["VePlayer"].util;
|
|
3299
3373
|
const load = window["VePlayer"].load;
|
|
3374
|
+
const ListType = window["VePlayer"].ListType;
|
|
3300
3375
|
setModuleSystem("esm");
|
|
3301
3376
|
const isMseSupported = util.isMseSupported;
|
|
3302
3377
|
const isSoftDecodeSupported = util.isSoftDecodeSupported;
|
|
@@ -3306,6 +3381,7 @@ export {
|
|
|
3306
3381
|
Degradation,
|
|
3307
3382
|
DynamicModule,
|
|
3308
3383
|
EN,
|
|
3384
|
+
ListType,
|
|
3309
3385
|
POSITIONS,
|
|
3310
3386
|
Plugin,
|
|
3311
3387
|
RTMCodec,
|
|
@@ -3319,5 +3395,6 @@ export {
|
|
|
3319
3395
|
live,
|
|
3320
3396
|
load,
|
|
3321
3397
|
register,
|
|
3398
|
+
registerPlugin,
|
|
3322
3399
|
util
|
|
3323
3400
|
};
|