cordova-plugin-nativeaudio icon indicating copy to clipboard operation
cordova-plugin-nativeaudio copied to clipboard

Resume App incorrect behaviour for looping music

Open Galaen opened this issue 8 years ago • 0 comments

If I loop a song using preloadComplex and loop methods, everything works fine as long as I do not stop the music.

But if I stop the music (without unloading it) and I put the App in background, when the App is resumed the music is also resumed (which is bad as the music were not playing before leaving).

If the music is preloaded but never looped, Resuming the App in this case won't resume the music (which is good).

I might be wrong, as I don't really know Android but I'm not sure isLooping means that the music is playing, just that "loop" mode is activated. In this case, this would be the problem:

    public boolean pause()
    {
        try
        {
                if ( mp.isLooping() || mp.isPlaying() )
                {
                    mp.pause();
                    return true;
                }
        }
        catch (IllegalStateException e)
        {
        // I don't know why this gets thrown; catch here to save app
        }
        return false;
    }

I see that someone has already made a pull request here, for the same problem.

I can at least see the problem described here on an Android S5 on OS 4.4.2

Galaen avatar Jan 29 '16 19:01 Galaen