|
@@ -87,12 +87,12 @@
|
|
|
</div>
|
|
|
<!-- 底部导航栏 -->
|
|
|
<div style="display: flex; justify-content: space-around; padding: 15px 0; background: #fff; border-top: 1px solid #f0f0f0;">
|
|
|
- <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;">
|
|
|
- <i class="el-icon-microphone" style="font-size: 20px;"></i>
|
|
|
+ <div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickRed">
|
|
|
+ <i class="el-icon-money" style="font-size: 20px;"></i>
|
|
|
<span style="font-size: 12px; margin-top: 4px;">红包配置</span>
|
|
|
</div>
|
|
|
<div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;" @click="handleClickLottery">
|
|
|
- <i class="el-icon-microphone" style="font-size: 20px;"></i>
|
|
|
+ <i class="el-icon-present" style="font-size: 20px;"></i>
|
|
|
<span style="font-size: 12px; margin-top: 4px;">抽奖配置</span>
|
|
|
</div>
|
|
|
<div style="display: flex; flex-direction: column; align-items: center; cursor: pointer;">
|
|
@@ -189,13 +189,13 @@ import { changeUserStatus, watchUserList } from '@/api/live/liveWatchUser'
|
|
|
import { getLiveVideoByLiveId } from '@/api/live/liveVideo'
|
|
|
import { getLivingUrl } from '@/api/live/live'
|
|
|
import { listLiveMsg } from '@/api/live/liveMsg'
|
|
|
-import { LiveWS } from '@/utils/liveWS'
|
|
|
-import flvjs from 'flv.js';
|
|
|
+import Hls from 'hls.js';
|
|
|
import LiveLotteryConf from '@/views/live/liveLotteryConf/index.vue'
|
|
|
+import LiveRedConf from '@/views/live/liveRedConf/index.vue'
|
|
|
|
|
|
export default {
|
|
|
name: "LiveConsole",
|
|
|
- components: { LiveLotteryConf },
|
|
|
+ components: { LiveLotteryConf,LiveRedConf },
|
|
|
data() {
|
|
|
return {
|
|
|
tabLeft: {
|
|
@@ -206,7 +206,6 @@ export default {
|
|
|
},
|
|
|
livingUrl:"",
|
|
|
liveVideo: {},
|
|
|
- socket: null,
|
|
|
liveWsUrl: process.env.VUE_APP_LIVE_WS_URL + '/app/webSocket',
|
|
|
userParams:{
|
|
|
pageNum: 1,
|
|
@@ -230,6 +229,9 @@ export default {
|
|
|
this.getLiveUrl()
|
|
|
},
|
|
|
computed: {
|
|
|
+ socket(){
|
|
|
+ return this.$store.state.liveWs
|
|
|
+ },
|
|
|
liveId() {
|
|
|
return this.$route.params.liveId;
|
|
|
},
|
|
@@ -269,7 +271,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
handleClickLottery(){
|
|
|
- //this.$router.push('/live/liveLotteryConf/'+this.liveId);
|
|
|
this.$router.push({
|
|
|
name: 'LiveLotteryConf',
|
|
|
query: {
|
|
@@ -277,6 +278,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ handleClickRed(){
|
|
|
+ this.$router.push({
|
|
|
+ name: 'LiveRedConf',
|
|
|
+ query: {
|
|
|
+ liveId: this.liveId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
getLiveUrl(){
|
|
|
getLivingUrl(this.liveId).then(res=>{
|
|
|
if(res.code === 200){
|
|
@@ -287,21 +296,16 @@ export default {
|
|
|
},
|
|
|
initPlayer(){
|
|
|
var isUrl = this.livingUrl === null || this.livingUrl.trim() === ''
|
|
|
- if (flvjs.isSupported() && !isUrl) {
|
|
|
+ if (Hls.isSupported() && !isUrl) {
|
|
|
const videoElement = this.$refs.videoPlayer
|
|
|
- var flvPlayer = flvjs.createPlayer({
|
|
|
- type: 'flv',
|
|
|
- // qfedu 是推流的时候的路径名称
|
|
|
- // dixon 是stream 自定义的名称
|
|
|
- url: this.livingUrl,
|
|
|
- enableWorker: true,
|
|
|
- enableStashBuffer: false, // 禁用内部缓冲区
|
|
|
- stashInitialSize: 128, // 减小初始缓冲大小
|
|
|
- autoCleanupSourceBuffer: true
|
|
|
+ const hls = new Hls();
|
|
|
+ hls.attachMedia(videoElement);
|
|
|
+ hls.on(Hls.Events.MEDIA_ATTACHED, () => {
|
|
|
+ hls.loadSource(this.livingUrl);
|
|
|
+ hls.on(Hls.Events.STREAM_LOADED, (event, data) => {
|
|
|
+ videoElement.play();
|
|
|
+ });
|
|
|
});
|
|
|
- flvPlayer.attachMediaElement(videoElement);
|
|
|
- flvPlayer.load();
|
|
|
- flvPlayer.play();
|
|
|
}
|
|
|
},
|
|
|
handleClick(tab) {
|
|
@@ -438,9 +442,12 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
connectWebSocket() {
|
|
|
- let socket = new LiveWS(this.liveWsUrl, this.liveId, this.userId);
|
|
|
- socket.onmessage = (event) => this.handleWsMessage(event)
|
|
|
- this.socket = socket
|
|
|
+ this.$store.dispatch('initLiveWs', {
|
|
|
+ liveWsUrl: this.liveWsUrl,
|
|
|
+ liveId: this.liveId,
|
|
|
+ userId: this.userId
|
|
|
+ })
|
|
|
+ this.socket.onmessage = (event) => this.handleWsMessage(event)
|
|
|
},
|
|
|
handleWsMessage(event) {
|
|
|
let { code, data } = JSON.parse(event.data)
|