2024-01-10 17:11:39 +08:00
|
|
|
|
2024-01-07 18:14:35 +08:00
|
|
|
<template>
|
2024-01-10 17:11:39 +08:00
|
|
|
<div class="video_wrap">
|
|
|
|
|
<div class="backIndex">
|
|
|
|
|
<span @click="router.push({ path: '/videoList' })"
|
|
|
|
|
><left-outlined
|
|
|
|
|
/></span>
|
|
|
|
|
</div>
|
|
|
|
|
<video width="800" height="600" ref="videoPlayer" muted="muted" class="video-js video"></video>
|
2024-01-07 18:14:35 +08:00
|
|
|
</div>
|
2024-01-09 15:40:09 +08:00
|
|
|
</template>
|
2024-01-10 17:11:39 +08:00
|
|
|
<script setup>
|
|
|
|
|
import { onUnmounted, ref, nextTick } from "vue";
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
import videojs from "video.js";
|
|
|
|
|
import "video.js/dist/video-js.css";
|
|
|
|
|
const videoPlayer = ref(null);
|
|
|
|
|
const myPlayer = ref(null);
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
if(localStorage.getItem('token')===null) {
|
|
|
|
|
router.push("/login");
|
|
|
|
|
}
|
|
|
|
|
let token = route.query.token;
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
myPlayer.value = videojs(videoPlayer.value, {
|
|
|
|
|
// poster: "//vjs.zencdn.net/v/oceans.png",//视频封面照片
|
|
|
|
|
controls: true, //视频控件
|
|
|
|
|
autoplay: true, //自动播放
|
|
|
|
|
sources: [
|
|
|
|
|
{
|
|
|
|
|
src:
|
2024-05-29 16:39:38 +08:00
|
|
|
"https://gep.ljsea.top/video/mp4?filename=" +
|
2024-01-10 17:11:39 +08:00
|
|
|
localStorage.getItem("video_name") +
|
|
|
|
|
"&id=" +
|
|
|
|
|
localStorage.getItem("video_id") +
|
2024-04-19 19:34:39 +08:00
|
|
|
"&ip=" +
|
|
|
|
|
localStorage.getItem("ip")+
|
2024-01-10 17:11:39 +08:00
|
|
|
"&userId=" +
|
|
|
|
|
localStorage.getItem("userId") +
|
|
|
|
|
"&token=" +
|
|
|
|
|
localStorage.getItem("token"), //视频地址
|
2024-01-12 17:05:56 +08:00
|
|
|
type: localStorage.getItem("video_name").split('.')[1]==="m3u8" ?"application/vnd.apple.mpegurl":"video/mp4",
|
2024-01-10 17:11:39 +08:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
controlBar: {
|
|
|
|
|
remainingTimeDisplay: {
|
|
|
|
|
displayNegative: false,
|
2024-01-09 15:40:09 +08:00
|
|
|
},
|
2024-01-10 17:11:39 +08:00
|
|
|
},
|
|
|
|
|
playbackRates: [0.5, 1, 1.5, 2], //设置播放速度
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
if (myPlayer.value) {
|
|
|
|
|
myPlayer.value.dispose();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.video_wrap {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
.backIndex {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
height: 50px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
line-height: 50px;
|
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
z-index: 99;
|
|
|
|
|
padding-left: 10px;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
color: white;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
span {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.video {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep(.vjs-big-play-button) {
|
|
|
|
|
margin-left: 45%;
|
|
|
|
|
margin-top: 20%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|