Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MusicFactory: AssetFileDescriptor closed and method to load music async #205

Open
wants to merge 1 commit into
base: GLES2
Choose a base branch
from

Conversation

flomin
Copy link

@flomin flomin commented Apr 10, 2013

This patch add close() method to the file descriptors after the setDataSource call: according to the Android documentation of MediaPlayer.setDataSource: "It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns."

This patch also add a new method to load the Music asynchronously like this:

MusicFactory.createMusicFromAssetAsync(aMusicManager, aContext, aFilename, new IMusicLoadedListener() {
    @Override
    public boolean onError(MediaPlayer pPlayer, int pWhat, int pExtra) {
        Debug.e(LOG_TAG, "createMusicFromAssetAsync() KO: MediaPlayer.onErrorListener(...) : " + pWhat + ": " + pExtra);
        return true;
    }

    @Override
    public void onMusicLoaded(final Music pMusic) {
        if (pMusic != null) {
            pMusic.play();
        }
    }
});

MusicFactory: createMusicFromAssetAsync method and IMusicLoadedListener interface added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant