InnerAudioContext.seek

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

# 方法参数

Number position

# 示例

扫码体验
重新加载
请使用百度APP扫码

# 图片示例

# 代码示例

    <view class="wrap">
        <view class="card-area">
            <button type="primary" bindtap="seek">跳转到80s处</button>
        </view>
    </view>
    
    Page({
        onLoad() {
            const innerAudioContext = swan.createInnerAudioContext();
            innerAudioContext.src = 'https://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.mp3';
            innerAudioContext.autoplay = true;
            innerAudioContext.onPlay(res => {
                swan.showModal({
                    title: 'onPlay',
                    content: JSON.stringify(res)
                });
                console.log('onPlay', res);
            });
            innerAudioContext.onSeeked(res => {
                swan.showModal({
                    title: 'onSeeked',
                    content: '跳转完成'
                });
            });
            innerAudioContext.onSeeking(res => {
                swan.showModal({
                    title: 'onSeeking',
                    content: '正在跳转至音频80s后'
                });
            });
            this.innerAudioContext = innerAudioContext;
        },
        seek() {
            this.innerAudioContext.seek(80);
        }
    });