Commit 7e588fa1 by chenwq

直播样式和逻辑

1 parent 0cd7685d
<template>
<!-- v-if="LiveProps[liveDetail.status].isLive" -->
<div class="videoContainer">
<div class="small-box"
@click="isSmallBox = false"
v-show="isSmallBox">
<img class="icon-small-live"
src="@/assets/images/icon-small-live.png" />
<div class="small-box" @click="isSmallBox = false" v-show="isSmallBox">
<img class="icon-small-live" src="@/assets/images/icon-small-live.png" />
<div class="flex small-content">
<!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> -->
<div class="live-line">
<div class="live-line" v-if="LiveProps[liveDetail.status].isLive">
<div class="side"></div>
<div class="center side"></div>
<div class="side"></div>
</div>
<!-- <div class="text">{{ LiveStatus[liveDetail.status] == 'live' ? '直播' : '回放' }}</div> -->
<!-- <div class="text">{{ LiveProps[liveDetail.status].status }}</div> -->
<img v-if="!LiveProps[liveDetail.status].isLive" :src="IMAGES.REPLAY_ICON" class="live-replayIcon" />
<div class="text">{{ LiveProps[liveDetail.status].status }}</div>
</div>
</div>
<!-- @click="openFullscreen" -->
<!-- @touchmove.stop.prevent 禁止使用滚动 -->
<div :style="videoStyle"
@touchmove.stop.prevent
id="live-box"
:class="['live-box', { videoFullscreen: videoFullscreen }]"
v-show="!isSmallBox">
<div class="sprite-icon icon-live-close"
v-show="!videoFullscreen && !isSmallBox"
@click="isSmallBox = true"></div>
<div :style="videoStyle" @touchmove.stop.prevent id="live-box" :class="['live-box', { videoFullscreen: videoFullscreen }]" v-show="!isSmallBox">
<div class="sprite-icon icon-live-close" v-show="!videoFullscreen && !isSmallBox" @click="isSmallBox = true"></div>
<div :class="{ videoShort: isAction }">
<div class="mask">
<div class="status flex">
<!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> -->
<div v-if="LiveProps[liveDetail.status].isLive"
class="live-line">
<div v-if="LiveProps[liveDetail.status].isLive" class="live-line">
<div class="side"></div>
<div class="center side"></div>
<div class="side"></div>
</div>
<!-- 回放图标 -->
<!-- :src="" -->
<img v-if="!LiveProps[liveDetail.status].isLive"
:src="IMAGES.REPLAY_ICON"
class="live-replayIcon" />
<!-- <div class="text">{{ LiveStatus[liveDetail.status] == 'live' ? '正在直播' : '直播回放' }}</div> -->
<img v-if="!LiveProps[liveDetail.status].isLive" :src="IMAGES.REPLAY_ICON" class="live-replayIcon" />
<div class="text">{{ LiveProps[liveDetail.status].text }}</div>
</div>
<template v-if="isShowGif">
<!-- v-if="LiveProps[liveDetail.status].covergif" -->
<!-- <img v-if="LiveStatus[liveDetail.status] == 'live'" src="https://wimg.588ku.com/gif620/20/04/23/79a7882dfb0c59497976fd8b3bfe60ef.gif" alt="" /> -->
<img class="coverGif"
:src="LiveProps[liveDetail.status].covergif"
alt="" />
<!-- <img v-else
:src="IMAGES.COVER_REPLAY"
alt="" /> -->
<img class="coverGif" :src="LiveProps[liveDetail.status].covergif" alt="" />
</template>
</div>
<div class="fullscreen-btn"
@click="openFullscreen(false)">
<div class="fullscreen-btn" @click="openFullscreen(false)">
<img :src="IMAGES.FULL_SCREEN" />
</div>
<div class="poster-btn"
@click="showKf = true">
<div class="poster-btn" @click="showKf = true">
<img :src="detail.floatingMaskDiagram" />
</div>
<video id="player-container-id"
preload="auto"
playsinline
webkit-playsinline></video>
<group-modal v-model="showKf"
:detail="detail" />
<video id="player-container-id" preload="auto" playsinline webkit-playsinline></video>
<group-modal v-model="showKf" :detail="detail" />
</div>
<action :bgBlack="true"
class="BgAction"
v-show="videoFullscreen && isAction"></action>
<action :bgBlack="true" class="BgAction" v-show="videoFullscreen && isAction"></action>
</div>
</div>
</template>
......@@ -116,8 +84,6 @@ export default {
showKf: false,
isShowGif: false,
videoStyle: '',
// LiveStatus: CONSTANTS.LiveStatus,
// LiveProps: CONSTANTS.LiveProps,
isSmallBox: false, //是否显示小容器直播
LiveProps,
IMAGES
......@@ -150,54 +116,10 @@ export default {
},
mounted() {
console.log(this.liveDetail, '============')
this.createPlayerCover()
this.createPlayer()
this.play()
console.log('2222222222', this.liveDetail);
// const _this = this
// if (!this.IsIOS) {
// this.changeGifStatus()
// }
// wxConfig.ready(() => {
// if (Hls.isSupported()) {
// _this.video = document.getElementById('player-container-id')
// _this.hls = new Hls()
// // bind them together
// _this.hls.attachMedia(_this.video)
// }
// const playParams = {
// autoplay: true, // 自动播放
// loop: true, // 循环播放
// // muted: false, // 是否静音
// controlBar: { // 控制条配置
// fullscreenToggle: false // 隐藏全屏按钮
// },
// webrtcConfig: { // webrtcConfig 参数列表
// showLog: true // 打印webrtc日志
// }
// }
// _this.player = TCPlayer('player-container-id', playParams)
// wx.getNetworkType({
// success: (result) => {
// _this.player.ready(function() { // 设置播放器初始化完成后的回调
// const src = _this.LiveStatus[_this.liveDetail.status] == 'live' ? _this.liveDetail.playPath : (_this.liveDetail.liveBroadcastRecordingFileList.length ? _this.liveDetail.liveBroadcastRecordingFileList[0].videoUrl : '')
// _this.player.src(src)
// _this.player.poster()
// _this.player.play() // 播放视频
// _this.draggable(document.getElementById('live-box'), _this.openFullscreen)
// })
// }
// })
// _this.player.on('play', () => {
// this.changeGifStatus()
// })
// _this.player.on('pause', () => {
// this.changeGifStatus()
// })
// _this.dealTcPlayerErr14(_this)
// })
// console.log('2222222222', this.liveDetail)
},
methods: {
createPlayerCover() {
......@@ -210,23 +132,27 @@ export default {
wxConfig.ready(() => {
wx.getNetworkType({
success: (result) => {
console.log('====', { result });
// console.log('====', { result });
this.player.ready(() => { // 设置播放器初始化完成后的回调
this.fixHls()
const src = this.LiveProps[this.liveDetail.status].isLive ? this.liveDetail.playPath : (this.liveDetail.liveBroadcastRecordingFileList || [])[0]?.videoUrl
this.player.src(src)
// this.player.src('http://play.glsx.com.cn/live/live.m3u8')
this.player.poster()
this.player.play() // 播放视频
// console.log('this.draggable', this.draggable)
this.draggable(document.getElementById('live-box'), this.openFullscreen, 'icon-live-close')
//
})
}
})
})
},
controlBarStyle() {
if (this.isAction) {
var [controlBar] = document.getElementsByClassName('vjs-control-bar')
controlBar.style.bottom = '10vh'
}
},
fixHls() {
if (Hls.isSupported()) {
this.video = document.getElementById(PLAYERDOMID)
......@@ -238,7 +164,7 @@ export default {
},
// 打开关闭全屏
openFullscreen(status = true) {
console.log('openFullscreen')
// console.log('openFullscreen')
this.isShowGif = false
const [live] = document.getElementsByClassName('live-box')
const [volumePanel] = document.getElementsByClassName('vjs-volume-panel ')
......@@ -247,6 +173,7 @@ export default {
this.player.play()
this.videoFullscreen = status
live.id = status ? '' : 'live-box'
this.controlBarStyle()
this.$emit('handleLiveFull', { isFull: this.videoFullscreen })
},
// 处理tcplayer错误码14
......@@ -274,10 +201,6 @@ export default {
changeGifStatus() {
this.isShowGif = !this.isShowGif
},
handleClose() {
// e.stopPropagation()
console.log('关闭--22222222222222222')
},
continueVideo() {
this.player.play()
}
......@@ -289,7 +212,7 @@ export default {
position: fixed;
top: 18%;
right: 0;
z-index: 2;
z-index: 7;
// position: relative;
width: 52px;
height: 21px;
......@@ -305,6 +228,7 @@ export default {
// object-fit: cover;
}
.small-content {
position: relative;
width: 100%;
height: 100%;
z-index: 9;
......@@ -314,6 +238,15 @@ export default {
justify-content: center;
// padding: ;
text-align: right;
.live-replayIcon {
position: absolute;
left: 7px;
top: 5px;
display: inline-block;
width: 10px;
height: 10px;
z-index: 9;
}
.text {
z-index: 40;
margin-left: 15px;
......@@ -430,7 +363,7 @@ export default {
/deep/.vjs-control-bar {
opacity: 1 !important;
bottom: 10vh;
// bottom: 10vh;
background: none !important;
// background-color: rgba(0, 0, 0, 0.3);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!