要在小程序中实现视频倍速播放功能,在微信小程序api开发文档中有描述:
https://developers.weixin.qq.com/miniprogram/dev/api/VideoContext.playbackRate.html?search-key=rate,
支持05/0.8/1.0/1.25/1.5倍率
微信小程序Video组件实现视频倍速播放
微信小程序Video组件实现视频倍速播放
下面整个demo:
https://developers.weixin.qq.com/s/w5mgzamw7454

1、wxml微信小程序Video组件实现视频倍速播放

  • wxml源码
<view class="mod_action">
  <button bindtap="bindButtonRate" data-rate='0.5'>倍速0.5</button>
    <button bindtap="bindButtonRate" data-rate='1'>倍速1</button>
    <button bindtap="bindButtonRate" data-rate='1.5'>倍速1.5</button>
  </view>

2、js
微信小程序Video组件实现视频倍速播放
3、创建播放器,缺少这一步会报以下错误
微信小程序Video组件实现视频倍速播放
报错的原因就是没有创建绑定播放器,但是在js中调用了playbackRate的方法微信小程序Video组件实现视频倍速播放
效果:
只是实现基本功能,样式就自行发挥了。
微信小程序Video组件实现视频倍速播放

相关文章: