@ezuikit/player-theme 3.1.5-beta.4 → 3.1.6

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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v3.1.5-beta.4
3
- * Copyright (c) 2026-09-15 13:35:29 Ezviz-OpenBiz
2
+ * @ezuikit/player-theme v3.1.6
3
+ * Copyright (c) 2026-09-18 12:22:27 Ezviz-OpenBiz
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import EventEmitter from 'eventemitter3';
@@ -18,8 +18,8 @@ import { DatePicker, TimePicker } from '@ezuikit/control-date-picker';
18
18
  import { MobileTimeLine, TimeLine } from '@ezuikit/control-time-line';
19
19
  import SegmentProgress from '@ezuikit/control-segment-progress';
20
20
 
21
- /**
22
- * 播放器的类名前缀
21
+ /**
22
+ * 播放器的类名前缀
23
23
  */ var PREFIX_CLASS = 'ezplayer';
24
24
  /** 填充模式 */ var THEME_SCALE_MODE_TYPE = {
25
25
  /** 画面完全填充canvas区域,画面会被拉伸 */ full: 0,
@@ -51,32 +51,32 @@ var THEME_PROPS = [
51
51
  // 播放区间(片段分享)。通过 props 下发而不是靠事件,避免主题异步渲染时错过初始化事件
52
52
  'playbackRange'
53
53
  ];
54
- /**
55
- * 当移动端 picker 控件打开时需要关闭动画(定时器)
54
+ /**
55
+ * 当移动端 picker 控件打开时需要关闭动画(定时器)
56
56
  */ var CLEAR_TIMER_HEADER_FOOTER_ANIMATION = 'CLEAR_TIMER_HEADER_FOOTER_ANIMATION';
57
- /**
58
- * 'rec', 'cloudRec', 'cloudRecord' 是一个组,并且要在头部(移动端特殊处理)
59
- *
60
- * | rec | cloudRec | cloudRecord |
61
- * |:---------------------:|:------------:|:---------------:|
62
- * | 本地回放(SDK存储回放) | 云存储回放 | 云录制回放 |
57
+ /**
58
+ * 'rec', 'cloudRec', 'cloudRecord' 是一个组,并且要在头部(移动端特殊处理)
59
+ *
60
+ * | rec | cloudRec | cloudRecord |
61
+ * |:---------------------:|:------------:|:---------------:|
62
+ * | 本地回放(SDK存储回放) | 云存储回放 | 云录制回放 |
63
63
  */ var REC_GROUP = [
64
64
  'rec',
65
65
  'cloudRec',
66
66
  'cloudRecord'
67
67
  ];
68
- /**
69
- * 设备信息
70
- *
71
- * | deviceID | deviceName |
72
- * |:-------------------:|:-------------:|
73
- * | 设备ID(唯一标识) | 设备名称 |
68
+ /**
69
+ * 设备信息
70
+ *
71
+ * | deviceID | deviceName |
72
+ * |:-------------------:|:-------------:|
73
+ * | 设备ID(唯一标识) | 设备名称 |
74
74
  */ var DEVICE_INFO_GROUP = [
75
75
  'deviceID',
76
76
  'deviceName'
77
77
  ];
78
- /**
79
- * 暂停时能禁用的控件按钮
78
+ /**
79
+ * 暂停时能禁用的控件按钮
80
80
  */ var PAUSE_DISABLED_BTN = [
81
81
  'capturePicture',
82
82
  'volume',
@@ -87,9 +87,9 @@ var THEME_PROPS = [
87
87
  'speed',
88
88
  'globalFullscreen'
89
89
  ];
90
- /**
91
- * 移动端可以扩展的控件
92
- * ['ptz', 'talk', 'record', 'capturePicture', 'timeLine', 'rec', 'date'];
90
+ /**
91
+ * 移动端可以扩展的控件
92
+ * ['ptz', 'talk', 'record', 'capturePicture', 'timeLine', 'rec', 'date'];
93
93
  */ var MOBILE_EXTENDS = [
94
94
  'ptz',
95
95
  'timeLine',
@@ -97,25 +97,25 @@ var THEME_PROPS = [
97
97
  'date',
98
98
  'segmentProgress'
99
99
  ];
100
- /**
101
- *
102
- * 事件名
103
- *
104
- * --------------- ------------------
105
- * - - theme.emit(EVENTS.xxxxx) - -
106
- * - - -------------------------------------> - -
107
- * - - - -
108
- * - Theme - - Controls -
109
- * - - control.emit(EVENTS.control.xxx) - -
110
- * - - <-------------------------------------- - -
111
- * --------------- ------------------
112
- *
113
- * @example
114
- * ```ts
115
- * theme.on(EVENTS.loading)
116
- * theme.on(EVENTS.loading)
117
- * ```
118
- *
100
+ /**
101
+ *
102
+ * 事件名
103
+ *
104
+ * --------------- ------------------
105
+ * - - theme.emit(EVENTS.xxxxx) - -
106
+ * - - -------------------------------------> - -
107
+ * - - - -
108
+ * - Theme - - Controls -
109
+ * - - control.emit(EVENTS.control.xxx) - -
110
+ * - - <-------------------------------------- - -
111
+ * --------------- ------------------
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * theme.on(EVENTS.loading)
116
+ * theme.on(EVENTS.loading)
117
+ * ```
118
+ *
119
119
  */ // 事件命名不要超过两层
120
120
  var EVENTS = {
121
121
  loading: 'loading',
@@ -130,11 +130,11 @@ var EVENTS = {
130
130
  /** 首帧 */ firstFrameDisplay: 'firstFrameDisplay',
131
131
  /** 全屏 */ fullscreen: 'fullscreen',
132
132
  /** 退出全屏 */ exitFullscreen: 'exitFullscreen',
133
- /**
134
- * 全屏变化(移动端也支持触发, 不过移动端是模拟的web全屏 即旋转 180度)
135
- * 当 isCurrentFullscreen 为 true 时,表示当前容器全局全屏状态
136
- *
137
- * 注意:同一个页面中只要有全屏的操作或取消全屏的操作,都会触发该事件 (移动端除外)
133
+ /**
134
+ * 全屏变化(移动端也支持触发, 不过移动端是模拟的web全屏 即旋转 180度)
135
+ * 当 isCurrentFullscreen 为 true 时,表示当前容器全局全屏状态
136
+ *
137
+ * 注意:同一个页面中只要有全屏的操作或取消全屏的操作,都会触发该事件 (移动端除外)
138
138
  */ fullscreenChange: 'fullscreenChange',
139
139
  /** 重置容器尺寸 */ resize: 'resize',
140
140
  /** 屏幕旋转方向变化 */ orientationChange: 'orientationChange',
@@ -161,8 +161,8 @@ var EVENTS = {
161
161
  setAllDayRecTimes: 'setAllDayRecTimes',
162
162
  getOSDTime: 'getOSDTime',
163
163
  /** 播放区间播放结束(SDK 层 playbackRange 特性) */ playbackEnd: 'playbackEnd',
164
- /**
165
- * 控件相关
164
+ /**
165
+ * 控件相关
166
166
  */ control: {
167
167
  /** 点击播放播放/暂停按钮 */ play: 'Control.play',
168
168
  /** 播放控件销毁 */ playDestroy: 'Control.playDestroy',
@@ -217,6 +217,8 @@ var EVENTS = {
217
217
  /** 日期面板展示隐藏变换 */ datePanelOpenChange: 'Control.datePanelOpenChange',
218
218
  /** 日期改变 */ dateChange: 'Control.dateChange',
219
219
  /** 日期改变 */ dateMonthChange: 'Control.dateMonthChange',
220
+ /** 日期面板展示的月份变化 */ datePanelMonthChange: 'Control.datePanelMonthChange',
221
+ /** 日期面板展示的年份变化 */ datePanelYearChange: 'Control.datePanelYearChange',
220
222
  /** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
221
223
  /** 时间面板展示隐藏变换 */ timePanelOpenChange: 'Control.timePanelOpenChange',
222
224
  /** 时间改变 */ timeChange: 'Control.timeChange',
@@ -233,8 +235,8 @@ var EVENTS = {
233
235
  /** 播放器内容区域销毁 */ contentDestroy: 'Control.contentDestroy',
234
236
  /** 播放器内容区域重新渲染 */ contentRerender: 'Control.contentRerender'
235
237
  },
236
- /**
237
- * 主题控件相关
238
+ /**
239
+ * 主题控件相关
238
240
  */ theme: {
239
241
  /** 销毁前 */ beforeDestroy: 'Theme.beforeDestroy',
240
242
  /** 销毁后 */ destroyed: 'Theme.destroyed',
@@ -2964,7 +2966,8 @@ var zh = {
2964
2966
  cancel: '取消',
2965
2967
  ok: '确定',
2966
2968
  close: '关闭',
2967
- BTN_REC_LIST_TITLE: '录像片段'
2969
+ BTN_REC_LIST_TITLE: '录像片段',
2970
+ UNKOWN_ISSUE: '未知问题 【{{scope}}】'
2968
2971
  };
2969
2972
 
2970
2973
  // 不要出现多层的的数据, 数据铺平
@@ -3248,7 +3251,8 @@ var en = {
3248
3251
  cancel: 'Cancel',
3249
3252
  ok: 'Ok',
3250
3253
  close: 'Close',
3251
- BTN_REC_LIST_TITLE: 'Records'
3254
+ BTN_REC_LIST_TITLE: 'Records',
3255
+ UNKOWN_ISSUE: 'Unknown issue [{{scope}}]'
3252
3256
  };
3253
3257
 
3254
3258
  /**
@@ -4846,6 +4850,12 @@ function debounce(func, wait) {
4846
4850
  theme.controls.dateControl.on(EVENTS.control.dateChange, function(date) {
4847
4851
  theme.emit(EVENTS.control.dateChange, date);
4848
4852
  });
4853
+ theme.controls.dateControl.on(EVENTS.control.datePanelMonthChange, function(date, month) {
4854
+ theme.emit(EVENTS.control.datePanelMonthChange, date, month);
4855
+ });
4856
+ theme.controls.dateControl.on(EVENTS.control.datePanelYearChange, function(date, year) {
4857
+ theme.emit(EVENTS.control.datePanelYearChange, date, year);
4858
+ });
4849
4859
  theme.controls.dateControl.on(EVENTS.control.dateDestroy, function() {
4850
4860
  theme.emit(EVENTS.control.dateDestroy);
4851
4861
  });
@@ -8388,9 +8398,9 @@ function _set_prototype_of$8(o, p) {
8388
8398
  };
8389
8399
  return _set_prototype_of$8(o, p);
8390
8400
  }
8391
- /**
8392
- * 日历选择器控件
8393
- * @category Control
8401
+ /**
8402
+ * 日历选择器控件
8403
+ * @category Control
8394
8404
  */ var DatePickerControl = /*#__PURE__*/ function(Control) {
8395
8405
  _inherits$8(DatePickerControl, Control);
8396
8406
  function DatePickerControl(options) {
@@ -8405,6 +8415,8 @@ function _set_prototype_of$8(o, p) {
8405
8415
  })) || this;
8406
8416
  _this.options = options;
8407
8417
  _this._value = DateTime.format(((_this_options_props = _this.options.props) == null ? void 0 : (_this_options_props_urlInfo = _this_options_props.urlInfo) == null ? void 0 : (_this_options_props_urlInfo_searchParams = _this_options_props_urlInfo.searchParams) == null ? void 0 : _this_options_props_urlInfo_searchParams.begin) || new Date(), 'YYYY-MM-DD');
8418
+ // 面板首次展示的就是选中日期所在月份,初始化后不应触发年 / 月变化
8419
+ _this._renderMonth = _this._value.slice(0, 7);
8408
8420
  _this._render();
8409
8421
  // 日期上的点
8410
8422
  _this.on(EVENTS.control.dateMonthChange, function(dates) {
@@ -8465,20 +8477,39 @@ function _set_prototype_of$8(o, p) {
8465
8477
  _this.emit(EVENTS.control.dateChange, date);
8466
8478
  }
8467
8479
  },
8480
+ // 日历面板「上一月 / 上一年」,底层两种翻页都回调 onPrevMonth
8481
+ onPrevMonth: function onPrevMonth(current, prev) {
8482
+ _this.options.onPrevMonth == null ? void 0 : _this.options.onPrevMonth.call(_this.options, current, prev);
8483
+ _this._onPanelDateChange(prev);
8484
+ },
8485
+ // 日历面板「下一月 / 下一年」,底层两种翻页都回调 onNextMonth
8486
+ onNextMonth: function onNextMonth(current, next) {
8487
+ _this.options.onNextMonth == null ? void 0 : _this.options.onNextMonth.call(_this.options, current, next);
8488
+ _this._onPanelDateChange(next);
8489
+ },
8490
+ // 月 / 年面板中点选单元格同样会改变日历展示的年月,但底层不回调翻页钩子
8491
+ onCell: function onCell(date, mode) {
8492
+ _this.options.onCell == null ? void 0 : _this.options.onCell.call(_this.options, date, mode);
8493
+ if (mode !== 'date' && !_this._isPanelCellDisabled(date, mode)) _this._onPanelDateChange(date);
8494
+ },
8468
8495
  onOpenChange: function onOpenChange(open) {
8469
8496
  _this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, _this.datePicker.current);
8470
8497
  _this.emit(EVENTS.control.datePanelOpenChange, open, _this.datePicker.current);
8498
+ // 面板重新打开会跳回选中日期所在月份,且底层不会回调翻页钩子,这里补齐
8499
+ if (open) _this._onPanelDateChange(_this.datePicker.current);
8471
8500
  }
8472
8501
  }));
8473
8502
  };
8474
- /**
8475
- * 设置日期, change = true 时触发 onChange 事件
8476
- * @param date 设置的日期
8477
- * @param change 是否触发 onChange 事件
8503
+ /**
8504
+ * 设置日期, change = true 时触发 onChange 事件
8505
+ * @param date 设置的日期
8506
+ * @param change 是否触发 onChange 事件
8478
8507
  */ _proto.setDate = function setDate(date, change) {
8479
8508
  if (change === void 0) change = true;
8480
8509
  var _this_datePicker;
8481
8510
  (_this_datePicker = this.datePicker) == null ? void 0 : _this_datePicker.setCurrent(date, change);
8511
+ // 主动设值由调用方发起,同步展示月份但不触发年 / 月变化回调
8512
+ if (date) this._renderMonth = DateTime.format(date, 'YYYY-MM');
8482
8513
  if (date && !change && this._value !== DateTime.format(date, 'YYYY-MM-DD')) {
8483
8514
  this._value = DateTime.format(date, 'YYYY-MM-DD');
8484
8515
  if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
@@ -8490,9 +8521,9 @@ function _set_prototype_of$8(o, p) {
8490
8521
  if (this.datePicker) this.datePicker.open = false;
8491
8522
  Control.prototype.reset.call(this);
8492
8523
  };
8493
- /**
8494
- * 销毁控件
8495
- * @override
8524
+ /**
8525
+ * 销毁控件
8526
+ * @override
8496
8527
  */ _proto.destroy = function destroy() {
8497
8528
  if (this.datePicker) {
8498
8529
  this.datePicker.destroy();
@@ -8505,9 +8536,39 @@ function _set_prototype_of$8(o, p) {
8505
8536
  var arr = this._value.split('-');
8506
8537
  return arr[1] + "." + arr[2];
8507
8538
  };
8508
- /**
8509
- * 点击 Control 会触发
8510
- * @overload super._onControlClick(e: Event)
8539
+ /**
8540
+ * / 年面板中被点选的单元格是否已被调用方禁用
8541
+ *
8542
+ * 禁用的单元格底层不会切换展示的年月,因此不应派发变化
8543
+ * @param date 单元格日期
8544
+ * @param mode 当前面板模式
8545
+ */ _proto._isPanelCellDisabled = function _isPanelCellDisabled(date, mode) {
8546
+ if (mode === 'month') return !!(this.options.disabledMonth == null ? void 0 : this.options.disabledMonth.call(this.options, date, DateTime.format(date, 'YYYY-MM')));
8547
+ if (mode === 'year') return !!(this.options.disabledYear == null ? void 0 : this.options.disabledYear.call(this.options, date, date.getFullYear()));
8548
+ return false;
8549
+ };
8550
+ /**
8551
+ * 日历面板展示的年月发生变化时,派发年份 / 月份变化
8552
+ *
8553
+ * 年份变化会先于月份变化派发;跨年翻页(如 2026-01 -> 2025-12)两者都会触发
8554
+ * @param renderDate 面板当前展示的日期
8555
+ */ _proto._onPanelDateChange = function _onPanelDateChange(renderDate) {
8556
+ if (!renderDate) return;
8557
+ var month = DateTime.format(renderDate, 'YYYY-MM');
8558
+ if (!month || month === this._renderMonth) return;
8559
+ var prevYear = this._renderMonth.slice(0, 4);
8560
+ var year = month.slice(0, 4);
8561
+ this._renderMonth = month;
8562
+ if (year !== prevYear) {
8563
+ this.options.onYearChange == null ? void 0 : this.options.onYearChange.call(this.options, renderDate, year);
8564
+ this.emit(EVENTS.control.datePanelYearChange, renderDate, year);
8565
+ }
8566
+ this.options.onMonthChange == null ? void 0 : this.options.onMonthChange.call(this.options, renderDate, month);
8567
+ this.emit(EVENTS.control.datePanelMonthChange, renderDate, month);
8568
+ };
8569
+ /**
8570
+ * 点击 Control 会触发
8571
+ * @overload super._onControlClick(e: Event)
8511
8572
  */ _proto._onControlClick = function _onControlClick(e) {
8512
8573
  Control.prototype._onControlClick.call(this, e);
8513
8574
  };
@@ -10398,6 +10459,11 @@ function _unsupported_iterable_to_array(o, minLen) {
10398
10459
  if (n === "Map" || n === "Set") return Array.from(n);
10399
10460
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
10400
10461
  }
10462
+ /**
10463
+ * 语言包缺 key 时的兜底文案 key
10464
+ *
10465
+ * 拼写沿用语言包中既有的 `UNKOWN_ISSUE`(少了一个 N),改名属破坏性变更,故保持原样。
10466
+ */ var UNKOWN_ISSUE_KEY = 'UNKOWN_ISSUE';
10401
10467
  var THEME_DEFAULT_OPTIONS = {
10402
10468
  dblClickFullscreen: true,
10403
10469
  language: 'zh',
@@ -10473,7 +10539,7 @@ var THEME_DEFAULT_OPTIONS = {
10473
10539
  */ _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, /**
10474
10540
  * 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
10475
10541
  * @private
10476
- */ _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, _this._url = '', /** 是否播放中 @private */ _this._playing = false, /** @private 加载中 */ _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 = [], /**
10542
+ */ _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, _this._url = '', /** 是否播放中 @private */ _this._playing = false, /** @private 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 正在兜底的原始 scope,非 null 表示处于兜底取值中(用于避免 customizeMissing 无限递归) */ _this._missingScope = null, /** 电子放大倍数 @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 = [], /**
10477
10543
  * 播放区间(片段分享),null 表示不约束。
10478
10544
  * 由 SDK 层在初始化时通过 props 下发,主题层据此决定日历/回放类型按钮
10479
10545
  * 是否渲染、片段进度条是否渲染。区间没有运行时变更入口。
@@ -10736,6 +10802,50 @@ var THEME_DEFAULT_OPTIONS = {
10736
10802
  }
10737
10803
  };
10738
10804
  /**
10805
+ * 获取多语言文案
10806
+ *
10807
+ * 相比直接用 `theme.i18n.t()`:返回类型收窄为 `string`(底层签名是 `string | number`,
10808
+ * 调用处不必再写 `as string`)。缺失 key 的兜底由 i18n 实例上的 `customizeMissing`
10809
+ * 统一处理,因此两者在兜底行为上一致。
10810
+ * @param scope 多语言 key
10811
+ * @param variables 插值变量,如 `{ zoom: 8 }`;传 `defaultvalue` 可指定自己的兜底文案
10812
+ * @returns 文案;scope 不存在时返回「未知问题 【scope】」
10813
+ * @example
10814
+ * ```ts
10815
+ * theme.t('ZOOM_LIMIT_MAX', { zoom: 8 });
10816
+ * theme.t('NOT_EXIST_KEY'); // 未知问题 【NOT_EXIST_KEY】
10817
+ * theme.t('NOT_EXIST_KEY', { defaultvalue: '自定义兜底' }); // 自定义兜底
10818
+ * ```
10819
+ */ _proto.t = function t(scope, variables) {
10820
+ return this.i18n.t(scope, variables);
10821
+ };
10822
+ /**
10823
+ * 语言包缺 key 时的兜底文案(`customizeMissing` 的实现)
10824
+ *
10825
+ * 注意底层是把本方法的返回值「原样返回」、不再做插值,所以这里借
10826
+ * `i18n.t(UNKOWN_ISSUE)` 完成插值。而这一次取值本身也可能缺失
10827
+ * (如 `language` 传了不存在的语言,当前语言包整体不存在),
10828
+ * 那会再次回调到这里造成无限递归,因此用重入标记兜住,退化为直接返回原始 scope。
10829
+ *
10830
+ * 注:`options.locales` 与内置语言包是深合并,无法移除内置的 UNKOWN_ISSUE,
10831
+ * 因此正常配置下不会走到退化分支。
10832
+ * @param scope 缺失的多语言 key
10833
+ * @param variables 原始插值变量
10834
+ */ _proto._missingText = function _missingText(scope, variables) {
10835
+ // 兜底文案自身也缺失(如当前语言的语言包不存在):直接返回最初的 scope,
10836
+ // 而不是兜底 key 本身,否则用户看到的是 'UNKOWN_ISSUE' 这种无意义内容
10837
+ if (this._missingScope !== null) return "" + this._missingScope;
10838
+ this._missingScope = scope;
10839
+ try {
10840
+ // scope 放在最后,避免调用方传入同名变量把它覆盖掉
10841
+ return this.i18n.t(UNKOWN_ISSUE_KEY, _extends({}, variables, {
10842
+ scope: scope
10843
+ }));
10844
+ } finally{
10845
+ this._missingScope = null;
10846
+ }
10847
+ };
10848
+ /**
10739
10849
  * 销毁包括事件、控件 ...
10740
10850
  *
10741
10851
  * Destroy (including events, controls...)
@@ -10791,6 +10901,7 @@ var THEME_DEFAULT_OPTIONS = {
10791
10901
  // 私有方法
10792
10902
  // ==============================================================================================
10793
10903
  /** 初始化配置项 */ _proto._initOptions = function _initOptions(options) {
10904
+ var _this = this;
10794
10905
  if (options === void 0) options = {};
10795
10906
  var _this_options_loggerOptions, _this_options_definitionOptions_list, _this_options_definitionOptions, _this_options_videoLevelList;
10796
10907
  // 先对模块级默认配置做一次深拷贝,得到全新的嵌套对象/数组,
@@ -10843,7 +10954,13 @@ var THEME_DEFAULT_OPTIONS = {
10843
10954
  });
10844
10955
  // prettier-ignore
10845
10956
  this.i18n = new I18n(locales, {
10846
- defaultLocale: language
10957
+ defaultLocale: language,
10958
+ // 语言包缺 key 时,底层默认返回 `[missing "zh.XXX" translation]`,
10959
+ // 这种占位串一旦透到 UI 上对用户毫无意义。挂在 i18n 实例上统一兜底,
10960
+ // 这样控件内直接调用 `i18n.t()` 的地方也能受益,无需逐处改造。
10961
+ customizeMissing: function customizeMissing(scope, variables) {
10962
+ return _this._missingText(scope, variables);
10963
+ }
10847
10964
  });
10848
10965
  // 默认清晰度列表
10849
10966
  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) {
@@ -11868,6 +11985,6 @@ var THEME_DEFAULT_OPTIONS = {
11868
11985
  zh: zh,
11869
11986
  en: en
11870
11987
  };
11871
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.5-beta.4';
11988
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '3.1.6';
11872
11989
 
11873
11990
  export { Control, EVENTS, Fullscreen, Loading, Message, Play, Poster, Rec, Theme, Utils, Volume };