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

Pause/resume works slowly #41

Open
anonym24 opened this issue Jun 7, 2017 · 3 comments
Open

Pause/resume works slowly #41

anonym24 opened this issue Jun 7, 2017 · 3 comments

Comments

@anonym24
Copy link

anonym24 commented Jun 7, 2017

Pause/resume working not instantly when I press pause/resume button.
So for example it has a little delay before it pauses after I pressed my pause button.
No such delay with default Android MediaPlayer, also apps like PowerAmp, AIMP don't have this problem.

I already use this solution to disable smooth fading, but this is quite another problem when it just works not fast as wanted

	factory = new OpenSLMediaPlayerFactory(activity.getApplicationContext()) {
			
			@Override
			protected int getMediaPlayerOptions () {
				return 0;
			}
			
		};
@h6ah4i
Copy link
Owner

h6ah4i commented Jun 11, 2017

@anonym24 Hi. Thank you for the issue report.

I have tweaked some parameters and try the following branch code 😉

@anonym24
Copy link
Author

anonym24 commented Jun 13, 2017

Yeah I see the difference (I compiled one project with current library and one with library from feature/improve_play_pause_response)

In previous library the biggest delay before pause had HybridMediaPlayerFactory (OpenSLMediaPlayerFactory was faster). Now I see that with the latest modified library it became much better (Standard MediaPlayer still has the fastest response)

switch (type) {
            case MediaPlayerStateStore.PLAYER_IMPL_TYPE_STANDARD:
                mFactory = new StandardMediaPlayerFactory(mContext);
                break;
            case MediaPlayerStateStore.PLAYER_IMPL_TYPE_OPENSL:
                mFactory = new OpenSLMediaPlayerFactory(mContext) {

                    @Override
                    protected int getMediaPlayerOptions () {
                        return 0;
                    }

                };
                break;
            case MediaPlayerStateStore.PLAYER_IMPL_TYPE_HYBRID:
                //mFactory = new HybridMediaPlayerFactory(mContext);
                mFactory = new HybridMediaPlayerFactory(mContext) {

                    @Override
                    protected int getMediaPlayerOptions () {
                        return 0;
                    }

                };
                break;
        }

Thanks!

@anonym24
Copy link
Author

Are you going to push this change to new version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants