InnerAudioContext.offPlay

2020-08-26 16:28 更新

解釋?zhuān)喝∠O(jiān)聽(tīng) onPlay 事件

方法參數(shù)

Function callback

示例 

在開(kāi)發(fā)者工具中打開(kāi)


圖片示例

代碼示例

<view class="wrap">
    <view class="card-area">
        <button type="primary" bindtap="offPlay">取消監(jiān)聽(tīng)onPlay</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.showModal({
                title: 'onPlay',
                content: JSON.stringify(res)
            });
            console.log('onPlay', res);
        });
        this.innerAudioContext = innerAudioContext;
        this.innerAudioContext.play();
    },
    offPlay() {
        swan.showModal({
            title: 'offPlay',
            content: '取消監(jiān)聽(tīng)成功'
        });
        this.innerAudioContext.offPlay();
    }
});


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)