InnerAudioContext.offPause
The InnerAudioContext.offPause
method allows mini program developers to remove an event listener previously registered with the InnerAudioContext.onPause
method. This stops the specified listener from monitoring the event that occurs when the audio is paused.
Parameters
Type | Required | Description |
Function listener | No | The callback that is passed to the |
Sample code
copy
const listener = () => {
console.log('on audio pause');
};
this.innerAudioContext = my.createInnerAudioContext();
this.innerAudioContext.src = 'https://www.sample.com/sample.mp3';
this.innerAudioContext.play();
setTimeout(() => {
this.innerAudioContext.pause();
}, 10000);
this.innerAudioContext.onPause(listener);
setTimeout(() => {
this.innerAudioContext.offPause(listener);
this.innerAudioContext.play();
}, 10010);
setTimeout(() => {
this.innerAudioContext.pause();
}, 20000);