Android : Mediaplayer plays music after 1 or 1.5 sec delays in Nexus Android 4.4.3

on Monday, July 14, 2014


I am using mediaplayer class to play .aac music files which is under raw resource. All the device performs well and start playing of each .aac file on user interaction but Nexus 5 with having Android 4.4.3 creating problem , It plays music after 1 or 2 sec delay. Also a same code working fine with Android Kitkat 4.4.2 (MOTO G Android Device) Below is my code



Intent i = new Intent(MusicClass.this, PlayerService.class);
i.putExtra("isplaying", "stop");
startService(i);


PlayerService class



public class PlayerService extends Service implements OnCompletionListener
private IMyRemoteService.Stub myRemoteServiceStub = new IMyRemoteService.Stub() {

@Override
public boolean isMusicPlaying() throws RemoteException {
if (mPlayer != null) {
if (mPlayer.isPlaying()) {
return true;
} else {
return false;
}
} else {
return false;
}
}


I have referred below links but not luck Link 1 & Link 2 So waht can be the solution for Android


0 comments:

Post a Comment