播放器禁止拖动设置修改

This commit is contained in:
joshen
2024-06-24 08:40:05 +08:00
parent a7c041b010
commit fe310b2a71
3 changed files with 55 additions and 44 deletions

View File

@@ -22,11 +22,12 @@
<image :src="require(playing? './images/pause.png':'./images/play.png')" @click.stop='videoOpreation'/>
</view>
<view class="currtime">{{currtime}}</view>
<!-- <cover-view v-if="drag" class='slider-container'>
<cover-view v-if="drag" class='slider-container'>
<slider @change.stop="sliderChange" @changing="sliderChanging" step="1" :value="sliderValue" backgroundColor="#9f9587" activeColor="#d6d2cc" block-color="#FFFFFF" block-size="12"/>
<slider v-if="!drag" disabled="true" step="1" :value="sliderValue" backgroundColor="#9f9587" activeColor="#d6d2cc" block-color="#FFFFFF" block-size="12"/>
</cover-view> v-if="!drag" -->
<view class='slider-container new-bar'>
<!-- <slider v-if="!drag" disabled="true" step="1" :value="sliderValue" backgroundColor="#9f9587" activeColor="#d6d2cc" block-color="#FFFFFF" block-size="12"/> -->
</cover-view>
<view v-if="!drag" class='slider-container new-bar'>
<progressBar
:currentProgress="sliderValue"
:blobId="blobId"
@@ -139,28 +140,30 @@
methods: {
/* 点击进度条更新视频播放进度
*/
updateProgressByClickBar(value) {
console.log('value------:',value)
let duration = this.curVideo.duration;
let new_current_time = Math.round(value * duration);
// this.barrageTimelineStart = new_current_time;
this.curVideo.currentTime = new_current_time;
this.sliderValue = value * 100;
this.videoContext.seek(new_current_time);
updateProgressByClickBar(type,value) {
let duration = this.curVideo.duration;
let second = Math.round(value * duration);
this.curVideo.currentTime = second;
this.sliderValue= value * 100,
this.druationTime = this.formatSeconds(duration);
this.currtime = this.formatSeconds(second);
// var duration=this.curVideo.duration;
// var second=e.detail.value / 100 * duration;
// if (duration) { //完成拖动后,计算对应时间并跳转到指定位置
// this.videoContext.seek(second);
// this.sliderValue= e.detail.value,
// this.updateState= true //完成拖动后允许更新滚动条
// this.druationTime = this.formatSeconds(duration);
// this.currtime = this.formatSeconds(second);
// }
// var second= value * duration;
if (duration) { //完成拖动后,计算对应时间并跳转到指定位置
if(type === 'start'){
this.updateState= false;
}
if( type === 'end'){
this.videoContext.seek(second);
this.curVideo.currentTime = second;
this.updateState= true //完成拖动后允许更新滚动条
//alert('value000------:'+value+'---'+this.curVideo.duration)
}
}
},
/* 获取鼠标是否按下了进度条
*/
@@ -220,7 +223,6 @@
let duration=this.curVideo.duration;
let sliderValue = e.detail.currentTime / duration * 100;
let second=sliderValue / 100 * duration;
// console.log('onTimeUpdate11111::',this.drag,second)
// if(!this.drag){
// this.videoContext.seek(second);
@@ -268,6 +270,7 @@
sliderChange(e) {
var duration=this.curVideo.duration;
var second=e.detail.value / 100 * duration;
// alert(e.detail.value + '--slider--'+duration + '--' +second)
if (duration) { //完成拖动后,计算对应时间并跳转到指定位置
this.videoContext.seek(second);
this.sliderValue= e.detail.value,