video组件可以调用pause和play方法,但是playbackRate配置了(0.5 0.75 1.25 1.5)都不生效.
<template>
<view style="margin-top: 250rpx;">
<video id="videoRef" ref="videoRef"
src="http://192.168.4.1/media/Front/2025-02-19/2025-02-19-10-16-11/F_2025-02-19-10-16-12.mp4"
style="width: 100%;" @play="onplay">
</video>
<button @click="stop" style="margin-bottom: 20rpx;">stop</button>
<button @click="speed" style="margin-bottom: 20rpx;">speed</button>
<button @click="play" style="margin-bottom: 20rpx;">play</button>
</view>
</template>
<script>
export default {
data() {
return {
videoContext: null,
};
},
onReady() {
this.videoContext = uni.createVideoContext('videoRef', this);
},
mounted() {
},
methods: {
onplay() {},
stop() {
this.videoContext.pause();
},
speed() {
this.videoContext.playbackRate(1.5);
},
play() {
this.videoContext.play()
}
}
};
</script>