const itemList = [{
label: '0.5x',
value: 0.5
}, {
label: '0.8x',
value: 0.8
}, {
label: '1.0x',
value: 1.0
}, {
label: '1.5x',
value: 1.5
}, {
label: '2.0x',
value: 2.0
}]
const videoContext = uni.createVideoContext('myVideo', instance.proxy);
uni.showActionSheet({
title: '播放倍速',
itemList: itemList.map(item => item.label),
success(res) {
console.log(itemList[res.tapIndex].value)
videoContext.playbackRate(itemList[res.tapIndex].value)
}
})

- 发布:2025-04-30 18:04
- 更新:2025-04-30 18:12
- 阅读:54
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: window10
HBuilderX类型: 正式
HBuilderX版本号: 4.57
手机系统: Android
手机系统版本号: Android 7.1.1
手机厂商: sunmi 手持机
手机机型: sunmi v2
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
const itemList = [{
label: '0.5x',
value: 0.5
}, {
label: '0.8x',
value: 0.8
}, {
label: '1.0x',
value: 1.0
}, {
label: '1.5x',
value: 1.5
}, {
label: '2.0x',
value: 2.0
}]
const videoContext = uni.createVideoContext('myVideo', instance.proxy);
uni.showActionSheet({
title: '播放倍速',
itemList: itemList.map(item => item.label),
success(res) {
console.log(itemList[res.tapIndex].value)
videoContext.playbackRate(itemList[res.tapIndex].value)
}
})
const itemList = [{
label: '0.5x',
value: 0.5
}, {
label: '0.8x',
value: 0.8
}, {
label: '1.0x',
value: 1.0
}, {
label: '1.5x',
value: 1.5
}, {
label: '2.0x',
value: 2.0
}]
const videoContext = uni.createVideoContext('myVideo', instance.proxy);
uni.showActionSheet({
title: '播放倍速',
itemList: itemList.map(item => item.label),
success(res) {
console.log(itemList[res.tapIndex].value)
videoContext.playbackRate(itemList[res.tapIndex].value)
}
})
预期结果:
video 播放倍速playbackRate 设为数字 2和 数字2.0 无效,数字1.5有效
video 播放倍速playbackRate 设为数字 2和 数字2.0 无效,数字1.5有效
实际结果:
video 播放倍速playbackRate 设为数字 2和 数字2.0 无效,数字1.5有效
video 播放倍速playbackRate 设为数字 2和 数字2.0 无效,数字1.5有效
bug描述:
video 播放倍速playbackRate 设为数字 2和 数字2.0 无效,数字1.5有效
2 个回复
2***@qq.com (作者)
nvue 有效,vue无效
爱豆豆 - 办法总比困难多
看文档描述的话 只有微信小程序支持到2倍
参考文档:https://uniapp.dcloud.net.cn/api/media/video-context.html#createvideocontext