InnerAudioContext.play

解释:播放

# 方法参数

# 示例

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

# 图片示例

# 代码示例

    <button type="primary" bindtap="play">play</button>
    
    Page({
        onLoad() {
            const innerAudioContext = swan.createInnerAudioContext();
            innerAudioContext.src = 'http://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.mp3';
            innerAudioContext.autoplay = false;
            innerAudioContext.onPlay(res => {
                swan.showModal({
                    title: 'onPlay',
                    content: JSON.stringify(res)
                });
                console.log('onPlay', res);
            });
            this.innerAudioContext = innerAudioContext;
        },
        play() {
            this.innerAudioContext.play();
        }
    });