videoView
This commit is contained in:
parent
f9766e1a80
commit
346ccb5fe7
|
@ -8,8 +8,8 @@ VUE_APP_TITLE = '曲阳金隅安全智能管控平台'
|
||||||
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
|
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
|
||||||
#VUE_APP_WS_API = 'ws://localhost:8000'
|
#VUE_APP_WS_API = 'ws://localhost:8000'
|
||||||
#VUE_APP_API_BASEURL = http://222.222.144.147:6013/api
|
#VUE_APP_API_BASEURL = http://222.222.144.147:6013/api
|
||||||
#VUE_APP_API_BASEURL = http://10.99.5.79:20309/api
|
VUE_APP_API_BASEURL = http://10.99.5.79:20309/api
|
||||||
VUE_APP_API_BASEURL = http://127.0.0.1:8000/api
|
#VUE_APP_API_BASEURL = http://127.0.0.1:8000/api
|
||||||
#VUE_APP_BASEURL = http://127.0.0.1:8000
|
#VUE_APP_BASEURL = http://127.0.0.1:8000
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="height: 100%;width: 100%;">
|
<div style="height: 100%;width: 100%;">
|
||||||
<video id="videoElement" muted="muted" style="object-fit:fill"></video>
|
<div class="video-container">
|
||||||
|
<video name="videoElement" class="centeredVideo" controls autoplay>
|
||||||
|
Your browser is too old which doesn't support HTML5 video.
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -13,6 +17,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
Player: null,
|
||||||
flvPlayer: null,
|
flvPlayer: null,
|
||||||
params: {
|
params: {
|
||||||
json: {
|
json: {
|
||||||
|
@ -29,7 +34,8 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
const scriptInfo = document.createElement("script");
|
const scriptInfo = document.createElement("script");
|
||||||
scriptInfo.setAttribute("data-callType", "callScript");
|
scriptInfo.setAttribute("data-callType", "callScript");
|
||||||
scriptInfo.src = "https://cdn.bootcdn.net/ajax/libs/flv.js/1.6.2/flv.js";
|
// scriptInfo.src = "https://cdn.bootcdn.net/ajax/libs/flv.js/1.6.2/flv.js";
|
||||||
|
scriptInfo.src = "../../utils/flv.js";
|
||||||
document.head.appendChild(scriptInfo);
|
document.head.appendChild(scriptInfo);
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -37,32 +43,63 @@ export default {
|
||||||
that.params.json.data.channelId = that.channelCode;
|
that.params.json.data.channelId = that.channelCode;
|
||||||
that.$API.am.video.item.req(that.params).then((res) => {
|
that.$API.am.video.item.req(that.params).then((res) => {
|
||||||
that.url = res.url;
|
that.url = res.url;
|
||||||
|
let URLS = res.url.replace('192.168.10.253',sysConfig.VUE_APP_VIDEOHOST);
|
||||||
debugger;
|
debugger;
|
||||||
|
console.log(URLS);
|
||||||
if (flvjs.isSupported()) {
|
if (flvjs.isSupported()) {
|
||||||
debugger;
|
var mediaDataSource = {
|
||||||
console.log(sysConfig.VUE_APP_VIDEOHOST);
|
type: 'flv',
|
||||||
debugger;
|
hasAudio:false,
|
||||||
let videoElement = document.getElementById("videoElement");
|
hasVideo:true,
|
||||||
let URLS = res.url.replace('192.168.10.253',sysConfig.VUE_APP_VIDEOHOST);
|
isLive:false,
|
||||||
debugger;
|
withCredentials:false,
|
||||||
console.log(URLS)
|
url:URLS
|
||||||
that.flvPlayer = flvjs.createPlayer({
|
};
|
||||||
type: "flv",
|
that.flv_load(mediaDataSource);
|
||||||
url: URLS,
|
|
||||||
});
|
|
||||||
that.flvPlayer.attachMediaElement(videoElement);
|
|
||||||
that.flvPlayer.load();
|
|
||||||
that.flvPlayer.play();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods:{
|
||||||
|
flv_load(mediaDataSource) {
|
||||||
|
debugger;
|
||||||
|
let that = this;
|
||||||
|
var element = document.getElementsByName('videoElement')[0];
|
||||||
|
if (that.player != null) {
|
||||||
|
that.player.unload();
|
||||||
|
that.player.detachMediaElement();
|
||||||
|
that.player.destroy();
|
||||||
|
that.player = null;
|
||||||
|
}
|
||||||
|
that.player = flvjs.createPlayer(mediaDataSource, {
|
||||||
|
enableWorker: false,
|
||||||
|
lazyLoadMaxDuration: 3 * 60,
|
||||||
|
seekType: 'range',
|
||||||
|
});
|
||||||
|
that.player.attachMediaElement(element);
|
||||||
|
that.player.load();
|
||||||
|
},
|
||||||
|
flv_start() {
|
||||||
|
that.player.play();
|
||||||
|
},
|
||||||
|
flv_pause() {
|
||||||
|
that.player.pause();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
beforeUnmount(){
|
beforeUnmount(){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.flvPlayer.pause();
|
that.player.pause();
|
||||||
that.flvPlayer.unload();
|
that.player.unload();
|
||||||
that.flvPlayer.detachMediaElement();
|
that.player.detachMediaElement();
|
||||||
that.flvPlayer.destroy();
|
that.player.destroy();
|
||||||
that.flvPlayer = null;
|
that.player = null;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
.centeredVideo{
|
||||||
|
width: 100%;
|
||||||
|
height: 60vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue