尝试解决时间乱跳的问题

This commit is contained in:
@fawn-nine
2024-08-15 14:18:45 +08:00
parent e9bcc83e4c
commit 69176ffbd9
2 changed files with 15 additions and 9 deletions

View File

@@ -24,7 +24,7 @@
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
}, },
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {

View File

@@ -450,6 +450,7 @@
var ReplayVideoFlag = false var ReplayVideoFlag = false
var curStatus = null var curStatus = null
var diff = 0 var diff = 0
var pauseTime = 0
var myplayer = undefined var myplayer = undefined
import $ from 'jquery' import $ from 'jquery'
export default { export default {
@@ -582,10 +583,11 @@
this.player.dispose(); this.player.dispose();
$('#url-player-test').empty(); $('#url-player-test').empty();
this.player = null; this.player = null;
myplayer = null myplayer = undefined
console.log('上一条视频的状态,',this.player.getStatus()); console.log('上一条视频的状态,',this.player.getStatus());
} }
pauseTime = 0
var fullScreenButtonComponent = Aliplayer.Component({ var fullScreenButtonComponent = Aliplayer.Component({
/** /**
* 初始函数在new对象时调用 * 初始函数在new对象时调用
@@ -788,10 +790,11 @@
$('.videoContent9').click() $('.videoContent9').click()
}) })
player.on('play', function() { player.on('play', function() {
console.log('开始播放------'); console.log('开始播放------');
$('.videoContent7').click() $('.videoContent7').click()
if(pauseTime > 0){
player.seek(pauseTime);
}
}) })
player.one('canplay', function() { player.one('canplay', function() {
// console.log('这是ios数据缓冲初次设置播放位置判断', videoData) // console.log('这是ios数据缓冲初次设置播放位置判断', videoData)
@@ -813,6 +816,7 @@
console.log('正在播放...') console.log('正在播放...')
}) })
this.player.on('timeupdate', function() { this.player.on('timeupdate', function() {
let that = this let that = this
var _time = parseInt(player.getCurrentTime()) var _time = parseInt(player.getCurrentTime())
@@ -834,10 +838,12 @@
$('.videoContent2').click() $('.videoContent2').click()
$('.videoContent6').click() $('.videoContent6').click()
}) })
this.player.on('pause', function() { player.on('pause', function() {
console.log('触发暂停') pauseTime = parseInt(player.getCurrentTime())
this.player.pause(true) player.pause(true)
console.log('触发暂停', pauseTime)
}) })
this.player.on('error', function() { this.player.on('error', function() {
console.log('播放出错') console.log('播放出错')
$('.videoContent5').click() $('.videoContent5').click()