InnerAudioContext.offError

解释:取消监听 offError 事件

# 方法参数

Function callback

# 示例

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

# 图片示例

# 代码示例

    <view class="container">
        <view class="card-area">
            <button type="primary" bindtap="offError">取消监听onError</button>
        </view>
    </view>
    
    Page({
        onLoad() {
            const innerAudioContext = swan.createInnerAudioContext();
            innerAudioContext.src = 'https://b.bdstatic.com/miniapp/images/yanyuan.mp3';
            innerAudioContext.autoplay = false;
            innerAudioContext.onPlay(res => {
                swan.showToast({
                    title: 'onplay',
                    icon: 'none'
                });
            });
            innerAudioContext.onError(err => {
                swan.showModal({
                    title: 'onError',
                    content: JSON.stringify(err)
                });
                console.log('onError', err);
            });
            innerAudioContext.play();
            this.innerAudioContext = innerAudioContext;
        },
        offError() {
            swan.showModal({
                title: 'offError',
                content: '取消监听成功'
            });
            this.innerAudioContext.offError();
        }
    });