VideoContext.seek

2020-08-26 16:31 更新

解释:跳转到指定位置(单位:s)

方法参数

Number position

示例 

开发者工具中打开


图片示例

代码示例

<view class="wrap">
    <video id="myVideo" auto enable-danmu="true" src="https://b.bdstatic.com/miniapp/development_tool/Smartprogram.mp4" rel="external nofollow" ></video>
    <button type="primary" bindtap="seek">seek</button>
</view>
Page({
    onLoad() {
        this.videoContext = swan.createVideoContext('myVideo');
        this.videoContext.play();
    },
    seek() {
        this.videoContext.seek(80); // 超出视频时长,此方法不生效
        swan.showToast({
            title: '跳转到80s处',
            icon: 'none'
        });
    }
});


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号