InnerAudioContext.onStop
Function callback
示例
请使用百度APP扫码
- 在 swan 文件中
- 在 js 文件中
onLoad() {
const innerAudioContext = swan.createInnerAudioContext();
innerAudioContext.src = 'https://vd3.bdstatic.com/mda-ic7mxzt5cvz6f4y5/mda-ic7mxzt5cvz6f4y5.mp3';
innerAudioContext.onPlay(res => {
swan.showModal({
title: 'onPlay',
content: JSON.stringify(res)
console.log('onPlay', res);
});
innerAudioContext.onStop(res => {
swan.showModal({
title: 'onStop',
content: JSON.stringify(res)
console.log('onStop', res);
this.innerAudioContext = innerAudioContext;
},
play() {
this.innerAudioContext.play();
},
stop() {
this.innerAudioContext.stop();
}