InnerAudioContext.onPause

The InnerAudioContext.onPause method allows mini program developers to register a callback that is executed when the audio is paused.

Parameters

Type

Required

Description

Function listener

Yes

The callback to be executed when the audio is paused.

Sample code

copy
this.innerAudioContext = my.createInnerAudioContext();
this.innerAudioContext.src = 'https://www.sample.com/sample.mp3';
this.innerAudioContext.play();
setTimeout(() => {
  this.innerAudioContext.pause();
}, 10000);
this.innerAudioContext.onPause(() => {
  console.log('on audio pause');
});