Browse Source

播放接口调整

lite
453530270@qq.com 3 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. 45
      public/index.html
  5. 1
      public/liveplayer-lib.min.js
  6. 424
      src/views/ty/index.vue
  7. 124
      src/views/ty/index10.vue
  8. 90
      src/views/ty/index11.vue
  9. 116
      src/views/ty/index12.vue
  10. 96
      src/views/ty/index15.vue
  11. 63
      src/views/ty/index18.vue
  12. 47
      src/views/ty/index19.vue
  13. 306
      src/views/ty/index2.vue
  14. 146
      src/views/ty/index20.vue
  15. 176
      src/views/ty/index21.vue
  16. 1124
      src/views/ty/index22.vue
  17. 335
      src/views/ty/index23.vue
  18. 502
      src/views/ty/index5.vue
  19. 694
      src/views/ty/index6.vue
  20. 128
      src/views/ty/index8.vue
  21. 180
      src/views/ty/index9.vue
  22. 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

45
public/index.html

@ -1,21 +1,24 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>宝安区公共文化体育服务中心智慧显示屏</title> <title>宝安区公共文化体育服务中心智慧显示屏</title>
<script src="<%= BASE_URL %>js/liveplayer-lib.min.js"></script> <script src="./liveplayer-lib.min.js"></script>
</head> <script src="./haikang/jquery-1.12.4.min.js"></script>
<body> <script src="./haikang/jsencrypt.min.js"></script>
<noscript> <script src="./haikang/web-control_1.2.5.min.js"></script>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> </head>
</noscript> <body>
<div id="app"></div> <noscript>
<script src="<%= BASE_URL %>static/h5player.min.js"></script> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<!-- built files will be auto injected --> <div id="app"></div>
</body> <script src="<%= BASE_URL %>static/h5player.min.js"></script>
</html>
<!-- built files will be auto injected -->
</body>
</html>

1
public/liveplayer-lib.min.js

File diff suppressed because one or more lines are too long

424
src/views/ty/index.vue

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

124
src/views/ty/index10.vue

@ -1,63 +1,63 @@
<template> <template>
<video-player class="video-player vjs-custom-skin" ref="videoPlayer" :playsinline="true" <video-player class="video-player vjs-custom-skin" ref="videoPlayer" :playsinline="true"
:options="playerOptions"></video-player> :options="playerOptions"></video-player>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
// import videojs from "video.js"; // import videojs from "video.js";
// import "video.js/dist/video-js.css"; // import "video.js/dist/video-js.css";
// import "videojs-flash"; // import "videojs-flash";
// api // api
import * as homeApi from '@/api/home' import * as homeApi from '@/api/home'
export default { export default {
data() { data() {
return { return {
playerOptions: { playerOptions: {
playbackRates: [0.7, 1.0, 1.5, 2.0], // playbackRates: [0.7, 1.0, 1.5, 2.0], //
autoplay: false, //true, autoplay: false, //true,
muted: false, // muted: false, //
loop: false, // loop: false, //
preload: 'auto', // <video>auto, preload: 'auto', // <video>auto,
language: 'zh-CN', language: 'zh-CN',
aspectRatio: '16:9', // 使 - "16:9""4:3" aspectRatio: '16:9', // 使 - "16:9""4:3"
techOrder: ['flash', 'html5'], // techOrder: ['flash', 'html5'], //
flash: { flash: {
hls: { withCredentials: false }, hls: { withCredentials: false },
swf: 'static/video-js.swf' // swf swf: 'static/video-js.swf' // swf
}, },
html5: { hls: { withCredentials: false } }, html5: { hls: { withCredentials: false } },
sources: [{ // sources: [{ //
type: 'rtmp/hls', type: 'rtmp/hls',
src: 'rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa' src: 'rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa'
}], }],
poster: "", // poster: "", //
// width: document.documentElement.clientWidth, // width: document.documentElement.clientWidth,
notSupportedMessage: '此视频暂无法播放,请稍后再试', // Video.js notSupportedMessage: '此视频暂无法播放,请稍后再试', // Video.js
controlBar: { controlBar: {
timeDivider: true, timeDivider: true,
durationDisplay: true, durationDisplay: true,
remainingTimeDisplay: false, remainingTimeDisplay: false,
fullscreenToggle: true // fullscreenToggle: true //
} }
} }
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

90
src/views/ty/index11.vue

@ -1,46 +1,46 @@
<template> <template>
<div class='instance'> <div class='instance'>
<video id='video' class="video-js vjs-default-skin vjs-big-play-centered" /> <video id='video' class="video-js vjs-default-skin vjs-big-play-centered" />
</div> </div>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
// api // api
// import * as homeApi from '@/api/home' // import * as homeApi from '@/api/home'
export default { export default {
data() { data() {
return { return {
nowPlayVideoUrl: 'rtmp://live.hkstv.hk.lxdns.com/live/hks1' nowPlayVideoUrl: 'rtmp://live.hkstv.hk.lxdns.com/live/hks1'
} }
}, },
mounted() { mounted() {
this.initVideoPlayer() this.initVideoPlayer()
}, },
methods: { methods: {
initVideoPlayer() { initVideoPlayer() {
// video, video, // video, video,
const currentInstance = this.$video(document.querySelector('video'), { const currentInstance = this.$video(document.querySelector('video'), {
autoplay: true, // autoplay: true, //
controls: true, // controls: true, //
}) })
currentInstance.src({ currentInstance.src({
src: this.nowPlayVideoUrl, src: this.nowPlayVideoUrl,
type: 'rtmp/flv', // type, videojsrtmp type: 'rtmp/flv', // type, videojsrtmp
}) })
} }
}, },
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

116
src/views/ty/index12.vue

@ -1,59 +1,59 @@
<template> <template>
<div class='instance'> <div class='instance'>
<view> <view>
<video id="dd" ref="rtmpPlayer2" :destroyOnClose="true" preload="auto" muted> <video id="dd" ref="rtmpPlayer2" :destroyOnClose="true" preload="auto" muted>
</video> </video>
</view> </view>
</div> </div>
</template> </template>
<script> <script>
import videojs from 'video.js' import videojs from 'video.js'
import 'video.js/dist/video-js.css' import 'video.js/dist/video-js.css'
export default { export default {
components: { components: {
}, },
mounted() { mounted() {
this.myPlayerRtmp = videojs('dd', { this.myPlayerRtmp = videojs('dd', {
sources: [{ sources: [{
type: 'rtmp/flv', type: 'rtmp/flv',
src: 'rtmp://ns8.indexforce.com/home/mystream' src: 'rtmp://ns8.indexforce.com/home/mystream'
}], }],
controls: true, controls: true,
muted: true, muted: true,
autoplay: true, autoplay: true,
preload: 'auto', preload: 'auto',
textTrackDisplay: false, textTrackDisplay: false,
errorDisplay: false, errorDisplay: false,
controlBar: false, controlBar: false,
bigPlayButton: false bigPlayButton: false
}) })
}, },
data() { data() {
return { return {
} }
}, },
methods: { methods: {
}, },
beforeDestroy() { beforeDestroy() {
if (this.myPlayerRtmp) { if (this.myPlayerRtmp) {
const myPlayerRtmp = this.$refs.rtmpPlayer2 // document const myPlayerRtmp = this.$refs.rtmpPlayer2 // document
videojs(myPlayerRtmp).dispose() // video flash this.el.......is not function videojs(myPlayerRtmp).dispose() // video flash this.el.......is not function
} }
} }
} }
</script> </script>
<style></style> <style></style>

96
src/views/ty/index15.vue

@ -1,49 +1,49 @@
<template> <template>
<div class='instance'> <div class='instance'>
<div id="vs"></div> <div id="vs"></div>
</div> </div>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
// api // api
// import * as homeApi from '@/api/home' // import * as homeApi from '@/api/home'
import DemoPlugin from 'demoplugin' import DemoPlugin from 'demoplugin'
import Player from 'xgplayer' import Player from 'xgplayer'
export default { export default {
data() { data() {
return { return {
} }
}, },
mounted() { mounted() {
let player = new Player({ let player = new Player({
id: 'vs', id: 'vs',
url: 'rtmp://58.200.131.2:1935/livetv/hunantv', url: 'rtmp://58.200.131.2:1935/livetv/hunantv',
plugins: [DemoPlugin] plugins: [DemoPlugin]
}) })
const pipInstance = player.getPlugin('pip') const pipInstance = player.getPlugin('pip')
pipInstance.switchPIP() pipInstance.switchPIP()
player.registerPlugin(DemoPlugin) player.registerPlugin(DemoPlugin)
// const player = new Player({ // const player = new Player({
// ..., // ...,
// plugins: [DemoPlugin] // plugins: [DemoPlugin]
// }) // })
}, },
methods: { methods: {
}, },
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

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>

306
src/views/ty/index2.vue

@ -1,154 +1,154 @@
<template> <template>
<v-scale-screen width="1920" height="1080"> <v-scale-screen width="1920" height="1080">
<div id="ty"> <div id="ty">
<div class="main"> <div class="main">
<div class="center"> <div class="center">
<div class="item"> <div class="item">
<!-- <Video :src="src1" :poster="poster" /> --> <!-- <Video :src="src1" :poster="poster" /> -->
<!-- <video id="myFlvVideo" controls autoplay width="80%" height="200px"></video> --> <!-- <video id="myFlvVideo" controls autoplay width="80%" height="200px"></video> -->
<video class="videosmall" ref="videosmallone" preload="auto" muted autoplay type="rtmp/flv"> <video class="videosmall" ref="videosmallone" preload="auto" muted autoplay type="rtmp/flv">
<!-- <source src="" /> --> <!-- <source src="" /> -->
</video> </video>
</div> </div>
<div class="item"> <div class="item">
<!-- <Video :src="src2" :poster="poster" /> --> <!-- <Video :src="src2" :poster="poster" /> -->
</div> </div>
<div class="item"> <div class="item">
<!-- <Video :src="src3" :poster="poster" /> --> <!-- <Video :src="src3" :poster="poster" /> -->
</div> </div>
<!-- <div class="item"></div> --> <!-- <div class="item"></div> -->
</div> </div>
</div> </div>
</div> </div>
</v-scale-screen> </v-scale-screen>
</template> </template>
<script> <script>
// echarts // echarts
// import * as echarts from "echarts"; // import * as echarts from "echarts";
import flvjs from "flv.js"; import flvjs from "flv.js";
// api // api
// import * as homeApi from '@/api/home' // import * as homeApi from '@/api/home'
// import Video from '../../components/btgym/Video.vue' // import Video from '../../components/btgym/Video.vue'
export default { export default {
// components: { // components: {
// Video // Video
// }, // },
data() { data() {
return { return {
player: null, player: null,
}; };
}, },
mounted() { mounted() {
// this.getVideo() // this.getVideo()
// var videoElement1 = document.getElementById('myFlvVideo'); // var videoElement1 = document.getElementById('myFlvVideo');
// this.$nextTick(() => { // this.$nextTick(() => {
// this.createVideo() // this.createVideo()
// }) // })
// this.createVideo() // this.createVideo()
this.init('rtsp://192.168.66.13:554/openUrl/MXdnCG4') this.init('rtsp://192.168.66.13:554/openUrl/MXdnCG4')
}, },
methods: { methods: {
// createVideo() { // createVideo() {
// if (flvjs.isSupported()) { // if (flvjs.isSupported()) {
// var videoElement = document.getElementById('myFlvVideo') // var videoElement = document.getElementById('myFlvVideo')
// console.log(videoElement); // console.log(videoElement);
// this.flvPlayer = flvjs.createPlayer( // this.flvPlayer = flvjs.createPlayer(
// { // {
// type: 'flv', // type: 'flv',
// isLive: true, // isLive: true,
// hasAudio: false, // hasAudio: false,
// url: // url:
// 'rtsp://192.168.66.13:554/openUrl/MXdnCG4' // 'rtsp://192.168.66.13:554/openUrl/MXdnCG4'
// }, // },
// { // {
// cors: true, // // cors: true, //
// enableWorker: true, // 线 // enableWorker: true, // 线
// enableStashBuffer: false, // // enableStashBuffer: false, //
// stashInitialSize: 128, // (kb) 384kb // stashInitialSize: 128, // (kb) 384kb
// autoCleanupSourceBuffer: true // // autoCleanupSourceBuffer: true //
// } // }
// ) // )
// this.flvPlayer.attachMediaElement(videoElement) // this.flvPlayer.attachMediaElement(videoElement)
// this.flvPlayer.load() // this.flvPlayer.load()
// // this.flvPlayer.play() // // this.flvPlayer.play()
// // // //
// // this.flvPlayer.on(flvjs.Events.ERROR, (errType, errDetail) => { // // this.flvPlayer.on(flvjs.Events.ERROR, (errType, errDetail) => {
// // console.log('errorType:', errType) // // console.log('errorType:', errType)
// // console.log('errorDetail:', errDetail) // // console.log('errorDetail:', errDetail)
// // if (this.flvPlayer) { // // if (this.flvPlayer) {
// // this.destoryVideo() // // this.destoryVideo()
// // this.createVideo() // // this.createVideo()
// // } // // }
// // }) // // })
// } // }
// }, // },
init(val) { //val http://192.168.2.201:85/live/9311272c49b845baa2b2810ad9bf3f68.flv init(val) { //val http://192.168.2.201:85/live/9311272c49b845baa2b2810ad9bf3f68.flv
setTimeout(() => { //使mountedDOM setTimeout(() => { //使mountedDOM
var videoElement = this.$refs.videosmallone; // htmlvideo var videoElement = this.$refs.videosmallone; // htmlvideo
if (flvjs.isSupported()) { if (flvjs.isSupported()) {
// playerTCP // playerTCP
if (this.player !== null) { if (this.player !== null) {
this.player.pause(); this.player.pause();
this.player.unload(); this.player.unload();
this.player.detachMediaElement(); this.player.detachMediaElement();
this.player.destroy(); this.player.destroy();
this.player = null; this.player = null;
} }
this.player = flvjs.createPlayer( //DOM this.player = flvjs.createPlayer( //DOM
{ {
type: "flv", type: "flv",
url: val, //url url: val, //url
isLive: true, // isLive: true, //
hasAudio: false, // hasAudio: false, //
hasVideo: true, // hasVideo: true, //
enableStashBuffer: true, // enableStashBuffer: true, //
}, },
{ {
enableWorker: false, //线 enableWorker: false, //线
enableStashBuffer: false, //IO enableStashBuffer: false, //IO
autoCleanupSourceBuffer: true, // autoCleanupSourceBuffer: true, //
lazyLoad: false, lazyLoad: false,
} }
); );
this.player.attachMediaElement(videoElement); //dom this.player.attachMediaElement(videoElement); //dom
this.player.load();// this.player.load();//
//!!!!!!loadsettimeout this.player.play() //!!!!!!loadsettimeout this.player.play()
this.player.play();// this.player.play();//
} }
}, 1000); }, 1000);
}, },
// destoryVideo() { // destoryVideo() {
// this.flvPlayer.pause() // this.flvPlayer.pause()
// this.flvPlayer.unload() // this.flvPlayer.unload()
// this.flvPlayer.detachMediaElement() // this.flvPlayer.detachMediaElement()
// this.flvPlayer.destroy() // this.flvPlayer.destroy()
// this.flvPlayer = null // this.flvPlayer = null
// } // }
}, },
beforeUnmount() { beforeUnmount() {
if (this.player) { if (this.player) {
this.player.pause(); this.player.pause();
this.player.unload(); this.player.unload();
this.player.detachMediaElement(); this.player.detachMediaElement();
this.player.destroy(); this.player.destroy();
this.player = null; this.player = null;
} }
}, },
// }, // },
}; };
</script> </script>

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>

502
src/views/ty/index5.vue

@ -1,252 +1,252 @@
<template> <template>
<v-scale-screen width="1920" height="1080"> <v-scale-screen width="1920" height="1080">
<div id="ty"> <div id="ty">
<div class="main"> <div class="main">
<div class="center"> <div class="center">
<!-- <el-button @click="begin"></el-button> --> <!-- <el-button @click="begin"></el-button> -->
<video id="playWnd" autoplay></video> <video id="playWnd" autoplay></video>
<!--v-resize="DomResize" 是用来播放器窗口自适应的如果不需要可以不添加下面会介绍到--> <!--v-resize="DomResize" 是用来播放器窗口自适应的如果不需要可以不添加下面会介绍到-->
</div> </div>
</div> </div>
</div> </div>
</v-scale-screen> </v-scale-screen>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
// import '@/utils/h5player.min.js' // import '@/utils/h5player.min.js'
import $ from "jquery";//jquerynpm----npm i jquery -S import $ from "jquery";//jquerynpm----npm i jquery -S
import { WebControl } from 'web-control'; import { WebControl } from 'web-control';
export default { export default {
data() { data() {
return { return {
initCount: 0, initCount: 0,
pubKey: '', pubKey: '',
oWebControl2: '', oWebControl2: '',
//便 //便
} }
}, },
created() { created() {
// this.$nextTick DOM使DOM // this.$nextTick DOM使DOM
this.$nextTick(() => { this.$nextTick(() => {
this.initPlugin(); this.initPlugin();
this.getVideoFun('05edddc148b141c5930301af43154942') this.getVideoFun('05edddc148b141c5930301af43154942')
}); });
}, },
methods: { methods: {
// //
initPlugin() { initPlugin() {
let _that = this; let _that = this;
var oWebControl = new WebControl({ var oWebControl = new WebControl({
szPluginContainer: 'playWnd', // id szPluginContainer: 'playWnd', // id
iServicePortStart: 15900, // 使 iServicePortStart: 15900, // 使
iServicePortEnd: 15909, iServicePortEnd: 15909,
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // IE10使ActiveXclsid szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // IE10使ActiveXclsid
cbConnectSuccess() { cbConnectSuccess() {
console.log('创建WebControl实例成功'); console.log('创建WebControl实例成功');
oWebControl.JS_StartService('window', { oWebControl.JS_StartService('window', {
// WebControl // WebControl
dllPath: './VideoPluginConnect.dll', // "./VideoPluginConnect.dll" dllPath: './VideoPluginConnect.dll', // "./VideoPluginConnect.dll"
}) })
.then( .then(
() => { () => {
// // // //
oWebControl.JS_SetWindowControlCallback({ oWebControl.JS_SetWindowControlCallback({
// //
cbIntegrationCallBack: _that.cbIntegrationCallBack, cbIntegrationCallBack: _that.cbIntegrationCallBack,
}); });
oWebControl.JS_CreateWnd('playWnd').then(() => { oWebControl.JS_CreateWnd('playWnd').then(() => {
//JS_CreateWnd //JS_CreateWnd
_that.init(); // _that.init(); //
console.log('111111111111'); console.log('111111111111');
}); });
}, },
() => { () => {
// //
} }
) )
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
}); });
}, },
cbConnectError() { cbConnectError() {
// WebControl // WebControl
console.log('xxx'); console.log('xxx');
oWebControl = null; oWebControl = null;
$('#playWnd').html('插件未启动,正在尝试启动,请稍候...'); $('#playWnd').html('插件未启动,正在尝试启动,请稍候...');
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // errorwakeup window.WebControl.JS_WakeUp('VideoWebPlugin://'); // errorwakeup
this.initCount++; this.initCount++;
if (this.initCount < 3) { if (this.initCount < 3) {
setTimeout(function () { setTimeout(function () {
this.initPlugin(); this.initPlugin();
}, 3000); }, 3000);
} else { } else {
$('#playWnd').html('插件启动失败,请检查插件是否安装!'); $('#playWnd').html('插件启动失败,请检查插件是否安装!');
} }
}, },
cbConnectClose() { cbConnectClose() {
// bNormalClose = false // bNormalClose = false
// JS_DisconnectbNormalClose = true // JS_DisconnectbNormalClose = true
console.log('cbConnectClose'); console.log('cbConnectClose');
oWebControl = null; oWebControl = null;
}, },
}); });
this.oWebControl2 = oWebControl; this.oWebControl2 = oWebControl;
}, },
// //
init() { init() {
let _that = this; let _that = this;
this.getPubKey(function () { this.getPubKey(function () {
// //
var appkey = "29940726"; //appkey var appkey = "29940726"; //appkey
var secret = 'SkTCnQdFbNW4Z2suNj8P'; //secret var secret = 'SkTCnQdFbNW4Z2suNj8P'; //secret
var ip = "192.168.66.13"; //IP var ip = "192.168.66.13"; //IP
var playMode = 0; //0-1- var playMode = 0; //0-1-
var port = 554; //HTTPS443 var port = 554; //HTTPS443
var snapDir = ""; // var snapDir = ""; //
var videoDir = "D:\\VideoDir"; // var videoDir = "D:\\VideoDir"; //
var layout = "1x1"; //playMode var layout = "1x1"; //playMode
var enableHTTPS = 1; //HTTPS1 var enableHTTPS = 1; //HTTPS1
var encryptedFields = "secret"; //secret var encryptedFields = "secret"; //secret
var showToolbar = 0; //0-0- var showToolbar = 0; //0-0-
var showSmart = 1; //线0-0- var showSmart = 1; //线0-0-
var buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; // var buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //
// //
_that.oWebControl2.JS_RequestInterface({ _that.oWebControl2.JS_RequestInterface({
funcName: "init", funcName: "init",
argument: JSON.stringify({ argument: JSON.stringify({
appkey: appkey, //APIappkey appkey: appkey, //APIappkey
secret: secret, //APIsecret secret: secret, //APIsecret
ip: ip, //APIIP ip: ip, //APIIP
playMode: playMode, // playMode: playMode, //
port: port, // port: port, //
snapDir: snapDir, // snapDir: snapDir, //
videoDir: videoDir, // videoDir: videoDir, //
layout: layout, // layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, // encryptedFields: encryptedFields, //
showToolbar: showToolbar, // showToolbar: showToolbar, //
showSmart: showSmart, // showSmart: showSmart, //
buttonIDs: buttonIDs, // buttonIDs: buttonIDs, //
}), }),
}) })
.then((res) => { .then((res) => {
let width = document.querySelector("#playWnd").offsetWidth; let width = document.querySelector("#playWnd").offsetWidth;
let height = document.querySelector("#playWnd").offsetHeight; let height = document.querySelector("#playWnd").offsetHeight;
_that.oWebControl2.JS_Resize(width, height); // resize _that.oWebControl2.JS_Resize(width, height); // resize
console.log('22222222222'); console.log('22222222222');
console.log(res); console.log(res);
}); });
}); });
}, },
// //
setCallbacks() { setCallbacks() {
this.oWebControl.JS_SetWindowControlCallback({ this.oWebControl.JS_SetWindowControlCallback({
cbIntegrationCallBack: this.cbIntegrationCallBack, cbIntegrationCallBack: this.cbIntegrationCallBack,
}); });
}, },
// //
cbIntegrationCallBack(oData) { cbIntegrationCallBack(oData) {
// //
console.log(oData); console.log(oData);
}, },
// //
getPubKey(callback) { getPubKey(callback) {
this.oWebControl2.JS_RequestInterface({ this.oWebControl2.JS_RequestInterface({
funcName: "getRSAPubKey", funcName: "getRSAPubKey",
argument: JSON.stringify({ argument: JSON.stringify({
keyLength: 1024, keyLength: 1024,
}), }),
}) })
.then((oData) => { .then((oData) => {
console.log(oData); console.log(oData);
if (oData.responseMsg.data) { if (oData.responseMsg.data) {
this.pubKey = oData.responseMsg.data; this.pubKey = oData.responseMsg.data;
callback(); callback();
} }
}); });
}, },
//RSA //RSA
// setEncrypt(value) { // setEncrypt(value) {
// var encrypt = new encrypt(); // var encrypt = new encrypt();
// encrypt.setPublicKey(this.pubKey); // encrypt.setPublicKey(this.pubKey);
// console.log(encrypt.encrypt(value)); // console.log(encrypt.encrypt(value));
// return encrypt.encrypt(value); // return encrypt.encrypt(value);
// }, // },
// //
getVideoFun(Code) { getVideoFun(Code) {
let _that = this; let _that = this;
// //
var cameraIndexCode = Code; // var cameraIndexCode = Code; //
var streamMode = 0; //0-1- var streamMode = 0; //0-1-
var transMode = 1; //0-UDP1-TCP var transMode = 1; //0-UDP1-TCP
var gpuMode = 1; //GPU0-1- var gpuMode = 1; //GPU0-1-
var wndId = -1; //2x2 var wndId = -1; //2x2
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, ""); cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, ""); cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
console.log('44444444444'); console.log('44444444444');
console.log(cameraIndexCode); console.log(cameraIndexCode);
console.log( _that.oWebControl2); console.log( _that.oWebControl2);
console.log( _that.oWebControl2.JS_RequestInterface); console.log( _that.oWebControl2.JS_RequestInterface);
_that.oWebControl2.JS_RequestInterface({ _that.oWebControl2.JS_RequestInterface({
funcName: "startPreview", funcName: "startPreview",
argument: JSON.stringify({ argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, // cameraIndexCode: cameraIndexCode, //
streamMode: streamMode, // streamMode: streamMode, //
transMode: transMode, // transMode: transMode, //
gpuMode: gpuMode, //GPU gpuMode: gpuMode, //GPU
wndId: wndId, // wndId: wndId, //
}), }),
}) })
.then((res) => { .then((res) => {
console.log(res, "res"); console.log(res, "res");
console.log('3333333333'); console.log('3333333333');
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
}, },
// //
stopVideoFun() { stopVideoFun() {
this.oWebControl2.JS_RequestInterface({ this.oWebControl2.JS_RequestInterface({
funcName: "stopAllPreview", funcName: "stopAllPreview",
}); });
}, },
// ---html // ---html
// 使 // 使
// //
destroyVideoDiv() { destroyVideoDiv() {
this.oWebControl2.JS_DestroyWnd() this.oWebControl2.JS_DestroyWnd()
.then((data) => { .then((data) => {
console.log("销毁窗口成功"); console.log("销毁窗口成功");
console.log(data); console.log(data);
}) })
.catch((err) => { .catch((err) => {
console.log("销毁窗口失败"); console.log("销毁窗口失败");
console.log(err); console.log(err);
}); });
}, },
// --- // ---
zhuaPicFun() { zhuaPicFun() {
this.oWebControl2.JS_RequestInterface({ this.oWebControl2.JS_RequestInterface({
funcName: "snapShot", funcName: "snapShot",
argument: { argument: {
name: "D:\test.jpg", // name: "D:\test.jpg", //
}, },
}); });
}, },
} }
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

694
src/views/ty/index6.vue

@ -1,348 +1,348 @@
<template> <template>
<v-scale-screen width="1920" height="1080"> <v-scale-screen width="1920" height="1080">
<div id="ty"> <div id="ty">
<div class="main"> <div class="main">
<div class="center"> <div class="center">
<!-- <el-button @click="begin"></el-button> --> <!-- <el-button @click="begin"></el-button> -->
<div ref="playWnd" :id="containerId" class="flex-1 hidden playWnd" <div ref="playWnd" :id="containerId" class="flex-1 hidden playWnd"
v-html="oWebControl === null ? playText : ''"></div> v-html="oWebControl === null ? playText : ''"></div>
<!--v-resize="DomResize" 是用来播放器窗口自适应的如果不需要可以不添加下面会介绍到--> <!--v-resize="DomResize" 是用来播放器窗口自适应的如果不需要可以不添加下面会介绍到-->
</div> </div>
</div> </div>
</div> </div>
</v-scale-screen> </v-scale-screen>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
// import '@/utils/h5player.min.js' // import '@/utils/h5player.min.js'
// import $ from "jquery";//jquerynpm----npm i jquery -S // import $ from "jquery";//jquerynpm----npm i jquery -S
import { WebControl } from 'web-control'; import { WebControl } from 'web-control';
export default { export default {
props: { props: {
// 4 // 4
// appkey: { // appkey: {
// type: "String", // type: "String",
// default: "29940726", // default: "29940726",
// }, // },
// secret: { // secret: {
// type: "String", // type: "String",
// default: "", // default: "",
// }, // },
// ip: { // ip: {
// type: "String", // type: "String",
// default: "", // default: "",
// }, // },
// port: { // port: {
// type: "Number", // type: "Number",
// default: 8888, // default: 8888,
// }, // },
// //
// layout: { // layout: {
// type: "String", // type: "String",
// default: "1x1", // default: "1x1",
// }, // },
// 0-1- // 0-1-
// playMode: { // playMode: {
// type: "Number", // type: "Number",
// default: 0, // default: 0,
// }, // },
// 0-0- // 0-0-
showToolbar: { showToolbar: {
type: Number, type: Number,
default: 1, default: 1,
}, },
// //
toolBarButtonIDs: { toolBarButtonIDs: {
type: String, type: String,
default: "4098,4097", default: "4098,4097",
}, },
// 线0-0- // 线0-0-
showSmart: { showSmart: {
type: Number, type: Number,
default: 1, default: 1,
}, },
// //
buttonIDs: { buttonIDs: {
type: String, type: String,
default: "0,16,256,257,258,259,260,512,515,516,517,768,769", default: "0,16,256,257,258,259,260,512,515,516,517,768,769",
}, },
// //
cameraIndexCode: { cameraIndexCode: {
type: [String, Number], type: [String, Number],
}, },
// //
refresh: { refresh: {
type: Number, type: Number,
}, },
// id // id
containerId: { containerId: {
type: String, type: String,
default: "playWnd", default: "playWnd",
} }
}, },
data() { data() {
return { return {
oWebControl: null, oWebControl: null,
plugKey: "", plugKey: "",
// //
videoParams: { videoParams: {
cameraIndexCode: "", // cameraIndexCode: "", //
streamMode: 0, //0-1- streamMode: 0, //0-1-
transMode: 1, //0-UDP1-TCP transMode: 1, //0-UDP1-TCP
gpuMode: 0, //GPU0-1- gpuMode: 0, //GPU0-1-
wndId: 1, // wndId: 1, //
}, },
videoWidth: null, videoWidth: null,
videoHeight: null, videoHeight: null,
playText: "启动中...", playText: "启动中...",
initCount: 0, // initCount: 0, //
href: "", href: "",
}; };
}, },
created() { created() {
this.getPluginUrl(); this.getPluginUrl();
this.createdVideo(); this.createdVideo();
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.videoWidth = this.$refs.playWnd.offsetWidth; this.videoWidth = this.$refs.playWnd.offsetWidth;
this.videoHeight = this.$refs.playWnd.offsetHeight; this.videoHeight = this.$refs.playWnd.offsetHeight;
}); });
// resize使DIV // resize使DIV
window.addEventListener("resize", this.windowResize); window.addEventListener("resize", this.windowResize);
// // scroll使 // // scroll使
window.addEventListener("scroll", this.windowScroll); window.addEventListener("scroll", this.windowScroll);
}, },
watch: { watch: {
// //
cameraIndexCode(value) { cameraIndexCode(value) {
if (value) { if (value) {
this.videoParams.cameraIndexCode = value.trim(); this.videoParams.cameraIndexCode = value.trim();
this.videoParams.wndId = -1; this.videoParams.wndId = -1;
if (this.oWebControl) { if (this.oWebControl) {
this.previewVideo(); this.previewVideo();
} else { } else {
this.createdVideo(); this.createdVideo();
} }
} }
}, },
// //
refresh() { refresh() {
this.destroyeWnd(); this.destroyeWnd();
setTimeout(() => { setTimeout(() => {
this.createdVideo(); this.createdVideo();
}, 0); }, 0);
} }
}, },
methods: { methods: {
// //
getPluginUrl() { getPluginUrl() {
return '' return ''
// getList(1, 999).then(res => { // getList(1, 999).then(res => {
// if (res.data.code === 200) { // if (res.data.code === 200) {
// const data = res.data.data.records; // const data = res.data.data.records;
// data.length // data.length
// if (data.length) { // if (data.length) {
// let existArr = data.filter(item => item.paramKey === ""); // let existArr = data.filter(item => item.paramKey === "");
// if (existArr.length) { // if (existArr.length) {
// this.href = existArr[0].paramValue; // this.href = existArr[0].paramValue;
// } // }
// } // }
// } // }
// }).catch(err => { // }).catch(err => {
// // // //
// console.log(err) // console.log(err)
// }) // })
; ;
}, },
// + // +
createdVideo() { createdVideo() {
this.initPlugin(() => { this.initPlugin(() => {
this.previewVideo(); this.previewVideo();
}); });
}, },
// //
initPlugin(callback) { initPlugin(callback) {
this.oWebControl = new WebControl({ this.oWebControl = new WebControl({
szPluginContainer: this.containerId, // id szPluginContainer: this.containerId, // id
iServicePortStart: 15900, iServicePortStart: 15900,
iServicePortEnd: 15909, iServicePortEnd: 15909,
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // IE10使ActiveXclsid szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // IE10使ActiveXclsid
// WebControl // WebControl
cbConnectSuccess: () => { cbConnectSuccess: () => {
this.oWebControl this.oWebControl
.JS_StartService("window", { .JS_StartService("window", {
// WebControl // WebControl
dllPath: "./VideoPluginConnect.dll", dllPath: "./VideoPluginConnect.dll",
}) })
.then(() => { .then(() => {
// //
this.oWebControl.JS_SetWindowControlCallback({ this.oWebControl.JS_SetWindowControlCallback({
// //
cbIntegrationCallBack: this.cbIntegrationCallBack, cbIntegrationCallBack: this.cbIntegrationCallBack,
}); });
this.oWebControl this.oWebControl
.JS_CreateWnd(this.containerId, this.videoWidth, this.videoHeight) .JS_CreateWnd(this.containerId, this.videoWidth, this.videoHeight)
.then(() => { .then(() => {
this.getVersion(callback); this.getVersion(callback);
}); });
}); });
}, },
cbConnectError: () => { cbConnectError: () => {
// WebControl // WebControl
this.oWebControl = null; this.oWebControl = null;
this.playText = "插件未启动,正在尝试启动,请稍候..."; this.playText = "插件未启动,正在尝试启动,请稍候...";
WebControl.JS_WakeUp("VideoWebPlugin://"); // errorwakeup WebControl.JS_WakeUp("VideoWebPlugin://"); // errorwakeup
this.initCount++; this.initCount++;
if (this.initCount < 3) { if (this.initCount < 3) {
setTimeout(() => { setTimeout(() => {
this.initPlugin(); this.initPlugin();
}, 2000); }, 2000);
} else { } else {
this.playText = ` this.playText = `
插件启动失败请检查插件是否安装 插件启动失败请检查插件是否安装
<a href=${this.href} type="primary" download="视频插件.exe" style='color:#4194fc'>下载地址</a>`; <a href=${this.href} type="primary" download="视频插件.exe" style='color:#4194fc'>下载地址</a>`;
} }
}, },
cbConnectClose: () => { cbConnectClose: () => {
this.oWebControl = null; this.oWebControl = null;
}, },
}); });
}, },
// //
cbIntegrationCallBack() { }, cbIntegrationCallBack() { },
// //
init(callback) { init(callback) {
this.getPubKey(() => { this.getPubKey(() => {
this.oWebControl this.oWebControl
.JS_RequestInterface({ .JS_RequestInterface({
funcName: "init", funcName: "init",
argument: JSON.stringify({ argument: JSON.stringify({
appkey: '29940726', //APIappkey appkey: '29940726', //APIappkey
secret: this.setEncrypt('SkTCnQdFbNW4Z2suNj8P'), //APIsecret secret: this.setEncrypt('SkTCnQdFbNW4Z2suNj8P'), //APIsecret
ip: this.ip, //APIIPz ip: this.ip, //APIIPz
playMode: this.playMode, // playMode: this.playMode, //
port: this.port, // port: this.port, //
snapDir: "C:\\SnapDir", // snapDir: "C:\\SnapDir", //
videoDir: "C:\\VideoDir", // videoDir: "C:\\VideoDir", //
layout: this.layout, // layout: this.layout, //
enableHTTPS: 1, //HTTPS enableHTTPS: 1, //HTTPS
encryptedFields: "secret", // encryptedFields: "secret", //
showToolbar: this.showToolbar, // showToolbar: this.showToolbar, //
toolBarButtonIDs: this.toolBarButtonIDs, toolBarButtonIDs: this.toolBarButtonIDs,
showSmart: this.showSmart, // showSmart: this.showSmart, //
buttonIDs: this.buttonIDs, // buttonIDs: this.buttonIDs, //
protocol: "hls", protocol: "hls",
}), }),
}) })
.then(() => { .then(() => {
// resizefirefoxDIV // resizefirefoxDIV
this.oWebControl.JS_Resize(this.videoWidth, this.videoHeight); this.oWebControl.JS_Resize(this.videoWidth, this.videoHeight);
if (callback) { if (callback) {
callback(); callback();
} }
}); });
}); });
}, },
// //
getPubKey(callback) { getPubKey(callback) {
const params = { const params = {
funcName: "getRSAPubKey", funcName: "getRSAPubKey",
argument: JSON.stringify({ keyLength: 1024 }), argument: JSON.stringify({ keyLength: 1024 }),
}; };
this.oWebControl.JS_RequestInterface(params).then((res) => { this.oWebControl.JS_RequestInterface(params).then((res) => {
if (res.responseMsg.data) { if (res.responseMsg.data) {
this.plugKey = res.responseMsg.data; this.plugKey = res.responseMsg.data;
callback(); callback();
} }
}); });
}, },
// RSA // RSA
// setEncrypt(value) { // setEncrypt(value) {
// const encrypt = new JSEncrypt(); // const encrypt = new JSEncrypt();
// encrypt.setPublicKey(this.plugKey); // encrypt.setPublicKey(this.plugKey);
// return encrypt.encrypt(value); // return encrypt.encrypt(value);
// }, // },
// //
previewVideo() { previewVideo() {
this.oWebControl.JS_RequestInterface({ this.oWebControl.JS_RequestInterface({
funcName: "startPreview", funcName: "startPreview",
argument: JSON.stringify(this.videoParams), argument: JSON.stringify(this.videoParams),
}); });
}, },
// //
showFullScreen() { showFullScreen() {
this.oWebControl.JS_RequestInterface({ this.oWebControl.JS_RequestInterface({
funcName: "setFullScreen", funcName: "setFullScreen",
}); });
}, },
// 退 // 退
exitFullScreen() { exitFullScreen() {
this.oWebControl.JS_RequestInterface({ this.oWebControl.JS_RequestInterface({
funcName: "exitFullScreen", funcName: "exitFullScreen",
}); });
}, },
windowScroll() { windowScroll() {
if (this.oWebControl != null) { if (this.oWebControl != null) {
this.oWebControl.JS_Resize(this.videoWidth, this.videoHeight); this.oWebControl.JS_Resize(this.videoWidth, this.videoHeight);
} }
}, },
windowResize() { windowResize() {
this.videoWidth = this.$refs.playWnd.offsetWidth; this.videoWidth = this.$refs.playWnd.offsetWidth;
this.videoHeight = this.$refs.playWnd.offsetHeight; this.videoHeight = this.$refs.playWnd.offsetHeight;
if (this.oWebControl) { if (this.oWebControl) {
this.oWebControl.JS_Resize(this.videoWidth, this.videoHeight); this.oWebControl.JS_Resize(this.videoWidth, this.videoHeight);
} }
}, },
// //
destroyeWnd() { destroyeWnd() {
if (this.oWebControl) { if (this.oWebControl) {
this.oWebControl.JS_HideWnd(); this.oWebControl.JS_HideWnd();
this.oWebControl.JS_Disconnect().then(() => { }); this.oWebControl.JS_Disconnect().then(() => { });
} }
}, },
// //
getVersion(callback) { getVersion(callback) {
if (this.oWebControl) { if (this.oWebControl) {
this.oWebControl.JS_RequestInterface({ this.oWebControl.JS_RequestInterface({
funcName: "getVersion", funcName: "getVersion",
}).then(res => { }).then(res => {
if (res.responseMsg.code === 0 && res.responseMsg.data === "V1.5.1") { if (res.responseMsg.code === 0 && res.responseMsg.data === "V1.5.1") {
//JS_CreateWnd //JS_CreateWnd
this.init(callback); // this.init(callback); //
console.log("启动插件成功!"); console.log("启动插件成功!");
} else { } else {
this.destroyeWnd(); this.destroyeWnd();
this.playText = ` this.playText = `
插件版本不正确请重新下载版本安装覆盖 插件版本不正确请重新下载版本安装覆盖
<a href=${this.href} type="primary" download="视频插件.exe" style='color:#4194fc'>下载地址</a>`; <a href=${this.href} type="primary" download="视频插件.exe" style='color:#4194fc'>下载地址</a>`;
} }
}) })
} }
}, },
}, },
beforeDestroy() { beforeDestroy() {
if (this.oWebControl) { if (this.oWebControl) {
this.oWebControl.JS_HideWnd(); this.oWebControl.JS_HideWnd();
this.oWebControl this.oWebControl
.JS_DestroyWnd({ .JS_DestroyWnd({
funcName: "destroyeWnd", funcName: "destroyeWnd",
}) })
.then(() => { }); .then(() => { });
} }
document.removeEventListener("resize", this.windowResize); document.removeEventListener("resize", this.windowResize);
document.removeEventListener("scroll", this.windowScroll); document.removeEventListener("scroll", this.windowScroll);
}, },
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

128
src/views/ty/index8.vue

@ -1,65 +1,65 @@
<template> <template>
<v-scale-screen width="1920" height="1080"> <v-scale-screen width="1920" height="1080">
<div id="ty"> <div id="ty">
<div class="main"> <div class="main">
<div class="center"> <div class="center">
<hls-video :videoUrl="currentFileUrl" class="videoBox" <hls-video :videoUrl="currentFileUrl" class="videoBox"
style="height: 370px"></hls-video> style="height: 370px"></hls-video>
</div> </div>
</div> </div>
</div> </div>
</v-scale-screen> </v-scale-screen>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
import HlsVideo from "../../components/btgym/HlsVideo.vue"; import HlsVideo from "../../components/btgym/HlsVideo.vue";
// api // api
import * as homeApi from '@/api/home' import * as homeApi from '@/api/home'
export default { export default {
components: { HlsVideo }, components: { HlsVideo },
data() { data() {
return { return {
currentFileUrl: "rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa", // currentFileUrl: "rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa", //
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
getVideo() { getVideo() {
let that = this let that = this
console.log(that); console.log(that);
homeApi.allGetVideo().then(res => { homeApi.allGetVideo().then(res => {
// get allTimeData // get allTimeData
const tmpdata = res.data.returnData const tmpdata = res.data.returnData
console.log(tmpdata); console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum // this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum // this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum // this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum // this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array(); // let btdata = new Array();
// let bvdata = new Array(); // let bvdata = new Array();
// tmpdata.foreach(function(item,index){ // tmpdata.foreach(function(item,index){
// console.log(item); // console.log(item);
// console.log(index); // console.log(index);
// }); // });
}); });
}, },
} }
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

180
src/views/ty/index9.vue

@ -1,91 +1,91 @@
<template> <template>
<v-scale-screen width="1920" height="1080"> <v-scale-screen width="1920" height="1080">
<div id="ty"> <div id="ty">
<div class="main"> <div class="main">
<div class="center"> <div class="center">
<video id="my-player" class="video-js vjs-default-skin vjs-big-play-centered vjs-fluid" preload="auto" <video id="my-player" class="video-js vjs-default-skin vjs-big-play-centered vjs-fluid" preload="auto"
autoplay style="width: 1200px;height: 640px;" controls data-setup="{}"></video> autoplay style="width: 1200px;height: 640px;" controls data-setup="{}"></video>
</div> </div>
</div> </div>
</div> </div>
</v-scale-screen> </v-scale-screen>
</template> </template>
<script> <script>
// import flvjs from "flv.js"; // import flvjs from "flv.js";
import videojs from "video.js"; import videojs from "video.js";
import "video.js/dist/video-js.css"; import "video.js/dist/video-js.css";
import "videojs-flash"; import "videojs-flash";
// api // api
import * as homeApi from '@/api/home' import * as homeApi from '@/api/home'
export default { export default {
data() { data() {
return { return {
} }
}, },
mounted() { mounted() {
this.playVideo() this.playVideo()
}, },
methods: { methods: {
playVideo() { playVideo() {
console.log('22222222222'); console.log('22222222222');
var videoPlayer = videojs( var videoPlayer = videojs(
"my-player", "my-player",
{ {
sources: [ sources: [
{ {
src: "rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa", src: "rtmp://192.168.66.13:1935/live/openUrl/1OSHzLa",
type: "rtmp/flv" type: "rtmp/flv"
} }
], ],
muted: true, muted: true,
controls: true, controls: true,
autoplay: true, autoplay: true,
loop: true, loop: true,
techOrder: ["html5", "flash"], techOrder: ["html5", "flash"],
width: "1200", width: "1200",
height: "640" height: "640"
}, },
function () { function () {
this.play(); this.play();
console.log('111111111111'); console.log('111111111111');
} }
); );
}, },
getVideo() { getVideo() {
let that = this let that = this
console.log(that); console.log(that);
homeApi.allGetVideo().then(res => { homeApi.allGetVideo().then(res => {
// get allTimeData // get allTimeData
const tmpdata = res.data.returnData const tmpdata = res.data.returnData
console.log(tmpdata); console.log(tmpdata);
// this.day_num = tmpdata.day.noRepeatInNum // this.day_num = tmpdata.day.noRepeatInNum
// this.week_num_num = tmpdata.week.noRepeatInNum // this.week_num_num = tmpdata.week.noRepeatInNum
// this.mon_num = tmpdata.month.noRepeatInNum // this.mon_num = tmpdata.month.noRepeatInNum
// this.year_num = tmpdata.year.noRepeatInNum // this.year_num = tmpdata.year.noRepeatInNum
// let btdata = new Array(); // let btdata = new Array();
// let bvdata = new Array(); // let bvdata = new Array();
// tmpdata.foreach(function(item,index){ // tmpdata.foreach(function(item,index){
// console.log(item); // console.log(item);
// console.log(index); // console.log(index);
// }); // });
}); });
}, },
} }
} }
</script> </script>
<style> <style>
.demo-video { .demo-video {
max-width: 880px; max-width: 880px;
max-height: 660px; max-height: 660px;
/* background-image: url(../../../src/utils/h5player.min.js); */ /* background-image: url(../../../src/utils/h5player.min.js); */
} }
</style> </style>

1833
yarn.lock

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