Browse Source

播放接口调整

lite
453530270@qq.com 2 years ago
parent
commit
66ac3faeb8
  1. 74
      public/haikang/jquery-1.12.4.min.js
  2. 1
      public/haikang/jsencrypt.min.js
  3. 2
      public/haikang/web-control_1.2.5.min.js
  4. 5
      public/index.html
  5. 1
      public/liveplayer-lib.min.js
  6. 330
      src/views/ty/index.vue
  7. 63
      src/views/ty/index18.vue
  8. 47
      src/views/ty/index19.vue
  9. 146
      src/views/ty/index20.vue
  10. 176
      src/views/ty/index21.vue
  11. 1124
      src/views/ty/index22.vue
  12. 335
      src/views/ty/index23.vue
  13. 1833
      yarn.lock

74
public/haikang/jquery-1.12.4.min.js

File diff suppressed because one or more lines are too long

1
public/haikang/jsencrypt.min.js

File diff suppressed because one or more lines are too long

2
public/haikang/web-control_1.2.5.min.js

File diff suppressed because one or more lines are too long

5
public/index.html

@ -6,7 +6,10 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>宝安区公共文化体育服务中心智慧显示屏</title>
<script src="<%= BASE_URL %>js/liveplayer-lib.min.js"></script>
<script src="./liveplayer-lib.min.js"></script>
<script src="./haikang/jquery-1.12.4.min.js"></script>
<script src="./haikang/jsencrypt.min.js"></script>
<script src="./haikang/web-control_1.2.5.min.js"></script>
</head>
<body>
<noscript>

1
public/liveplayer-lib.min.js

File diff suppressed because one or more lines are too long

330
src/views/ty/index.vue

@ -1,160 +1,250 @@
<template>
<v-scale-screen width="1920" height="1080">
<div id="ty">
<div class="main">
<div class="center">
<div id="player" class="item">
<!-- <Video :src="src1" :poster="poster" /> -->
<!-- <video id="myFlvVideo" controls autoplay width="80%" height="200px"></video> -->
<!-- <video class="demo-video" ref="player" muted autoplay></video> -->
</div>
<div class="item">
<!-- <Video :src="src2" :poster="poster" /> -->
</div>
<div class="item">
<!-- <Video :src="src3" :poster="poster" /> -->
<!-- <video id="playWnd" autoplay></video> -->
<!--预览界面-->
<!-- <div id="operate" class="operate">
<div class="module" style="color:#fff;">
<div class="item"><span class="label">监控点编号</span><input id="cameraIndexCode" type="text" value="">
</div>
<!-- <div class="item"></div> -->
<div class="item" style="margin-top: 20px;margin-left: -20px;color:#fff;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button style="width:20px;padding:0;margin:0;color:#fff;" id="startPreview" class="btn">预览</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button style="width:90px;padding:0;margin:0;" id="stopAllPreview" class="btn">停止全部预览</button>
</div>
</div>
</div> -->
<!--视频窗口展示-->
<video id="playWnd" autoplay></video>
</div>
</v-scale-screen>
</template>
<script>
// import flvjs from "flv.js";
import '@/utils/h5player.min.js'
// import '@/utils/h5player.min.js'
// api
import * as homeApi from '@/api/home'
import $ from "jquery";
// import { getVideoRegionTree, getVideoInfo } from "@/api/realTimeInformation";
export default {
data() {
return {
player: null
initCount: 0,
pubKey: '',
oWebControl2: '',
}
},
mounted() {
created() {
// this.$nextTick DOM使DOM
this.$nextTick(() => {
this.initPlayer()
})
// this.getVideo()
this.initPlugin();
});
},
methods: {
/**
* 初始化播放器
*/
initPlayer() {
this.player = new JSPlugin({
//
szId: 'player',
// ,H5player.min.jsjs
szBasePath: '/static/',
// // div#play_windowiWidthiHeight
iWidth: 600,
iHeight: 400,
// // 4*4
// iMaxSplit: 16,
// iCurrentSplit: 1,
// //
// oStyle: {
// border: '#343434',
// borderSelect: '#FFCC00',
// background: '#000'
// }
//
initPlugin() {
let _that = this;
const oWebControl = new window.WebControl({
szPluginContainer: 'playWnd', // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15900,
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // IE10使ActiveXclsid
cbConnectSuccess() {
console.log('创建WebControl实例成功');
oWebControl.JS_StartService('window', {
// WebControl
dllPath: './VideoPluginConnect.dll', // "./VideoPluginConnect.dll"
})
this.initPlugin()
.then(
() => {
// //
oWebControl.JS_SetWindowControlCallback({
//
cbIntegrationCallBack: _that.cbIntegrationCallBack,
});
oWebControl.JS_CreateWnd('playWnd').then(() => {
//JS_CreateWnd
console.log('111111111111');
_that.init(); //
_that.getVideoFun('05edddc148b141c5930301af43154942')
});
},
/**
* 事件初始化
*/
initPlugin() {
this.player.JS_SetWindowControlCallback({
windowEventSelect(iWindIndex) {
//
console.log('windowSelect callback: ', iWindIndex)
},
pluginErrorHandler(iWindIndex, iErrorCode, oError) {
//
console.error(`window-${iWindIndex}, errorCode: ${iErrorCode}`, oError)
},
windowEventOver(iWindIndex) {
//
console.log('鼠标移过回调', iWindIndex)
},
windowEventOut(iWindIndex) {
//
console.log('鼠标移出回调', iWindIndex)
},
windowFullCcreenChange(bFull) {
//
console.log('全屏切换回调', bFull)
},
firstFrameDisplay(iWndIndex, iWidth, iHeight) {
//
console.log('首帧显示回调', iWndIndex, iWidth, iHeight)
},
performanceLack(iWndIndex) {
//
console.log('性能不足回调', iWndIndex)
() => {
//
console.log('启动插件服务失败');
}
)
.catch((err) => {
console.log(err);
});
},
cbConnectError() {
// WebControl
console.log('xxx');
oWebControl = null;
$('#playWnd').html('插件未启动,正在尝试启动,请稍候...');
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // errorwakeup
this.initCount++;
if (this.initCount < 3) {
setTimeout(function () {
this.initPlugin();
}, 3000);
} else {
$('#playWnd').html('插件启动失败,请检查插件是否安装!');
}
},
cbConnectClose(bNormalClose) {
// bNormalClose = false
// JS_DisconnectbNormalClose = true
console.log('cbConnectClose');
oWebControl = null;
},
});
this.oWebControl2 = oWebControl;
},
//
init() {
let _that = this;
this.getPubKey(function () {
//
var appkey = "29940726"; //appkey
var secret = _that.setEncrypt("SkTCnQdFbNW4Z2suNj8P"); //secret
var ip = "192.168.66.13"; //IP
var playMode = 0; //0-1-
var port = 554; //HTTPS443
var snapDir = ""; //
var videoDir = "D:\\VideoDir"; //
var layout = "1x1"; //playMode
var enableHTTPS = 1; //HTTPS1
var encryptedFields = "secret"; //secret
var showToolbar = 0; //0-0-
var showSmart = 1; //线0-0-
var buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //
//
_that.oWebControl2.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
playMode: playMode, //
port: port, //
snapDir: snapDir, //
videoDir: videoDir, //
layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, //
showToolbar: showToolbar, //
showSmart: showSmart, //
buttonIDs: buttonIDs, //
}),
})
this.play()
},
/**
* 播放
*/
play() {
let preUrl = 'ws://192.168.2.135:10800/ws-flv/hls/stream_1.flv'
// const param = {
// playURL: preUrl,
// // 1 0
// mode: 0
// }
//
let index = 0
let mode = 0
// console.log(this.playerArr)
console.log(this.player.JS_Play);
this.player.JS_Play(preUrl, { preUrl, mode }, index).then(
() => {
.then((oData) => {
let width = document.querySelector("#playWnd").offsetWidth;
let height = document.querySelector("#playWnd").offsetHeight;
_that.oWebControl2.JS_Resize(width, height); // resize
console.log(oData);
});
});
},
//
setCallbacks() {
this.oWebControl.JS_SetWindowControlCallback({
cbIntegrationCallBack: this.cbIntegrationCallBack,
});
},
//
cbIntegrationCallBack(oData) {
//
console.log(oData);
},
//
getPubKey(callback) {
this.oWebControl2.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then((oData) => {
if (oData.responseMsg.data) {
this.pubKey = oData.responseMsg.data;
console.log(this.pubKey);
callback();
}
});
},
//RSA
setEncrypt(value) {
var encrypt = new window.JSEncrypt();
encrypt.setPublicKey(this.pubKey);
return encrypt.encrypt(value);
},
//
getVideoFun(Code) {
//
var cameraIndexCode = Code; //
var streamMode = 0; //0-1-
var transMode = 1; //0-UDP1-TCP
var gpuMode = 1; //GPU0-1-
var wndId = -1; //2x2
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
console.log(cameraIndexCode);
this.oWebControl2.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, //GPU
wndId: wndId, //
}),
})
.then((res) => {
//
console.log('播放成功')
console.log('1111111111');
console.log(res);
},
err => {
console.log('播放失败')
console.log(preUrl);
// console.info('JS_Play failed:', err)
console.info(err)
}
)
});
},
getVideo() {
let that = this
console.log(that);
homeApi.allGetVideo().then(res => {
// get allTimeData
const tmpdata = res.data.returnData
console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array();
// let bvdata = new Array();
// tmpdata.foreach(function(item,index){
// console.log(item);
// console.log(index);
// });
//
stopVideoFun() {
this.oWebControl2.JS_RequestInterface({
funcName: "stopAllPreview",
});
},
}
// ---html
// 使
//
destroyVideoDiv() {
this.oWebControl2.JS_DestroyWnd()
.then((data) => {
console.log("销毁窗口成功");
})
.catch((err) => {
console.log("销毁窗口失败");
});
},
// ---
zhuaPicFun() {
this.oWebControl2.JS_RequestInterface({
funcName: "snapShot",
argument: {
name: "D:\test.jpg", //
},
});
},
},
}

63
src/views/ty/index18.vue

@ -0,0 +1,63 @@
<template>
<v-scale-screen width="1920" height="1080">
<div id="ty">
<div class="main">
<div class="center">
<div class="h5video" id="playerDiv1" style="float: left;"></div>
</div>
</div>
</div>
</v-scale-screen>
</template>
<script>
// import flvjs from "flv.js";
// import '@/utils/h5player.min.js'
// api
import * as homeApi from '@/api/home'
export default {
data() {
return {
}
},
mounted() {
var url_1 = 'rtmp://192.168.12.187:1935/live/1';
var oPlayerDiv1 = document.getElementById('playerDiv1');
oPlayerDiv1.setAttribute("data-rtmp", url_1);
oPlayerDiv1.setAttribute("href", url_1);
var swfStr = "./js/flowplayer-3.2.18.swf"
var obj_1 = {
clip: {
provider: 'rtmp',
bufferLength: 0,
bufferTime: 0,
autoPlay: true,
live: true
},
plugins: {
rtmp: {
url: "js/flowplayer.rtmp-3.2.13.swf",
netConnectionUrl: url_1
}
}
};
// JSON.stringify(obj_1)
flowplayer('playerDiv1', swfStr, obj_1);
},
methods: {
}
}
</script>
<style>
.demo-video {
max-width: 880px;
max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */
}
</style>

47
src/views/ty/index19.vue

@ -0,0 +1,47 @@
<template>
<div class='instance'>
<LivePlayer :videoUrl="videoUrl" fluent autoplay live stretch></LivePlayer>
<!-- <LivePlayer class="videostr1" @snapOutside="snapOutside" ref="player2" :videoUrl="flvURL" live /> -->
<!-- <LivePlayer class="videostr1" :videoUrl="mp4URL" /> -->
</div>
</template>
<script>
import LivePlayer from '@liveqing/liveplayer'
export default {
// props: {
// msg: String
// },
components: {
LivePlayer
},
mounted() {
},
data() {
return {
videoUrl: 'rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa'
// mp4URL() {
// return "http://999.222.444.533/sdk/file/2022-11-29/15047_20221129_103705140/CHN06.mp4"
// },
// flvURL() {
// return "http://live.hkstv.hk.lxdns.com/flv/hks.flv"
// },
}
},
methods: {
},
}
</script>
<style></style>

146
src/views/ty/index20.vue

@ -0,0 +1,146 @@
<template>
<v-scale-screen width="1920" height="1080">
<div id="ty">
<div class="main">
<div class="center">
<div id="player" class="item">
<!-- <Video :src="src1" :poster="poster" /> -->
<!-- <video id="myFlvVideo" controls autoplay width="80%" height="200px"></video> -->
<!-- <video class="demo-video" ref="player" muted autoplay></video> -->
</div>
<div class="item">
<!-- <Video :src="src2" :poster="poster" /> -->
</div>
<div class="item">
<!-- <Video :src="src3" :poster="poster" /> -->
</div>
<!-- <div class="item"></div> -->
</div>
</div>
</div>
</v-scale-screen>
</template>
<script>
// import flvjs from "flv.js";
import '@/utils/h5player.min.js'
export default {
data() {
return {
player: null
}
},
mounted() {
this.$nextTick(() => {
this.initPlayer()
})
},
methods: {
/**
* 初始化播放器
*/
initPlayer() {
this.player = new JSPlugin({
//
szId: 'player',
// ,H5player.min.jsjs
szBasePath: '/static/',
// // div#play_windowiWidthiHeight
iWidth: 600,
iHeight: 400,
// // 4*4
// iMaxSplit: 16,
// iCurrentSplit: 1,
// //
// oStyle: {
// border: '#343434',
// borderSelect: '#FFCC00',
// background: '#000'
// }
})
this.initPlugin()
},
/**
* 事件初始化
*/
initPlugin() {
this.player.JS_SetWindowControlCallback({
windowEventSelect(iWindIndex) {
//
console.log('windowSelect callback: ', iWindIndex)
},
pluginErrorHandler(iWindIndex, iErrorCode, oError) {
//
console.error(`window-${iWindIndex}, errorCode: ${iErrorCode}`, oError)
},
windowEventOver(iWindIndex) {
//
console.log('鼠标移过回调', iWindIndex)
},
windowEventOut(iWindIndex) {
//
console.log('鼠标移出回调', iWindIndex)
},
windowFullCcreenChange(bFull) {
//
console.log('全屏切换回调', bFull)
},
firstFrameDisplay(iWndIndex, iWidth, iHeight) {
//
console.log('首帧显示回调', iWndIndex, iWidth, iHeight)
},
performanceLack(iWndIndex) {
//
console.log('性能不足回调', iWndIndex)
}
})
this.play()
},
/**
* 播放
*/
play() {
let preUrl = 'ws://192.168.66.13:559/openUrl/jazXRGE'
// const param = {
// playURL: preUrl,
// // 1 0
// mode: 0
// }
//
let index = 0
let mode = 0
// console.log(this.playerArr)
console.log(this.player);
console.log(this.player.JS_Play);
this.player.JS_Play(preUrl, { preUrl, mode }, index).then(
() => {
//
console.log('播放成功')
console.log('1111111111');
},
err => {
console.log('播放失败')
console.log(preUrl);
// console.info('JS_Play failed:', err)
console.info(err)
}
)
},
}
}
</script>
<style>
.demo-video {
max-width: 880px;
max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */
}
</style>

176
src/views/ty/index21.vue

@ -0,0 +1,176 @@
<template>
<v-scale-screen width="1920" height="1080">
<div id="ty">
<div class="main">
<div class="center">
<input v-model="code" placeholder="输入监控点编码" @change="onChangeCode" />
<button @click="onSubmit">默认预览</button>
<button @click="onTwoSubmit(2)">4分屏</button>
<button @click="onTwoSubmit(4)">16分屏</button>
<button @click="onTwoSubmit(8)">64分屏</button>
<div id="player" style="width: 800px;height: 800px;"></div>
</div>
</div>
</div>
</v-scale-screen>
</template>
<script>
// import flvjs from "flv.js";
// import http from '@/http/http2.js'
import '@/utils/h5player.min.js'
export default {
data() {
return {
//
code: '',
//
player: null
}
},
mounted() {
this.initPlayer()
this.play()
},
methods: {
/**
* 初始化播放器
*/
initPlayer() {
this.player = new JSPlugin({
//
szId: 'player',
// ,H5player.min.jsjs
szBasePath: './static/util',
// div#play_windowiWidthiHeight
iWidth: 600,
iHeight: 400,
// 4*4
iMaxSplit: 16,
iCurrentSplit: 1,
//
oStyle: {
border: '#343434',
borderSelect: '#FFCC00',
background: '#000'
}
})
},
/**
* 获取取流连接
* @returns {*}
*/
// getPreviewUrl() {
// let tempCode = '61077001001320000018'
// if (this.code) {
// tempCode = this.code
// }
// const param = {
// 'cameraIndexCode': tempCode,
// 'streamType': 0,
// 'protocol': 'ws',
// 'transmode': 1
// }
// //
// return http.post('/ay-video-manage/video/monitor/getRealTimeMonitorVideo', param)
// },
/**
* 播放
*/
play() {
const _this = this
let preUrl = 'wss://cloud.liveqing.com:1443/ws-flv/hls/LiveGBS0013402000000132000026434020000001320000264.flv?k=LiveGBS0013402000000132000026434020000001320000264.d4d1ee3b8644b53101'
const param = {
preUrl: preUrl,
// 1 0
mode: 0
}
// 0
let index = 0
console.log(preUrl);
console.log(param);
console.log(this.player.JS_Play);
this.player.JS_Play(preUrl, param, index).then(() => {
//
console.log('播放成功')
},
(err) => {
console.log('播放失败',err)
})
// this.getPreviewUrl().then(res => {
// if (res.status !== 200) {
// _this.$message.warning('')
// return
// }
// let preUrl = res.data.data.url
// const param = {
// playURL: preUrl,
// // 1 0
// mode: 1
// }
// // 0
// if (!index) {
// index = 0
// }
// _this.player.JS_Play(preUrl, param, index).then(() => {
// //
// console.log('')
// },
// (err) => {
// console.log('')
// })
// })
},
/**
* 监控点更新
* @param data
*/
onChangeCode(data) {
console.log(data);
this.code = data
this.play()
},
/**
* 默认预览
*/
onSubmit() {
this.play()
},
/**
* 分屏这里我太懒了就循环了一个视频流
*/
onTwoSubmit(num) {
const _this = this
// 24
this.player.JS_ArrangeWindow(num).then(
() => {
//
for (let i = 0; i < num * num; i++) {
_this.play(i)
}
},
e => { console.error(e) }
)
}
}
}
</script>
<style>
.demo-video {
max-width: 880px;
max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */
}
</style>

1124
src/views/ty/index22.vue

File diff suppressed because it is too large

335
src/views/ty/index23.vue

@ -0,0 +1,335 @@
<template>
<v-scale-screen width="1920" height="1080">
<div id="ty">
<div ref="playWndBox">
<!-- 视频数据站位 -->
<div id="playWnd" class="playWnd" :style="{
height: playWndHeight + 'px',
width: playWndWidth + 'px',
}"></div>
</div>
</div>
</v-scale-screen>
</template>
<script>
// import flvjs from "flv.js";
import '@/utils/h5player.min.js'
// api
import * as homeApi from '@/api/home'
// import { getVideoRegionTree, getVideoInfo } from "@/api/realTimeInformation";
export default {
data() {
return {
treeData: [],
defaultProps: {
children: "children",
label: "name",
},
//
playWndHeight: "",
//
playWndWidth: "",
oWebControl: null,
initCount: 0,
pubKey: "",
cameraIndexCode: "05edddc148b141c5930301af43154942", //
objData: {
appkey: "29940726",
ip: "192.168.66.13",
port: 554,
playMode: 0, // 0 1
layout: "2x2", //16
}
}
},
mounted() {
// this.getTreeList();
//
this.playWndHeight = this.$refs.playWndBox.clientHeight;
//
this.playWndWidth = this.$refs.playWndBox.clientWidth - 140;
//
this.$nextTick(() => {
this.initPlugin();
});
console.log(this._data);
// resize使DIV
window.addEventListener("resize", () => {
console.log(
this.$refs.playWndBox.clientHeight,
this.$refs.playWndBox.clientWidth
);
if (this.oWebControl != null) {
this.oWebControl.JS_Resize(
this.$refs.playWndBox.clientWidth - 140,
this.$refs.playWndBox.clientHeight
);
}
});
},
methods: {
//
// getTreeList() {
// getVideoRegionTree().then((res) => {
// this.treeData = res.data;
// });
// },
// handleNodeClick(data) {
// console.log(data);
// if (!data.children) {
// getVideoInfo({ videoId: data.id })
// .then((res) => {
// this.previewVideo(res.data);
// })
// .catch((err) => {
// console.log(err, "-------");
// });
// }
// },
//
initPlugin() {
let that = this;
this.oWebControl = null;
that.oWebControl = new WebControl({
szPluginContainer: "playWnd", // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15900,
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // IE10使ActiveXclsid
cbConnectSuccess: () => {
// WebControl
console.log('1111111');
console.log(that.oWebControl);
that.oWebControl
.JS_StartService("window", {
// WebControl
// "./VideoPluginConnect.dll"
dllPath: "./VideoPluginConnect.dll",
})
.then(
function () {
//
that.oWebControl.JS_SetWindowControlCallback({
cbIntegrationCallBack: that.cbIntegrationCallBack,
});
//JS_CreateWnd
that.oWebControl
.JS_CreateWnd("playWnd", 1000, 600)
.then(function () {
//
that.init();
that.previewVideo(that._data);
});
},
function () {
//
}
);
},
// WebControl
cbConnectError: function () {
that.oWebControl = null;
that.$message.warning("插件未启动,正在尝试启动,请稍候...");
// errorwakeup
window.WebControl.JS_WakeUp("VideoWebPlugin://");
that.initCount++;
if (that.initCount < 3) {
setTimeout(function () {
that.initPlugin();
}, 3000);
} else {
that.$message.warning("插件启动失败,请检查插件是否安装!");
}
},
cbConnectClose: () => {
// bNormalClose = false
// JS_DisconnectbNormalClose = true
console.log("cbConnectClose");
that.oWebControl = null;
},
});
},
//
init(callback) {
let that = this;
that.getPubKey(() => {
let appkey = that.objData.appkey; //appkey
let secret = that.setEncrypt('PSkTCnQdFbNW4Z2suNj8'); //secret
let ip = that.objData.ip; //IP
let playMode = that.objData.playMode; //0-1-
let port = that.objData.port; //HTTPS443
let snapDir = "D:\\SnapDir"; //
let videoDir = "D:\\VideoDir"; //
let layout = that.objData.layout; //playMode
let enableHTTPS = 1; //HTTPS1
let encryptedFields = "secret"; //secret
let showToolbar = 1; //0-0-
let showSmart = 1; //线0-0-
let buttonIDs =
"0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //
// var toolBarButtonIDs = "2049,2304" //
that.oWebControl
.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
playMode: playMode, //
port: port, //
snapDir: snapDir, //
videoDir: videoDir, //
layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, //
showToolbar: showToolbar, //
showSmart: showSmart, //
buttonIDs, //
}),
})
.then(function (oData) {
console.log(oData);
that.oWebControl.JS_Resize(that.playWndWidth, that.playWndHeight); // resizefirefoxDIV
if (callback) {
callback();
}
//
// that.oWebControl.JS_HideWnd()
});
});
},
//
getPubKey(callback) {
let that = this;
console.log(that.oWebControl);
this.oWebControl
.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then(function (oData) {
if (oData.responseMsg.data) {
that.pubKey = oData.responseMsg.data;
callback();
}
});
},
// RSA
setEncrypt(value) {
let that = this;
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(that.pubKey);
return encrypt.encrypt(value);
},
//
cbIntegrationCallBack(oData) {
let { responseMsg: type } = oData;
if (type === "error") {
console.log(
type,
type,
this.dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss")
);
} else {
console.log(
type,
type,
this.dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss")
);
}
},
//
previewVideo(data) {
let that = this;
console.log(data);
console.log(data.cameraIndexCode);
let cameraIndexCode = data.cameraIndexCode; //
let streamMode = 0; // 0-1-
let transMode = 0; // 0-UDP1-TCP
let gpuMode = 0; // GPU0-1-
let wndId = -1; // 2x2
console.log(cameraIndexCode, "-------cameraIndexCode-");
// that.initPlugin()
console.log(that.oWebControl);
// console.log(this.oWebControl);
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
that.oWebControl.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode.trim(), //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, // GPU
wndId: wndId, //
}),
})
.then(function (oData) {
console.log(oData);
});
},
//
stopAllPreview() {
this.oWebControl.JS_RequestInterface({
funcName: "stopAllPreview",
});
},
//
dateFormat(oDate, fmt) {
let o = {
"M+": oDate.getMonth() + 1, //
"d+": oDate.getDate(), //
"h+": oDate.getHours(), //
"m+": oDate.getMinutes(), //
"s+": oDate.getSeconds(), //
"q+": Math.floor((oDate.getMonth() + 3) / 3), //
S: oDate.getMilliseconds(), //
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
(oDate.getFullYear() + "").substr(4 - RegExp.$1.length)
);
}
for (let k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1
? o[k]
: ("00" + o[k]).substr(("" + o[k]).length)
);
}
}
return fmt;
},
},
//
destroyed() {
if (this.oWebControl != null) {
//
this.oWebControl.JS_HideWnd();
//
this.oWebControl.JS_RequestInterface({ funcName: "destroyWnd" });
//
this.oWebControl.JS_Disconnect();
}
},
}
</script>
<style>
.demo-video {
max-width: 880px;
max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */
}
</style>

1833
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save