InnerAudioContext.onEnded
The InnerAudioContext.onEnded
method allows mini program developers to register a callback that is executed when the audio finishes playing.
Parameters
Type | Required | Description |
Function listener | Yes | The callback to be executed when the audio finishes playing. |
Sample code
copy
this.innerAudioContext = my.createInnerAudioContext();
this.innerAudioContext.src = 'https://www.sample.com/sample.mp3';
this.innerAudioContext.play();
this.innerAudioContext.onEnded(() => {
console.log('on audio play ended');
});