@havue/solutions 1.1.2 → 1.2.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/bc-connect/dist/bc-connect.mjs +71 -68
- package/bc-connect/dist/bc-connect.umd.js +71 -68
- package/bc-connect/dist/types/src/manager.d.ts +70 -62
- package/bc-connect/package.json +1 -1
- package/bc-connect/src/manager.ts +84 -73
- package/dist/solutions.full.js +138 -122
- package/dist/solutions.full.min.js +4 -4
- package/dist/solutions.full.min.js.map +1 -1
- package/dist/types/bc-connect/src/manager.d.ts +70 -62
- package/dist/types/ws-video-manager/src/loader/websocket-loader.d.ts +13 -10
- package/dist/types/ws-video-manager/src/manager/index.d.ts +54 -37
- package/dist/types/ws-video-manager/src/render/drawer.d.ts +7 -7
- package/dist/types/ws-video-manager/src/render/index.d.ts +35 -19
- package/package.json +4 -4
- package/vite.config.ts +1 -1
- package/ws-video-manager/dist/types/src/loader/websocket-loader.d.ts +13 -10
- package/ws-video-manager/dist/types/src/manager/index.d.ts +54 -37
- package/ws-video-manager/dist/types/src/render/drawer.d.ts +7 -7
- package/ws-video-manager/dist/types/src/render/index.d.ts +35 -19
- package/ws-video-manager/dist/ws-video-manager.mjs +67 -54
- package/ws-video-manager/dist/ws-video-manager.umd.js +67 -54
- package/ws-video-manager/package.json +1 -1
- package/ws-video-manager/src/loader/websocket-loader.ts +15 -11
- package/ws-video-manager/src/manager/index.ts +57 -40
- package/ws-video-manager/src/render/drawer.ts +22 -20
- package/ws-video-manager/src/render/index.ts +61 -27
- package/ws-video-manager/src/render/mp4box.ts +1 -1
|
@@ -7312,29 +7312,32 @@ class Render extends EventBus {
|
|
|
7312
7312
|
// private divID = ''
|
|
7313
7313
|
constructor(options = {}) {
|
|
7314
7314
|
super();
|
|
7315
|
-
/** video元素 */
|
|
7315
|
+
/** video元素 | videw element */
|
|
7316
7316
|
__publicField(this, "_videoEl");
|
|
7317
|
-
/** mp4box
|
|
7317
|
+
/** mp4box file */
|
|
7318
7318
|
__publicField(this, "_mp4box", MP4Box.createFile());
|
|
7319
|
-
/**
|
|
7319
|
+
/**
|
|
7320
|
+
* mp4box onFragment获取的视频数据buffer数组
|
|
7321
|
+
* mp4box onFragment gets a buffer array of audio and video data
|
|
7322
|
+
*/
|
|
7320
7323
|
__publicField(this, "_audioBufsQueue", []);
|
|
7321
7324
|
__publicField(this, "_videoBufsQueue", []);
|
|
7322
|
-
/** MediaSource
|
|
7325
|
+
/** MediaSource instance */
|
|
7323
7326
|
__publicField(this, "_mediaSource");
|
|
7324
|
-
/** SourceBuffer
|
|
7327
|
+
/** SourceBuffer instance */
|
|
7325
7328
|
__publicField(this, "_audioSourceBuffer");
|
|
7326
7329
|
__publicField(this, "_videoSourceBuffer");
|
|
7327
7330
|
__publicField(this, "_audioTrackId");
|
|
7328
7331
|
__publicField(this, "_videoTrackId");
|
|
7329
|
-
/** 用于MediaSource的mimeType */
|
|
7332
|
+
/** 用于MediaSource的mimeType | mime type of the video */
|
|
7330
7333
|
__publicField(this, "_mimeType", "");
|
|
7331
7334
|
__publicField(this, "_audioMimeType", "");
|
|
7332
7335
|
__publicField(this, "_videoMimeType", "");
|
|
7333
|
-
/** 是否暂停播放 */
|
|
7336
|
+
/** 是否暂停播放 | Pause or not */
|
|
7334
7337
|
__publicField(this, "_paused", false);
|
|
7335
7338
|
__publicField(this, "_options");
|
|
7336
7339
|
__publicField(this, "_cacheAnimationID");
|
|
7337
|
-
/** fmp4初始化片段是否已经添加 */
|
|
7340
|
+
/** fmp4初始化片段是否已经添加 | fmp4 Initializes whether the fragment has been added */
|
|
7338
7341
|
__publicField(this, "_isAudioInitSegmentAdded", false);
|
|
7339
7342
|
__publicField(this, "_isVideoInitSegmentAdded", false);
|
|
7340
7343
|
__publicField(this, "_offset", 0);
|
|
@@ -7367,14 +7370,14 @@ class Render extends EventBus {
|
|
|
7367
7370
|
get videoEl() {
|
|
7368
7371
|
return this._videoEl;
|
|
7369
7372
|
}
|
|
7370
|
-
/** 更新实例配置 */
|
|
7373
|
+
/** 更新实例配置 | Update configuration */
|
|
7371
7374
|
updateOptions(option = {}) {
|
|
7372
7375
|
Object.assign(this._options, {
|
|
7373
7376
|
...option
|
|
7374
7377
|
});
|
|
7375
7378
|
}
|
|
7376
7379
|
/**
|
|
7377
|
-
* 添加视频流buffer数据
|
|
7380
|
+
* 添加视频流buffer数据 | Add video stream buffer data
|
|
7378
7381
|
* @param buf
|
|
7379
7382
|
*/
|
|
7380
7383
|
appendMediaBuffer(bufs) {
|
|
@@ -7389,8 +7392,8 @@ class Render extends EventBus {
|
|
|
7389
7392
|
return;
|
|
7390
7393
|
}
|
|
7391
7394
|
/**
|
|
7392
|
-
* mp4box解析完成
|
|
7393
|
-
* @param info mp4box解析信息
|
|
7395
|
+
* mp4box解析完成 | handle Mp4box onReady
|
|
7396
|
+
* @param info mp4box解析信息 | mp4box parses the information
|
|
7394
7397
|
*/
|
|
7395
7398
|
_onMp4boxReady(info) {
|
|
7396
7399
|
console.log("onMp4boxReady", info);
|
|
@@ -7467,7 +7470,7 @@ class Render extends EventBus {
|
|
|
7467
7470
|
this._cache(isVideo);
|
|
7468
7471
|
}
|
|
7469
7472
|
/**
|
|
7470
|
-
* 初始化视频元素
|
|
7473
|
+
* 初始化视频元素 | Initialize the video element
|
|
7471
7474
|
*/
|
|
7472
7475
|
_setupVideo() {
|
|
7473
7476
|
this._videoEl = document.createElement("video");
|
|
@@ -7523,13 +7526,14 @@ class Render extends EventBus {
|
|
|
7523
7526
|
}
|
|
7524
7527
|
/**
|
|
7525
7528
|
* 是否支持Media Source Extention
|
|
7529
|
+
* whether Media Source Extention is supported
|
|
7526
7530
|
* @returns boolean
|
|
7527
7531
|
*/
|
|
7528
7532
|
isSupportMSE() {
|
|
7529
7533
|
return "MediaSource" in window;
|
|
7530
7534
|
}
|
|
7531
7535
|
/**
|
|
7532
|
-
* 初始化MSE
|
|
7536
|
+
* 初始化MSE | Init MSE
|
|
7533
7537
|
* @returns
|
|
7534
7538
|
*/
|
|
7535
7539
|
_setupMSE() {
|
|
@@ -7606,6 +7610,7 @@ class Render extends EventBus {
|
|
|
7606
7610
|
}
|
|
7607
7611
|
/**
|
|
7608
7612
|
* 将_bufsQueue中的数据添加到SourceBuffer中
|
|
7613
|
+
* Add the data from _bufsQueue to the SourceBuffer
|
|
7609
7614
|
* @returns
|
|
7610
7615
|
*/
|
|
7611
7616
|
_cache(isVideo = false) {
|
|
@@ -7649,6 +7654,7 @@ class Render extends EventBus {
|
|
|
7649
7654
|
}
|
|
7650
7655
|
/**
|
|
7651
7656
|
* 刷新播放时间为最新
|
|
7657
|
+
* Refresh the playback time to the latest
|
|
7652
7658
|
*/
|
|
7653
7659
|
refresh() {
|
|
7654
7660
|
if (this._videoEl && this._videoEl.buffered.length) {
|
|
@@ -7656,7 +7662,7 @@ class Render extends EventBus {
|
|
|
7656
7662
|
this._videoEl.currentTime = end;
|
|
7657
7663
|
}
|
|
7658
7664
|
}
|
|
7659
|
-
/** 重置解析的视频mime type */
|
|
7665
|
+
/** 重置解析的视频mime type | Reset the parsed video mime type */
|
|
7660
7666
|
resetMimeType() {
|
|
7661
7667
|
this.destroyMp4box();
|
|
7662
7668
|
this.destroyMediaSource();
|
|
@@ -7707,7 +7713,7 @@ class Render extends EventBus {
|
|
|
7707
7713
|
this._mp4box = null;
|
|
7708
7714
|
}
|
|
7709
7715
|
/**
|
|
7710
|
-
* 销毁
|
|
7716
|
+
* 销毁 | Destroy
|
|
7711
7717
|
*/
|
|
7712
7718
|
destroy() {
|
|
7713
7719
|
if (this._videoEl) {
|
|
@@ -7758,7 +7764,7 @@ class CanvasDrawer {
|
|
|
7758
7764
|
this._ctx2d.fillRect(0, 0, this._canvas.width, this._canvas.height);
|
|
7759
7765
|
}
|
|
7760
7766
|
/**
|
|
7761
|
-
* 初始化 webgl
|
|
7767
|
+
* 初始化 webgl | Initialize webgl
|
|
7762
7768
|
*/
|
|
7763
7769
|
initGl() {
|
|
7764
7770
|
if (!this._canvas) return;
|
|
@@ -7800,7 +7806,7 @@ class CanvasDrawer {
|
|
|
7800
7806
|
this._glReady = true;
|
|
7801
7807
|
}
|
|
7802
7808
|
/**
|
|
7803
|
-
* 创建着色器源码
|
|
7809
|
+
* 创建着色器源码 | Create shader source code
|
|
7804
7810
|
*/
|
|
7805
7811
|
createShaderSource(gl, type) {
|
|
7806
7812
|
const vertexShaderSource = `
|
|
@@ -7827,7 +7833,7 @@ class CanvasDrawer {
|
|
|
7827
7833
|
}
|
|
7828
7834
|
}
|
|
7829
7835
|
/**
|
|
7830
|
-
* 创建着色器
|
|
7836
|
+
* 创建着色器 | Create shaders
|
|
7831
7837
|
*/
|
|
7832
7838
|
createShader(gl, type, source) {
|
|
7833
7839
|
const shader = gl.createShader(type);
|
|
@@ -7845,7 +7851,7 @@ class CanvasDrawer {
|
|
|
7845
7851
|
return shader;
|
|
7846
7852
|
}
|
|
7847
7853
|
/**
|
|
7848
|
-
* 创建着色器程序
|
|
7854
|
+
* 创建着色器程序 | Create program
|
|
7849
7855
|
*/
|
|
7850
7856
|
createProgram(gl, vertexShader, fragmentShader) {
|
|
7851
7857
|
const program = gl.createProgram();
|
|
@@ -7864,7 +7870,7 @@ class CanvasDrawer {
|
|
|
7864
7870
|
return program;
|
|
7865
7871
|
}
|
|
7866
7872
|
/**
|
|
7867
|
-
* 绘制
|
|
7873
|
+
* 绘制 | draw
|
|
7868
7874
|
*/
|
|
7869
7875
|
draw(video) {
|
|
7870
7876
|
if (this._useGl) {
|
|
@@ -7903,7 +7909,7 @@ class CanvasDrawer {
|
|
|
7903
7909
|
}
|
|
7904
7910
|
}
|
|
7905
7911
|
/**
|
|
7906
|
-
* 销毁
|
|
7912
|
+
* 销毁 | Destroy
|
|
7907
7913
|
*/
|
|
7908
7914
|
destroy() {
|
|
7909
7915
|
this._canvas = null;
|
|
@@ -7939,7 +7945,7 @@ const WsVideoManagerEventEnums = Object.assign({}, EventEnums, RenderEventsEnum)
|
|
|
7939
7945
|
class WsVideoManager extends EventBus {
|
|
7940
7946
|
constructor(options) {
|
|
7941
7947
|
super();
|
|
7942
|
-
/** socket
|
|
7948
|
+
/** socket相关信息map | map of socket information */
|
|
7943
7949
|
__publicField(this, "_wsInfoMap", /* @__PURE__ */ new Map());
|
|
7944
7950
|
__publicField(this, "_option", DEFAULT_OPTIONS);
|
|
7945
7951
|
__publicField(this, "_reqAnimationID", null);
|
|
@@ -7972,8 +7978,8 @@ class WsVideoManager extends EventBus {
|
|
|
7972
7978
|
render();
|
|
7973
7979
|
}
|
|
7974
7980
|
/**
|
|
7975
|
-
* 添加socket
|
|
7976
|
-
* @param url socket
|
|
7981
|
+
* 添加socket连接 | Adding a socket connection
|
|
7982
|
+
* @param url socket url
|
|
7977
7983
|
* @returns
|
|
7978
7984
|
*/
|
|
7979
7985
|
_addSocket(url, renderOptions) {
|
|
@@ -8002,9 +8008,9 @@ class WsVideoManager extends EventBus {
|
|
|
8002
8008
|
socket.open();
|
|
8003
8009
|
}
|
|
8004
8010
|
/**
|
|
8005
|
-
* 绑定render事件
|
|
8006
|
-
* @param url 连接地址
|
|
8007
|
-
* @param render Render
|
|
8011
|
+
* 绑定render事件 | Binding the render event
|
|
8012
|
+
* @param url 连接地址 | websocket url
|
|
8013
|
+
* @param render Render instance
|
|
8008
8014
|
*/
|
|
8009
8015
|
_bindRenderEvent(url, render) {
|
|
8010
8016
|
render.on(RenderEventsEnum.AUDIO_STATE_CHANGE, (state) => {
|
|
@@ -8018,8 +8024,8 @@ class WsVideoManager extends EventBus {
|
|
|
8018
8024
|
});
|
|
8019
8025
|
}
|
|
8020
8026
|
/**
|
|
8021
|
-
*
|
|
8022
|
-
* @param url socket
|
|
8027
|
+
* Destroying the socket connect
|
|
8028
|
+
* @param url socket url
|
|
8023
8029
|
*/
|
|
8024
8030
|
_removeSocket(url) {
|
|
8025
8031
|
const wsInfo = this._wsInfoMap.get(url);
|
|
@@ -8033,9 +8039,9 @@ class WsVideoManager extends EventBus {
|
|
|
8033
8039
|
}
|
|
8034
8040
|
}
|
|
8035
8041
|
/**
|
|
8036
|
-
* 绑定socket事件
|
|
8037
|
-
* @param url
|
|
8038
|
-
* @param socket WebSocketLoader
|
|
8042
|
+
* 绑定socket事件 | Binding socket events
|
|
8043
|
+
* @param url websocket url
|
|
8044
|
+
* @param socket WebSocketLoader instance
|
|
8039
8045
|
*/
|
|
8040
8046
|
_bindSocketEvent(socket, render, url) {
|
|
8041
8047
|
socket.on("close", () => {
|
|
@@ -8065,8 +8071,8 @@ class WsVideoManager extends EventBus {
|
|
|
8065
8071
|
}
|
|
8066
8072
|
}
|
|
8067
8073
|
/**
|
|
8068
|
-
* url对应的 socket实例是否已存在
|
|
8069
|
-
* @param url
|
|
8074
|
+
* url对应的 socket实例是否已存在 | Whether the socket instance for the url already exists
|
|
8075
|
+
* @param url websocket url
|
|
8070
8076
|
* @returns boolean
|
|
8071
8077
|
*/
|
|
8072
8078
|
_isSocketExist(url) {
|
|
@@ -8074,8 +8080,9 @@ class WsVideoManager extends EventBus {
|
|
|
8074
8080
|
}
|
|
8075
8081
|
/**
|
|
8076
8082
|
* 添加url对应socket,以及需要绘制的canvas元素
|
|
8077
|
-
*
|
|
8078
|
-
* @param
|
|
8083
|
+
* Add the socket for the url and the canvas element to draw
|
|
8084
|
+
* @param canvas canvas
|
|
8085
|
+
* @param url websocket url
|
|
8079
8086
|
*/
|
|
8080
8087
|
addCanvas(canvas, url, renderOptions) {
|
|
8081
8088
|
this._addSocket(url, renderOptions);
|
|
@@ -8094,8 +8101,8 @@ class WsVideoManager extends EventBus {
|
|
|
8094
8101
|
}
|
|
8095
8102
|
}
|
|
8096
8103
|
/**
|
|
8097
|
-
* 初始化canvas背景
|
|
8098
|
-
* @param canvas canvas
|
|
8104
|
+
* 初始化canvas背景 | Initialize the canvas background
|
|
8105
|
+
* @param canvas canvas
|
|
8099
8106
|
* @returns
|
|
8100
8107
|
*/
|
|
8101
8108
|
// private _setupCanvas(canvas: HTMLCanvasElement) {
|
|
@@ -8107,8 +8114,8 @@ class WsVideoManager extends EventBus {
|
|
|
8107
8114
|
// ctx.fillRect(0, 0, canvas.width, canvas.height)
|
|
8108
8115
|
// }
|
|
8109
8116
|
/**
|
|
8110
|
-
* 删除canvas元素
|
|
8111
|
-
* @param canvas canvas
|
|
8117
|
+
* 删除canvas元素 || Remove the canvas element
|
|
8118
|
+
* @param canvas canvas
|
|
8112
8119
|
*/
|
|
8113
8120
|
removeCanvas(canvas) {
|
|
8114
8121
|
const entries = this._wsInfoMap.entries();
|
|
@@ -8127,8 +8134,8 @@ class WsVideoManager extends EventBus {
|
|
|
8127
8134
|
});
|
|
8128
8135
|
}
|
|
8129
8136
|
/**
|
|
8130
|
-
*
|
|
8131
|
-
* @param canvas canvas
|
|
8137
|
+
* 获取canvas是否已经添加过 | Gets whether the canvas has already been added
|
|
8138
|
+
* @param canvas canvas
|
|
8132
8139
|
* @returns boolean
|
|
8133
8140
|
*/
|
|
8134
8141
|
isCanvasExist(canvas) {
|
|
@@ -8137,13 +8144,13 @@ class WsVideoManager extends EventBus {
|
|
|
8137
8144
|
return info.canvasMap.has(canvas);
|
|
8138
8145
|
});
|
|
8139
8146
|
}
|
|
8140
|
-
/** 设置全部render静音状态 */
|
|
8147
|
+
/** 设置全部render静音状态 | Mute all render */
|
|
8141
8148
|
setAllVideoMutedState(muted) {
|
|
8142
8149
|
this._wsInfoMap.forEach((wsInfo) => {
|
|
8143
8150
|
wsInfo.render.muted = muted;
|
|
8144
8151
|
});
|
|
8145
8152
|
}
|
|
8146
|
-
/** 更新单个render实例的配置 */
|
|
8153
|
+
/** 更新单个render实例的配置 | Update the configuration of a single render instance */
|
|
8147
8154
|
updateRenderOptions(url, options) {
|
|
8148
8155
|
if (options) {
|
|
8149
8156
|
const wsInfo = this._wsInfoMap.get(url);
|
|
@@ -8151,9 +8158,9 @@ class WsVideoManager extends EventBus {
|
|
|
8151
8158
|
}
|
|
8152
8159
|
}
|
|
8153
8160
|
/**
|
|
8154
|
-
* 设置单个render静音状态
|
|
8161
|
+
* 设置单个render静音状态 | Set a single render to be silent
|
|
8155
8162
|
* @param url
|
|
8156
|
-
* @param muted
|
|
8163
|
+
* @param {boolean} muted 是否静音 | Muted or not
|
|
8157
8164
|
*/
|
|
8158
8165
|
setOneMutedState(url, muted) {
|
|
8159
8166
|
const wsInfo = this._wsInfoMap.get(url);
|
|
@@ -8164,7 +8171,8 @@ class WsVideoManager extends EventBus {
|
|
|
8164
8171
|
}
|
|
8165
8172
|
/**
|
|
8166
8173
|
* 获取url对应render video元素是否静音
|
|
8167
|
-
*
|
|
8174
|
+
* Gets whether the render video element of the url is muted
|
|
8175
|
+
* @param url websocket url
|
|
8168
8176
|
*/
|
|
8169
8177
|
getOneMutedState(url) {
|
|
8170
8178
|
const wsInfo = this._wsInfoMap.get(url);
|
|
@@ -8175,7 +8183,8 @@ class WsVideoManager extends EventBus {
|
|
|
8175
8183
|
}
|
|
8176
8184
|
/**
|
|
8177
8185
|
* 单个解除静音,其他未静音的变成静音,只播放一个
|
|
8178
|
-
*
|
|
8186
|
+
* Unmute a single video and mute all other videos
|
|
8187
|
+
* @param url websocket url
|
|
8179
8188
|
*/
|
|
8180
8189
|
playOneAudio(url) {
|
|
8181
8190
|
this.setAllVideoMutedState(true);
|
|
@@ -8183,6 +8192,7 @@ class WsVideoManager extends EventBus {
|
|
|
8183
8192
|
}
|
|
8184
8193
|
/**
|
|
8185
8194
|
* 设置单个render是否继续处理ws数据
|
|
8195
|
+
* Sets whether a single render continues to process ws data
|
|
8186
8196
|
* @param url
|
|
8187
8197
|
*/
|
|
8188
8198
|
setOneVideoPausedState(url, paused) {
|
|
@@ -8192,15 +8202,16 @@ class WsVideoManager extends EventBus {
|
|
|
8192
8202
|
}
|
|
8193
8203
|
wsInfo.render.paused = paused;
|
|
8194
8204
|
}
|
|
8195
|
-
/** 设置全部render是否继续处理ws数据 */
|
|
8205
|
+
/** 设置全部render是否继续处理ws数据 | Sets whether all render continues to process ws data */
|
|
8196
8206
|
setAllVideoPausedState(paused) {
|
|
8197
8207
|
this._wsInfoMap.forEach((wsInfo) => {
|
|
8198
8208
|
wsInfo.render.paused = paused;
|
|
8199
8209
|
});
|
|
8200
8210
|
}
|
|
8201
8211
|
/**
|
|
8202
|
-
* 获取url对应render video
|
|
8203
|
-
*
|
|
8212
|
+
* 获取url对应render video元素的播放状态
|
|
8213
|
+
* Get the playback status of the render video element corresponding to the url
|
|
8214
|
+
* @param url websocket url
|
|
8204
8215
|
*/
|
|
8205
8216
|
getOneVideoPausedState(url) {
|
|
8206
8217
|
const wsInfo = this._wsInfoMap.get(url);
|
|
@@ -8211,7 +8222,8 @@ class WsVideoManager extends EventBus {
|
|
|
8211
8222
|
}
|
|
8212
8223
|
/**
|
|
8213
8224
|
* 单个视频继续播放,其他暂停处理数据
|
|
8214
|
-
*
|
|
8225
|
+
* A single video continues to play while others pause to process data
|
|
8226
|
+
* @param url websocket url
|
|
8215
8227
|
*/
|
|
8216
8228
|
playOneVideo(url) {
|
|
8217
8229
|
this.setAllVideoPausedState(true);
|
|
@@ -8219,6 +8231,7 @@ class WsVideoManager extends EventBus {
|
|
|
8219
8231
|
}
|
|
8220
8232
|
/**
|
|
8221
8233
|
* 刷新socket,以及播放时间
|
|
8234
|
+
* Refresh the socket, and the playback time
|
|
8222
8235
|
*/
|
|
8223
8236
|
refresh(url) {
|
|
8224
8237
|
if (url) {
|
|
@@ -8239,7 +8252,7 @@ class WsVideoManager extends EventBus {
|
|
|
8239
8252
|
}
|
|
8240
8253
|
}
|
|
8241
8254
|
/**
|
|
8242
|
-
* 销毁
|
|
8255
|
+
* 销毁 | Destroy
|
|
8243
8256
|
*/
|
|
8244
8257
|
destroy() {
|
|
8245
8258
|
this._wsInfoMap.forEach((wsInfo) => {
|