Commit 2cd51d79 by 李伟康

增加观看视频时跳转页面返回增加继续播放事件

1 parent 2cffd84e
<template> <template>
<!-- v-if="LiveProps[liveDetail.status].isLive" --> <!-- v-if="LiveProps[liveDetail.status].isLive" -->
<div class="videoContainer"> <div class="videoContainer">
<div class="small-box" <div
class="small-box"
@click="isSmallBox = false" @click="isSmallBox = false"
v-show="isSmallBox"> v-show="isSmallBox"
<img class="icon-small-live" >
src="@/assets/images/icon-small-live.png" /> <img
class="icon-small-live"
src="@/assets/images/icon-small-live.png"
/>
<div class="flex small-content"> <div class="flex small-content">
<!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> --> <!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> -->
<div class="live-line"> <div class="live-line">
...@@ -19,29 +23,37 @@ ...@@ -19,29 +23,37 @@
</div> </div>
</div> </div>
<!-- @click="openFullscreen" --> <!-- @click="openFullscreen" -->
<div :style="videoStyle" <div
:style="videoStyle"
id="live-box" id="live-box"
:class="['live-box', { videoFullscreen: videoFullscreen }]" :class="['live-box', { videoFullscreen: videoFullscreen }]"
v-show="!isSmallBox"> v-show="!isSmallBox"
<div class="sprite-icon icon-live-close" >
<div
class="sprite-icon icon-live-close"
v-show="!videoFullscreen && !isSmallBox" v-show="!videoFullscreen && !isSmallBox"
@click="isSmallBox = true"></div> @click="isSmallBox = true"
></div>
<div :class="{ videoShort: isAction }"> <div :class="{ videoShort: isAction }">
<div class="mask"> <div class="mask">
<div class="status flex"> <div class="status flex">
<!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> --> <!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> -->
<div v-if="LiveProps[liveDetail.status].isLive" <div
class="live-line"> v-if="LiveProps[liveDetail.status].isLive"
class="live-line"
>
<div class="side"></div> <div class="side"></div>
<div class="center side"></div> <div class="center side"></div>
<div class="side"></div> <div class="side"></div>
</div> </div>
<!-- 回放图标 --> <!-- 回放图标 -->
<!-- :src="" --> <!-- :src="" -->
<img v-if="!LiveProps[liveDetail.status].isLive" <img
v-if="!LiveProps[liveDetail.status].isLive"
:src="IMAGES.REPLAY_ICON" :src="IMAGES.REPLAY_ICON"
class="live-replayIcon" /> class="live-replayIcon"
/>
<!-- <div class="text">{{ LiveStatus[liveDetail.status] == 'live' ? '正在直播' : '直播回放' }}</div> --> <!-- <div class="text">{{ LiveStatus[liveDetail.status] == 'live' ? '正在直播' : '直播回放' }}</div> -->
<div class="text">{{ LiveProps[liveDetail.status].text }}</div> <div class="text">{{ LiveProps[liveDetail.status].text }}</div>
...@@ -49,32 +61,44 @@ ...@@ -49,32 +61,44 @@
<template v-if="isShowGif"> <template v-if="isShowGif">
<!-- v-if="LiveProps[liveDetail.status].covergif" --> <!-- 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 v-if="LiveStatus[liveDetail.status] == 'live'" src="https://wimg.588ku.com/gif620/20/04/23/79a7882dfb0c59497976fd8b3bfe60ef.gif" alt="" /> -->
<img class="coverGif" <img
class="coverGif"
:src="LiveProps[liveDetail.status].covergif" :src="LiveProps[liveDetail.status].covergif"
alt="" /> alt=""
/>
<!-- <img v-else <!-- <img v-else
:src="IMAGES.COVER_REPLAY" :src="IMAGES.COVER_REPLAY"
alt="" /> --> alt="" /> -->
</template> </template>
</div> </div>
<div class="fullscreen-btn" <div
@click="openFullscreen(false)"> class="fullscreen-btn"
@click="openFullscreen(false)"
>
<img :src="IMAGES.FULL_SCREEN" /> <img :src="IMAGES.FULL_SCREEN" />
</div> </div>
<div class="poster-btn" <div
@click="showKf = true"> class="poster-btn"
@click="showKf = true"
>
<img :src="detail.floatingMaskDiagram" /> <img :src="detail.floatingMaskDiagram" />
</div> </div>
<video id="player-container-id" <video
id="player-container-id"
preload="auto" preload="auto"
playsinline playsinline
webkit-playsinline></video> webkit-playsinline
<group-modal v-model="showKf" ></video>
:detail="detail" /> <group-modal
v-model="showKf"
:detail="detail"
/>
</div> </div>
<action :bgBlack="true" <action
:bgBlack="true"
class="BgAction" class="BgAction"
v-show="videoFullscreen && isAction"></action> v-show="videoFullscreen && isAction"
></action>
</div> </div>
</div> </div>
</template> </template>
...@@ -107,7 +131,7 @@ const LiveProps = Object.freeze({ ...@@ -107,7 +131,7 @@ const LiveProps = Object.freeze({
const PLAYERDOMID = 'player-container-id' const PLAYERDOMID = 'player-container-id'
export default { export default {
name: 'LiveBox', name: 'LiveBox',
data() { data () {
return { return {
player: null, player: null,
videoFullscreen: false, videoFullscreen: false,
...@@ -122,7 +146,7 @@ export default { ...@@ -122,7 +146,7 @@ export default {
} }
}, },
computed: { computed: {
isAction() { isAction () {
const { activityStatus, buyFlag } = this.detail const { activityStatus, buyFlag } = this.detail
return activityStatus != 3 && buyFlag != 2 //TODO CONSTANT return activityStatus != 3 && buyFlag != 2 //TODO CONSTANT
} }
...@@ -147,7 +171,7 @@ export default { ...@@ -147,7 +171,7 @@ export default {
} }
}, },
mounted() { mounted () {
console.log(this.liveDetail, '============') console.log(this.liveDetail, '============')
this.createPlayerCover() this.createPlayerCover()
this.createPlayer() this.createPlayer()
...@@ -198,13 +222,13 @@ export default { ...@@ -198,13 +222,13 @@ export default {
// }) // })
}, },
methods: { methods: {
createPlayerCover() { createPlayerCover () {
!this.IsIOS && (this.isShowGif = true) !this.IsIOS && (this.isShowGif = true)
}, },
createPlayer() { createPlayer () {
this.player = TCPlayer(PLAYERDOMID, TCPlayerConfig) this.player = TCPlayer(PLAYERDOMID, TCPlayerConfig)
}, },
play() { play () {
wxConfig.ready(() => { wxConfig.ready(() => {
wx.getNetworkType({ wx.getNetworkType({
success: (result) => { success: (result) => {
...@@ -224,7 +248,8 @@ export default { ...@@ -224,7 +248,8 @@ export default {
}) })
}) })
}, },
fixHls() {
fixHls () {
if (Hls.isSupported()) { if (Hls.isSupported()) {
this.video = document.getElementById(PLAYERDOMID) this.video = document.getElementById(PLAYERDOMID)
this.hls = new Hls() this.hls = new Hls()
...@@ -234,7 +259,7 @@ export default { ...@@ -234,7 +259,7 @@ export default {
} }
}, },
// 打开关闭全屏 // 打开关闭全屏
openFullscreen(status = true) { openFullscreen (status = true) {
console.log('openFullscreen') console.log('openFullscreen')
this.isShowGif = false this.isShowGif = false
const [live] = document.getElementsByClassName('live-box') const [live] = document.getElementsByClassName('live-box')
...@@ -247,7 +272,7 @@ export default { ...@@ -247,7 +272,7 @@ export default {
this.$emit('handleLiveFull', { isFull: this.videoFullscreen }) this.$emit('handleLiveFull', { isFull: this.videoFullscreen })
}, },
// 处理tcplayer错误码14 // 处理tcplayer错误码14
dealTcPlayerErr14() { dealTcPlayerErr14 () {
this.hls.on(Hls.Events.ERROR, function (event, data) { this.hls.on(Hls.Events.ERROR, function (event, data) {
if (data.fatal) { if (data.fatal) {
switch (data.type) { switch (data.type) {
...@@ -268,12 +293,15 @@ export default { ...@@ -268,12 +293,15 @@ export default {
} }
}) })
}, },
changeGifStatus() { changeGifStatus () {
this.isShowGif = !this.isShowGif this.isShowGif = !this.isShowGif
}, },
handleClose() { handleClose () {
// e.stopPropagation() // e.stopPropagation()
console.log('关闭--22222222222222222') console.log('关闭--22222222222222222')
},
continueVideo () {
this.player.play()
} }
} }
} }
......
...@@ -326,7 +326,11 @@ export default { ...@@ -326,7 +326,11 @@ export default {
if (from.name == 'crowdfunding.success') window.location.reload() if (from.name == 'crowdfunding.success') window.location.reload()
else { else {
if (vm.detail && vm.detail.activityName) document.title = vm.detail.activityName if (vm.detail && vm.detail.activityName) document.title = vm.detail.activityName
if (vm.isLiveFull) return if (vm.isLiveFull) {
console.log(vm.$refs)
vm.$refs.liveBox.continueVideo()
return
}
if (window.$AUDIO && vm.userOff != 1) { if (window.$AUDIO && vm.userOff != 1) {
window.$AUDIO.toggleBGM() window.$AUDIO.toggleBGM()
vm.musicOff = false vm.musicOff = false
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!