1.0.5 • Published 1 year ago

y-video v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

y-video 说明

2024-7-30 增加海康插件组件封装

海康插件组件

  1. HikPluginPlayer 使用
import {HikPluginPlayer, PlatformProp} from 'y-video'

const player = () => {
	const [platformInfo, setPlatformInfo] = useState<PlatformProp>({
      host: '192.168.1.1',
      port: 1443,
      appkey: '23232332',
      appsecret: 'dcskndsn2323sdasa',
      layout: '1x1'
    })
  
    const [playProps, setPlayProps] = useState<PlayArgumentProps>([])
  
	return <div style={{'width': '600px', 'height': '400px'}}>
      <HikPluginPlayer platform={platformInfo} onInit={(player) => {
		player.showWnd()  // 在初始化的过程中进行了隐藏操作,需要先调用showWnd方法显示窗口
        player.play(playProps) // 视频预览
      }} />
    </div>
}
  1. HikPluginPlayer 海康插件组件 组件参数:
参数名参数说明类型默认值
platform海康平台基本信息Object具体信息查看PlatformProp
onInit初始化成功回调Function(player: HikPlugin) => void
onError失败回调Function(error: callbackProp) => void
downloadUrl插件下载地址, 可选string''
showCallback是否展示海康插件的回调信息booleanfalse

PlatformProp 类型:

参数名参数说明类型默认值
appkey海康平台appKeystring''
appsecret海康平台appSecretstring''
layout视频预览布局,可选string'1x1'
host海康平台ipstring''
port海康平台端口string''

海康插件实例方法:

|方法名参数说明描述默认值
playPlayArgumentProps,播放参数对象海康插件播放实时预览-
getPlayer-获取播放实例-
getInitOptions-获取播放参数-
resizeWndwidth: number(宽),height: number(高), callback(回调)调整插件窗口大小-
hideWndcallback: (info: callbackProp) => void 回调参数隐藏窗口-
showWndcallback: (info: callbackProp) => void 回调参数显示窗口-
destroyWndcallback: (info: callbackProp) => void 回调参数销毁插件-

大华插件组件

  1. DhPluginPlayer 使用
import {DhPluginPlayer, PlatformProps, DhPlayArgumentProps} from 'y-video'

const player = () => {
	const [platformInfo] = useState<PlatformProps>({
		host: '192.168.1.1',
		port: '443',
		username: 'system',
		password: '123456', 
        division: 1
	})

	const [playProps] = useState<<DhPlayArgumentProps>[]>([{
        channelId: '100010$1$0$6',
        channelName: '活发围墙周界',
        snum: 0,
        streamType: 1,
        deviceType: 6,
        cameraType: '2',
        capability: '0000000000000000100000000000000',
        decodeMode: 0
    }])

	return <div style={{'width': '600px', 'height': '400px'}}>
		<HikPluginPlayer platform={platformInfo} onInit={(player) => {
			player.showWnd()  // 在初始化的过程中进行了隐藏操作,需要先调用showWnd方法显示窗口
			player.play(playProps) // 视频预览
		}} />
	</div>
}
  1. DhPluginPlayer插件参数 组件参数:
参数名参数说明类型默认值
platform大华平台基本信息(必填)Object具体信息查看PlatformProps
onInit初始化成功回调(必填)Function(player: DhPlugin) => void
onError失败回调Function(error: callbackProp) => void
downloadUrl插件下载地址, 可选string''
onChangeDivision插件布局变化回调Function(division: number) => void

PlatformProps参数:

参数名参数说明类型默认值
host大华平台ip(必填)string''
port大华平台端口(必填)string''
username大华平台用户名(必填)string''
password大华平台密码(必填)string''
division大华平台布局,可选number1

DhPlayArgumentProps预览参数:

参数名参数说明类型默认值
channelId大华平台通道号(必填)string''
channelName大华平台通道string''
snum窗口序号number0
streamType主子码流标识number1
deviceType设备类型number''
cameraType摄像机类型string''
capability能力集string''
decodeMode解码模式number2

插件实例方法:

方法名参数说明
play(playProps: DhPlayArgumentProps[])播放参数
getPlayer()获取播放实例
getInitOptions()获取播放参数
init(callback: (player: callbackProp) => void)初始化方法
hideWnd()隐藏窗口
showWnd()显示窗口
destroyWnd()销毁窗口
setWndControlBtn(btns, snum)设置窗口控制按钮

更新说明

1.0.0 最初版,rollup构建 1.0.1 增加海康插件封装 1.0.2 修复插件无法显示问题 1.0.3 增加海康插件参数调整及文档说明 1.0.4 增加大华插件封装 1.0.5 修复大华插件播放参数报错问题

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago