Commit c15124ea authored by 张牧越's avatar 张牧越

bugfix

parent 3df8f0b7
...@@ -180,6 +180,7 @@ export default { ...@@ -180,6 +180,7 @@ export default {
id: data.id, id: data.id,
}; };
this.$forceUpdate(); this.$forceUpdate();
let ts = new Date().getTime();
getVideoLiveAddressUrl(data.id).then((res) => { getVideoLiveAddressUrl(data.id).then((res) => {
if (res.data.live_address_url) { if (res.data.live_address_url) {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -187,11 +188,12 @@ export default { ...@@ -187,11 +188,12 @@ export default {
`video-container-${nullIndex + 1}` `video-container-${nullIndex + 1}`
); );
myVideoDiv.innerHTML = `<video myVideoDiv.innerHTML = `<video
id="singleVideo${nullIndex + 1}" id="singleVideo${ts}"
autoplay="autoplay" autoplay="autoplay"
class="video-js vjs-default-skin" class="video-js vjs-default-skin"
muted="muted"
></video>`; ></video>`;
const singlePlayer = videojs(`singleVideo${nullIndex + 1}`, { const singlePlayer = videojs(`singleVideo${ts}`, {
autoplay: true, // 自动播放 autoplay: true, // 自动播放
controls: true, // 控件显示 controls: true, // 控件显示
preload: "auto", //定义视频加载模式 preload: "auto", //定义视频加载模式
...@@ -227,6 +229,7 @@ export default { ...@@ -227,6 +229,7 @@ export default {
id="singleVideo${this.cameraList.length}" id="singleVideo${this.cameraList.length}"
autoplay="autoplay" autoplay="autoplay"
class="video-js vjs-default-skin" class="video-js vjs-default-skin"
muted="muted"
></video>`; ></video>`;
const singlePlayer = videojs( const singlePlayer = videojs(
`singleVideo${this.cameraList.length}`, `singleVideo${this.cameraList.length}`,
...@@ -290,16 +293,19 @@ export default { ...@@ -290,16 +293,19 @@ export default {
player: undefined, player: undefined,
id: id, id: id,
}); });
let ts = new Date().getTime();
setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
const myVideoDiv = document.getElementById( const myVideoDiv = document.getElementById(
`video-container-${index + 1}` `video-container-${index + 1}`
); );
myVideoDiv.innerHTML = `<video myVideoDiv.innerHTML = `<video
id="singleVideo${index + 1}" id="singleVideo${ts}"
autoplay="autoplay" autoplay="autoplay"
class="video-js vjs-default-skin" class="video-js vjs-default-skin"
muted="muted"
></video>`; ></video>`;
const singlePlayer = videojs(`singleVideo${index + 1}`, { const singlePlayer = videojs(`singleVideo${ts}`, {
autoplay: true, // 自动播放 autoplay: true, // 自动播放
controls: true, // 控件显示 controls: true, // 控件显示
preload: "auto", //定义视频加载模式 preload: "auto", //定义视频加载模式
...@@ -309,10 +315,14 @@ export default { ...@@ -309,10 +315,14 @@ export default {
src: res.data.live_address_url, src: res.data.live_address_url,
type: "application/x-mpegURL", type: "application/x-mpegURL",
}); });
this.$nextTick(() => {
singlePlayer.play(); singlePlayer.play();
});
this.cameraList[index].player = singlePlayer; this.cameraList[index].player = singlePlayer;
this.$forceUpdate();
}); });
}, 500);
} }
}); });
}); });
...@@ -332,6 +342,9 @@ export default { ...@@ -332,6 +342,9 @@ export default {
} }
}, },
}, },
destroyed() {
this.closeAll();
},
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -33,6 +33,10 @@ noLoadingrequest.interceptors.response.use( ...@@ -33,6 +33,10 @@ noLoadingrequest.interceptors.response.use(
return response.data return response.data
}, },
error => { error => {
Message({
message: '服务器错误',
type: 'error'
})
console.log(error) console.log(error)
return Promise.reject(new Error(error).message) return Promise.reject(new Error(error).message)
} }
......
...@@ -69,6 +69,10 @@ request.interceptors.response.use( ...@@ -69,6 +69,10 @@ request.interceptors.response.use(
return response.data return response.data
}, },
error => { error => {
Message({
message: '服务器错误',
type: 'error'
})
console.log(error) console.log(error)
closeLoading() closeLoading()
return Promise.reject(new Error(error).message) return Promise.reject(new Error(error).message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment