InnerAudioContext.stop
2020-08-26 16:27 更新
解释:停止
方法参数
无
示例
图片示例
代码示例
<view class="wrap">
<view class="card-area">
<button type="primary" bindtap="play">play</button>
<button type="primary" bindtap="stop">stop</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);
});
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();
}
});
以上内容是否对您有帮助:
更多建议: