Parcourir la source

fix 随机拍

he2802 il y a 3 ans
Parent
commit
c2d12b5c9b
1 fichiers modifiés avec 9 ajouts et 12 suppressions
  1. 9 12
      pages3/polyv/detail.vue

+ 9 - 12
pages3/polyv/detail.vue

@@ -470,7 +470,7 @@ export default {
 				currentTime = polyvPlayerContext.getCurrentTime();
 			}
 			let self = this;
-			let photoIndex = self.photoIndex-1
+			let photoIndex = self.photoIndex
 			let data = {
 				photo: self.ossAvatarUrl,
 				sectionId: parseInt(self.playSectionId),
@@ -1027,28 +1027,25 @@ export default {
 			if (polyvPlayerContext != null) {
 				
 				this.playTime = polyvPlayerContext.getCurrentTime() //播放时刻
+				console.log(this.photoIndex,789)
 				//判断是否需要拍照
 				if (this.photoNum > 0) {
 					this.configPhoto()
-					if(this.photoIndex<this.photoList.length){
-						let photoTime = Number(this.photoList[this.photoIndex]); //获取拍照秒数
-						let nextIndex = this.photoIndex+1
-						let nextTime = 0
-						if(nextIndex<this.photoList.length){
-							nextTime = Number(this.photoList[nextIndex]); //获取下次拍照秒数
-						}
-						if (photoTime < this.playTime&&photoTime>this.playTime-4) { //3秒区间内才触发拍照,避免拉动滚动条 
-							if(this.photoHistoryList.indexOf(this.photoIndex)<0){ //不存在拍照历史则拍照
+					let photoTime =0; //获取拍照秒数
+					for(let i=0;i<this.photoList.length;i++){
+						photoTime = Number(this.photoList[i]); //获取拍照秒数
+						if (photoTime < this.playTime&&photoTime>this.playTime-4) { //3秒区间内才触发拍照,避免拉动滚动条
+							if(this.photoHistoryList.indexOf(i)<0){ //不存在拍照历史则拍照
 								//启动拍照
 								//暂停
 								polyvPlayerContext.exitFullScreen();
 								polyvPlayerContext.pause();
-								this.photoIndex++;
+								this.photoHistoryList.push(i)
 								this.openPhoto();
+								this.photoIndex = i
 								
 							}
 							
-							
 						}
 					}