|
@@ -183,9 +183,12 @@
|
|
|
<view class="action-button-group end">
|
|
<view class="action-button-group end">
|
|
|
<view :class="[liveItem.showType === 1 ? 'horizontal' : 'vertical','icon-button','ml20']">
|
|
<view :class="[liveItem.showType === 1 ? 'horizontal' : 'vertical','icon-button','ml20']">
|
|
|
<button open-type="share" class="action-icon button-reset">
|
|
<button open-type="share" class="action-icon button-reset">
|
|
|
- <image class="action-icon"
|
|
|
|
|
|
|
+ <!-- <image class="action-icon"
|
|
|
src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/fs/20251231/de30446abc5644fdac8438e6aa7058b6.png"
|
|
src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/fs/20251231/de30446abc5644fdac8438e6aa7058b6.png"
|
|
|
- mode="widthFix" />
|
|
|
|
|
|
|
+ mode="widthFix" /> -->
|
|
|
|
|
+ <image class="action-icon"
|
|
|
|
|
+ src="@/static/images/weixin1.png"
|
|
|
|
|
+ mode="widthFix" />
|
|
|
</button>
|
|
</button>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -249,7 +252,7 @@
|
|
|
|
|
|
|
|
<!-- 底部输入和操作区域 -->
|
|
<!-- 底部输入和操作区域 -->
|
|
|
<view class="input-actions-container" :class="{ 'input-actions-focused': isFocus }">
|
|
<view class="input-actions-container" :class="{ 'input-actions-focused': isFocus }">
|
|
|
- <view v-if="liveItem.status!=3&&!isPlayback" class="input-container" :class="{
|
|
|
|
|
|
|
+ <view v-if="liveItem.status!=3&&!isPlayback&&!generating" class="input-container" :class="{
|
|
|
'input-container-focused': isFocus,
|
|
'input-container-focused': isFocus,
|
|
|
'input-container-normal': !isFocus
|
|
'input-container-normal': !isFocus
|
|
|
}">
|
|
}">
|
|
@@ -901,7 +904,7 @@
|
|
|
networkType: 'unknown', // 当前网络类型
|
|
networkType: 'unknown', // 当前网络类型
|
|
|
isNetworkAvailable: true, // 网络是否可用
|
|
isNetworkAvailable: true, // 网络是否可用
|
|
|
|
|
|
|
|
- templateId: 'lbCjbm04ic1Bc93Sn6p6-MdPwJ1DzntUUY8APGv2qh0', //百域良品
|
|
|
|
|
|
|
+ templateId: 'JO9ZKlZES7vqxza82uSVyepLk8jbgYO75EGGEzXzje4', //云联精选
|
|
|
//templateId: 'ELHbRqBdzSV7ttXTWw7RgnddnIqkj2-ld8dMU-gJmyU', //乐享优品
|
|
//templateId: 'ELHbRqBdzSV7ttXTWw7RgnddnIqkj2-ld8dMU-gJmyU', //乐享优品
|
|
|
isAgreement: false,
|
|
isAgreement: false,
|
|
|
|
|
|
|
@@ -1887,7 +1890,7 @@
|
|
|
this.countdownTimer = setInterval(() => {
|
|
this.countdownTimer = setInterval(() => {
|
|
|
this.updateCountdown();
|
|
this.updateCountdown();
|
|
|
}, 1000); // 每秒更新一次
|
|
}, 1000); // 每秒更新一次
|
|
|
- console.log("this.completionPointsEnabled+++++++",this.liveItem.completionPointsEnabled,this.countdownPercentage,this.receiveStatus,this.hasReceived,this.isPreview)
|
|
|
|
|
|
|
+ //console.log("this.completionPointsEnabled+++++++",this.liveItem.completionPointsEnabled,this.countdownPercentage,this.receiveStatus,this.hasReceived,this.isPreview)
|
|
|
},
|
|
},
|
|
|
// 更新倒计时
|
|
// 更新倒计时
|
|
|
updateCountdown() {
|
|
updateCountdown() {
|
|
@@ -3226,17 +3229,31 @@
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 如果流量计算已经在进行中,且 trafficStartTime 已存在,不重复启动
|
|
|
|
|
+ // 避免重复累计流量
|
|
|
|
|
+ if (this.trafficTimer && this.trafficStartTime > 0) {
|
|
|
|
|
+ console.log('流量计算已在进行中,跳过重复启动');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
// 清除已有定时器
|
|
// 清除已有定时器
|
|
|
if (this.trafficTimer) {
|
|
if (this.trafficTimer) {
|
|
|
clearInterval(this.trafficTimer);
|
|
clearInterval(this.trafficTimer);
|
|
|
this.trafficTimer = null;
|
|
this.trafficTimer = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 如果之前有流量计算,先提交当前流量数据,避免丢失
|
|
|
|
|
+ if (this.trafficStartTime > 0 && this.videoLoaded) {
|
|
|
|
|
+ const watchDuration = Math.floor((this.getServerTimeNow() - this.trafficStartTime) / 1000);
|
|
|
|
|
+ if (watchDuration > 0) {
|
|
|
|
|
+ this.submitTraffic(watchDuration);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 重置总流量
|
|
|
|
|
+ this.totalTraffic = 0;
|
|
|
// 记录流量计算开始时间
|
|
// 记录流量计算开始时间
|
|
|
- //this.trafficStartTime = Date.now();
|
|
|
|
|
this.trafficStartTime = this.getServerTimeNow();
|
|
this.trafficStartTime = this.getServerTimeNow();
|
|
|
var that = this;
|
|
var that = this;
|
|
|
-
|
|
|
|
|
// 立即提交一次10s流量(模拟10秒观看)
|
|
// 立即提交一次10s流量(模拟10秒观看)
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
that.submitTraffic(10);
|
|
that.submitTraffic(10);
|
|
@@ -3395,7 +3412,7 @@
|
|
|
if (this.liveItem.liveType == 1) {
|
|
if (this.liveItem.liveType == 1) {
|
|
|
param.bufferRate = this.totalTraffic;
|
|
param.bufferRate = this.totalTraffic;
|
|
|
}
|
|
}
|
|
|
- internetTraffic(param);
|
|
|
|
|
|
|
+ //internetTraffic(param);
|
|
|
},
|
|
},
|
|
|
scrollToBottom() {
|
|
scrollToBottom() {
|
|
|
const now = Date.now();
|
|
const now = Date.now();
|
|
@@ -3460,7 +3477,7 @@
|
|
|
array.slice(-100).forEach((id) => this.shownEntryUsers.add(id));
|
|
array.slice(-100).forEach((id) => this.shownEntryUsers.add(id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- console.log('内存清理完成');
|
|
|
|
|
|
|
+ console.log('内存清理完成——————————————————————',this.shownEntryUsers);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('内存清理失败:', error);
|
|
console.error('内存清理失败:', error);
|
|
|
}
|
|
}
|
|
@@ -3610,8 +3627,8 @@
|
|
|
maOpenId: this.userInfo.maOpenId,
|
|
maOpenId: this.userInfo.maOpenId,
|
|
|
appId: this.appid,
|
|
appId: this.appid,
|
|
|
data: {
|
|
data: {
|
|
|
- thing2: this.liveItem.liveName,
|
|
|
|
|
- time4: this.liveItem.startTime,
|
|
|
|
|
|
|
+ thing4: this.liveItem.liveName,
|
|
|
|
|
+ time2: this.liveItem.startTime,
|
|
|
date7: this.liveItem.startTime
|
|
date7: this.liveItem.startTime
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -3947,8 +3964,8 @@
|
|
|
if (!createTimeStr) return;
|
|
if (!createTimeStr) return;
|
|
|
// const createTime = new Date(createTimeStr.replace(/-/g, '/'));
|
|
// const createTime = new Date(createTimeStr.replace(/-/g, '/'));
|
|
|
// 使用服务器时间或本地时间
|
|
// 使用服务器时间或本地时间
|
|
|
- const now = useServerTime ? new Date(this.getServerTimeNow()) : new Date();
|
|
|
|
|
- const timeDiffMs = now.getTime() - createTimeStr;
|
|
|
|
|
|
|
+ const now = useServerTime ? Number(this.getServerTimeNow()) : Date.now();
|
|
|
|
|
+ const timeDiffMs = now - createTimeStr;
|
|
|
const timeDiffSeconds = Math.floor(timeDiffMs / 1000);
|
|
const timeDiffSeconds = Math.floor(timeDiffMs / 1000);
|
|
|
return Math.max(0, timeDiffSeconds);
|
|
return Math.max(0, timeDiffSeconds);
|
|
|
},
|
|
},
|
|
@@ -3967,13 +3984,6 @@
|
|
|
this.isHeight = true
|
|
this.isHeight = true
|
|
|
}
|
|
}
|
|
|
const wH = (winH / winW) * 100;
|
|
const wH = (winH / winW) * 100;
|
|
|
- // this.scale = wW / this.videoRatio;
|
|
|
|
|
- // if (this.liveItem.showType == 2) {
|
|
|
|
|
- // const videoRatio = (height / width) * 100;
|
|
|
|
|
- // this.scale = wH / videoRatio;
|
|
|
|
|
- // console.log("比例", this.videoRatio, width, height)
|
|
|
|
|
- // } else if (this.isFullscreen) {
|
|
|
|
|
- // }
|
|
|
|
|
this.videoProgressKey = `videoProgress_${this.liveId}`;
|
|
this.videoProgressKey = `videoProgress_${this.liveId}`;
|
|
|
this.setVideoProgress();
|
|
this.setVideoProgress();
|
|
|
|
|
|
|
@@ -3984,7 +3994,10 @@
|
|
|
this.lastVideoUpdateTime = Date.now();
|
|
this.lastVideoUpdateTime = Date.now();
|
|
|
// 延迟一下确保数据已加载
|
|
// 延迟一下确保数据已加载
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- this.startTrafficCalculation();
|
|
|
|
|
|
|
+ // 只有在流量计算未启动时才启动,避免重复累计
|
|
|
|
|
+ if (!this.trafficTimer || this.trafficStartTime === 0) {
|
|
|
|
|
+ this.startTrafficCalculation();
|
|
|
|
|
+ }
|
|
|
}, 500);
|
|
}, 500);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -4002,13 +4015,31 @@
|
|
|
currentTime = storedProgress >= this.liveItem.duration ? 0 : storedProgress || 0;
|
|
currentTime = storedProgress >= this.liveItem.duration ? 0 : storedProgress || 0;
|
|
|
this.isPlayback = true;
|
|
this.isPlayback = true;
|
|
|
this.hasPlayback = true;
|
|
this.hasPlayback = true;
|
|
|
|
|
+ if (this.isPlayback) {
|
|
|
|
|
+ const hasWatchedKey = `hasWatchedReplay_${this.liveId}`;
|
|
|
|
|
+ const hasWatched = uni.getStorageSync(hasWatchedKey);
|
|
|
|
|
+
|
|
|
|
|
+ // 如果回放正在生成中,重置进度从头开始
|
|
|
|
|
+ if (this.generating) {
|
|
|
|
|
+ currentTime = 0;
|
|
|
|
|
+ // 清除存储的进度,确保从头开始
|
|
|
|
|
+ if (this.videoProgressKey) {
|
|
|
|
|
+ uni.removeStorageSync(this.videoProgressKey);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (!hasWatched) {
|
|
|
|
|
+ // 首次观看且回放已生成完成(isPlayback = true),从0开始
|
|
|
|
|
+ currentTime = 0;
|
|
|
|
|
+ // 标记已观看过(只有在回放生成完成且 isPlayback = true 时才设置)
|
|
|
|
|
+ uni.setStorageSync(hasWatchedKey, true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 非首次观看,从存储中获取进度
|
|
|
|
|
+ const storedProgress = uni.getStorageSync(this.videoProgressKey);
|
|
|
|
|
+ currentTime = storedProgress || 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
currentTime = diff % this.liveItem.duration;
|
|
currentTime = diff % this.liveItem.duration;
|
|
|
}
|
|
}
|
|
|
- } else if (this.liveItem.liveType === 3) {
|
|
|
|
|
- // 回放:从存储中获取进度
|
|
|
|
|
- const storedProgress = uni.getStorageSync(this.videoProgressKey);
|
|
|
|
|
- currentTime = storedProgress || 0;
|
|
|
|
|
}
|
|
}
|
|
|
const videoId = `myVideo_${this.liveId}`;
|
|
const videoId = `myVideo_${this.liveId}`;
|
|
|
const videoContext = uni.createVideoContext(videoId, this);
|
|
const videoContext = uni.createVideoContext(videoId, this);
|
|
@@ -4016,27 +4047,13 @@
|
|
|
videoContext.seek(currentTime);
|
|
videoContext.seek(currentTime);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- // onVideoWaiting(e) {
|
|
|
|
|
- // // console.log('视频等待加载', e);
|
|
|
|
|
- // if (this.liveItem.liveType == 2) {
|
|
|
|
|
- // this.startTrafficCalculation(this.bitrate);
|
|
|
|
|
- // } else {
|
|
|
|
|
- // let that = this;
|
|
|
|
|
- // if (this.trafficInterval) {
|
|
|
|
|
- // clearInterval(this.trafficInterval);
|
|
|
|
|
- // this.trafficInterval = null;
|
|
|
|
|
- // }
|
|
|
|
|
- // this.trafficInterval = setInterval(function() {
|
|
|
|
|
- // that.getInternetTraffic();
|
|
|
|
|
- // }, 10000);
|
|
|
|
|
- // }
|
|
|
|
|
- // },
|
|
|
|
|
onVideoWaiting(e) {
|
|
onVideoWaiting(e) {
|
|
|
// console.log('视频等待加载', e);
|
|
// console.log('视频等待加载', e);
|
|
|
if (this.liveItem.liveType == 2) {
|
|
if (this.liveItem.liveType == 2) {
|
|
|
- // 修改这里:不再传入固定码率,而是在方法内部计算
|
|
|
|
|
- this.startTrafficCalculation();
|
|
|
|
|
|
|
+ // 录播:只有在流量计算未启动时才启动,避免重复累计
|
|
|
|
|
+ if (!this.trafficTimer || this.trafficStartTime === 0) {
|
|
|
|
|
+ this.startTrafficCalculation();
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
if (this.trafficInterval) {
|
|
if (this.trafficInterval) {
|
|
@@ -4057,14 +4074,20 @@
|
|
|
this.waitingTimer = setTimeout(() => {
|
|
this.waitingTimer = setTimeout(() => {
|
|
|
const waitingDuration = Date.now() - this.waitingStartTime;
|
|
const waitingDuration = Date.now() - this.waitingStartTime;
|
|
|
const timeSinceLastUpdate = Date.now() - this.lastVideoUpdateTime;
|
|
const timeSinceLastUpdate = Date.now() - this.lastVideoUpdateTime;
|
|
|
-
|
|
|
|
|
|
|
+ const now = Date.now();
|
|
|
|
|
+ const timeSinceLastToast = now - this.lastNetworkUnstableToastTime;
|
|
|
|
|
+
|
|
|
// 只有在等待超过5秒,且视频时间超过3秒没有更新时,才认为是真正的卡顿/黑屏
|
|
// 只有在等待超过5秒,且视频时间超过3秒没有更新时,才认为是真正的卡顿/黑屏
|
|
|
|
|
+ // 并且距离上次提示至少30秒,避免频繁弹出(特别是对于短时长的预告视频)
|
|
|
if (waitingDuration >= 5000 && timeSinceLastUpdate >= 3000) {
|
|
if (waitingDuration >= 5000 && timeSinceLastUpdate >= 3000) {
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '当前您的网络不稳定',
|
|
|
|
|
- icon: 'loading',
|
|
|
|
|
- duration: 2000
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // 防抖:30秒内只弹出一次提示
|
|
|
|
|
+ if (timeSinceLastToast >= 30000 || this.lastNetworkUnstableToastTime === 0) {
|
|
|
|
|
+ this.$refs.customToast.show({
|
|
|
|
|
+ title: '当前您的网络不稳定',
|
|
|
|
|
+ duration: 2000
|
|
|
|
|
+ });
|
|
|
|
|
+ this.lastNetworkUnstableToastTime = now;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}, 5000); // 延迟5秒检测
|
|
}, 5000); // 延迟5秒检测
|
|
|
}
|
|
}
|
|
@@ -4352,8 +4375,10 @@
|
|
|
this.playVideo();
|
|
this.playVideo();
|
|
|
} else if (e.detail.code == 2004) {
|
|
} else if (e.detail.code == 2004) {
|
|
|
this.calculateTimeDiff(this.liveItem);
|
|
this.calculateTimeDiff(this.liveItem);
|
|
|
- // this.startTrafficCalculation(this.bitrateLive);
|
|
|
|
|
- this.startTrafficCalculation();
|
|
|
|
|
|
|
+ // 直播:只有在流量计算未启动时才启动,避免重复累计
|
|
|
|
|
+ if (!this.trafficTimer || this.trafficStartTime === 0) {
|
|
|
|
|
+ this.startTrafficCalculation();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// 2001: 已经连接服务器
|
|
// 2001: 已经连接服务器
|
|
|
// 2002: 已经连接服务器,开始拉流
|
|
// 2002: 已经连接服务器,开始拉流
|