You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!--
* @ Descripttion :
* @ version :
* @ Author : JC9527
* @ Date : 2023 - 12 - 26 13 : 59 : 07
* @ LastEditors : JC9527
* @ LastEditTime : 2023 - 12 - 28 14 : 46 : 59
-- >
< template >
< dia -log ref = "dialog4" width = "45%" title = "实时监控" @close ="Close" >
< div class = "video-main" >
<!-- muted : 是否静音 -- >
< video
id = "video"
preload = "auto"
controls
autoplay
class = "video-js vjs-default-skin vjs-big-play-centered"
style = "width: 100%; height: 100%; object-fit: fill"
>
< source :src ="videoUrl" type = "application/x-mpegURL" / >
< / video >
< / div >
< / d i a - l o g >
< / template >
< script >
import diaLog from "../../components/dialog/index.vue"
import Videojs from "video.js"
import "videojs-contrib-hls" ;
// 引入中文json文件
import video _zhCN from 'video.js/dist/lang/zh-CN.json'
// 设置中文
Videojs . addLanguage ( 'zh-CN' , video _zhCN )
export default {
components : { diaLog } ,
data ( ) {
return {
videoUrl : "" ,
videoPlayer : null ,
}
} ,
props : { } ,
methods : {
open ( url ) {
this . $refs . dialog4 . open ( '3' ) ;
this . initVideo ( ) ;
this . videoUrl = url ;
} ,
Close ( ) {
// this.videoPlayer.dispose();
if ( this . videoPlayer ) {
this . videoPlayer . dispose ( ) ;
}
} ,
initVideo ( ) {
this . $nextTick ( ( ) => {
this . videoPlayer = Videojs ( ` video ` , {
bigPlayButton : true , // 显示大按钮
textTrackDisplay : false ,
posterImage : false ,
errorDisplay : false ,
language : 'zh-CN' ,
controls : true ,
height : '100%' ,
hls : {
withCredentials : true ,
} ,
} )
} ) ;
} ,
} ,
destroyed ( ) {
if ( this . videoPlayer ) {
console . log ( "1111111111111111111111" ) ;
this . videoPlayer . dispose ( ) ;
}
}
}
< / script >
< style lang = "scss" scoped >
. video - main {
width : 100 % ;
height : 500 px ;
padding : 0 40 px 0 0 ;
}
< / style >