Socket
Socket
Sign inDemoInstall

bonc-htmlplayer

Package Overview
Dependencies
2
Maintainers
5
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.12 to 5.0.13

5

dist/h265Page/decodeWorkerPage.js

@@ -26,2 +26,3 @@ /*

isStart[currentIndex] = true; //wuyage 1114 edit 多路h265
// console.log('start_decode',currentIndex)
postMessage({

@@ -39,2 +40,3 @@ type: "start",

};
// console.log('解码后的数据:',obj)
_self.postMessage({

@@ -49,3 +51,3 @@ type: "afterDecode",

//当modulestart=0时,解码器初始化成功
console.log("初始化解码器modulestart:", modulestart);
// console.log("初始化解码器modulestart:", modulestart);
if (modulestart == 0) {

@@ -63,2 +65,3 @@ postMessage({

case "currentIndex":
// console.log('currentIndex')
moduleInit(e.data.value);

@@ -65,0 +68,0 @@ break;

2

package.json
{
"name": "bonc-htmlplayer",
"version": "5.0.12",
"version": "5.0.13",
"description": "东方国信的html播放器内核",

@@ -5,0 +5,0 @@ "main": "./dist/BoncH5Player.js",

@@ -6,7 +6,7 @@ import Event from "../../util/event";

export default class BufferController extends Event {
constructor(sourceBuffer, type, videoNode, mediaSource) {
constructor(sourceBuffer, type, videoNode, mediaSource,canvasOver) {
super("buffer");
this.type = type;
this.videoNode = videoNode;
this.canvasOverEle=document.getElementById(canvasOver)
this.queue = new Uint8Array();

@@ -74,7 +74,11 @@ this.cleaning = false;

this.sourceBuffer.addEventListener("error", () => {
this.dispatch("error", {
type: this.type,
name: "buffer",
error: "buffer error",
});
// console.log('异常error',)
// this.sourceBuffer.abort()
// this.videoNode.pause();
this.canvasOver();
// this.dispatch("error", {
// type: this.type,
// name: "error",
// });
});

@@ -139,2 +143,4 @@ }

try {
this.queue1=this.queue
// console.log("112-this.queue长度:",this.queue)
this.sourceBuffer.appendBuffer(this.queue);

@@ -145,6 +151,7 @@ this.dispatch("bufferAppended", this.type);

} catch (e) {
// debugger
// console.log(e, this.type, this.videoNode.id, e.name);
// console.log("添加buffter错误异常",e, this.type, this.videoNode.id, e.name);
// console.log("异常this.queue:",this.queue)
this.videoNode.addEventListener("error", function (e) {
console.error(e);
// console.log("112-异常-error")
// console.log(e);
});

@@ -160,13 +167,24 @@ if (e.name === "QuotaExceededError") {

} else if (e.name === "InvalidStateError") {
// this.dispatch('restart')
// this.videoNode.pause();
this.queue = new Uint8Array();
// console.log("112-异常-InvalidStateError")
// console.log('异常InvalidStateError',)
// this.dispatch('restart',e.name)
this.canvasOver();
// this.sourceBuffer.abort()
// this.dispatch("error", {
// type: this.type,
// name: "InvalidStateError",
// error: e,
// });
return;
}
//debug.error(`Error occured while appending ${this.type} buffer - ${e.name}: ${e.message}`);
this.dispatch("error", {
type: this.type,
name: "unexpectedError",
error: "buffer error",
});
// console.log('112-unexpectedError')
this.canvasOver();
// this.dispatch("error", {
// type: this.type,
// name: "unexpectedError",
// error: e,
// });
}

@@ -180,2 +198,11 @@ }

}
canvasOver(){
this.videoNode.pause();
this.canvasOverEle.style.display="block";
var context = this.canvasOverEle.getContext('2d');
context.drawImage(this.videoNode, 0, 0, this.canvasOverEle.width, this.canvasOverEle.height);
this.dispatch('restart',"buffterError")
this.queue = new Uint8Array();
}
}

@@ -58,2 +58,3 @@ import { MP4 } from "../../util/mp4-generator.js";

let track = this.tracks[type];
// console.log("初始化track:",track)
// console.log(track.mp4track)

@@ -69,3 +70,3 @@ let data = {

};
// console.log("解码后数据:",data)
this.dispatch("buffer", data);

@@ -115,2 +116,3 @@ } else if (type == "audio") {

let track = this.tracks[type];
// console.log("后面的track:",track)
let pay = track.getPayload();

@@ -225,2 +227,4 @@ if (pay && pay.byteLength) {

if (samples.length > 0) {
// console.log('samples:',samples)
this.tracks[type].remux(samples);

@@ -227,0 +231,0 @@ }

@@ -62,5 +62,8 @@ import { extractNALubonc } from "./utils";

this.recoder = new localRecorder(app);
this.messageData=true;
// console.log('new H264Mp4Player')
}
onVideoPrepared() {
console.log("视频开始播放时间:", new Date().toLocaleString());
this.app.dispatch("startSuccess");

@@ -74,2 +77,5 @@ }

// 将videobuffer的起始位去掉存到 this.nalsboncarr
// let dataTeime=new Date().getTime();
// new Uint8Array创建一个多少长度的无符号8位整数数组
//videobuffer是ArrayBuffer,即一段原始的二进制数据
this.extractNALubonc(new Uint8Array(videobuffer));

@@ -79,2 +85,4 @@ this.PlayNals();

this.clearBuffer();
// let jiange=new Date().getTime()-dataTeime;
// console.log('解码耗时:'+jiange+'\n' )
}

@@ -156,3 +164,4 @@ playBfferReverse(videobuffer) {

this.app.node,
this.mediaSource
this.mediaSource,
this.app.configs.canvasOver
);

@@ -164,4 +173,6 @@ this.sourceBuffers[type] = sb;

}
addSourceBuffer(type) {
if (!this.mediaSource || this.mediaSource.readyState !== "open") {
addSourceBuffer(type,Isbuffer) {
// console.log('添加buffer:',this.mediaSource.readyState,Isbuffer)
if (!this.mediaSource || (this.mediaSource.readyState !== "open" && Isbuffer)) {
return false;

@@ -177,6 +188,9 @@ }

// codecs后面是浏览器关于视频编解码的一些重要信息,诸如编码方式、分辨率、帧率、码率以及对解码器解码能力的要求
// console.log("addSourceBuffer");
sb = this.mediaSource.addSourceBuffer(
`${type}/mp4; codecs="${track.mp4track.codec}"`
`${type}/mp4; codecs="${track.mp4track.codec?track.mp4track.codec:'avc1.42E01E'}"`
);
// sb = this.mediaSource.addSourceBuffer(
// `${type}/mp4; codecs="avc1.42E01E"`
// );
// console.log('视频编码codec:',`${type}/mp4; codecs="${track.mp4track.codec?track.mp4track.codec:'avc1.42E01E'}"`)
}

@@ -187,2 +201,3 @@ return sb;

onBuffer(data) {
// console.log('转换后的mp4:',data)
// console.log("当前时间:", new Date().toLocaleString(), "。数据:", data);

@@ -193,7 +208,8 @@ if (data.isStart) {

if (this.bufferControllers && this.bufferControllers[data.type]) {
// console.log('data.payload:',data.payload)
this.bufferControllers[data.type].feed(data.payload);
}
}
onBufferError(data) {
console.log("onBufferError错误信息:",data)
if (data.name == "QuotaExceeded") {

@@ -207,13 +223,14 @@ this.bufferControllers[data.type].initCleanup(this.app.node.currentTime);

) {
this.mediaSource.removeSourceBuffer(this.sourceBuffers[data.type]);
this.mediaSource.removeSourceBuffer(this.sourceBuffers[data.type]);
// 重新把buffer填上
var sb = this.addSourceBuffer(data.type);
this.bufferControllers[type] = new BufferController(
var sb = this.addSourceBuffer(data.type,false);
this.bufferControllers[data.type] = new BufferController(
sb,
type,
data.type,
this.app.node,
this.mediaSource
this.mediaSource,
this.app.configs.canvasOver
);
this.sourceBuffers[type] = sb;
this.bufferControllers[type].on("error", this.onBufferError.bind(this));
this.sourceBuffers[data.type] = sb;
this.bufferControllers[data.type].on("error", this.onBufferError.bind(this));
}

@@ -229,4 +246,5 @@ if (this.mediaSource.sourceBuffers.length == 0) {

onRestart() {
this.app.dispatch("restart");
onRestart(data) {
URL.revokeObjectURL(this.mseUrl);
this.app.dispatch("errorRestart",data);
}

@@ -278,3 +296,4 @@

this.mediaSource = new MediaSource();
this.app.node.src = URL.createObjectURL(this.mediaSource);
this.mseUrl=URL.createObjectURL(this.mediaSource);
this.app.node.src =this.mseUrl;
// console.log("this.app.node.src:", this.app.node.src);

@@ -312,15 +331,24 @@ this.mediaSource.addEventListener("sourceopen", this.onMSEOpen.bind(this));

var nalarr = [];
// console.log('this.nalsboncarr:',this.nalsboncarr)
var nal = this.nalsboncarr.shift();
var nalType = nal[0] & 0x1f;
//debug.log('nalType==',nalType);
// if(nalType>=13){
// console.log('nalType扔掉的==',nalType)
// return true;
// }
// console.log('nalType==',nalType);
if (this.spspps === false) {
if (nalType == 7) {
this.spsnal = nal;
//debug.log('找到sps=');
// console.log('找到sps=',nalType);
return;
} else if (nalType == 8) {
this.ppsnal = nal;
//debug.log('找到pps=');
// console.log('找到pps=',nalType);
return;
}
else if (nalType == 6) {
// console.log("找到6")
return;
}

@@ -357,3 +385,3 @@ if (this.spsnal != null && this.ppsnal != null) {

// console.log('nalarr',nalarr.length)
// console.log('nalarr',nalarr.length)
chunks.video = this.getVideoFrames(nalarr, 0);

@@ -363,2 +391,3 @@ if (chunks.video.length === 0) {

}
// debugger;
this.remuxController.remux(chunks); //将接收到的数据传入此方法并转成mp4片段

@@ -438,2 +467,4 @@ }

clearBuffer() {
// console.log(this.app.node.id,'视频开始播放了')
if (!this.clearBufferValidate) {

@@ -448,3 +479,3 @@ // console.log(this.app.node.buffered.end(0) - this.app.node.currentTime);

//video.currentTime 表示当前视频播放的时间位置。
//bufferLength:可以得到当前视频已经缓冲了多少部分的时间,用来实时更新缓冲进度条的显示,或者在缓冲完成后自动播放视频等功能中使用
//bufferLength:可以得到当前视频已经缓冲了多少部分的时间
let bufferLength =

@@ -599,2 +630,3 @@ this.app.node.buffered.end(0) - this.app.node.currentTime;

getVideoFrames(nalus, duration) {
let nalu,

@@ -607,6 +639,5 @@ units = [],

numberOfFrames = [];
for (nalu of nalus) {
naluObj = new NALU(nalu);
// debug.log('帧类型='+naluObj.type());
naluObj.type()!=1?console.log('帧类型='+naluObj.type()):"";
units.push(naluObj);

@@ -613,0 +644,0 @@ // NALU.IDR 5关键帧 NALU.NDR 1非关键帧

@@ -50,4 +50,6 @@

keyFrame = false;
// console.log("sample.units:",sample.units)
for (unit of sample.units)
{
// console.log('unit:',unit.type())
if (this.h264.parseNAL(unit))

@@ -54,0 +56,0 @@ {

@@ -7,2 +7,4 @@ /**

{
// console.log('buffer:',buffer)
let i = 0,

@@ -42,2 +44,3 @@ length = buffer.byteLength,

this.nalsboncarr.push(buffer.subarray(lastIndex, i - state -1));
// console.log('lastIndex')
}

@@ -58,2 +61,3 @@ lastIndex = i;

if (lastIndex) {
// console.log('lastIndex2')
this.nalsboncarr.push(buffer.subarray(lastIndex, length));

@@ -60,0 +64,0 @@ }

@@ -43,3 +43,3 @@ // import { MP4 } from '../util/mp4-generator';

sourceOpenCallback() {
console.log('Media Source Ready')
// console.log('Media Source Ready')
var codecStr = 'audio/mp4; codecs=' + 'mp4a.40.' + 2

@@ -50,7 +50,7 @@ this.sourceBuffer = this.mediaSource.addSourceBuffer(codecStr)

sourceCloseCallback() {
console.log('Media Source closed')
// console.log('Media Source closed')
this.initialized = false;
}
sourceEndedCallback() {
console.log('Media Source ended')
// console.log('Media Source ended')
}

@@ -57,0 +57,0 @@ updateEndCallback() {

@@ -26,2 +26,3 @@ /*

isStart[currentIndex] = true; //wuyage 1114 edit 多路h265
// console.log('start_decode',currentIndex)
postMessage({

@@ -39,2 +40,3 @@ type: "start",

};
// console.log('解码后的数据:',obj)
_self.postMessage({

@@ -49,3 +51,3 @@ type: "afterDecode",

//当modulestart=0时,解码器初始化成功
console.log("初始化解码器modulestart:", modulestart);
// console.log("初始化解码器modulestart:", modulestart);
if (modulestart == 0) {

@@ -63,2 +65,3 @@ postMessage({

case "currentIndex":
// console.log('currentIndex')
moduleInit(e.data.value);

@@ -65,0 +68,0 @@ break;

@@ -16,3 +16,3 @@ /*

locateFile: function (wasm) {
return wasm;
return `/h265Page/${wasm}`;
},

@@ -24,3 +24,2 @@ };

let appCurrent = {}; //wuyage 1114 add 多路h265
class H265CanvasPlayer {

@@ -71,4 +70,3 @@ constructor(app, option, appIndex) {

this.currentIndex = canvasIdIndex.split("_")[1];
console.log("canvasIdIndex:", canvasIdIndex, this.currentIndex);
console.log("实例化窗口:", this.app.configs.canvasId);
// console.log("实例化窗口:", this.app.configs.canvasId);
this.createDecoderWorker();

@@ -88,3 +86,3 @@ }

}
console.log(`创建窗口${currentId}解码线程`);
// console.log(`创建窗口${currentId}解码线程`);
this.decodeWorker[currentId].postMessage({

@@ -109,4 +107,5 @@ type: "currentIndex",

case "start":
appCurrent[currentId].dispatch("startSuccess"); //wuyage 1114 edit 多路h265
appCurrent[currentId].dispatch("startH265Success"); //为安防配置规则h265的
// console.log('start:',appCurrent,appCurrent[currentId])
appCurrent[currentId] && appCurrent[currentId].dispatch("startSuccess"); //wuyage 1114 edit 多路h265
appCurrent[currentId] && appCurrent[currentId].dispatch("startH265Success"); //为安防配置规则h265的
break;

@@ -188,2 +187,3 @@ }

playBuffer(videoBuffer) {
//当this.modulestart=0时,解码器初始化成功

@@ -211,19 +211,25 @@ let _this = this;

// 为每个窗口添加索引,为了实现多路h265 wuyage 1114 add
let canvasIdIndex = this.app.configs.canvasId;
let currentIndex = canvasIdIndex.split("_")[1];
Module._uninit_decoder(currentIndex);
console.log("h265主动销毁窗口:", currentIndex);
webglPlayer[currentIndex] && webglPlayer[currentIndex].clear(); //wuyage 1114 edit 多路h265(一个子线程需要)
webglPlayer[currentIndex] = null; //wuyage 1116 add 多路h265(一个子线程需要)
this.app.node = null;
appCurrent = {}; //wuyage 1115 add 多路h265
//关闭子线程
this.decodeWorker[currentIndex].postMessage({
type: "closeVideo",
});
this.decodeWorker[currentIndex].terminate(); //关闭主线程
//(两个子线程需要)
// this.webglworker[currentIndex].postMessage({
// type: "closeVideo",
// });
try{
let canvasIdIndex = this.app.configs.canvasId;
let currentIndex = canvasIdIndex.split("_")[1];
Module._uninit_decoder(currentIndex);
console.log("h265主动销毁窗口:", currentIndex);
// console.log('webglPlayer:',webglPlayer,currentIndex,webglPlayer[currentIndex])
webglPlayer[currentIndex] && webglPlayer[currentIndex].clear(); //wuyage 1114 edit 多路h265(一个子线程需要)
webglPlayer[currentIndex] = null; //wuyage 1116 add 多路h265(一个子线程需要)
this.app.node = null;
appCurrent = {}; //wuyage 1115 add 多路h265
//关闭子线程
this.decodeWorker[currentIndex].postMessage({
type: "closeVideo",
});
this.decodeWorker[currentIndex].terminate(); //关闭主线程
//(两个子线程需要)
// this.webglworker[currentIndex].postMessage({
// type: "closeVideo",
// });
}catch (err) {
console.log('err:',err)
}
}

@@ -230,0 +236,0 @@

@@ -139,2 +139,3 @@ function Texture(gl) {

) {
// console.log('renderFrame:',videoFrame)
if (!this.gl) {

@@ -144,3 +145,3 @@ console.log("[ER] Render frame failed due to WebGL not supported.");

}
try{
var gl = this.gl;

@@ -162,4 +163,9 @@ gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);

);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
}catch (e){
console.error(err)
}
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
};

@@ -166,0 +172,0 @@

@@ -138,14 +138,12 @@ import Event from "./util/event";

this.on("onGetVideoCode", this.makePlayer.bind(this));
//this.on("onVideoInitDecoder", this.videoInitDecoder.bind(this)); // wuyage1110 add
// this.on('elementInfo',function(elementInfo){
// this.dispatch('elementInfo',elementInfo);
// }.bind(this))
this.on("errorRestart",(data)=>{
console.log('buffter异常重新实例化',data)
validateConfigs.call(this, this.configs); //对配置项进行验证
this._player = new H264Mp4Player(this);
})
}
makePlayer(codetype) {
console.log(`视频编码格式:${codetype}`);
switch (codetype) {
case "H265":
// this._h265player = this._h265player || new H265CanvasPlayer(this,this.configs);
// this._player = this._h265player
// 判断是否可以实例化h265

@@ -155,5 +153,2 @@ if (this.validateH265()) {

let currentIndex = canvasIdIndex.split("_")[1]; //wuyage 1114 add 多路h265
// this._h265player =
// this._h265player ||
// new H265CanvasPlayer(this, this.configs, currentIndex);
this._h265player = new H265CanvasPlayer(

@@ -177,10 +172,3 @@ this,

}
// wuyage1110 add
// videoInitDecoder(codetype) {
// switch (codetype) {
// case "H265":
// this._player.videoInitDecoder();
// break;
// }
// }
/**

@@ -328,4 +316,4 @@ * 判断是否只有一个websocket连接

*/
openVideo(jsonbonc) {
openVideo(jsonbonc,wssOpen) {
console.log('向内核传参数时间:',new Date().toLocaleString())
if (!jsonbonc && !this.jsonbonc) {

@@ -406,2 +394,12 @@ console.warn("通道数据不存在,请确定是否完成通道信息的获取");

)[0].firstChild.nodeValue = jsonbonc.PublicMDSServerIP);
//20230523 新加两个参数
jsonbonc.Scale &&
(playBody.getElementsByTagName(
"Scale"
)[0].firstChild.nodeValue = jsonbonc.Scale);
jsonbonc.Codec &&
(playBody.getElementsByTagName(
"Codec"
)[0].firstChild.nodeValue = jsonbonc.Codec);
if (

@@ -411,3 +409,12 @@ playBody.getElementsByTagName("StreamServerIP")[0].firstChild.nodeValue &&

) {
this.webSocketController.url =
if(wssOpen=='wssOpen'){
this.webSocketController.url =
"wss://" +
playBody.getElementsByTagName("StreamServerIP")[0].firstChild
.nodeValue +
":" +
playBody.getElementsByTagName("StreamServerPort")[0].firstChild
.nodeValue;
}else{
this.webSocketController.url =
"ws://" +

@@ -419,6 +426,8 @@ playBody.getElementsByTagName("StreamServerIP")[0].firstChild

.nodeValue;
}
} else {
this.webSocketController.url = "";
}
console.log('发送给c端的XML:',Xml2String(playBody))
this.webSocketController.xmlPlayBody = Xml2String(playBody);

@@ -587,3 +596,6 @@ this.webSocketController.WebSocketInit();

closeVideo(reason = "normal", ifnew = true) {
if (!this.webSocketController.boncws) return;
if (!this.webSocketController.boncws) {
// console.log('ws已经关闭')
return;
}
if (this.webSocketController instanceof TimeSelector) {

@@ -598,3 +610,10 @@ this.webSocketController.WebSocketUtils.forEach((val) => {

}
// console.log('aaa',this.configs)
//清除异常butter的canvas wuyage
const canvasElement = document.getElementById(this.configs.canvasOver);
if (canvasElement) {
var ctx = canvasElement.getContext("2d");
// 清除视频上叠加canvas绘制的内容
ctx.clearRect(0, 0, canvasElement.width, canvasElement.height);
}
// this.node && (this.node.src = "");

@@ -604,3 +623,3 @@ try{

}catch{}
// console.log('this._player:',this._player)
this._player && this._player.destroy();

@@ -822,2 +841,3 @@

changeAfterclose() {
console.log('this.jsonbonc :',this.jsonbonc)
this.openVideo(this.jsonbonc);

@@ -838,9 +858,2 @@ }

videoBufferAdd(videoBuffer) {
// console.log('开始进入死循环')
// while (true){
//
// }
// console.log('退出死循环')
// this.H264Mp4Player.playBuffer(videoBuffer);
// this.H264CanvasPlayer.playBuffer(videoBuffer);
if (this.reverse) {

@@ -852,7 +865,2 @@ // 倒放 ,需要将裸流加入到倒放队列

if (this._player) {
//let worker = new Worker(H265CanvasPlayer);
// this.worker.postMessage(videoBuffer,[videoBuffer]);
// this.worker.addEventListener("error", function(evt){
// console.log("workerErrorLine #" + evt.lineno + " - " + evt.message + " in " + evt.filename);
// }, false);
// let dataTeime=new Date().getTime();

@@ -859,0 +867,0 @@ // console.log("this._player:", this._player);

@@ -28,2 +28,4 @@ //这里存储的 指令模板

"<PublicMDSServerIP>192.168.2.112</PublicMDSServerIP>\n" +
"<Scale>0</Scale>\n" +
"<Codec>0</Codec>\n" +
"</Notify>";

@@ -30,0 +32,0 @@

@@ -86,3 +86,3 @@ import ByteArray from "./ByteArray";

let leftField = socketBA.ReadUint32(); //保留字段
// console.log('112-iCmdLen',iCmdLen)
// 如果是视频回放,指针还要向后移动这些才到数据体

@@ -109,2 +109,3 @@ var timestamp;

var biSizeImage = socketBA.ReadUint32(true); //4字节
// console.log('112-biSize',biSize,biSizeImage)
var biXPelsPerMeter = socketBA.ReadUint32(true); //4字节

@@ -140,8 +141,14 @@ var biYPelsPerMeter = socketBA.ReadUint32(true); //4字节

}
// 20230601 add 如果宽和高的值为0,则设置默认是1920*1080(针对h265)
let h265BiWidth=1920;
let h265BiHeight=1080;
if(biWidth!=0 && biHeight!=0){
h265BiWidth=biWidth;
h265BiHeight=biHeight;
}
//把设备信息传出去
this.app.dispatch("getDeviceInfo", {
code: biClrUsed,
resolution: `${biWidth}*${biHeight}`,
resolution: `${h265BiWidth}*${h265BiHeight}`,
});
// 判断数据类型是否改变

@@ -152,16 +159,21 @@ if (this.ifDispatchVideoType || this.codeType !== biClrUsed) {

this.app.dispatch("onGetVideoCode", "H264");
this.app.dispatch("getVideoBuf", true); //2023/0524 add 是否取到流
// console.log('h264取到流')
this.ifDispatchVideoType = false;
} else if (biClrUsed === "H265" && biWidth != 0 && biHeight != 0) {
}
else if (biClrUsed === "H265") {
// 验证是否具备h265解码的功能
this.codeType = "H265";
this.app.dispatch("onGetVideoCode", "H265");
//此事件的目的是为了每次单击此窗口都会调用c端的初始化,为了实现h265多路 wuyage1110
//this.app.dispatch("onVideoInitDecoder", "H265");
this.app.dispatch("h265Info", {
videoCanvasHeight: biHeight,
videoCanvasWidth: biWidth,
videoCanvasHeight: h265BiHeight,
videoCanvasWidth: h265BiWidth,
});
this.app.dispatch("getVideoBuf", true); //2023/0524 add 是否取到流
// console.log('h265取到流')
this.ifDispatchVideoType = false;
// this.app.dispatch('')
} else {
}
else {
// this.app.dispatch('restart');

@@ -178,5 +190,10 @@ console.log("丢弃");

var videoBuf = socketBA.SliceNewAB(biSizeImage);
// console.log('112-videoBuf:',videoBuf.byteLength)
if (this.ifDispatchBuf && this.ifDispatchBuf_h265) {
// let dataTeime=new Date().getTime();
this.app.dispatch("videoBufferAdd", videoBuf);
// console.log(this.app.configs.canvasId
// ,'从c端接收到的流:',videoBuf)
// let jiange=new Date().getTime()-dataTeime;

@@ -207,3 +224,4 @@ // console.log('videoBufferAdd推送数据耗时:'+jiange+'\n' )

var auClrImportant = socketBA.ReadUint32(true);
// console.log('音频格式:',type)
//20230525 add 当前音频编码格式
this.app.dispatch("audioType", type);
if (type != "MPEG") {

@@ -549,3 +567,3 @@ if (this.ifDispatchAudioError) {

let leftField = socketBA.ReadUint32(); //保留字段
if (company !== 1112757248) {
if (company !== 1112757248 && verbonc!=256) {
//'BST ' 只有当包满的时候company== 1112757248

@@ -555,2 +573,3 @@ // console.log('包未满ifFirstPackage:'+company)

} else {
// console.log('包满ifFirstPackage:'+iCmdLen,verbonc,imsgType,linType)
return iCmdLen;

@@ -574,2 +593,3 @@ }

} catch (err) {
console.log('MergeBuffer异常')
debugger;

@@ -576,0 +596,0 @@ }

@@ -260,2 +260,2 @@ export function appendByteArray(buffer1, buffer2)

export const version="5.0.12"
export const version="5.0.13"

@@ -14,6 +14,8 @@ import {

var packagenum = 0;
window.WebSocket.prototype.normalClose = function (reason) {
this.closeReason = reason || "normal";
// console.log("ws关闭", reason, new Date().toLocaleString());
this.close(3001, this.closeReason);
this.close(1000, this.closeReason);
this.messageData=false;
// console.log("前端发出断开请求:", reason, new Date().toLocaleString());
};

@@ -120,4 +122,8 @@

}
// console.log('this.app:',this.app,this.app.configs.videoId.split("_")[1])
// currentIndex=this.app.configs.videoId.split("_")[1];
// messageData[currentIndex]=true;
this.boncws.messageData=true;
if (this.closed === true) {
// console.log('异常断开后重新播放视频')
this.app.dispatch("startSuccess");

@@ -242,4 +248,4 @@ // console.log(

}
// console.log("监听到websocket关闭事件:", new Date().toLocaleString());
// console.log("监听到websocket关闭事件:",this.boncws.closeReason,new Date().toLocaleString());
if (this.boncws.closeReason === "normal") {

@@ -268,2 +274,7 @@ this.boncws.closeReason = "";

} else {
//判断如何ws断开不再接受消息,则不再重连
if(this.boncws.messageData==false){
// console.log("ws断开不再接受消息,不再重连")
return;
}
console.log(

@@ -281,5 +292,5 @@ "发出异常断开的消息",

if (this.boncws.closeReason == "normal") return;
console.log("websocket 5s后重新连接");
console.log("websocket 10s后重新连接");
this.WebSocketInit();
}, 5000);
}, 10000);
clearInterval(this.heartLiveInterval);

@@ -346,3 +357,7 @@ }

WebSocketMessage(evt) {
// console.log("websocket接收到消息-message", new Date().toLocaleString());
if(this.boncws.messageData==false){
// console.log('ws已经关闭,不再接受新的消息');
return;
}
// console.log('窗格号'+ this.app.configs.videoId+"," + '收到包数量:'+ packagenum++)

@@ -458,4 +473,4 @@ //console.time("str") //开始

//3表示连接已经关闭或者根本没有建立
// console.log("心跳重连");
// this.WebSocketInit(this.wsurl); //自动重连 wuyage 20221102 del
//console.log(this.app,"心跳重连");
// this.WebSocketInit(this.wsurl); //自动重连
return; //wuyage 20221102 add

@@ -462,0 +477,0 @@ } else {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc