|
@@ -917,11 +917,13 @@ export default {
|
|
|
// h5
|
|
|
vodPlayerJs: "https://player.polyv.net/script/player.js",
|
|
|
player: "",
|
|
|
- H5isAllowSeek: "off",
|
|
|
+ H5isAllowSeek: "on",
|
|
|
// stream: null,
|
|
|
faceUrl: "",
|
|
|
erJianErZao: false,
|
|
|
pauseTime: 0,
|
|
|
+ pauseTimer: null,
|
|
|
+ barTimer: null,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -932,13 +934,15 @@ export default {
|
|
|
"playVID",
|
|
|
"config",
|
|
|
]),
|
|
|
+ playSecIsLearn() {
|
|
|
+ return this.sectionItem.learning != 1;
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
showSet(n) {
|
|
|
if (n) {
|
|
|
// var polyvPlayerContext = this.selectComponent("#playerVideo")
|
|
|
if (polyvPlayerContext) {
|
|
|
- console.log(3213213);
|
|
|
// #ifdef MP-WEIXIN
|
|
|
polyvPlayerContext.pause();
|
|
|
// #endif
|
|
@@ -1156,7 +1160,38 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ erJianErZaoPauseTip() {
|
|
|
+ if (this.playSecIsLearn && this.erJianErZao) {
|
|
|
+ this.pauseTime = Date.now();
|
|
|
+ this.pauseTimer = setInterval(() => {
|
|
|
+ if (Date.now() - this.pauseTime > 60 * 1000) {
|
|
|
+ let text = this.photoPopup ? "拍照停留" : "暂停";
|
|
|
+ this.photoPopup = false;
|
|
|
+ uni.showModal({
|
|
|
+ title: "提示",
|
|
|
+ showCancel: false,
|
|
|
+ content: `检测${text}时间过长,刷新当前页面`,
|
|
|
+ cancelText: "取消",
|
|
|
+ confirmText: "确定",
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ // #ifdef H5
|
|
|
+ location.reload();
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ pages[pages.length - 1].onload();
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ clearInterval(this.pauseTimer);
|
|
|
|
|
|
+ this.pauseTimer = null;
|
|
|
+ }
|
|
|
+ }, 5000);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 原来onshow里面的内容
|
|
|
originOnShow() {
|
|
|
this.getbaseprofiletplists().then((res) => {
|
|
@@ -1292,11 +1327,19 @@ export default {
|
|
|
uni.$off();
|
|
|
this.clearTimer && clearTimeout(this.clearTimer);
|
|
|
this.toastTimer && clearTimeout(this.toastTimer);
|
|
|
+
|
|
|
if (this.studyTimer) {
|
|
|
clearInterval(this.studyTimer);
|
|
|
this.hasStart = false;
|
|
|
}
|
|
|
-
|
|
|
+ if (this.pauseTimer) {
|
|
|
+ clearInterval(this.pauseTimer);
|
|
|
+ this.pauseTimer = null;
|
|
|
+ }
|
|
|
+ if (this.barTimer) {
|
|
|
+ clearInterval(this.barTimer);
|
|
|
+ this.barTimer = null;
|
|
|
+ }
|
|
|
this.timer && clearInterval(this.timer);
|
|
|
if (this.lockTimer) {
|
|
|
clearInterval(this.lockTimer);
|
|
@@ -2217,6 +2260,10 @@ export default {
|
|
|
let photoNum = this.photoNum;
|
|
|
if (!this.photoConfig) {
|
|
|
this.photoConfig = true;
|
|
|
+ if (this.erJianErZao) {
|
|
|
+ this.photoList = this.randomConfig(totalVideoTime, duration);
|
|
|
+ return;
|
|
|
+ }
|
|
|
//没有历史拍照间隔数据
|
|
|
if (this.photoList.length == 0) {
|
|
|
if (totalVideoTime >= 900) {
|
|
@@ -2275,18 +2322,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 随机拍摄时间
|
|
|
- randomConfigPhoto() {
|
|
|
- if(this.pauseTime&&Date.now()-this.pauseTime){
|
|
|
-
|
|
|
- }
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- let totalVideoTime = polyvPlayerContext.getDuration();
|
|
|
- let duration = polyvPlayerContext.getCurrentTime();
|
|
|
- // #endif
|
|
|
- // #ifdef H5
|
|
|
- let totalVideoTime = polyvPlayerContext.j2s_getDuration();
|
|
|
- let duration = polyvPlayerContext.j2s_getCurrentTime();
|
|
|
- // #endif
|
|
|
+ randomConfig(totalVideoTime, duration) {
|
|
|
this.photoHistoryList = [];
|
|
|
let photoList = [duration];
|
|
|
let pre = duration;
|
|
@@ -2299,7 +2335,7 @@ export default {
|
|
|
photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
|
|
|
}
|
|
|
}
|
|
|
- this.photoList = photoList;
|
|
|
+ return photoList;
|
|
|
},
|
|
|
getLiveUid(channelId) {
|
|
|
let self = this;
|
|
@@ -2951,7 +2987,7 @@ export default {
|
|
|
// #ifdef H5
|
|
|
this.playTime = polyvPlayerContext.j2s_getCurrentTime();
|
|
|
// #endif
|
|
|
- !this.erJianErZao ? this.configPhoto() : this.randomConfigPhoto();
|
|
|
+ this.configPhoto();
|
|
|
console.info(this.photoList, "photoList");
|
|
|
let photoTime = 0; //获取拍照秒数
|
|
|
for (let i = 0; i < this.photoList.length; i++) {
|
|
@@ -3024,6 +3060,7 @@ export default {
|
|
|
onStateChange(newstate, oldstate) {
|
|
|
polyvPlayerContext = this.selectComponent("#playerVideo");
|
|
|
if (newstate.detail.newstate == "playing") {
|
|
|
+ this.pauseTime = 0;
|
|
|
if (this.needSeek) {
|
|
|
// var polyvPlayerContext = this.selectComponent("#playerVideo");
|
|
|
if (this.recordObj.videoCurrentTime) {
|
|
@@ -3047,20 +3084,17 @@ export default {
|
|
|
}
|
|
|
//开始播放
|
|
|
this.timer && clearInterval(this.timer);
|
|
|
- if (
|
|
|
- this.sectionItem.learning != 1 &&
|
|
|
- (this.erJianErZao || this.photoNum > 0)
|
|
|
- ) {
|
|
|
+ if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
|
|
|
this.timer = setInterval(this.timeEvent, 1000); //定时器
|
|
|
}
|
|
|
}
|
|
|
if (newstate.detail.newstate == "pause") {
|
|
|
- this.pauseTime = Date.now();
|
|
|
- console.log("小程序暂停", this.pauseTime);
|
|
|
+ console.log("暂停");
|
|
|
+ this.erJianErZaoPauseTip();
|
|
|
clearInterval(this.timer);
|
|
|
+ //暂停提交记录
|
|
|
}
|
|
|
if (newstate.detail.newstate == "ended") {
|
|
|
- this.pauseTime = 0;
|
|
|
clearInterval(this.timer);
|
|
|
uni.showToast({
|
|
|
icon: "none",
|
|
@@ -3069,6 +3103,7 @@ export default {
|
|
|
this.hasStart = false;
|
|
|
this.postStudyRecord(1);
|
|
|
this.nextSection();
|
|
|
+ // uni.$emit('playNext') //播放重修下一节
|
|
|
}
|
|
|
},
|
|
|
//播放下一节
|
|
@@ -3149,7 +3184,6 @@ export default {
|
|
|
|
|
|
//拍照
|
|
|
openPhoto() {
|
|
|
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
|
|
|
if (polyvPlayerContext) {
|
|
|
// #ifdef MP-WEIXIN
|
|
|
polyvPlayerContext.exitFullScreen();
|
|
@@ -3431,7 +3465,7 @@ export default {
|
|
|
self.isAllowSeek = "yes";
|
|
|
// #endif
|
|
|
// #ifdef H5
|
|
|
- this.H5isAllowSeek = "off";
|
|
|
+ self.H5isAllowSeek = "off";
|
|
|
// #endif
|
|
|
}
|
|
|
if (self.goodsPlayConfig.speed > 0) {
|
|
@@ -3675,15 +3709,9 @@ export default {
|
|
|
// 播放视频
|
|
|
loadPlayer() {
|
|
|
const polyvPlayer = window.polyvPlayer;
|
|
|
- console.log(
|
|
|
- "h5开始",
|
|
|
- polyvPlayer,
|
|
|
- this.recordObj.videoCurrentTime,
|
|
|
- 666,
|
|
|
- this.vid
|
|
|
- );
|
|
|
+ this.pauseTime = 0;
|
|
|
this.$api.polyvVideoSign(this.vid).then(async (res) => {
|
|
|
- console.log("播放凭证res", res);
|
|
|
+ console.log("播放凭证res", res, 465555555555555555555);
|
|
|
this.player = await polyvPlayer({
|
|
|
wrap: "#player",
|
|
|
width: "100%",
|
|
@@ -3716,6 +3744,26 @@ export default {
|
|
|
this.player.on("s2j_onPlayStart", (vid) => {
|
|
|
// 视频初次播放时触发
|
|
|
console.log("视频初次播放时触发:");
|
|
|
+ // #ifdef H5
|
|
|
+ // h5禁止拖动进度条
|
|
|
+ clearInterval(this.barTimer);
|
|
|
+ this.barTimer = null;
|
|
|
+ let originTime = this.recordObj.videoCurrentTime || 0;
|
|
|
+ if (this.H5isAllowSeek == "on" && !this.barTimer) {
|
|
|
+ this.barTimer = setInterval(function () {
|
|
|
+ const currentTime = polyvPlayerContext.j2s_getCurrentTime();
|
|
|
+ // console.log(currentTime, originTime)
|
|
|
+ if (
|
|
|
+ currentTime - originTime > 1 ||
|
|
|
+ currentTime - originTime < 0
|
|
|
+ ) {
|
|
|
+ polyvPlayerContext.j2s_seekVideo(originTime);
|
|
|
+ } else {
|
|
|
+ originTime = currentTime;
|
|
|
+ }
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
this.loadedmetadata();
|
|
|
this.postStudyRecord(0);
|
|
|
});
|
|
@@ -3723,6 +3771,8 @@ export default {
|
|
|
this.player.on("s2j_onVideoPause", () => {
|
|
|
// 视频暂停时触发
|
|
|
console.log("视频暂停时触发", this.vid);
|
|
|
+ this.erJianErZaoPauseTip();
|
|
|
+
|
|
|
clearInterval(this.studyTimer);
|
|
|
clearInterval(this.timer);
|
|
|
});
|
|
@@ -3748,10 +3798,7 @@ export default {
|
|
|
}
|
|
|
//开始播放
|
|
|
this.timer && clearInterval(this.timer);
|
|
|
- if (
|
|
|
- this.sectionItem.learning != 1 &&
|
|
|
- (this.erJianErZao || this.photoNum > 0)
|
|
|
- ) {
|
|
|
+ if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
|
|
|
this.timer = setInterval(this.timeEvent, 1000); //定时器
|
|
|
}
|
|
|
|