InnerAudioContext.onStop

    Function callback

    示例

    请使用百度APP扫码

    InnerAudioContext.onStop - 图3

    • 在 swan 文件中
    • 在 js 文件中
    1. onLoad() {
    2. const innerAudioContext = swan.createInnerAudioContext();
    3. innerAudioContext.src = 'https://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.mp3';
    4. innerAudioContext.onPlay(res => {
    5. swan.showModal({
    6. title: 'onPlay',
    7. content: JSON.stringify(res)
    8. console.log('onPlay', res);
    9. });
    10. innerAudioContext.onStop(res => {
    11. swan.showModal({
    12. title: 'onStop',
    13. content: JSON.stringify(res)
    14. console.log('onStop', res);
    15. this.innerAudioContext = innerAudioContext;
    16. },
    17. play() {
    18. this.innerAudioContext.play();
    19. },
    20. stop() {
    21. this.innerAudioContext.stop();
    22. }