Commit 49753565 by 李伟康

删除直播代码

1 parent d2738178
<template>
<div :class="['live-box', { videoFullscreen: videoFullscreen }]" :style="videoStyle" id="live-box">
<div class="mask" @click="openFullscreen">
<div class="sprite-icon icon-live-close"></div>
<div class="status flex">
<div class="live-line">
<div class="side"></div>
<div class="center side"></div>
<div class="side"></div>
</div>
<div class="text">正在直播</div>
</div>
<template v-if="!IsIOS">
<img src="https://wimg.588ku.com/gif620/20/04/23/79a7882dfb0c59497976fd8b3bfe60ef.gif" alt="" />
</template>
</div>
<div class="fullscreen-btn" @click="openFullscreen(false)">
<img src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/fullscreen.png" />
</div>
<div class="poster-btn" @click="showKf = true">
<img src="https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/gift.gif" />
</div>
<video id="player-container-id" preload="auto" playsinline webkit-playsinline></video>
<kf-modal v-model="showKf" :detail="detail" />
</div>
</template>
<script type="text/ecmascript-6">
import { KfModal } from './index'
import { wxConfig } from '@/api'
export default {
components: { KfModal },
name: 'LiveBox',
data () {
return {
player: null,
videoFullscreen: false,
showKf: false,
detail: {
customerServiceQrImg: 'https://img02.glsx.com.cn/weapp/resource/h5/images/123.png'
},
videoStyle: ''
}
},
mounted () {
let _this = this
wxConfig.ready(() => {
if (Hls.isSupported()) {
_this.video = document.getElementById('player-container-id');
_this.hls = new Hls();
// bind them together
_this.hls.attachMedia(_this.video);
}
_this.player = TCPlayer('player-container-id', {
// fileID: '387702305074716718', //点播ID
// appID: '1311227058', //点播APPID
autoplay: true, // 自动播放
loop: true, // 循环播放
muted: true, //是否静音
controlBar: { //控制条配置
fullscreenToggle: false //隐藏全屏按钮
},
webrtcConfig: { //webrtcConfig 参数列表
showLog: true // 打印webrtc日志
}
})
// _this.player.src('http://play.glsx.com.cn/live/live.m3u8') //直播地址
_this.player.src('webrtc://play.glsx.com.cn/live/live_normal')
wx.getNetworkType({
success: (result) => {
_this.player.ready(function () { //设置播放器初始化完成后的回调
console.log('-------------------------', _this.player.poster())
_this.player.play() //播放视频
_this.draggable(document.getElementById('live-box'), _this.openFullscreen)
})
}
})
_this.player.on('webrtcevent', function (event) { //监听webrtc
console.log(event)
})
_this.hls.on(Hls.Events.ERROR, function (event, data) {
if (data.fatal) {
switch (data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
// try to recover network error
console.log('fatal network error encountered, try to recover');
_this.hls.startLoad()
break
case Hls.ErrorTypes.MEDIA_ERROR:
console.log('fatal media error encountered, try to recover');
_this.hls.recoverMediaError();
break;
default:
// cannot recover
_this.hls.destroy();
break;
}
}
});
})
},
methods: {
openFullscreen (status = true) { //打开关闭全屏
let [live] = document.getElementsByClassName('live-box')
let [volumePanel] = document.getElementsByClassName('vjs-volume-panel ')
let [volume] = volumePanel.getElementsByClassName('vjs-mute-control')
volume.click()
this.player.play()
this.videoFullscreen = status
live.id = status ? '' : 'live-box'
},
}
}
</script>
<style scoped lang="scss">
.live-box {
position: fixed;
top: 23%;
left: calc(98% - 86px);
z-index: 7;
width: 86px;
height: 148px;
border-radius: 4px;
overflow: hidden;
-webkit-user-select: auto;
.mask {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
border: 2px solid #f95d35;
border-radius: 4px;
box-sizing: border-box;
.icon-live-close {
position: absolute;
top: 0;
right: 0;
}
img {
object-fit: contain;
height: 126px;
}
.status {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 18px;
background: linear-gradient(291deg, #f6542b 0%, #ff6c47 100%), linear-gradient(270deg, rgba(255, 57, 0, 0) 0%, #ff3900 33%, #fd466f 100%);
font-size: 12px;
font-weight: 500;
color: #ffffff;
box-sizing: border-box;
padding: 0 9px;
.text {
margin-left: auto;
}
}
}
#player-container-id {
width: 100%;
height: 100%;
video {
object-fit: cover !important;
}
}
.fullscreen-btn {
display: none;
position: absolute;
right: 8px;
top: 14px;
width: 32px;
height: 32px;
z-index: 2;
}
.poster-btn {
display: none;
position: absolute;
left: 17px;
top: 17px;
width: 76px;
height: 115px;
z-index: 2;
}
/deep/.vjs-control-bar {
opacity: 0;
}
}
.videoFullscreen {
width: 100vw !important;
height: 100vh !important;
left: 0 !important;
top: 0 !important;
right: 0 !important;
bottom: 0 !important;
border: none !important;
.mask {
display: none;
}
.fullscreen-btn,
.poster-btn {
display: block;
}
/deep/.vjs-control-bar {
opacity: 1 !important;
}
}
</style>
...@@ -3,12 +3,10 @@ import CountDown from './CountDown.vue' ...@@ -3,12 +3,10 @@ import CountDown from './CountDown.vue'
import Action from './Action.vue' import Action from './Action.vue'
import KfModal from './KfModal.vue' import KfModal from './KfModal.vue'
import createOrderImg from './createOrderImg.vue' import createOrderImg from './createOrderImg.vue'
import LiveBox from './LiveBox.vue'
export { export {
MoveGroup, MoveGroup,
CountDown, CountDown,
Action, Action,
KfModal, KfModal,
createOrderImg, createOrderImg
LiveBox
} }
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="layout"> <div class="layout">
<!-- <live-box></live-box> -->
<div <div
class="to-top" class="to-top"
v-show="scrollY > 300" v-show="scrollY > 300"
...@@ -254,10 +253,10 @@ ...@@ -254,10 +253,10 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import { shopmallApi, wxConfig, mapApi, bigdatautilApi } from '@/api' import { shopmallApi, wxConfig, mapApi, bigdatautilApi } from '@/api'
import { MoveGroup, CountDown, KfModal, Action, LiveBox } from './components/index' import { MoveGroup, CountDown, KfModal, Action } from './components/index'
import { Audio } from '@/utils/audio' import { Audio } from '@/utils/audio'
export default { export default {
components: { MoveGroup, CountDown, KfModal, Action, LiveBox }, components: { MoveGroup, CountDown, KfModal, Action },
name: 'index', name: 'index',
data () { data () {
return { return {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!