InnerAudioContext.offPlay

    Function callback

    示例

    请使用百度APP扫码

    InnerAudioContext.offPlay - 图3

    • 在 swan 文件中
    • 在 js 文件中
    1. onLoad() {
    2. innerAudioContext.src = 'https://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.mp3';
    3. innerAudioContext.autoplay = false;
    4. innerAudioContext.onPlay(res => {
    5. swan.showModal({
    6. title: 'onPlay',
    7. });
    8. console.log('onPlay', res);
    9. });
    10. this.innerAudioContext = innerAudioContext;
    11. this.innerAudioContext.play();
    12. },
    13. swan.showModal({
    14. title: 'offPlay',
    15. content: '取消监听成功'
    16. });
    17. this.innerAudioContext.offPlay();
    18. });