Socket
Socket
Sign inDemoInstall

bonc-htmlplayer

Package Overview
Dependencies
2
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.26 to 1.0.27

2

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

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

import Event from './util/event';
import { validateChannelInfo, validateConfigs } from './util/viladate';
import { BLoadXML, Xml2String, fullScreen, getChannelInfo, dealRecordSearchInfo } from './util/utils';
import { BLoadXML, Xml2String, fullScreen, getChannelInfo,getBackChannelInfo, dealRecordSearchInfo } from './util/utils';
import {

@@ -73,3 +73,7 @@ xmlPlayBody,

if (centerInfo) {
getChannelInfo.call(this, centerInfo.centerUrl, centerInfo.channelId, centerInfo.callBack);
if(!centerInfo.channelId){
getBackChannelInfo.call(this, centerInfo.centerUrl, centerInfo.callBack);
}else{
getChannelInfo.call(this, centerInfo.centerUrl, centerInfo.channelId, centerInfo.callBack);
}
}

@@ -265,6 +269,6 @@

download(info) {
var { startTime, endTime, ip, port, filename, channelId } = info
var url = `http://${ip}:${port}/${filename}.flv?channelid=${channelId}&starttime=${startTime}&endtime=${endTime}`
var { startTime, endTime, ip, port, filename, channelId, type = 'flv' } = info
var url = `http://${ip}:${port}/${filename}.${type}?channelid=${channelId}&starttime=${startTime}&endtime=${endTime}`
var a = document.createElement("a");
a.download = filename + ".flv";
a.download = filename + "." + type;
a.href = url;

@@ -271,0 +275,0 @@ var bodynode = document.querySelector('body')

@@ -60,2 +60,14 @@ export default class ByteArray

}
ReadUint32Last(offset)
{
let result=null;
try{
result = this.dataView.getUint32(offset,false);
}
catch(err){
debugger
}
return result;
}
ReadUint64(little=false)

@@ -62,0 +74,0 @@ {

@@ -53,6 +53,4 @@ import ByteArray from './ByteArray';

}
addDataPackage(e) {
addDataPackage(e, type) {
//判断当前状态是否异常,并且不是第一个包,
if (this.packageState) {

@@ -86,3 +84,3 @@ // console.log('yichang')

//处理message,判断包是否满了
if (this.ifFull()) {
if (this.ifFull(type)) {
//如果满了

@@ -415,47 +413,6 @@ //this.packageNum = 0;

//如果没满,看当前状态,如果状态正常,合并,如果异常,丢弃
if (!this.packageState) {
if (!this.packageState) {// 0状态正常 1异常
//如果没满又来了第一包
if (this.ifFirstPackage(e.data)) {
console.log('没满又出了一包,指针回原点')
// 上一包的情况
// var socketBA_last = new ByteArray(this.whole.buffer,this.wholeOffset)
// var verbonc = socketBA_last.ReadUint32();//verbonc
// var company = socketBA_last.ReadUint32();//company
// var imsgType = socketBA_last.ReadUint32();//消息类型
// var linType = socketBA_last.ReadUint32();//指令类型
// var iCmdLen = socketBA_last.ReadUint32();//指令长度
// var allDataLength = socketBA_last.ReadUint32();//数据全长
// var leftField = socketBA_last.ReadUint32();//保留字段
// if( company !== 1112757248 ){//'BST '
// console.log('丢失第一包')
// //this.templateDataQueue = new ArrayBuffer(0);
// this.packageState = 1;
// return false
// }
// if(socketBA_last.bytesAvailable<iCmdLen){
// console.log('上一包数据')
// console.log('verbonc',verbonc)
// console.log('company',company)
// console.log('imsgType',imsgType)
// console.log('linType',linType)
// console.log('iCmdLen',iCmdLen)
// console.log('已收数据',socketBA_last.bytesAvailable)
// }
// 本包的情况
// var socketBA_this = new ByteArray(e.data);
// var verbonc = socketBA_this.ReadUint32();//verbonc
// var company = socketBA_this.ReadUint32();//company
// var imsgType = socketBA_this.ReadUint32();//消息类型
// var linType = socketBA_this.ReadUint32();//指令类型
// var iCmdLen = socketBA_this.ReadUint32();//指令长度
// var allDataLength = socketBA_this.ReadUint32();//数据全长
// var leftField = socketBA_this.ReadUint32();//保留字段
// console.log('本包情况')
// console.log('verbonc',verbonc)
// console.log('company',company)
// console.log('imsgType',imsgType)
// console.log('linType',linType)
// console.log('iCmdLen',iCmdLen)
// console.log('本包长',socketBA_this.bytesAvailable)
console.log('没满又出了一包,指针回原点==>丢弃上一包,收集新的一包')
this.wholeOffset = 0;

@@ -467,2 +424,7 @@ }

//如果状态异常,判断这个包是不是第一个包
if(this.ifFirstPackage(e.data)){
this.wholeOffset = 0;
this.packageState = 0;
this.MergeBuffer(this.whole, e.data);
}
return;

@@ -473,17 +435,7 @@ }

}
/**
* 判断是否数据流错位了
*/
ifError() {
}
/**
* 判断单个包是否满了
* @param {ArrayBuffer} data
*/
ifFull() {
ifFull(type) {
// if(!this.templateDataQueue || !this.templateDataQueue.byteLength){

@@ -495,2 +447,7 @@ // return false;

}
//判断包数据长度是否小于28
if(this.whole.buffer.byteLength<28){
console.log('包长度==》',this.whole.buffer.byteLength)
return false
}
// let socketBA = new ByteArray(this.templateDataQueue);

@@ -512,14 +469,40 @@ let socketBA = new ByteArray(this.whole.buffer, this.wholeOffset)

}
if (socketBA.bytesAvailable < iCmdLen) {
if(verbonc == 256){
if (socketBA.bytesAvailable < iCmdLen) {
return false;
} else if (socketBA.bytesAvailable === iCmdLen) {
return true;
} else if (socketBA.bytesAvailable > iCmdLen) {
//console.warn('中间有丢包',this.packageNum)
//console.log(socketBA)
debugger
console.log('包长度超过iCmdLen')
this.packageState = 1;
return false
}
}else if(verbonc == 512 && type == 'playback'){
if (socketBA.bytesAvailable < iCmdLen+4) {
return false;
} else if (socketBA.bytesAvailable === iCmdLen+4) {
let lastByte = socketBA.ReadUint32Last(allDataLength-4);
console.log('尾部4字节',lastByte, iCmdLen)
if(lastByte !== iCmdLen){
this.packageState = 1;
return false;
}
return true;
} else if (socketBA.bytesAvailable > iCmdLen+4) {
//console.warn('中间有丢包',this.packageNum)
//console.log(socketBA)
debugger
console.log('包长度超过iCmdLen')
this.packageState = 1;
return false
}
}else{
return false;
} else if (socketBA.bytesAvailable === iCmdLen) {
return true;
} else if (socketBA.bytesAvailable > iCmdLen) {
//console.warn('中间有丢包',this.packageNum)
//console.log(socketBA)
//debugger
console.log('包长度超过iCmdLen')
this.packageState = 1;
return false
}

@@ -541,4 +524,9 @@

//let verbonc = socketBA.ReadUint32();//verbonc
socketBA.ReadUint32();//verbonc
let verbonc = socketBA.ReadUint32();//verbonc
let company = socketBA.ReadUint32();//company
let imsgType = socketBA.ReadUint32();//消息类型
let linType = socketBA.ReadUint32();//指令类型
let iCmdLen = socketBA.ReadUint32();//指令长度
let allDataLength = socketBA.ReadUint32();//数据全长
let leftField = socketBA.ReadUint32();//保留字段
if (company !== 1112757248) {//'BST '

@@ -545,0 +533,0 @@

@@ -167,3 +167,27 @@ export function appendByteArray(buffer1, buffer2)

export function getBackChannelInfo(centerURL,callback){
var url = centerURL
console.log(url)
fetch(url, {
method: 'GET',
})
.then(function(response)
{
return response.json();
})
.then((jsonbonc)=> {
if(!jsonbonc.StreamServerIP){
throw new Error('错误')
}
this.jsonbonc=jsonbonc;
if(callback){
callback(jsonbonc);
}
}).catch((e)=>{
console.error(e,'服务器错误')
});
}
/**

@@ -170,0 +194,0 @@ * @desc 函数节流

@@ -233,5 +233,5 @@ import { xmlHeader, xmlHeartBody, xmlCloseBody, xmlPlayControl ,xmlPlayRecord} from './orderList';

setTimeout(() => {
console.log('websocket 重新连接', this.type)
console.log('websocket 10s后重新连接', this.type)
this.WebSocketInit();
}, 2000);
}, 10000);
clearInterval(this.heartLiveInterval)

@@ -251,3 +251,3 @@ }

//console.time("str") //开始
this.socketDataMerge.addDataPackage(evt);
this.socketDataMerge.addDataPackage(evt,'video');
//console.timeEnd("str") //结束

@@ -272,3 +272,3 @@ }

if (this.finishSearch) {
this.socketDataMerge.addDataPackage(evt);
this.socketDataMerge.addDataPackage(evt, 'playback');
} else {

@@ -291,3 +291,3 @@ var socketBA = new ByteArray(evt.data);

// 取本次查询结果的起始时间和结束时间
console.log(jsonData)
// console.log(jsonData)
var arr = jsonData.Response.RecordList ? jsonData.Response.RecordList.Item : false;

@@ -301,3 +301,3 @@ if(!Array.isArray(arr)){

}
console.log(arr)
// console.log(arr)
if (xbn.indexOf('Response') == -1) {

@@ -304,0 +304,0 @@ throw new Error('服务器返回内容错误或丢包');

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