Home > Backend Development > PHP Tutorial > javascript - WeChat audio interface, audio playback will not stop even if you leave the current page

javascript - WeChat audio interface, audio playback will not stop even if you leave the current page

WBOY
Release: 2016-08-04 09:22:09
Original
1282 people have browsed it

<code>$(window).bind('beforeunload', function(){
    if(localId)
    {
        wx.stopVoice({
        localId:localId
        });
    }
});
</code>
Copy after login
Copy after login

Can’t call the wx.stopVoice interface when leaving the current page? What should I do to make the audio stop playing when I leave the page

Reply content:

<code>$(window).bind('beforeunload', function(){
    if(localId)
    {
        wx.stopVoice({
        localId:localId
        });
    }
});
</code>
Copy after login
Copy after login

Can’t call the wx.stopVoice interface when leaving the current page? What should I do to make the audio stop playing when I leave the page

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template