@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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v1.0.0-beta.1
3
- * Copyright (c) 2025-10-27 Ezviz-OpenBiz
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
  import EventEmitter from 'eventemitter3';
@@ -16,7 +16,12 @@ import { MobileTimeLine, TimeLine } from '@ezuikit/control-time-line';
16
16
  /**
17
17
  * 播放器的类名前缀
18
18
  */ const PREFIX_CLASS = 'ezplayer';
19
- const DATE_PICKER_ICON_WIDTH = 36;
19
+ /** */ const DATE_PICKER_ICON_WIDTH = 36;
20
+ /** 填充模式 */ const THEME_SCALE_MODE_TYPE = {
21
+ /** 画面完全填充canvas区域,画面会被拉伸 */ full: 0,
22
+ /** 画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边 */ auto: 1,
23
+ /** 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全 */ fullAuto: 2
24
+ };
20
25
  // 切换主题时把当前的状态传给控件, 而不是传 theme 对象, 为了解耦
21
26
  // 不要添加方法,只添加状态
22
27
  const THEME_PROPS = [
@@ -184,6 +189,7 @@ const EVENTS = {
184
189
  /** 日期改变 */ dateChange: 'Control.dateChange',
185
190
  /** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
186
191
  /** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
192
+ /** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
187
193
  /** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
188
194
  /** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
189
195
  /** 主题控件挂载完成, 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ mountedControls: 'Control.mountedControls',
@@ -3205,8 +3211,68 @@ var en = {
3205
3211
  * 截图控件
3206
3212
  * @category Content
3207
3213
  */ class Content extends EventEmitter {
3214
+ /**
3215
+ * 重新画面区域
3216
+ * @param {number} originWidth 画面宽度
3217
+ * @param {number} originHeight 画面高度
3218
+ * @returns {void}
3219
+ */ _rerender(originWidth = 0, originHeight = 0) {
3220
+ const width = this.$wrapper.clientWidth;
3221
+ const height = this.$wrapper.clientHeight;
3222
+ if (originWidth > 0 && originHeight > 0) {
3223
+ this._originWidth = originWidth;
3224
+ this._originHeight = originHeight;
3225
+ }
3226
+ // 默认是1
3227
+ // 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边
3228
+ let objectFill = 'contain';
3229
+ // 视频画面完全填充canvas区域,画面会被拉伸
3230
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.full) {
3231
+ objectFill = 'fill';
3232
+ }
3233
+ // 视频画面做等比缩放后,完全填充canvas区域,画面不被拉伸,没有黑边,但画面显示不全
3234
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
3235
+ objectFill = 'cover';
3236
+ }
3237
+ if (width > 0 && height > 0 && this._originWidth > 0 && this._originHeight > 0 && this.$video) {
3238
+ const left = (width - this._originWidth) / 2;
3239
+ const top = (height - this._originHeight) / 2;
3240
+ const wScale = width / this._originWidth;
3241
+ const hScale = height / this._originHeight;
3242
+ let scale = wScale > hScale ? hScale : wScale;
3243
+ //
3244
+ if (!(this._scaleMode === THEME_SCALE_MODE_TYPE.auto)) {
3245
+ if (wScale !== hScale) {
3246
+ scale = wScale + ',' + hScale;
3247
+ }
3248
+ }
3249
+ //
3250
+ if (this._scaleMode === THEME_SCALE_MODE_TYPE.fullAuto) {
3251
+ scale = wScale > hScale ? wScale : hScale;
3252
+ }
3253
+ this.$video.style.cssText += `
3254
+ width: ${this._originWidth}px;
3255
+ height: ${this._originHeight}px;
3256
+ position: absolute;
3257
+ object-fit:${objectFill};
3258
+ left: ${left}px;
3259
+ top: ${top}px;
3260
+ transform-origin: 50% 50%;
3261
+ transform: scale(${scale});
3262
+ `;
3263
+ }
3264
+ }
3265
+ setScaleMode(scaleMode = 0) {
3266
+ this._scaleMode = scaleMode;
3267
+ this._rerender();
3268
+ }
3208
3269
  destroy() {
3209
3270
  var _this_$wrapper;
3271
+ if (this.$video) {
3272
+ this.$video.remove();
3273
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3274
+ this.$video = null;
3275
+ }
3210
3276
  if (this.$content) {
3211
3277
  this.$content.remove();
3212
3278
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -3219,17 +3285,27 @@ var en = {
3219
3285
  this.removeAllListeners();
3220
3286
  }
3221
3287
  constructor(options){
3222
- super();
3288
+ super(), this._scaleMode = 0, this._originWidth = 0, this._originHeight = 0;
3223
3289
  this.options = options;
3290
+ this._scaleMode = options.scaleMode || 0;
3224
3291
  this.$wrapper = document.createElement('div');
3225
3292
  this.$wrapper.className = `${PREFIX_CLASS}-content-wrapper`;
3226
3293
  this.$content = document.createElement('div');
3227
3294
  this.$content.className = `${PREFIX_CLASS}-content`;
3295
+ this.$video = document.createElement('div');
3296
+ this.$video.className = `${PREFIX_CLASS}-content-video`;
3297
+ this.$content.appendChild(this.$video);
3228
3298
  this.$wrapper.appendChild(this.$content);
3229
3299
  if (typeof options.getContainer === 'function') {
3230
3300
  const $popupContainer = options.getContainer();
3231
3301
  $popupContainer.appendChild(this.$wrapper);
3232
3302
  }
3303
+ this.on(EVENTS.videoInfo, (originWidth, originHeight)=>{
3304
+ this._rerender(originWidth, originHeight);
3305
+ });
3306
+ this.on(EVENTS.resize, ()=>{
3307
+ this._rerender();
3308
+ });
3233
3309
  }
3234
3310
  }
3235
3311
 
@@ -3385,6 +3461,17 @@ function debounce(func, wait) {
3385
3461
  }
3386
3462
  });
3387
3463
  theme == null ? void 0 : theme.on(EVENTS.videoInfo, (info)=>{
3464
+ // 排除流信息回调触发的事件
3465
+ if (!!info && info.from !== "setStreamInfoCallBack") {
3466
+ var // rerender 画面
3467
+ _theme_contentControl_emit, _theme_contentControl;
3468
+ (_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);
3469
+ }
3470
+ });
3471
+ theme == null ? void 0 : theme.on(EVENTS.resize, ()=>{
3472
+ var // rerender 画面
3473
+ _theme_contentControl_emit, _theme_contentControl;
3474
+ (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.resize);
3388
3475
  });
3389
3476
  theme == null ? void 0 : theme.on('getDeviceInfo', (info)=>{
3390
3477
  });
@@ -3699,6 +3786,14 @@ function debounce(func, wait) {
3699
3786
  theme.controls.timeLineControl.on(EVENTS.control.timeLineChange, (date)=>{
3700
3787
  theme.emit(EVENTS.control.timeLineChange, date);
3701
3788
  });
3789
+ theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, (open)=>{
3790
+ var _theme_controls_dateControl;
3791
+ if ((_theme_controls_dateControl = theme.controls.dateControl) == null ? void 0 : _theme_controls_dateControl.dataPickerUtil) {
3792
+ var _theme_controls_dateControl_dataPickerUtil, _theme_controls_dateControl1;
3793
+ (_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();
3794
+ }
3795
+ theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
3796
+ });
3702
3797
  theme.controls.timeLineControl.on(EVENTS.control.timeLineDestroy, ()=>{
3703
3798
  theme.emit(EVENTS.control.timeLineDestroy);
3704
3799
  });
@@ -3766,12 +3861,12 @@ const ignoreList = [
3766
3861
  * @returns {void}
3767
3862
  */ function _resize(theme, width, height) {
3768
3863
  let cssText = '';
3769
- if (/\d/.test(width + '')) {
3864
+ if (/^\d+(\.\d+)?$/.test(width + '')) {
3770
3865
  cssText += `width: ${width}px;`;
3771
3866
  } else if (width) {
3772
3867
  cssText += `width: ${width};`;
3773
3868
  }
3774
- if (/\d/.test(height + '')) {
3869
+ if (/^\d+(\.\d+)?$/.test(height + '')) {
3775
3870
  cssText += `height: ${height}px;`;
3776
3871
  } else if (height) {
3777
3872
  cssText += `height: ${height};`;
@@ -3917,7 +4012,7 @@ const ZOOM_DEFAULT_OPTIONS = {
3917
4012
 
3918
4013
  /*
3919
4014
  * @ezuikit/control-zoom v0.0.2
3920
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
4015
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
3921
4016
  * Released under the MIT License.
3922
4017
  */
3923
4018
  /**
@@ -5297,7 +5392,7 @@ function _extends$c() {
5297
5392
 
5298
5393
  /*
5299
5394
  * @ezuikit/control-ptz v0.0.1
5300
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
5395
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
5301
5396
  * Released under the MIT License.
5302
5397
  */
5303
5398
 
@@ -5466,11 +5561,11 @@ class MobilePtz extends BasePtz {
5466
5561
  $icons[0].className = $icons[0].className.replace(`${PTZ_MOBILE_PREFIX}-default`, `${PTZ_MOBILE_PREFIX}-active`);
5467
5562
  }
5468
5563
  }
5469
- $warp.style.cssText = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #c0ddf1 0%, rgba(100,143,252,0.00) 50%)`;
5564
+ $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%)`;
5470
5565
  if (type === 'stop') {
5471
5566
  var _this_options_env1;
5472
5567
  url = ((_this_options_env1 = this.options.env) == null ? void 0 : _this_options_env1.domain) + '/api/lapp/device/ptz/stop';
5473
- $warp.style.cssText = '';
5568
+ $warp.style = '';
5474
5569
  $icons[3].className = $icons[3].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
5475
5570
  $icons[1].className = $icons[1].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
5476
5571
  $icons[2].className = $icons[2].className.replace(`${PTZ_MOBILE_PREFIX}-active`, `${PTZ_MOBILE_PREFIX}-default`);
@@ -5514,14 +5609,11 @@ class MobilePtz extends BasePtz {
5514
5609
  60003,
5515
5610
  60004
5516
5611
  ].includes(+rt.code)) {
5517
- $warp.style.cssText = `background-image:linear-gradient(${direction === 0 ? 180 : direction === 1 ? 0 : direction === 2 ? 90 : 270}deg, #f45656 0%, rgba(100,143,252,0.00) 50%)`;
5612
+ $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%)`;
5518
5613
  }
5519
5614
  }
5520
5615
  operationResultCb == null ? void 0 : operationResultCb(rt);
5521
5616
  }).catch((err)=>{
5522
- }).finally(()=>{
5523
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5524
- operationResultCb = null;
5525
5617
  });
5526
5618
  }
5527
5619
  constructor(container, options){
@@ -6793,12 +6885,14 @@ function __filter(list, locale = {}) {
6793
6885
  controlType: 'button',
6794
6886
  classNameSuffix: 'definition',
6795
6887
  renderLabel: (label, item, list)=>{
6888
+ var _list_;
6796
6889
  if ((item == null ? void 0 : item.level) === 'auto') {
6797
6890
  var _options_locales_options_language;
6798
- const realIitem = list.find((it)=>it.level === this._level);
6799
- return `<span>${options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO}(${(realIitem == null ? void 0 : realIitem.name) || ''})</span>`;
6891
+ const realItem = list.find((it)=>it.level === this._level);
6892
+ 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>`;
6800
6893
  }
6801
- return `<span>${label}</span>`;
6894
+ // 如果 label 不存在,则不显示label,直接显示list的第一个label, 一般自定义清晰度列表可能会出现
6895
+ return `<span>${label || ((_list_ = list[0]) == null ? void 0 : _list_.name) || ''}</span>`;
6802
6896
  },
6803
6897
  onChange: (value, item)=>{
6804
6898
  var _options_onChange;
@@ -6825,9 +6919,9 @@ function __filter(list, locale = {}) {
6825
6919
  this._level = realLevel + '';
6826
6920
  if (l === 'auto') {
6827
6921
  var _options_locales_options_language;
6828
- const realIitem = this.list.find((it)=>it.level === this._level);
6922
+ const realItem = this.list.find((it)=>it.level === this._level);
6829
6923
  this.$container.querySelector(`.${PREFIX_CLASS}-select-btn`).innerHTML = `
6830
- <span>${options == null ? void 0 : (_options_locales_options_language = options.locales[options.language]) == null ? void 0 : _options_locales_options_language.VIDEO_LEVEL_AUTO}(${(realIitem == null ? void 0 : realIitem.name) || ''})</span>
6924
+ <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>
6831
6925
  `;
6832
6926
  } else {
6833
6927
  if (this.value !== this._level + '') this.value = this._level + '';
@@ -6910,7 +7004,7 @@ const SPEED_DEFAULT_OPTIONS = {
6910
7004
 
6911
7005
  /*
6912
7006
  * @ezuikit/control-date-picker v0.0.1
6913
- * Copyright (c) 2025-09-21 Ezviz-OpenBiz
7007
+ * Copyright (c) 2025-11-11 Ezviz-OpenBiz
6914
7008
  * Released under the MIT License.
6915
7009
  */
6916
7010
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
@@ -7005,7 +7099,7 @@ const DEFAULT_OPTIONS = {
7005
7099
  };
7006
7100
  /**
7007
7101
  * 日期选择器
7008
- */ let DatePicker$1 = class DatePicker {
7102
+ */ class DatePicker {
7009
7103
  _init() {
7010
7104
  // 因为挂载在行内,需要父标签设置 position: relative;
7011
7105
  this.$container.style.cssText += `;position: relative;`;
@@ -7133,7 +7227,7 @@ const DEFAULT_OPTIONS = {
7133
7227
  }
7134
7228
  });
7135
7229
  }
7136
- };
7230
+ }
7137
7231
 
7138
7232
  /**
7139
7233
  * @description 时间操作
@@ -7296,7 +7390,7 @@ function _extends$5() {
7296
7390
  /**
7297
7391
  * 日历选择器控件
7298
7392
  * @category Control
7299
- */ class DatePicker extends Control {
7393
+ */ class DatePickerControl extends Control {
7300
7394
  _render() {
7301
7395
  if (isMobile()) {
7302
7396
  var _this_locale;
@@ -7311,7 +7405,7 @@ function _extends$5() {
7311
7405
  title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
7312
7406
  });
7313
7407
  }
7314
- this.dataPickerUtil = new DatePicker$1(this.$container, {
7408
+ this.dataPickerUtil = new DatePicker(this.$container, {
7315
7409
  staticPath: this.options.staticPath,
7316
7410
  language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
7317
7411
  current: new Date(this._value + ' 00:00:00'),
@@ -7403,10 +7497,16 @@ function _extends$4() {
7403
7497
  _render() {
7404
7498
  var _this_timeLineUtil_updateTimeSections, _this_timeLineUtil;
7405
7499
  const _timeLineOptions = {
7406
- // locale: this._options.locale,
7500
+ language: this._options.language || 'zh',
7501
+ coverQuery: this._options.coverQuery || '',
7407
7502
  onChange: (date)=>{
7408
- this._options.onChange == null ? void 0 : this._options.onChange.call(this._options, date);
7409
- this.emit(EVENTS.control.timeLineChange, date);
7503
+ if (this._currentTime !== (date == null ? void 0 : date.getTime())) {
7504
+ this._options.onChange == null ? void 0 : this._options.onChange.call(this._options, date);
7505
+ this.emit(EVENTS.control.timeLineChange, date);
7506
+ }
7507
+ },
7508
+ onPickerOpenChange: (open)=>{
7509
+ this.emit(EVENTS.control.timeLinePanelOpenChange, open);
7410
7510
  },
7411
7511
  // 2025-10-27 仅移动端支持
7412
7512
  onPickerSelect: (item)=>{
@@ -7482,7 +7582,8 @@ function _extends$4() {
7482
7582
  tagName: 'div',
7483
7583
  controlType: 'block',
7484
7584
  classNameSuffix: 'time-line'
7485
- })), this._$add = null, this._$reduce = null, this.records = [];
7585
+ })), this._$add = null, this._$reduce = null, this._currentTime = 0, this.records = [];
7586
+ this._currentTime = 0;
7486
7587
  this._options = options;
7487
7588
  this.records = ((_this__options = this._options) == null ? void 0 : (_this__options_props = _this__options.props) == null ? void 0 : _this__options_props.recordList) || [];
7488
7589
  this._render();
@@ -7493,9 +7594,13 @@ function _extends$4() {
7493
7594
  (_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_updateTimeSections = _this_timeLineUtil.updateTimeSections) == null ? void 0 : _this_timeLineUtil_updateTimeSections.call(_this_timeLineUtil, records);
7494
7595
  });
7495
7596
  this.on(EVENTS.getOSDTime, (time)=>{
7496
- var // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
7497
- _this_timeLineUtil_update, _this_timeLineUtil;
7498
- (_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_update = _this_timeLineUtil.update) == null ? void 0 : _this_timeLineUtil_update.call(_this_timeLineUtil, new Date(time * 1000));
7597
+ if (time) {
7598
+ var // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
7599
+ _this_timeLineUtil_update, _this_timeLineUtil;
7600
+ const date = new Date(time * 1000);
7601
+ this._currentTime = date.getTime();
7602
+ (_this_timeLineUtil = this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_update = _this_timeLineUtil.update) == null ? void 0 : _this_timeLineUtil_update.call(_this_timeLineUtil, date);
7603
+ }
7499
7604
  });
7500
7605
  }
7501
7606
  }
@@ -7561,7 +7666,7 @@ const Controls = {
7561
7666
  globalFullscreen: GlobalFullscreen,
7562
7667
  rec: Rec,
7563
7668
  speed: Speed,
7564
- date: DatePicker,
7669
+ date: DatePickerControl,
7565
7670
  timeLine: TimeLineControl
7566
7671
  };
7567
7672
 
@@ -7990,7 +8095,7 @@ function _renderTheme(theme, data) {
7990
8095
  }
7991
8096
  if (theme.options.posterOptions !== null) {
7992
8097
  theme.posterControl = new Poster(_extends$1({}, theme.options.posterOptions || {}, {
7993
- getPopupContainer: ()=>theme.contentControl.$content
8098
+ getPopupContainer: ()=>theme.contentControl.$video
7994
8099
  }));
7995
8100
  }
7996
8101
  theme.controls = {}; // 防止为 null
@@ -8131,12 +8236,13 @@ function _renderTheme(theme, data) {
8131
8236
  }
8132
8237
  const _renderTimeLine = (theme, container, props = {})=>{
8133
8238
  if (!theme.controls.timeLineControl && theme.options.timeLineOptions !== null) {
8134
- var _theme_options;
8239
+ var _theme_urlInfo, _theme_options;
8135
8240
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
8136
8241
  theme.controls.timeLineControl = new Controls['timeLine'](_extends$1({
8137
8242
  getPopupContainer: ()=>container,
8138
8243
  language: theme.options.language,
8139
- locales: theme.i18n.translations
8244
+ locales: theme.i18n.translations,
8245
+ coverQuery: ((_theme_urlInfo = theme.urlInfo) == null ? void 0 : _theme_urlInfo.validateCode) ? `decodekey=${theme.urlInfo.validateCode}` : ''
8140
8246
  }, ((_theme_options = theme.options) == null ? void 0 : _theme_options[`timeLineOptions`]) || {}, {
8141
8247
  props
8142
8248
  }));
@@ -8220,6 +8326,7 @@ const THEME_DEFAULT_OPTIONS = {
8220
8326
  dblClickFullscreen: true,
8221
8327
  language: 'zh',
8222
8328
  autoPlay: true,
8329
+ scaleMode: THEME_SCALE_MODE_TYPE.full,
8223
8330
  loggerOptions: {
8224
8331
  level: 'INFO',
8225
8332
  showTime: true
@@ -8709,6 +8816,37 @@ const THEME_DEFAULT_OPTIONS = {
8709
8816
  (_this = this) == null ? void 0 : _this.emit(EVENTS.setLoggerOptions, options);
8710
8817
  }
8711
8818
  /**
8819
+ * 设置视频画面缩放模式
8820
+ * @since 1.0.1
8821
+ * @param {0 | 1 | 2} scaleMode - 缩放模式, 0: 窗口铺满, 1: 等比缩放大边铺满, 2: 等比缩放小边铺满
8822
+ */ setScaleMode(scaleMode) {
8823
+ if ([
8824
+ 0,
8825
+ 1,
8826
+ 2
8827
+ ].includes(+scaleMode)) {
8828
+ var _this_contentControl_setScaleMode, _this_contentControl;
8829
+ this.scaleMode = +scaleMode;
8830
+ (_this_contentControl = this.contentControl) == null ? void 0 : (_this_contentControl_setScaleMode = _this_contentControl.setScaleMode) == null ? void 0 : _this_contentControl_setScaleMode.call(_this_contentControl, +scaleMode);
8831
+ const classList = this.$container.classList;
8832
+ for (const item of classList){
8833
+ if (item.startsWith(`${PREFIX_CLASS}-scale-mode-`)) {
8834
+ classList.remove(item);
8835
+ }
8836
+ }
8837
+ if (this.scaleMode === 0) {
8838
+ this.$container.classList.add(`${PREFIX_CLASS}-scale-mode-full`);
8839
+ } else if (this.scaleMode === 1) {
8840
+ this.$container.classList.add(`${PREFIX_CLASS}-scale-mode-auto`);
8841
+ } else if (this.scaleMode === 2) {
8842
+ this.$container.classList.add(`${PREFIX_CLASS}-scale-mode-full-auto`);
8843
+ }
8844
+ } else {
8845
+ var _this_logger;
8846
+ (_this_logger = this.logger) == null ? void 0 : _this_logger.warn('scaleMode must be 0 | 1 | 2');
8847
+ }
8848
+ }
8849
+ /**
8712
8850
  * 销毁包括事件、控件 ...
8713
8851
  *
8714
8852
  * Destroy (including events, controls...)
@@ -8757,7 +8895,7 @@ const THEME_DEFAULT_OPTIONS = {
8757
8895
  // 私有方法
8758
8896
  // ==============================================================================================
8759
8897
  /** 初始化配置项 */ _initOptions(options = {}) {
8760
- var _this_options_loggerOptions;
8898
+ var _this_options_loggerOptions, _this_options_definitionOptions_list, _this_options_definitionOptions, _this_options_videoLevelList;
8761
8899
  this.options = deepmerge(THEME_DEFAULT_OPTIONS, options, {
8762
8900
  clone: false
8763
8901
  });
@@ -8771,7 +8909,7 @@ const THEME_DEFAULT_OPTIONS = {
8771
8909
  }
8772
8910
  if (!this.$container) throw new Error('container option is required!');
8773
8911
  if ([
8774
- 'VIDOE',
8912
+ 'VIDEO',
8775
8913
  'CANVAS'
8776
8914
  ].includes(this.$container.tagName)) {
8777
8915
  throw new Error('container node cannot be video or canvas!');
@@ -8782,7 +8920,15 @@ const THEME_DEFAULT_OPTIONS = {
8782
8920
  }));
8783
8921
  this.logger.log(navigator.userAgent || 'unknown');
8784
8922
  this.logger.log('[Theme Version] ', Theme.THEME_VERSION);
8785
- this.logger.log(JSON.stringify(this.options));
8923
+ if ('container' in this.options) {
8924
+ // JSON 不能序列化dom节点, 不要使用 this.options.container, 请使用 this.container
8925
+ delete this.options.container;
8926
+ }
8927
+ try {
8928
+ this.logger.log('[options] \n', JSON.stringify(this.options));
8929
+ } catch (error) {
8930
+ this.logger.log('[options] \n', this.options);
8931
+ }
8786
8932
  const language = this.options.language || 'zh';
8787
8933
  const locales = deepmerge({
8788
8934
  zh,
@@ -8794,6 +8940,12 @@ const THEME_DEFAULT_OPTIONS = {
8794
8940
  this.i18n = new I18n(locales, {
8795
8941
  defaultLocale: language
8796
8942
  });
8943
+ // 默认清晰度列表
8944
+ 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) {
8945
+ var _this_options_definitionOptions1;
8946
+ this.videoLevelList = ((_this_options_definitionOptions1 = this.options.definitionOptions) == null ? void 0 : _this_options_definitionOptions1.list) || this.options.videoLevelList;
8947
+ }
8948
+ this.setScaleMode(this.options.scaleMode);
8797
8949
  }
8798
8950
  /**
8799
8951
  * 初始化设置类名和设置宽高
@@ -9283,7 +9435,7 @@ const THEME_DEFAULT_OPTIONS = {
9283
9435
  */ 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, /**
9284
9436
  * 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
9285
9437
  * @private
9286
- */ 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;
9438
+ */ 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;
9287
9439
  this._initOptions(options);
9288
9440
  if (this.options.type === 'ezopen') {
9289
9441
  var _this_urlInfo_searchParams, _this_urlInfo;
@@ -9305,7 +9457,8 @@ const THEME_DEFAULT_OPTIONS = {
9305
9457
  this._initClassName();
9306
9458
  // 画布需要渲染在 this.contentControl.$container 内
9307
9459
  this.contentControl = new Content({
9308
- getContainer: ()=>this.$container
9460
+ getContainer: ()=>this.$container,
9461
+ scaleMode: this.scaleMode
9309
9462
  });
9310
9463
  // zoom utils
9311
9464
  __zoom(this, this.contentControl.$content, _extends({}, this.options.zoomOptions || {}, {
@@ -9343,6 +9496,6 @@ const THEME_DEFAULT_OPTIONS = {
9343
9496
  zh,
9344
9497
  en
9345
9498
  };
9346
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.0-beta.1';
9499
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.1-alpha.0';
9347
9500
 
9348
9501
  export { Control, Fullscreen, Loading, Message, Play, Poster, Rec, Theme, Utils, Volume, Theme as default };