Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
bonc-h5player-components
Advanced tools
本组件库包含若干基于内核进行封装的React组件,可以针对h264编码的视频流进行解析播放。
# 仓库地址切换到公司的私有npm上
npm config set registry https://code.bonc.com.cn/nexus/repository/npm-unstable/
# 安装
npm i bonc-h5player-components --save
VideoPlayer用于播放单个实时视频,具有清除、全屏、截图等功能
import React from 'react';
import ReactDOM from 'react-dom';
import {VideoPlayer} from '../../../src/index'
import './index.css';
class App extends React.Component{
constructor(){
super();
this.channelInfo1 = {
DeviceIP: "192.168.1.188",
DevicePort: "554",
DeviceType: "1101",
ChannelNum: "0",
PassWord: "123",
StreamServerIP: "172.16.96.165",
StreamServerPort: "10088",
UserName: "admin"
}
this.state = {
playState:false
}
}
playeVideo1(){
debugger
this.videoEl.playVideo(this.channelInfo1)
}
playeVideo2(){
this.videoEl.playVideo(this.channelInfo2)
}
render(){
return <div className='Full'>
<div className='left'>
<button id='playbtn1' onClick={()=>this.playeVideo1.bind(this)()}>播一路</button>
</div>
<div className='right'>
<VideoPlayer
ref={el => this.videoEl = el}
style = {{
top: '0%',
left: '0%',
width: '100%',
height:'100%'
}}/>
</div>
</div>
}
};
ReactDOM.render(<App />, document.getElementById("root"))
.Full{
display: flex;
height: 100%;
}
.left{
width: 100px;
}
.right{
flex: 1;
position: relative;
}
参数 | 说明 | 类型 |
---|---|---|
top | 组件的样式的top值 | string |
left | 组件的样式的left值 | string |
width | 组件的样式的width值 | string |
height | 组件的样式的height值 | string |
播放器内核实例
配置项 | 必选 | 类型 | 说明 |
---|---|---|---|
DeviceType | 是 | String | 摄像头类型编号 |
DeviceIP | 是 | String | 视频的通道ID |
StreamServerIP | 是 | String | 流服务IP |
StreamServerPort | 是 | String | 流服务端口 |
DevicePort | 是 | String | 设备端口 |
UserName | 是 | String | 用户名 |
PassWord | 是 | String | 密码 |
ChannelNum | 是 | String | 通道数 |
VideoPanel 用于播放多个实时视频
import React from 'react';
import ReactDOM from 'react-dom';
import {VideoPanel} from '../../../src/index'
import './index.css';
class App extends React.Component{
constructor(){
super();
this.channelInfo1 = {
DeviceIP: "192.168.1.188",
DevicePort: "554",
DeviceType: "1101",
PassWord: "123",
StreamServerIP: "172.16.96.165",
StreamServerPort: "10088",
UserName: "admin"
}
this.channelInfo2 = {
ChannelNum: "0",
DeviceIP: "192.168.1.202",
DevicePort: "554",
DeviceType: "1101",
PassWord: "123",
StreamServerIP: "172.16.96.165",
StreamServerPort: "10088",
UserName: "admin"
}
this.state = {
playState:false
}
}
playeVideo1(){
this.videoEl.videoPlay(this.channelInfo1)
}
playeVideo2(){
this.videoEl.videoPlay(this.channelInfo2)
}
render(){
return <div className='Full'>
<div className='left'>
<button id='playbtn1' onClick={()=>this.playeVideo1.bind(this)()}>播一路</button>
<button id='playbtn2' onClick={()=>this.playeVideo2.bind(this)()}>播二路</button>
</div>
<div className='right'>
<VideoPanel ref={el => this.videoEl = el}/>
</div>
</div>
}
};
ReactDOM.render(<App />, document.getElementById("root"))
配置项 | 必选 | 类型 | 说明 |
---|---|---|---|
DeviceType | 是 | String | 摄像头类型编号 |
DeviceIP | 是 | String | 视频的通道ID |
StreamServerIP | 是 | String | 流服务IP |
StreamServerPort | 是 | String | 流服务端口 |
DevicePort | 是 | String | 设备端口 |
UserName | 是 | String | 用户名 |
PassWord | 是 | String | 密码 |
ChannelNum | 是 | String | 通道数 |
获取视频的数组,数组中每个元素为一个videoPlayer组件的实例
VideoPanelBack用于回放多个视频
描述:用于保存需要播放的通道信息 类型:数组 单个数组元素结构:
配置项 | 必选 | 类型 | 说明 |
---|---|---|---|
channelId | 是 | String | 通道ID |
name | 是 | String | 通道名称 |
描述:用于保存查询视频的开始时间和结束时间 类型:对象 对象结构:
配置项 | 必选 | 类型 | 说明 |
---|---|---|---|
startTime | 是 | String | 起始时间 |
endTime | 是 | String | 结束时间 |
在selectedChannels和timeInfo设置之后,执行该方法,可以完成该段时间段的视频查询
用于安防的算法配置规则,可在视频上绘制单向绊线、双向绊线、
##属性 videoWidth 视频区域的宽度 必填 number videoHeight 视频区域的高度 必填 number channelInfo 通道信息 必填 object showOsd 是否展示osd信息 选填 Boolean 默认不展示 drawRule 是否将事先绘制好的规则画在视频上 选填 Boolean 默认false
配置项 | 必选 | 类型 | 说明 |
---|---|---|---|
DeviceType | 是 | String | 摄像头类型编号 |
DeviceIP | 是 | String | 视频的通道ID |
StreamServerIP | 是 | String | 流服务IP |
StreamServerPort | 是 | String | 流服务端口 |
DevicePort | 是 | String | 设备端口 |
UserName | 是 | String | 用户名 |
PassWord | 是 | String | 密码 |
ChannelNum | 是 | String | 通道数 |
具体用法参见内核实例的文档
请核实坐标原点位置,canvas的坐标原点位置在左上角,如果坐标不满足请做坐标变换
eleType | 几何名称 | 几何信息描述 |
---|---|---|
rect | 矩形 | 对角线坐标:sX 起点x坐标, sY 起点y坐标, eX 终点x坐标, eY终点y坐标 |
polygon | 区域 | points属性为存储坐标的数组,数组中的元素为对象,包括x和y |
polygonDirection | 区域+方向线 | points属性为区域的坐标同上,arrow属性为箭头的坐标对象,包括:sX 箭头起点x, sY 箭头起点y, eX 箭头终点x, eY 箭头终点y |
lineSingleDirection | 单向绊线 | sX 起点x坐标, sY 起点y坐标, eX 终点x坐标, eY终点y坐标,单向绊线的方向为绊线方向的逆时针方向 |
lineDoubleDirection | 双向绊线 | 起点、终点信息同上 |
FAQs
基于bonc-h5内核的组件库
We found that bonc-h5player-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.