@ezuikit/player-theme 3.1.2-beta.1 → 3.1.2-beta.3

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.
@@ -858,7 +858,7 @@ declare class Volume extends Control {
858
858
  /**
859
859
  * 全屏信息
860
860
  */
861
- interface FullscreenChangeInfo {
861
+ interface FullscreenChangeInfo$1 {
862
862
  /** 当前窗口是否处于全屏 */
863
863
  isCurrentFullscreen: boolean;
864
864
  /** 浏览器中是否有全屏 (移动端中永远是 false) */
@@ -869,7 +869,7 @@ interface FullscreenChangeInfo {
869
869
  /**
870
870
  * 全屏变化回调
871
871
  */
872
- type FullscreenChange = (info: FullscreenChangeInfo) => void;
872
+ type FullscreenChange = (info: FullscreenChangeInfo$1) => void;
873
873
  /**
874
874
  * 全屏配置项
875
875
  */
@@ -953,7 +953,7 @@ interface FullscreenOptions extends Omit<ControlOptions, 'tagName'> {
953
953
  * 全屏改变
954
954
  * @param info FullscreenChangeInfo 全屏信息
955
955
  */
956
- onChange?: (info: FullscreenChangeInfo) => void;
956
+ onChange?: (info: FullscreenChangeInfo$1) => void;
957
957
  }
958
958
  /**
959
959
  * 全屏控件
@@ -971,7 +971,7 @@ declare class Fullscreen extends Control {
971
971
  */
972
972
  destroy(): void;
973
973
  protected _render(): void;
974
- protected _fullscreenChange(info: FullscreenChangeInfo): void;
974
+ protected _fullscreenChange(info: FullscreenChangeInfo$1): void;
975
975
  /**
976
976
  * 点击 Control 会触发
977
977
  */
@@ -1492,10 +1492,9 @@ declare class Theme extends EventEmitter {
1492
1492
  readonly audioInfo: "audioInfo";
1493
1493
  readonly videoInfo: "videoInfo";
1494
1494
  readonly firstFrameDisplay: "firstFrameDisplay";
1495
- readonly fullscreen: "fullscreen"; /** 所有私有流的模板 @since 0.0.1 */
1495
+ readonly fullscreen: "fullscreen";
1496
1496
  readonly exitFullscreen: "exitFullscreen";
1497
1497
  readonly fullscreenChange: "fullscreenChange";
1498
- /** 播放器配置项 */
1499
1498
  readonly resize: "resize";
1500
1499
  readonly orientationChange: "orientationChange";
1501
1500
  readonly audioCodecUnsupported: "audioCodecUnsupported";
@@ -1505,15 +1504,25 @@ declare class Theme extends EventEmitter {
1505
1504
  readonly speedChange: "speedChange";
1506
1505
  readonly recordingChange: "recordingChange";
1507
1506
  readonly talkingChange: "talkingChange";
1508
- readonly talkVolumeChange: "talkVolumeChange"; /** 封面控件 @since 0.0.1 @private */
1507
+ readonly talkVolumeChange: "talkVolumeChange";
1509
1508
  readonly broadcastChange: "broadcastChange";
1510
1509
  readonly aichatChange: "aichatChange";
1511
1510
  readonly liveChange: "liveChange";
1511
+ /**
1512
+ * @type { "rec" | "cloudRec" | "cloudRecord" } recType 回放类型
1513
+ * ```ts
1514
+ * theme.recType // 回放类型
1515
+ * ```
1516
+ */
1512
1517
  readonly recDropdownChange: "recDropdownChange";
1513
1518
  readonly recListChange: "recListChange";
1514
1519
  readonly alarmMessageChange: "alarmMessageChange";
1515
1520
  readonly setLoggerOptions: "setLoggerOptions";
1516
- readonly records: "records";
1521
+ readonly records: "records"; /**
1522
+ * 更多控件(footer more)
1523
+ * @since 0.0.1
1524
+ * @private
1525
+ */
1517
1526
  readonly ptzSpeedChange: "ptzSpeedChange";
1518
1527
  readonly setVideoLevelList: "setVideoLevelList";
1519
1528
  readonly currentVideoLevel: "currentVideoLevel";
@@ -1523,8 +1532,8 @@ declare class Theme extends EventEmitter {
1523
1532
  readonly control: {
1524
1533
  readonly play: "Control.play";
1525
1534
  readonly playDestroy: "Control.playDestroy";
1526
- readonly capturePicture: "Control.capturePicture";
1527
- readonly capturePictureResult: "Control.capturePictureResult"; /** @since 0.0.1 @private */
1535
+ readonly capturePicture: "Control.capturePicture"; /** @since 0.0.1 @private */
1536
+ readonly capturePictureResult: "Control.capturePictureResult";
1528
1537
  readonly capturePictureDestroy: "Control.capturePictureDestroy";
1529
1538
  readonly volumechange: "Control.volumechange";
1530
1539
  readonly volumePanelOpenChange: "Control.volumePanelOpenChange";
@@ -1535,16 +1544,13 @@ declare class Theme extends EventEmitter {
1535
1544
  readonly footerMoreShowControlsChange: "Control.footerMoreShowControlsChange";
1536
1545
  readonly footerMorePanelOpenChange: "Control.footerMorePanelOpenChange";
1537
1546
  readonly deviceDestroy: "Control.deviceDestroy";
1538
- readonly recTypeChange: "Control.recTypeChange";
1547
+ readonly recTypeChange: "Control.recTypeChange"; /** 自定清晰度 @private */
1539
1548
  readonly recDestroy: "Control.recDestroy";
1540
1549
  readonly definitionChange: "Control.definitionChange";
1541
1550
  readonly definitionList: "Control.definitionList";
1542
1551
  readonly definitionPanelOpenChange: "Control.definitionPanelOpenChange";
1543
1552
  readonly definitionDestroy: "Control.definitionDestroy";
1544
1553
  readonly speedChange: "Control.speedChange";
1545
- /**
1546
- * 录像回放的月份列表 @private
1547
- */
1548
1554
  readonly speedPanelOpenChange: "Control.speedPanelOpenChange";
1549
1555
  readonly speedDestroy: "Control.speedDestroy";
1550
1556
  readonly ptzPanelOpenChange: "Control.ptzPanelOpenChange";
@@ -1599,9 +1605,7 @@ declare class Theme extends EventEmitter {
1599
1605
  readonly mobileExtendDestroy: "Theme.mobileExtendDestroy";
1600
1606
  readonly recFooterDestroy: "Theme.recFooterDestroy";
1601
1607
  };
1602
- readonly message: "message"; /**
1603
- * url 信息 播放地址信息
1604
- */
1608
+ readonly message: "message";
1605
1609
  };
1606
1610
  /** 语言包 @since 0.0.1 */
1607
1611
  static LOCALES: {
@@ -1706,7 +1710,6 @@ declare class Theme extends EventEmitter {
1706
1710
  397007: string;
1707
1711
  399000: string;
1708
1712
  399001: string;
1709
- /** 移动端竖屏, 全屏情况下不展示扩张,放置在 footer 中 */
1710
1713
  399002: string;
1711
1714
  399016: string;
1712
1715
  399048: string;
@@ -1761,6 +1764,7 @@ declare class Theme extends EventEmitter {
1761
1764
  MIN_SPEED_LIMIT: string;
1762
1765
  SEEK_CANNOT_CROSS_DAYS: string;
1763
1766
  SEEK_TIMEFORMAT_ERROR: string;
1767
+ /** 所有控件列表, 所有控件名称规则(`${iconId}Control`), 如音量控件 this.controls["volumeControl"] @since 0.0.1 */
1764
1768
  PAUSE: string;
1765
1769
  PAUSE_FAILED: string;
1766
1770
  RESUME: string;
@@ -1771,7 +1775,6 @@ declare class Theme extends EventEmitter {
1771
1775
  CHANGE_VIDEO_LEVEL: string;
1772
1776
  CHANGE_VIDEO_LEVEL_FAIL: string;
1773
1777
  GET_VIDEO_LEVEL_LIST: string;
1774
- /** 消息提示控件 @since 0.0.1 @private */
1775
1778
  PLEASE_INPUT_RIGHT_VIDEO_LEVEL: string;
1776
1779
  VIDEO_LEVEL_NOT_SUPPORT: string;
1777
1780
  VIDEO_LEVEL_AUTO: string;
@@ -1785,6 +1788,11 @@ declare class Theme extends EventEmitter {
1785
1788
  RESET_THEME: string;
1786
1789
  BTN_PLAY: string;
1787
1790
  BTN_PAUSE: string;
1791
+ /**
1792
+ * 更多控件(header more)
1793
+ * @since 0.0.1
1794
+ * @private
1795
+ */
1788
1796
  BTN_VOLUME: string;
1789
1797
  BTN_MUTED: string;
1790
1798
  BTN_RECORDVIDEO: string;
@@ -1794,18 +1802,14 @@ declare class Theme extends EventEmitter {
1794
1802
  BTN_AICHAT: string;
1795
1803
  BTN_LIVE: string;
1796
1804
  BTN_REC_DROPDOWN: string;
1797
- BTN_ALARM_MESSAGE: string;
1805
+ BTN_ALARM_MESSAGE: string; /** 头部控件 @since 0.0.1 @private */
1798
1806
  REC_DROPDOWN_CLOUD_REC: string;
1799
- REC_DROPDOWN_CLOUD_RECORD: string;
1807
+ REC_DROPDOWN_CLOUD_RECORD: string; /** 低部控件 @since 0.0.1 @private */
1800
1808
  REC_DROPDOWN_LOCAL_REC: string;
1801
- BTN_ZOOM: string; /** 回放底部时间轴 @since 0.0.1 @private */
1809
+ BTN_ZOOM: string;
1802
1810
  BTN_3D_ZOOM: string;
1803
1811
  BTN_PTZ: string;
1804
1812
  BTN_GLOBAL_FULLSCREEN: string;
1805
- /**
1806
- * 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
1807
- * @private
1808
- */
1809
1813
  BTN_EXIT_GLOBAL_FULLSCREEN: string;
1810
1814
  BTN_FULLSCREEN: string;
1811
1815
  BTN_EXIR_FULLSCREEN: string;
@@ -1823,14 +1827,13 @@ declare class Theme extends EventEmitter {
1823
1827
  CAPTURE_FAILED: string;
1824
1828
  START_RECORD_SUCCESS: string;
1825
1829
  START_RECORD_FAILED: string;
1826
- STOP_RECORD_SUCCESS: string; /** resizeObserver 监听销毁 */
1830
+ STOP_RECORD_SUCCESS: string;
1827
1831
  STOP_RECORD_FAILED: string;
1828
1832
  RECORD_TIPS: string;
1829
1833
  RECORDS: string;
1830
1834
  OPEN_SOUND: string;
1831
1835
  CLOSE_SOUND: string;
1832
1836
  SOUND_OPENED: string;
1833
- /** 容器的宽 */
1834
1837
  ZOOM: string;
1835
1838
  START_ZOOM: string;
1836
1839
  CLOSE_ZOOM: string;
@@ -1842,7 +1845,6 @@ declare class Theme extends EventEmitter {
1842
1845
  ZOOM_LIMIT_MIN: string;
1843
1846
  ZOOM_NOT_ENABLED: string;
1844
1847
  '3D_ZOOM': string;
1845
- /** @private 加载中 */
1846
1848
  '3D_ZOOM_DISABLE': string;
1847
1849
  '3D_ZOOM_FAILED': string;
1848
1850
  START_3D_ZOOM: string;
@@ -1850,14 +1852,14 @@ declare class Theme extends EventEmitter {
1850
1852
  DEVICE_NOT_SUPPORT_3D_ZOOM: string;
1851
1853
  '3D_ZOOM_ACTIVED': string;
1852
1854
  '3D_ZOOM_NOT_ACTIVED': string;
1853
- '3D_ZOOM_CLOSED': string;
1855
+ '3D_ZOOM_CLOSED': string; /** 录制中 @private */
1854
1856
  CHANGE_ZOOM_TYPE: string;
1855
1857
  FULLSCREEN: string;
1856
- FULLSCREEN_EXIT: string; /** 自定清晰度 @private */
1858
+ FULLSCREEN_EXIT: string;
1859
+ /** 倍速 @private */
1857
1860
  GET_WEB_FULLSCREEN_STATUS: string;
1858
1861
  WEB_FULLSCREEN: string;
1859
1862
  WEB_FULLSCREEN_EXIT: string;
1860
- /** 回放片段列表 */
1861
1863
  DESTROY: string;
1862
1864
  GET_CAPACITY: string;
1863
1865
  GET_PTZ_STATUS: string;
@@ -1871,16 +1873,16 @@ declare class Theme extends EventEmitter {
1871
1873
  PTZ_SPEED: string;
1872
1874
  DEVICE_ZOOM: string;
1873
1875
  DEVICE_FOCUS: string;
1874
- /**
1875
- * 录像回放的月份列表 @private
1876
- */
1877
1876
  NOT_SUPPORT_DEVICE_ZOOM: string;
1878
1877
  NOT_SUPPORT_FOCUS: string;
1879
1878
  MIRROR: string;
1879
+ /**
1880
+ * 录像回放的月份列表 @private
1881
+ */
1880
1882
  MIRROR_TYPE_ERROR: string;
1881
- CHANGE_FEC_TYPE: string;
1883
+ CHANGE_FEC_TYPE: string; /** 清理 header/footer 动画 定时器 @private */
1882
1884
  DEVICE_NOT_SUPPORT: string;
1883
- TYPE_NOT_SUPPORT: string; /** 销毁标识 @readonly */
1885
+ TYPE_NOT_SUPPORT: string;
1884
1886
  FEC_SUPPORT_VERSION: string;
1885
1887
  NO_CANVAS_ID: string;
1886
1888
  SET_FEC_PARAMS: string;
@@ -1950,8 +1952,8 @@ declare class Theme extends EventEmitter {
1950
1952
  395601: string;
1951
1953
  395602: string;
1952
1954
  395610: string;
1953
- /** 暂停控件 @since 0.0.1 @private */
1954
1955
  395620: string;
1956
+ /** 消息提示控件 @since 0.0.1 @private */
1955
1957
  395701: string;
1956
1958
  395702: string;
1957
1959
  395703: string;
@@ -1972,17 +1974,19 @@ declare class Theme extends EventEmitter {
1972
1974
  396503: string;
1973
1975
  396504: string;
1974
1976
  396505: string;
1975
- /** 屏幕旋转角度 0 | 90 | 180 | 270 */
1976
- 396506: string; /** 是否播放中 @private */
1977
+ 396506: string;
1977
1978
  396508: string;
1978
1979
  396509: string;
1979
1980
  396510: string;
1980
1981
  396511: string;
1981
1982
  396512: string;
1982
1983
  396513: string;
1983
- 396514: string;
1984
+ 396514: string; /** 回放片段列表 */
1984
1985
  396515: string;
1985
1986
  396516: string;
1987
+ /**
1988
+ * 录像回放的月份列表 @private
1989
+ */
1986
1990
  396517: string;
1987
1991
  396518: string;
1988
1992
  396519: string;
@@ -2040,9 +2044,7 @@ declare class Theme extends EventEmitter {
2040
2044
  STOP_SUCCESS: string;
2041
2045
  CHANGE_PLAYURL_SUCCESS: string;
2042
2046
  CHANGE_PLAYURL_FAILED: string;
2043
- GET_OSD_TIME: string; /**
2044
- * url 信息 播放地址信息
2045
- */
2047
+ GET_OSD_TIME: string;
2046
2048
  GET_OSD_TIME_FAILED: string;
2047
2049
  SET_POSTER: string;
2048
2050
  RESIZE: string;
@@ -2064,6 +2066,10 @@ declare class Theme extends EventEmitter {
2064
2066
  CHANGE_VIDEO_LEVEL: string;
2065
2067
  CHANGE_VIDEO_LEVEL_FAIL: string;
2066
2068
  GET_VIDEO_LEVEL_LIST: string;
2069
+ /**
2070
+ * 视频分辨率 高
2071
+ * @version 3.1.2
2072
+ */
2067
2073
  PLEASE_INPUT_RIGHT_VIDEO_LEVEL: string;
2068
2074
  VIDEO_LEVEL_NOT_SUPPORT: string;
2069
2075
  VIDEO_LEVEL_AUTO: string;
@@ -2113,6 +2119,9 @@ declare class Theme extends EventEmitter {
2113
2119
  CAPTURE_FAILED: string;
2114
2120
  START_RECORD_SUCCESS: string;
2115
2121
  START_RECORD_FAILED: string;
2122
+ /**
2123
+ * 音量值
2124
+ */
2116
2125
  STOP_RECORD_SUCCESS: string;
2117
2126
  STOP_RECORD_FAILED: string;
2118
2127
  RECORD_TIPS: string;
@@ -2129,6 +2138,10 @@ declare class Theme extends EventEmitter {
2129
2138
  ZOOM_SUB_MIN: string;
2130
2139
  ZOOM_LIMIT_MAX: string;
2131
2140
  ZOOM_LIMIT_MIN: string;
2141
+ /**
2142
+ * 静音
2143
+ *
2144
+ */
2132
2145
  ZOOM_NOT_ENABLED: string;
2133
2146
  '3D_ZOOM': string;
2134
2147
  '3D_ZOOM_DISABLE': string;
@@ -2256,6 +2269,7 @@ declare class Theme extends EventEmitter {
2256
2269
  private _isCurrentFullscreen;
2257
2270
  /** 屏幕旋转角度 0 | 90 | 180 | 270 */
2258
2271
  private _orientationAngle;
2272
+ _url: string;
2259
2273
  /** 是否播放中 @private */
2260
2274
  _playing: boolean;
2261
2275
  /** @private 加载中 */
@@ -2291,7 +2305,10 @@ declare class Theme extends EventEmitter {
2291
2305
  /** 销毁标识 @readonly */
2292
2306
  destroyed: boolean;
2293
2307
  scaleMode: ThemeOptions['scaleMode'];
2308
+ _videoInfo: ThemeVideoInfo;
2294
2309
  constructor(options: ThemeOptions);
2310
+ get url(): string;
2311
+ set url(url: string);
2295
2312
  /**
2296
2313
  * url 信息 播放地址信息
2297
2314
  */
@@ -2310,6 +2327,29 @@ declare class Theme extends EventEmitter {
2310
2327
  * ```
2311
2328
  */
2312
2329
  get height(): number;
2330
+ /**
2331
+ * 视频信息
2332
+ * @version 3.1.2
2333
+ * ```ts
2334
+ * theme.videoInfo // ThemeVideoInfo
2335
+ * ```
2336
+ */
2337
+ get videoInfo(): ThemeVideoInfo;
2338
+ /**
2339
+ * 视频分辨率 宽
2340
+ *
2341
+ * @version 3.1.2
2342
+ *
2343
+ * ```ts
2344
+ * theme.videoWidth // number
2345
+ * ```
2346
+ */
2347
+ get videoWidth(): number;
2348
+ /**
2349
+ * 视频分辨率 高
2350
+ * @version 3.1.2
2351
+ */
2352
+ get videoHeight(): number;
2313
2353
  /**
2314
2354
  * 当前播放状态
2315
2355
  * ```ts
@@ -2627,12 +2667,18 @@ declare class Theme extends EventEmitter {
2627
2667
  * @param url 录像 url
2628
2668
  * @returns {"rec" | "cloudRecord" | "cloudRec" | ""} 录像类型, rec: 录像, cloudRec: 云录像, cloudRecord: 云录制
2629
2669
  */
2630
- protected _getRecType(url: string): "" | "cloudRec" | "cloudRecord" | "rec";
2670
+ protected _getRecType(url: string): "" | "rec" | "cloudRec" | "cloudRecord";
2631
2671
  private resetControl;
2632
2672
  /**
2633
2673
  * 窗口全屏后旋转 90度判断, 然后设置控件已经旋转 90度, 为了解决控件交互问题
2634
2674
  */
2635
2675
  private _isRotated;
2676
+ get isEzopen(): boolean;
2677
+ /**
2678
+ * 判断播放地址是萤石的播放地址
2679
+ * @since 3.1.2
2680
+ */
2681
+ get isEzviz(): boolean;
2636
2682
  }
2637
2683
 
2638
2684
  /**
@@ -2796,6 +2842,11 @@ interface ThemeOptions {
2796
2842
  disabledTimeLine?: boolean;
2797
2843
  [kye: string]: any;
2798
2844
  }
2845
+ interface ThemeVideoInfo {
2846
+ width?: number;
2847
+ height?: number;
2848
+ [key: string]: any;
2849
+ }
2799
2850
  /**
2800
2851
  * 回放控件类型
2801
2852
  * @since 0.0.1
@@ -2911,5 +2962,247 @@ declare class Utils {
2911
2962
  static resizeObserver(node: Element, callback?: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void): CleanUpResizeObserver;
2912
2963
  }
2913
2964
 
2965
+ /**
2966
+ * 事件类型定义
2967
+ *
2968
+ * 本文件根据 `src/constant.ts` 的 `EVENTS` 常量生成对应的「事件名」与「事件载荷」类型,
2969
+ * 用于给 `theme.on / once / off / emit` 提供类型提示。
2970
+ *
2971
+ * - 事件名(`ThemeEventName` 等)直接由 `typeof EVENTS` 推导,随 `EVENTS` 自动同步。
2972
+ * - 事件载荷(`ThemeEventMap`)依据事件文档与实际 emit 现场(`_bindEventemitter.ts` 等)手写,
2973
+ * 键为事件的「字符串值」(如 `'play'`、`'Control.play'`、`'Theme.destroyed'`),
2974
+ * 与 `EVENTS.play` / `EVENTS.control.play` / `EVENTS.theme.destroyed` 的取值一致。
2975
+ * - 文件末尾有编译期断言:保证 `EVENTS` 中的每个事件都在 `ThemeEventMap` 中声明了类型,
2976
+ * 反之亦然(防止漏写或写错事件名)。
2977
+ *
2978
+ * @remarks 载荷见 guide/events.md。标注为 `unknown` 的表示载荷由内核/插件决定,未固定结构。
2979
+ */
2980
+
2981
+ type EventsConst = typeof EVENTS;
2982
+ /** 对外事件名,如 `'play'`、`'volumechange'`、`'message'` */
2983
+ type ThemeOuterEventName = EventsConst[Exclude<keyof EventsConst, 'control' | 'theme'>];
2984
+ /** 控件事件名,如 `'Control.play'`、`'Control.volumechange'` */
2985
+ type ControlEventName = EventsConst['control'][keyof EventsConst['control']];
2986
+ /** 主题生命周期事件名,如 `'Theme.destroyed'` */
2987
+ type ThemeLifecycleEventName = EventsConst['theme'][keyof EventsConst['theme']];
2988
+ /** 所有事件名(对外 + 控件 + 生命周期)的并集 */
2989
+ type ThemeEventName = ThemeOuterEventName | ControlEventName | ThemeLifecycleEventName;
2990
+ /** 屏幕旋转角度 */
2991
+ type OrientationAngle = 0 | 90 | 180 | 270;
2992
+ /** 全屏状态变化载荷 */
2993
+ interface FullscreenChangeInfo {
2994
+ /** 当前容器是否处于全局全屏 */
2995
+ isCurrentFullscreen: boolean;
2996
+ /** 是否浏览器全屏 */
2997
+ isFullscreen: boolean;
2998
+ /** 是否移动端(移动端为模拟全屏) */
2999
+ isMobile: boolean;
3000
+ /** 旋转角度 */
3001
+ orientationAngle?: OrientationAngle;
3002
+ }
3003
+ /** 容器尺寸变化载荷 */
3004
+ interface ResizeInfo {
3005
+ width: number;
3006
+ height: number;
3007
+ isCurrentFullscreen?: boolean;
3008
+ orientationAngle?: OrientationAngle;
3009
+ }
3010
+ /** 音频信息(用于解禁音量控件) */
3011
+ interface AudioInfo {
3012
+ /** 标准流编码类型 */
3013
+ encType?: string;
3014
+ /** 私有流音频格式名 */
3015
+ audioFormatName?: string;
3016
+ [key: string]: unknown;
3017
+ }
3018
+ /** 视频信息(用于重渲染画面) */
3019
+ interface VideoInfo {
3020
+ width: number;
3021
+ height: number;
3022
+ [key: string]: unknown;
3023
+ }
3024
+ /** 云台错误信息 */
3025
+ interface PtzErrorInfo {
3026
+ code: string | number;
3027
+ localeKey?: string;
3028
+ msg?: string;
3029
+ [key: string]: unknown;
3030
+ }
3031
+ /**
3032
+ * 事件名 → 监听器签名 的映射表。
3033
+ *
3034
+ * 可用于给 eventemitter3 提供泛型:`class Theme extends EventEmitter<ThemeEventMap>`,
3035
+ * 或直接查询单个事件的处理函数类型:`ThemeEventMap['play']`。
3036
+ */
3037
+ interface ThemeEventMap {
3038
+ /** 加载状态变化 */
3039
+ loading: (loading: boolean) => void;
3040
+ /** 播放/暂停状态变化 */
3041
+ play: (playing: boolean) => void;
3042
+ /** 首帧显示(内部会解禁控件) */
3043
+ firstFrameDisplay: () => void;
3044
+ /** 截图 */
3045
+ capturePicture: () => void;
3046
+ /** 音量变化 */
3047
+ volumechange: (volume: number, muted: boolean) => void;
3048
+ /** 缩放倍数变化 */
3049
+ zoomChange: (zoom: number) => void;
3050
+ /** 缩放状态变化(true 可缩放 / false 禁止) */
3051
+ zoomingChange: (zooming: boolean) => void;
3052
+ /** 缩放平移改变(载荷来自缩放插件) */
3053
+ zoomTranslateChange: (translate: unknown) => void;
3054
+ /** 音频信息 */
3055
+ audioInfo: (info: AudioInfo) => void;
3056
+ /** 视频信息 */
3057
+ videoInfo: (info: VideoInfo) => void;
3058
+ /** 音频编码不支持(仅标准流 flv) */
3059
+ audioCodecUnsupported: (flag: boolean) => void;
3060
+ /** 进入全屏 */
3061
+ fullscreen: () => void;
3062
+ /** 退出全屏 */
3063
+ exitFullscreen: () => void;
3064
+ /** 全屏状态变化 */
3065
+ fullscreenChange: (info: FullscreenChangeInfo) => void;
3066
+ /** 容器尺寸变化 */
3067
+ resize: (info: ResizeInfo) => void;
3068
+ /** 屏幕旋转方向变化 */
3069
+ orientationChange: (angle: OrientationAngle) => void;
3070
+ /** 切换主题 */
3071
+ changeTheme: (themeData: IThemeData | null) => void;
3072
+ /** 回放类型切换 */
3073
+ recTypeChange: (type: string) => void;
3074
+ /** 切换清晰度 */
3075
+ definitionChange: (definition: number, item?: DefinitionItem) => void;
3076
+ /** 播放速度切换 */
3077
+ speedChange: (speed: number, item?: unknown) => void;
3078
+ /** 录制状态变化 */
3079
+ recordingChange: (recording: boolean) => void;
3080
+ /** 对讲状态变化 */
3081
+ talkingChange: (talking: boolean) => void;
3082
+ /** 麦克风音量变化(高频) */
3083
+ talkVolumeChange: (value: number) => void;
3084
+ /** 语音广播状态变化 */
3085
+ broadcastChange: (active: boolean) => void;
3086
+ /** AI 对话框状态变化 */
3087
+ aichatChange: (active: boolean) => void;
3088
+ /** 直播模式切换 */
3089
+ liveChange: () => void;
3090
+ /** 回放下拉选择变化 */
3091
+ recDropdownChange: (type: string) => void;
3092
+ /** 录像列表面板状态变化 */
3093
+ recListChange: (active: boolean) => void;
3094
+ /** 告警消息面板状态变化 */
3095
+ alarmMessageChange: (active: boolean) => void;
3096
+ /** 动态切换日志配置 */
3097
+ setLoggerOptions: (options: LoggerOptions) => void;
3098
+ /** 回放片段 */
3099
+ records: (records: unknown) => void;
3100
+ /** 云台速度变化 */
3101
+ ptzSpeedChange: (speed: number) => void;
3102
+ /** 设置清晰度列表 */
3103
+ setVideoLevelList: (list: DefinitionItem[]) => void;
3104
+ /** 当前清晰度 */
3105
+ currentVideoLevel: (item: DefinitionItem | number, level: number) => void;
3106
+ /** 当前是否自动清晰度 */
3107
+ currentVideoLevelAuto: (auto: boolean) => void;
3108
+ /** 设置全天回放片段(高频) */
3109
+ setAllDayRecTimes: (data: {
3110
+ list: unknown[];
3111
+ }) => void;
3112
+ /** OSD 时间(高频) */
3113
+ getOSDTime: (time: {
3114
+ data: number;
3115
+ }) => void;
3116
+ /** 统一消息提示入口(duration 单位秒) */
3117
+ message: (message: string, type: string, duration?: number) => void;
3118
+ /** 控件挂载前 */
3119
+ 'Control.beforeMountControls': () => void;
3120
+ /** 控件挂载完成 */
3121
+ 'Control.mountedControls': () => void;
3122
+ /** 控件卸载前 */
3123
+ 'Control.beforeUnmountControls': () => void;
3124
+ /** 控件卸载完成 */
3125
+ 'Control.unmountedControls': () => void;
3126
+ /** Header/Footer 显隐变化 */
3127
+ 'Control.controlsBarOpenChange': (open: boolean) => void;
3128
+ /** Header 更多按钮列表变化 */
3129
+ 'Control.headerMoreShowControlsChange': (show: boolean) => void;
3130
+ /** Header 更多面板显隐 */
3131
+ 'Control.headerMorePanelOpenChange': (open: boolean) => void;
3132
+ /** Footer 更多按钮列表变化 */
3133
+ 'Control.footerMoreShowControlsChange': (show: boolean, controls?: unknown[]) => void;
3134
+ /** Footer 更多面板显隐 */
3135
+ 'Control.footerMorePanelOpenChange': (open: boolean) => void;
3136
+ /** 点击播放/暂停 */
3137
+ 'Control.play': (playing: boolean, from?: unknown) => void;
3138
+ 'Control.playDestroy': () => void;
3139
+ 'Control.capturePicture': (options?: unknown) => void;
3140
+ 'Control.capturePictureResult': (result: unknown) => void;
3141
+ 'Control.capturePictureDestroy': () => void;
3142
+ 'Control.volumechange': (volume: number, muted: boolean) => void;
3143
+ 'Control.volumePanelOpenChange': (open: boolean, volume: number, muted: boolean) => void;
3144
+ 'Control.volumeDestroy': () => void;
3145
+ 'Control.ptzPanelOpenChange': (open: boolean) => void;
3146
+ 'Control.ptzSpeedChange': (speed: number) => void;
3147
+ 'Control.ptzError': (info: PtzErrorInfo) => void;
3148
+ 'Control.ptzDestroy': () => void;
3149
+ 'Control.recordingChange': (recording: boolean) => void;
3150
+ 'Control.recordDestroy': () => void;
3151
+ 'Control.talkingChange': (talking: boolean) => void;
3152
+ 'Control.talkError': (info: unknown) => void;
3153
+ 'Control.talkDestroy': () => void;
3154
+ 'Control.broadcastChange': (active: boolean) => void;
3155
+ 'Control.broadcastDestroy': () => void;
3156
+ 'Control.aichatChange': (active: boolean) => void;
3157
+ 'Control.aichatDestroy': () => void;
3158
+ 'Control.liveChange': () => void;
3159
+ 'Control.liveDestroy': () => void;
3160
+ 'Control.recDropdownChange': (type: string) => void;
3161
+ 'Control.recDropdownDestroy': () => void;
3162
+ 'Control.alarmMessageChange': (active: boolean) => void;
3163
+ 'Control.alarmMessageDestroy': () => void;
3164
+ 'Control.recTypeChange': (type: string) => void;
3165
+ 'Control.recDestroy': () => void;
3166
+ 'Control.recListChange': (active: boolean) => void;
3167
+ 'Control.recListCardClick': (section: unknown, index: number, sections: unknown[]) => void;
3168
+ 'Control.recListDestroy': () => void;
3169
+ 'Control.definitionChange': (definition: number, item?: DefinitionItem) => void;
3170
+ 'Control.definitionList': (list: DefinitionItem[]) => void;
3171
+ 'Control.definitionPanelOpenChange': (open: boolean, definition: number, item?: DefinitionItem) => void;
3172
+ 'Control.definitionDestroy': () => void;
3173
+ 'Control.speedChange': (speed: number, item?: unknown) => void;
3174
+ 'Control.speedPanelOpenChange': (open: boolean, speed: number, item?: unknown) => void;
3175
+ 'Control.speedDestroy': () => void;
3176
+ 'Control.zoomChange': (zoom: number) => void;
3177
+ 'Control.zoomPanelOpenChange': (open: boolean) => void;
3178
+ 'Control.zoomDestroy': () => void;
3179
+ 'Control.fullscreenDestroy': () => void;
3180
+ 'Control.globalFullscreenDestroy': () => void;
3181
+ 'Control.deviceDestroy': () => void;
3182
+ 'Control.datePanelOpenChange': (open: boolean, date: Date) => void;
3183
+ 'Control.dateChange': (date: Date) => void;
3184
+ 'Control.dateMonthChange': (dates: string[]) => void;
3185
+ /** 日历控件销毁(注意其字符串值为 `Control.datePanelDestroy`) */
3186
+ 'Control.datePanelDestroy': () => void;
3187
+ 'Control.timePanelOpenChange': (open: boolean, time: string) => void;
3188
+ 'Control.timeChange': (time: string) => void;
3189
+ 'Control.timeLineChange': (date: Date | string) => void;
3190
+ 'Control.timeLinePanelOpenChange': (open: boolean) => void;
3191
+ 'Control.timeLineDestroy': () => void;
3192
+ 'Control.posterDestroy': () => void;
3193
+ 'Control.loadingDestroy': () => void;
3194
+ 'Control.messageDestroy': () => void;
3195
+ 'Control.contentDestroy': () => void;
3196
+ 'Control.contentRerender': (info: unknown) => void;
3197
+ 'Theme.beforeDestroy': () => void;
3198
+ 'Theme.destroyed': () => void;
3199
+ 'Theme.mobileExtendDestroy': () => void;
3200
+ 'Theme.recFooterDestroy': () => void;
3201
+ }
3202
+ /** 单个事件的监听器类型,如 `ThemeEventHandler<'volumechange'>` */
3203
+ type ThemeEventHandler<K extends ThemeEventName> = K extends keyof ThemeEventMap ? ThemeEventMap[K] : (...args: unknown[]) => void;
3204
+ /** 单个事件的参数元组,如 `ThemeEventArgs<'volumechange'>` = `[number, boolean]` */
3205
+ type ThemeEventArgs<K extends ThemeEventName> = K extends keyof ThemeEventMap ? Parameters<ThemeEventMap[K]> : unknown[];
3206
+
2914
3207
  export { Control, EVENTS, Fullscreen, Loading, Message, Play, Poster, Rec, Theme, Utils, Volume };
2915
- export type { CleanUpResizeObserver, CleanUpScreenOrientationFun, ControlItem, ControlOptions, FooterOptions, FullscreenOptions, HeaderOptions, IThemeData, IThemeDataItem, LoadingOptions, MessageOptions, PlayOptions, PosterOptions, RecOptions, ScreenOrientation, ThemeOptions, VolumeOptions };
3208
+ export type { AudioInfo, CleanUpResizeObserver, CleanUpScreenOrientationFun, ControlEventName, ControlItem, ControlOptions, FooterOptions, FullscreenChangeInfo, FullscreenOptions, HeaderOptions, IThemeData, IThemeDataItem, LoadingOptions, MessageOptions, OrientationAngle, PlayOptions, PosterOptions, PtzErrorInfo, RecOptions, ResizeInfo, ScreenOrientation, ThemeEventArgs, ThemeEventHandler, ThemeEventMap, ThemeEventName, ThemeLifecycleEventName, ThemeOptions, ThemeOuterEventName, VideoInfo, VolumeOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezuikit/player-theme",
3
- "version": "3.1.2-beta.1",
3
+ "version": "3.1.2-beta.3",
4
4
  "description": "player theme",
5
5
  "title": "theme",
6
6
  "main": "dist/index.cjs",
@@ -20,7 +20,8 @@
20
20
  "./dist/constant": "./dist/constant.js"
21
21
  },
22
22
  "files": [
23
- "dist"
23
+ "dist",
24
+ "!dist/*.map"
24
25
  ],
25
26
  "keywords": [
26
27
  "player",