@ezuikit/player-theme 1.0.0-beta.1 → 1.0.1-alpha.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/dist/index.js +194 -41
- package/dist/index.mjs +194 -41
- package/dist/index.umd.js +2284 -1382
- package/dist/style.css +3 -3
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +76 -70
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v1.0.
|
|
3
|
-
* Copyright (c) 2025-
|
|
2
|
+
* @ezuikit/player-theme v1.0.1-alpha.0
|
|
3
|
+
* Copyright (c) 2025-11-11 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
@@ -20,7 +20,12 @@ var controlTimeLine = require('@ezuikit/control-time-line');
|
|
|
20
20
|
/**
|
|
21
21
|
* 播放器的类名前缀
|
|
22
22
|
*/ const PREFIX_CLASS = 'ezplayer';
|
|
23
|
-
const DATE_PICKER_ICON_WIDTH = 36;
|
|
23
|
+
/** */ const DATE_PICKER_ICON_WIDTH = 36;
|
|
24
|
+
/** 填充模式 */ const THEME_SCALE_MODE_TYPE = {
|
|
25
|
+
/** 画面完全填充canvas区域,画面会被拉伸 */ full: 0,
|
|
26
|
+
/** 画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边 */ auto: 1,
|
|
27
|
+
/** 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全 */ fullAuto: 2
|
|
28
|
+
};
|
|
24
29
|
// 切换主题时把当前的状态传给控件, 而不是传 theme 对象, 为了解耦
|
|
25
30
|
// 不要添加方法,只添加状态
|
|
26
31
|
const THEME_PROPS = [
|
|
@@ -188,6 +193,7 @@ const EVENTS = {
|
|
|
188
193
|
/** 日期改变 */ dateChange: 'Control.dateChange',
|
|
189
194
|
/** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
|
|
190
195
|
/** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
|
|
196
|
+
/** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
|
|
191
197
|
/** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
|
|
192
198
|
/** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
|
|
193
199
|
/** 主题控件挂载完成, 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ mountedControls: 'Control.mountedControls',
|
|
@@ -3209,8 +3215,68 @@ var en = {
|
|
|
3209
3215
|
* 截图控件
|
|
3210
3216
|
* @category Content
|
|
3211
3217
|
*/ class Content extends EventEmitter {
|
|
3218
|
+
/**
|
|
3219
|
+
* 重新画面区域
|
|
3220
|
+
* @param {number} originWidth 画面宽度
|
|
3221
|
+
* @param {number} originHeight 画面高度
|
|
3222
|
+
* @returns {void}
|
|
3223
|
+
*/ _rerender(originWidth = 0, originHeight = 0) {
|
|
3224
|
+
const width = this.$wrapper.clientWidth;
|
|
3225
|
+
const height = this.$wrapper.clientHeight;
|
|
3226
|
+
if (originWidth > 0 && originHeight > 0) {
|
|
3227
|
+
this._originWidth = originWidth;
|
|
3228
|
+
this._originHeight = originHeight;
|
|
3229
|
+
}
|
|
3230
|
+
// 默认是1
|
|
3231
|
+
// 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边
|
|
3232
|
+
let objectFill = 'contain';
|
|
3233
|
+
// 视频画面完全填充canvas区域,画面会被拉伸
|
|
3234
|
+
if (this._scaleMode === THEME_SCALE_MODE_TYPE.full) {
|
|
3235
|
+
objectFill = 'fill';
|
|
3236
|
+
}
|
|
3237
|
+
// 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全
|
|
3238
|
+
if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
|
|
3239
|
+
objectFill = 'cover';
|
|
3240
|
+
}
|
|
3241
|
+
if (width > 0 && height > 0 && this._originWidth > 0 && this._originHeight > 0 && this.$video) {
|
|
3242
|
+
const left = (width - this._originWidth) / 2;
|
|
3243
|
+
const top = (height - this._originHeight) / 2;
|
|
3244
|
+
const wScale = width / this._originWidth;
|
|
3245
|
+
const hScale = height / this._originHeight;
|
|
3246
|
+
let scale = wScale > hScale ? hScale : wScale;
|
|
3247
|
+
//
|
|
3248
|
+
if (!(this._scaleMode === THEME_SCALE_MODE_TYPE.auto)) {
|
|
3249
|
+
if (wScale !== hScale) {
|
|
3250
|
+
scale = wScale + ',' + hScale;
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
//
|
|
3254
|
+
if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
|
|
3255
|
+
scale = wScale > hScale ? wScale : hScale;
|
|
3256
|
+
}
|
|
3257
|
+
this.$video.style.cssText += `
|
|
3258
|
+
width: ${this._originWidth}px;
|
|
3259
|
+
height: ${this._originHeight}px;
|
|
3260
|
+
position: absolute;
|
|
3261
|
+
object-fit:${objectFill};
|
|
3262
|
+
left: ${left}px;
|
|
3263
|
+
top: ${top}px;
|
|
3264
|
+
transform-origin: 50% 50%;
|
|
3265
|
+
transform: scale(${scale});
|
|
3266
|
+
`;
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
setScaleMode(scaleMode = 0) {
|
|
3270
|
+
this._scaleMode = scaleMode;
|
|
3271
|
+
this._rerender();
|
|
3272
|
+
}
|
|
3212
3273
|
destroy() {
|
|
3213
3274
|
var _this_$wrapper;
|
|
3275
|
+
if (this.$video) {
|
|
3276
|
+
this.$video.remove();
|
|
3277
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3278
|
+
this.$video = null;
|
|
3279
|
+
}
|
|
3214
3280
|
if (this.$content) {
|
|
3215
3281
|
this.$content.remove();
|
|
3216
3282
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -3223,17 +3289,27 @@ var en = {
|
|
|
3223
3289
|
this.removeAllListeners();
|
|
3224
3290
|
}
|
|
3225
3291
|
constructor(options){
|
|
3226
|
-
super();
|
|
3292
|
+
super(), this._scaleMode = 0, this._originWidth = 0, this._originHeight = 0;
|
|
3227
3293
|
this.options = options;
|
|
3294
|
+
this._scaleMode = options.scaleMode || 0;
|
|
3228
3295
|
this.$wrapper = document.createElement('div');
|
|
3229
3296
|
this.$wrapper.className = `${PREFIX_CLASS}-content-wrapper`;
|
|
3230
3297
|
this.$content = document.createElement('div');
|
|
3231
3298
|
this.$content.className = `${PREFIX_CLASS}-content`;
|
|
3299
|
+
this.$video = document.createElement('div');
|
|
3300
|
+
this.$video.className = `${PREFIX_CLASS}-content-video`;
|
|
3301
|
+
this.$content.appendChild(this.$video);
|
|
3232
3302
|
this.$wrapper.appendChild(this.$content);
|
|
3233
3303
|
if (typeof options.getContainer === 'function') {
|
|
3234
3304
|
const $popupContainer = options.getContainer();
|
|
3235
3305
|
$popupContainer.appendChild(this.$wrapper);
|
|
3236
3306
|
}
|
|
3307
|
+
this.on(EVENTS.videoInfo, (originWidth, originHeight)=>{
|
|
3308
|
+
this._rerender(originWidth, originHeight);
|
|
3309
|
+
});
|
|
3310
|
+
this.on(EVENTS.resize, ()=>{
|
|
3311
|
+
this._rerender();
|
|
3312
|
+
});
|
|
3237
3313
|
}
|
|
3238
3314
|
}
|
|
3239
3315
|
|
|
@@ -3389,6 +3465,17 @@ function debounce(func, wait) {
|
|
|
3389
3465
|
}
|
|
3390
3466
|
});
|
|
3391
3467
|
theme == null ? void 0 : theme.on(EVENTS.videoInfo, (info)=>{
|
|
3468
|
+
// 排除流信息回调触发的事件
|
|
3469
|
+
if (!!info && info.from !== "setStreamInfoCallBack") {
|
|
3470
|
+
var // rerender 画面
|
|
3471
|
+
_theme_contentControl_emit, _theme_contentControl;
|
|
3472
|
+
(_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.videoInfo, info.width, info.height);
|
|
3473
|
+
}
|
|
3474
|
+
});
|
|
3475
|
+
theme == null ? void 0 : theme.on(EVENTS.resize, ()=>{
|
|
3476
|
+
var // rerender 画面
|
|
3477
|
+
_theme_contentControl_emit, _theme_contentControl;
|
|
3478
|
+
(_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.resize);
|
|
3392
3479
|
});
|
|
3393
3480
|
theme == null ? void 0 : theme.on('getDeviceInfo', (info)=>{
|
|
3394
3481
|
});
|
|
@@ -3703,6 +3790,14 @@ function debounce(func, wait) {
|
|
|
3703
3790
|
theme.controls.timeLineControl.on(EVENTS.control.timeLineChange, (date)=>{
|
|
3704
3791
|
theme.emit(EVENTS.control.timeLineChange, date);
|
|
3705
3792
|
});
|
|
3793
|
+
theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, (open)=>{
|
|
3794
|
+
var _theme_controls_dateControl;
|
|
3795
|
+
if ((_theme_controls_dateControl = theme.controls.dateControl) == null ? void 0 : _theme_controls_dateControl.dataPickerUtil) {
|
|
3796
|
+
var _theme_controls_dateControl_dataPickerUtil, _theme_controls_dateControl1;
|
|
3797
|
+
(_theme_controls_dateControl1 = theme.controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_dataPickerUtil = _theme_controls_dateControl1.dataPickerUtil) == null ? void 0 : _theme_controls_dateControl_dataPickerUtil.hide();
|
|
3798
|
+
}
|
|
3799
|
+
theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
3800
|
+
});
|
|
3706
3801
|
theme.controls.timeLineControl.on(EVENTS.control.timeLineDestroy, ()=>{
|
|
3707
3802
|
theme.emit(EVENTS.control.timeLineDestroy);
|
|
3708
3803
|
});
|
|
@@ -3770,12 +3865,12 @@ const ignoreList = [
|
|
|
3770
3865
|
* @returns {void}
|
|
3771
3866
|
*/ function _resize(theme, width, height) {
|
|
3772
3867
|
let cssText = '';
|
|
3773
|
-
if (
|
|
3868
|
+
if (/^\d+(\.\d+)?$/.test(width + '')) {
|
|
3774
3869
|
cssText += `width: ${width}px;`;
|
|
3775
3870
|
} else if (width) {
|
|
3776
3871
|
cssText += `width: ${width};`;
|
|
3777
3872
|
}
|
|
3778
|
-
if (
|
|
3873
|
+
if (/^\d+(\.\d+)?$/.test(height + '')) {
|
|
3779
3874
|
cssText += `height: ${height}px;`;
|
|
3780
3875
|
} else if (height) {
|
|
3781
3876
|
cssText += `height: ${height};`;
|
|
@@ -3921,7 +4016,7 @@ const ZOOM_DEFAULT_OPTIONS = {
|
|
|
3921
4016
|
|
|
3922
4017
|
/*
|
|
3923
4018
|
* @ezuikit/control-zoom v0.0.2
|
|
3924
|
-
* Copyright (c) 2025-
|
|
4019
|
+
* Copyright (c) 2025-11-11 Ezviz-OpenBiz
|
|
3925
4020
|
* Released under the MIT License.
|
|
3926
4021
|
*/
|
|
3927
4022
|
/**
|
|
@@ -5301,7 +5396,7 @@ function _extends$c() {
|
|
|
5301
5396
|
|
|
5302
5397
|
/*
|
|
5303
5398
|
* @ezuikit/control-ptz v0.0.1
|
|
5304
|
-
* Copyright (c) 2025-
|
|
5399
|
+
* Copyright (c) 2025-11-11 Ezviz-OpenBiz
|
|
5305
5400
|
* Released under the MIT License.
|
|
5306
5401
|
*/
|
|
5307
5402
|
|
|
@@ -5470,11 +5565,11 @@ class MobilePtz extends BasePtz {
|
|
|
5470
5565
|
$icons[0].className = $icons[0].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
|
|
5471
5566
|
}
|
|
5472
5567
|
}
|
|
5473
|
-
$warp.style
|
|
5568
|
+
$warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
|
|
5474
5569
|
if (type === 'stop') {
|
|
5475
5570
|
var _this_options_env1;
|
|
5476
5571
|
url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
|
|
5477
|
-
$warp.style
|
|
5572
|
+
$warp.style = '';
|
|
5478
5573
|
$icons[3].className = $icons[3].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
|
|
5479
5574
|
$icons[1].className = $icons[1].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
|
|
5480
5575
|
$icons[2].className = $icons[2].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
|
|
@@ -5518,14 +5613,11 @@ class MobilePtz extends BasePtz {
|
|
|
5518
5613
|
60003,
|
|
5519
5614
|
60004
|
|
5520
5615
|
].includes(+rt.code)) {
|
|
5521
|
-
$warp.style
|
|
5616
|
+
$warp.style = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
|
|
5522
5617
|
}
|
|
5523
5618
|
}
|
|
5524
5619
|
operationResultCb == null ? void 0 : operationResultCb(rt);
|
|
5525
5620
|
}).catch((err)=>{
|
|
5526
|
-
}).finally(()=>{
|
|
5527
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
5528
|
-
operationResultCb = null;
|
|
5529
5621
|
});
|
|
5530
5622
|
}
|
|
5531
5623
|
constructor(container, options){
|
|
@@ -6797,12 +6889,14 @@ function __filter(list, locale = {}) {
|
|
|
6797
6889
|
controlType: 'button',
|
|
6798
6890
|
classNameSuffix: 'definition',
|
|
6799
6891
|
renderLabel: (label, item, list)=>{
|
|
6892
|
+
var _list_;
|
|
6800
6893
|
if ((item == null ? void 0 : item.level) === 'auto') {
|
|
6801
6894
|
var _options_locales_options_language;
|
|
6802
|
-
const
|
|
6803
|
-
return `<span>${options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO}(${(
|
|
6895
|
+
const realItem = list.find((it)=>it.level === this._level);
|
|
6896
|
+
return `<span>${options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO}(${(realItem == null ? void 0 : realItem.name) || ''})</span>`;
|
|
6804
6897
|
}
|
|
6805
|
-
|
|
6898
|
+
// 如果 label 不存在,则不显示label,直接显示list的第一个label, 一般自定义清晰度列表可能会出现
|
|
6899
|
+
return `<span>${label || ((_list_ = list[0]) == null ? void 0 : _list_.name) || ''}</span>`;
|
|
6806
6900
|
},
|
|
6807
6901
|
onChange: (value, item)=>{
|
|
6808
6902
|
var _options_onChange;
|
|
@@ -6829,9 +6923,9 @@ function __filter(list, locale = {}) {
|
|
|
6829
6923
|
this._level = realLevel + '';
|
|
6830
6924
|
if (l === 'auto') {
|
|
6831
6925
|
var _options_locales_options_language;
|
|
6832
|
-
const
|
|
6926
|
+
const realItem = this.list.find((it)=>it.level === this._level);
|
|
6833
6927
|
this.$container.querySelector(`.${PREFIX_CLASS}-select-btn`).innerHTML = `
|
|
6834
|
-
<span>${options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO}(${(
|
|
6928
|
+
<span>${options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO}(${(realItem == null ? void 0 : realItem.name) || ''})</span>
|
|
6835
6929
|
`;
|
|
6836
6930
|
} else {
|
|
6837
6931
|
if (this.value !== this._level + '') this.value = this._level + '';
|
|
@@ -6914,7 +7008,7 @@ const SPEED_DEFAULT_OPTIONS = {
|
|
|
6914
7008
|
|
|
6915
7009
|
/*
|
|
6916
7010
|
* @ezuikit/control-date-picker v0.0.1
|
|
6917
|
-
* Copyright (c) 2025-
|
|
7011
|
+
* Copyright (c) 2025-11-11 Ezviz-OpenBiz
|
|
6918
7012
|
* Released under the MIT License.
|
|
6919
7013
|
*/
|
|
6920
7014
|
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -7009,7 +7103,7 @@ const DEFAULT_OPTIONS = {
|
|
|
7009
7103
|
};
|
|
7010
7104
|
/**
|
|
7011
7105
|
* 日期选择器
|
|
7012
|
-
*/
|
|
7106
|
+
*/ class DatePicker {
|
|
7013
7107
|
_init() {
|
|
7014
7108
|
// 因为挂载在行内,需要父标签设置 position: relative;
|
|
7015
7109
|
this.$container.style.cssText += `;position: relative;`;
|
|
@@ -7137,7 +7231,7 @@ const DEFAULT_OPTIONS = {
|
|
|
7137
7231
|
}
|
|
7138
7232
|
});
|
|
7139
7233
|
}
|
|
7140
|
-
}
|
|
7234
|
+
}
|
|
7141
7235
|
|
|
7142
7236
|
/**
|
|
7143
7237
|
* @description 时间操作
|
|
@@ -7300,7 +7394,7 @@ function _extends$5() {
|
|
|
7300
7394
|
/**
|
|
7301
7395
|
* 日历选择器控件
|
|
7302
7396
|
* @category Control
|
|
7303
|
-
*/ class
|
|
7397
|
+
*/ class DatePickerControl extends Control {
|
|
7304
7398
|
_render() {
|
|
7305
7399
|
if (utilsTools.isMobile()) {
|
|
7306
7400
|
var _this_locale;
|
|
@@ -7315,7 +7409,7 @@ function _extends$5() {
|
|
|
7315
7409
|
title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
|
|
7316
7410
|
});
|
|
7317
7411
|
}
|
|
7318
|
-
this.dataPickerUtil = new DatePicker
|
|
7412
|
+
this.dataPickerUtil = new DatePicker(this.$container, {
|
|
7319
7413
|
staticPath: this.options.staticPath,
|
|
7320
7414
|
language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
|
|
7321
7415
|
current: new Date(this._value + ' 00:00:00'),
|
|
@@ -7407,10 +7501,16 @@ function _extends$4() {
|
|
|
7407
7501
|
_render() {
|
|
7408
7502
|
var _this_timeLineUtil_updateTimeSections, _this_timeLineUtil;
|
|
7409
7503
|
const _timeLineOptions = {
|
|
7410
|
-
|
|
7504
|
+
language: this._options.language || 'zh',
|
|
7505
|
+
coverQuery: this._options.coverQuery || '',
|
|
7411
7506
|
onChange: (date)=>{
|
|
7412
|
-
this.
|
|
7413
|
-
|
|
7507
|
+
if (this._currentTime !== (date == null ? void 0 : date.getTime())) {
|
|
7508
|
+
this._options.onChange == null ? void 0 : this._options.onChange.call(this._options, date);
|
|
7509
|
+
this.emit(EVENTS.control.timeLineChange, date);
|
|
7510
|
+
}
|
|
7511
|
+
},
|
|
7512
|
+
onPickerOpenChange: (open)=>{
|
|
7513
|
+
this.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
7414
7514
|
},
|
|
7415
7515
|
// 2025-10-27 仅移动端支持
|
|
7416
7516
|
onPickerSelect: (item)=>{
|
|
@@ -7486,7 +7586,8 @@ function _extends$4() {
|
|
|
7486
7586
|
tagName: 'div',
|
|
7487
7587
|
controlType: 'block',
|
|
7488
7588
|
classNameSuffix: 'time-line'
|
|
7489
|
-
})), this._$add = null, this._$reduce = null, this.records = [];
|
|
7589
|
+
})), this._$add = null, this._$reduce = null, this._currentTime = 0, this.records = [];
|
|
7590
|
+
this._currentTime = 0;
|
|
7490
7591
|
this._options = options;
|
|
7491
7592
|
this.records = ((_this__options = this._options) == null ? void 0 : (_this__options_props = _this__options.props) == null ? void 0 : _this__options_props.recordList) || [];
|
|
7492
7593
|
this._render();
|
|
@@ -7497,9 +7598,13 @@ function _extends$4() {
|
|
|
7497
7598
|
(_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_updateTimeSections = _this_timeLineUtil.updateTimeSections) == null ? void 0 : _this_timeLineUtil_updateTimeSections.call(_this_timeLineUtil, records);
|
|
7498
7599
|
});
|
|
7499
7600
|
this.on(EVENTS.getOSDTime, (time)=>{
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7601
|
+
if (time) {
|
|
7602
|
+
var // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7603
|
+
_this_timeLineUtil_update, _this_timeLineUtil;
|
|
7604
|
+
const date = new Date(time * 1000);
|
|
7605
|
+
this._currentTime = date.getTime();
|
|
7606
|
+
(_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_update = _this_timeLineUtil.update) == null ? void 0 : _this_timeLineUtil_update.call(_this_timeLineUtil, date);
|
|
7607
|
+
}
|
|
7503
7608
|
});
|
|
7504
7609
|
}
|
|
7505
7610
|
}
|
|
@@ -7565,7 +7670,7 @@ const Controls = {
|
|
|
7565
7670
|
globalFullscreen: GlobalFullscreen,
|
|
7566
7671
|
rec: Rec,
|
|
7567
7672
|
speed: Speed,
|
|
7568
|
-
date:
|
|
7673
|
+
date: DatePickerControl,
|
|
7569
7674
|
timeLine: TimeLineControl
|
|
7570
7675
|
};
|
|
7571
7676
|
|
|
@@ -7994,7 +8099,7 @@ function _renderTheme(theme, data) {
|
|
|
7994
8099
|
}
|
|
7995
8100
|
if (theme.options.posterOptions !== null) {
|
|
7996
8101
|
theme.posterControl = new Poster(_extends$1({}, theme.options.posterOptions || {}, {
|
|
7997
|
-
getPopupContainer: ()=>theme.contentControl.$
|
|
8102
|
+
getPopupContainer: ()=>theme.contentControl.$video
|
|
7998
8103
|
}));
|
|
7999
8104
|
}
|
|
8000
8105
|
theme.controls = {}; // 防止为 null
|
|
@@ -8135,12 +8240,13 @@ function _renderTheme(theme, data) {
|
|
|
8135
8240
|
}
|
|
8136
8241
|
const _renderTimeLine = (theme, container, props = {})=>{
|
|
8137
8242
|
if (!theme.controls.timeLineControl && theme.options.timeLineOptions !== null) {
|
|
8138
|
-
var _theme_options;
|
|
8243
|
+
var _theme_urlInfo, _theme_options;
|
|
8139
8244
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
8140
8245
|
theme.controls.timeLineControl = new Controls['timeLine'](_extends$1({
|
|
8141
8246
|
getPopupContainer: ()=>container,
|
|
8142
8247
|
language: theme.options.language,
|
|
8143
|
-
locales: theme.i18n.translations
|
|
8248
|
+
locales: theme.i18n.translations,
|
|
8249
|
+
coverQuery: ((_theme_urlInfo = theme.urlInfo) == null ? void 0 : _theme_urlInfo.validateCode) ? `decodekey=${theme.urlInfo.validateCode}` : ''
|
|
8144
8250
|
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options[`timeLineOptions`]) || {}, {
|
|
8145
8251
|
props
|
|
8146
8252
|
}));
|
|
@@ -8224,6 +8330,7 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
8224
8330
|
dblClickFullscreen: true,
|
|
8225
8331
|
language: 'zh',
|
|
8226
8332
|
autoPlay: true,
|
|
8333
|
+
scaleMode: THEME_SCALE_MODE_TYPE.full,
|
|
8227
8334
|
loggerOptions: {
|
|
8228
8335
|
level: 'INFO',
|
|
8229
8336
|
showTime: true
|
|
@@ -8713,6 +8820,37 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
8713
8820
|
(_this = this) == null ? void 0 : _this.emit(EVENTS.setLoggerOptions, options);
|
|
8714
8821
|
}
|
|
8715
8822
|
/**
|
|
8823
|
+
* 设置视频画面缩放模式
|
|
8824
|
+
* @since 1.0.1
|
|
8825
|
+
* @param {0 | 1 | 2} scaleMode - 缩放模式, 0: 窗口铺满, 1: 等比缩放大边铺满, 2: 等比缩放小边铺满
|
|
8826
|
+
*/ setScaleMode(scaleMode) {
|
|
8827
|
+
if ([
|
|
8828
|
+
0,
|
|
8829
|
+
1,
|
|
8830
|
+
2
|
|
8831
|
+
].includes(+scaleMode)) {
|
|
8832
|
+
var _this_contentControl_setScaleMode, _this_contentControl;
|
|
8833
|
+
this.scaleMode = +scaleMode;
|
|
8834
|
+
(_this_contentControl = this.contentControl) == null ? void 0 : (_this_contentControl_setScaleMode = _this_contentControl.setScaleMode) == null ? void 0 : _this_contentControl_setScaleMode.call(_this_contentControl, +scaleMode);
|
|
8835
|
+
const classList = this.$container.classList;
|
|
8836
|
+
for (const item of classList){
|
|
8837
|
+
if (item.startsWith(`${PREFIX_CLASS}-scale-mode-`)) {
|
|
8838
|
+
classList.remove(item);
|
|
8839
|
+
}
|
|
8840
|
+
}
|
|
8841
|
+
if (this.scaleMode === 0) {
|
|
8842
|
+
this.$container.classList.add(`${PREFIX_CLASS}-scale-mode-full`);
|
|
8843
|
+
} else if (this.scaleMode === 1) {
|
|
8844
|
+
this.$container.classList.add(`${PREFIX_CLASS}-scale-mode-auto`);
|
|
8845
|
+
} else if (this.scaleMode === 2) {
|
|
8846
|
+
this.$container.classList.add(`${PREFIX_CLASS}-scale-mode-full-auto`);
|
|
8847
|
+
}
|
|
8848
|
+
} else {
|
|
8849
|
+
var _this_logger;
|
|
8850
|
+
(_this_logger = this.logger) == null ? void 0 : _this_logger.warn('scaleMode must be 0 | 1 | 2');
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
/**
|
|
8716
8854
|
* 销毁包括事件、控件 ...
|
|
8717
8855
|
*
|
|
8718
8856
|
* Destroy (including events, controls...)
|
|
@@ -8761,7 +8899,7 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
8761
8899
|
// 私有方法
|
|
8762
8900
|
// ==============================================================================================
|
|
8763
8901
|
/** 初始化配置项 */ _initOptions(options = {}) {
|
|
8764
|
-
var _this_options_loggerOptions;
|
|
8902
|
+
var _this_options_loggerOptions, _this_options_definitionOptions_list, _this_options_definitionOptions, _this_options_videoLevelList;
|
|
8765
8903
|
this.options = deepmerge(THEME_DEFAULT_OPTIONS, options, {
|
|
8766
8904
|
clone: false
|
|
8767
8905
|
});
|
|
@@ -8775,7 +8913,7 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
8775
8913
|
}
|
|
8776
8914
|
if (!this.$container) throw new Error('container option is required!');
|
|
8777
8915
|
if ([
|
|
8778
|
-
'
|
|
8916
|
+
'VIDEO',
|
|
8779
8917
|
'CANVAS'
|
|
8780
8918
|
].includes(this.$container.tagName)) {
|
|
8781
8919
|
throw new Error('container node cannot be video or canvas!');
|
|
@@ -8786,7 +8924,15 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
8786
8924
|
}));
|
|
8787
8925
|
this.logger.log(navigator.userAgent || 'unknown');
|
|
8788
8926
|
this.logger.log('[Theme Version] ', Theme.THEME_VERSION);
|
|
8789
|
-
|
|
8927
|
+
if ('container' in this.options) {
|
|
8928
|
+
// JSON 不能序列化dom节点, 不要使用 this.options.container, 请使用 this.container
|
|
8929
|
+
delete this.options.container;
|
|
8930
|
+
}
|
|
8931
|
+
try {
|
|
8932
|
+
this.logger.log('[options] \n', JSON.stringify(this.options));
|
|
8933
|
+
} catch (error) {
|
|
8934
|
+
this.logger.log('[options] \n', this.options);
|
|
8935
|
+
}
|
|
8790
8936
|
const language = this.options.language || 'zh';
|
|
8791
8937
|
const locales = deepmerge({
|
|
8792
8938
|
zh,
|
|
@@ -8798,6 +8944,12 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
8798
8944
|
this.i18n = new I18n(locales, {
|
|
8799
8945
|
defaultLocale: language
|
|
8800
8946
|
});
|
|
8947
|
+
// 默认清晰度列表
|
|
8948
|
+
if (((_this_options_definitionOptions = this.options.definitionOptions) == null ? void 0 : (_this_options_definitionOptions_list = _this_options_definitionOptions.list) == null ? void 0 : _this_options_definitionOptions_list.length) > 0 || ((_this_options_videoLevelList = this.options.videoLevelList) == null ? void 0 : _this_options_videoLevelList.length) > 0) {
|
|
8949
|
+
var _this_options_definitionOptions1;
|
|
8950
|
+
this.videoLevelList = ((_this_options_definitionOptions1 = this.options.definitionOptions) == null ? void 0 : _this_options_definitionOptions1.list) || this.options.videoLevelList;
|
|
8951
|
+
}
|
|
8952
|
+
this.setScaleMode(this.options.scaleMode);
|
|
8801
8953
|
}
|
|
8802
8954
|
/**
|
|
8803
8955
|
* 初始化设置类名和设置宽高
|
|
@@ -9287,7 +9439,7 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
9287
9439
|
*/ this._footerMoreControl = null, /** 头部控件 @since 0.0.1 @private */ this._header = null, /** 低部控件 @since 0.0.1 @private */ this._footer = null, /** 回放底部时间轴 @since 0.0.1 @private */ this._recFooter = null, /**
|
|
9288
9440
|
* 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
|
|
9289
9441
|
* @private
|
|
9290
|
-
*/ this._mobileExtend = null, /** @since 0.0.1 @private */ this._interactiveResult = null, /** @since 0.0.1 @private */ this._themeData = null, this._fullscreen = null, this.zoomUtil = null, /** 清除屏幕旋转 */ this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ this._cleanUpResizeObserver = null, /** 容器的宽 */ this._width = 0, /** 容器的高 */ this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ this._orientationAngle = 0, /** 是否播放中 @private */ this._playing = false, /** 加载中 */ this._loading = false, /** 音量 */ this._volume = 0, /** 静音 */ this._muted = false, /** 电子放大倍数 @private */ this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ this._zooming = false, /** 录制中 @private */ this._recording = false, /** 对讲中 @private */ this._talking = false, /** 倍速 @private */ this._speed = 1, /** 自定清晰度 @private */ this._videoLevelAuto = false, /** 清晰度列表 */ this.videoLevelList = [], /** 回放片段列表 */ this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ this.destroyed = false, /** 播放地址信息 */ this.urlInfo = null;
|
|
9442
|
+
*/ this._mobileExtend = null, /** @since 0.0.1 @private */ this._interactiveResult = null, /** @since 0.0.1 @private */ this._themeData = null, this._fullscreen = null, this.zoomUtil = null, /** 清除屏幕旋转 */ this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ this._cleanUpResizeObserver = null, /** 容器的宽 */ this._width = 0, /** 容器的高 */ this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ this._orientationAngle = 0, /** 是否播放中 @private */ this._playing = false, /** 加载中 */ this._loading = false, /** 音量 */ this._volume = 0, /** 静音 */ this._muted = false, /** 电子放大倍数 @private */ this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ this._zooming = false, /** 录制中 @private */ this._recording = false, /** 对讲中 @private */ this._talking = false, /** 倍速 @private */ this._speed = 1, /** 自定清晰度 @private */ this._videoLevelAuto = false, /** 清晰度列表 */ this.videoLevelList = [], /** 回放片段列表 */ this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ this.destroyed = false, /** 播放地址信息 */ this.urlInfo = null, this.scaleMode = 0;
|
|
9291
9443
|
this._initOptions(options);
|
|
9292
9444
|
if (this.options.type === 'ezopen') {
|
|
9293
9445
|
var _this_urlInfo_searchParams, _this_urlInfo;
|
|
@@ -9309,7 +9461,8 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
9309
9461
|
this._initClassName();
|
|
9310
9462
|
// 画布需要渲染在 this.contentControl.$container 内
|
|
9311
9463
|
this.contentControl = new Content({
|
|
9312
|
-
getContainer: ()=>this.$container
|
|
9464
|
+
getContainer: ()=>this.$container,
|
|
9465
|
+
scaleMode: this.scaleMode
|
|
9313
9466
|
});
|
|
9314
9467
|
// zoom utils
|
|
9315
9468
|
__zoom(this, this.contentControl.$content, _extends({}, this.options.zoomOptions || {}, {
|
|
@@ -9347,7 +9500,7 @@ const THEME_DEFAULT_OPTIONS = {
|
|
|
9347
9500
|
zh,
|
|
9348
9501
|
en
|
|
9349
9502
|
};
|
|
9350
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.
|
|
9503
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.1-alpha.0';
|
|
9351
9504
|
|
|
9352
9505
|
exports.Control = Control;
|
|
9353
9506
|
exports.Fullscreen = Fullscreen;
|