android-openslmediaplayer icon indicating copy to clipboard operation
android-openslmediaplayer copied to clipboard

Pause/resume works slowly

Open anonym24 opened this issue 8 years ago • 3 comments
trafficstars

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;
			}
			
		};

anonym24 avatar Jun 07 '17 19:06 anonym24

@anonym24 Hi. Thank you for the issue report.

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

h6ah4i avatar Jun 11 '17 13:06 h6ah4i

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 avatar Jun 13 '17 19:06 anonym24

Are you going to push this change to new version?

anonym24 avatar Sep 16 '17 19:09 anonym24