新增socket链接

master
于肖磊 2025-12-10 10:54:16 +08:00
parent 8a98cb3cf5
commit 4150f122f4
5 changed files with 13 additions and 5 deletions

View File

@ -368,7 +368,13 @@
//
initHlsPlayer(src) {
if (hlsjs.isSupported()) {
this.hlsPlayer = new hlsjs()
this.hlsPlayer = new hlsjs({
manifestLoadingTimeOut: 1000, //
fragLoadingTimeOut: 1000, //
maxLiveSyncPlaybackRate: 1, // 1.05
lowLatencyMode: true, //
debug: false //
})
this.hlsPlayer.loadSource(src)
this.hlsPlayer.attachMedia(this.videoEl)
this.hlsPlayer.on(hlsjs.Events.MANIFEST_PARSED, () => {

View File

@ -598,6 +598,7 @@
break;
//
case 'message':
console.log(data, 'message');
//
if (this.bulletins.length > 0 && this.bulletins[this.bulletins.length - 1].type == 'go') {
this.bulletins.splice(this.bulletins.length - 1, 1);
@ -613,6 +614,7 @@
this.scroll_to_lower();
break;
case 'live-status':
console.log(data.content, 'live-status');
this.$emit('liveStatus', data.content);
break;
}

View File

@ -26,7 +26,7 @@ export default {
lastTapPosition: { x: 0, y: 0 }, // 记录上次点击位置
lastLikeTime: 0, // 记录上次点赞时间,用于防抖
live_status: 'start',
live_end_msg: '主播暂时离开,请稍等...',
live_end_msg: '直播已结束',
}
},
@ -220,7 +220,7 @@ export default {
this.lastTapPosition = { x, y };
},
socket_live_status(status) {
console.log(status);
console.log(status, '直播间状态');
this.live_status = status;
// 如果是开始直播了或者继续直播了,则取消直播结束标记
console.log(this.is_live_ended);

View File

@ -7,7 +7,7 @@
<full-screen-like-effect ref="fullScreenLikeEffect" :propCustomImages="like_show_imgs" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"></full-screen-like-effect>
</view>
<view v-if="!is_loading" class="live-content" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<live-content ref="liveContent" :propLiveConfig="live_config" :propLiveShowImgs="like_show_imgs" @live-back="live_back" @handleDoubleClick="handle_double_click" @handleTouchEnd="handle_touch_end" @liveStatus="socket_live_status"></live-content>
<live-content ref="liveContent" :propLiveConfig="live_config" :propLiveShowImgs="like_show_imgs" @liveBack="live_back" @handleDoubleClick="handle_double_click" @handleTouchEnd="handle_touch_end" @liveStatus="socket_live_status"></live-content>
</view>
<view v-if="is_live_ended" class="live-ended flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<view class="flex-col align-c">

View File

@ -6,7 +6,7 @@
<full-screen-like-effect ref="fullScreenLikeEffect" :propCustomImages="like_show_imgs"></full-screen-like-effect>
</view>
<view v-if="!is_loading" :class="'live-content ' + (!is_live_ended ? 'pointer-events-none' : '')">
<live-content ref="liveContent" :propLiveConfig="live_config" :propLiveShowImgs="like_show_imgs" @live-back="live_back" @liveStatus="socket_live_status"></live-content>
<live-content ref="liveContent" :propLiveConfig="live_config" :propLiveShowImgs="like_show_imgs" @liveBack="live_back" @liveStatus="socket_live_status"></live-content>
</view>
<view v-if="is_live_ended" class="live-ended flex-row align-c jc-c">
<view class="flex-col align-c">