This commit is contained in:
@fawn-nine
2024-07-23 16:24:52 +08:00
parent 85d2d7f41b
commit dfaa65c7a2

View File

@@ -168,17 +168,7 @@
const ctx = this.$refs.myVideo;
ctx.exitFullScreen();
},
// 播放进度改变
// videoTimeUpdateEvent(e) {
// this.playTime = parseInt(e.detail.currentTime);
// this.currentTime = parseInt(e.detail.currentTime);
// this.allTime = parseInt(e.detail.duration);
// this.recordTime({
// time: this.playTime,
// });
// },
//
async init(data, isChange) {
this.show = false;
this.platform = this.$platform;
@@ -248,6 +238,7 @@
});
});
},
// 配置播放项
async getData(data, isChange) {
var that = this;
if (!this.isSetFirstTime) {
@@ -289,10 +280,7 @@
}
this.isSetFirstTime = true;
},
async playVideo(e) {
this.videoContext = uni.createVideoContext("videoId", this);
this.videoContext.seek(this.firstTime);
},
// 存储本地播放时间
recordTime(data) {
// console.log('recordTime',data.time);
this.currentTime = data.time;
@@ -301,9 +289,7 @@
if (uni.getStorageSync("videoOssList")) {
list = JSON.parse(uni.getStorageSync("videoOssList"));
}
var index = list.findIndex((e) => e.id == this.videoData.id);
// console.log('recordTime------',index,list );
if (list.length > 0 && index >= 0) {
list[index] = {
@@ -316,10 +302,9 @@
time: data.time,
});
}
uni.setStorageSync("videoOssList", JSON.stringify(list));
},
// 获取数据
// 获取播放凭证
async getLive(isChange) {
var that = this;
this.isfresh = false;
@@ -385,13 +370,10 @@
that.$forceUpdate();
});
},
async handleEnd() {
// console.log('进来了吗handleEnd')
console.log("找到了吗????",this.videoData.id);
var list = JSON.parse(uni.getStorageSync("videoOssList"));
var data = list.find((e) => e.id == this.videoData.id);
console.log("找到了吗????");
// data.time ? this.currentTime = data.time : this.currentTime = 0;
this.currentTime = data.time;
console.log(
"this.currentTime at line 这是结束的时候掉的存储视频:",
@@ -401,12 +383,14 @@
clearInterval(this.$store.state.videoTimer);
this.timer = null;
},
// 存储时长到线上
setVideoTime(time) {
var data = {};
console.log("是否走了存储视屏," + this.videoData.id, this.currentTime);
var data = {
videoId: this.videoData.id,
position: this.currentTime, //秒数
loadAnimate: 'none',
};
$http
@@ -433,7 +417,7 @@
delta: 1,
});
},
// 设置初始播放时间 并开启定时器
async setVideoFirtsetTime(time) {
this.currentTime = this.firstTime;
console.log("这里准备开始设置播放时间:", this.currentTime);
@@ -743,18 +727,6 @@
var player = new Aliplayer(playerOptions, function(player) {});
this.player = player;
console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
// if (this.platform == 'ios') {
// this.player.one('timeupdate', () => {
// this.player.seek(this.firstTime);
// })
// } else {
// // if(player){
// this.player.seek(this.firstTime)
// // }
// }
clearInterval(this.videoTimer);
@@ -763,8 +735,6 @@
var that = this;
that.curTime = parseInt(this.player.getCurrentTime());
that.curStatus = this.player.getStatus()
}, 1000);
this.$refs.videoContent4.click()
player.on('ready', function() {
@@ -778,8 +748,6 @@
console.log('正在播放')
})
this.player.on('ended', function() {
// console.log('that.curTime at line 242:', this.curTime)
// console.log('that.curStatus at line 210:', this.curStatus)
this.$refs.videoContent2.click()
})
},