mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-01-05 13:26:45 +01:00
Fixed unnecessary starts
This commit is contained in:
parent
3d61dde83f
commit
4b0809f905
@ -176,28 +176,6 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void seekTo(final int position)
|
||||
{
|
||||
MediaPlayerService.executeOnStartedMediaPlayerService(context, new Consumer<MediaPlayerService>() {
|
||||
@Override
|
||||
public void accept(MediaPlayerService mediaPlayerService) {
|
||||
mediaPlayerService.seekTo(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void pause()
|
||||
{
|
||||
MediaPlayerService.executeOnStartedMediaPlayerService(context, new Consumer<MediaPlayerService>() {
|
||||
@Override
|
||||
public void accept(MediaPlayerService mediaPlayerService) {
|
||||
mediaPlayerService.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void start()
|
||||
{
|
||||
@ -209,15 +187,25 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void seekTo(final int position)
|
||||
{
|
||||
MediaPlayerService mediaPlayerService = MediaPlayerService.getRunningInstance();
|
||||
if (mediaPlayerService != null) mediaPlayerService.seekTo(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void pause()
|
||||
{
|
||||
MediaPlayerService mediaPlayerService = MediaPlayerService.getRunningInstance();
|
||||
if (mediaPlayerService != null) mediaPlayerService.pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void stop()
|
||||
{
|
||||
MediaPlayerService.executeOnStartedMediaPlayerService(context, new Consumer<MediaPlayerService>() {
|
||||
@Override
|
||||
public void accept(MediaPlayerService mediaPlayerService) {
|
||||
mediaPlayerService.stop();
|
||||
}
|
||||
});
|
||||
MediaPlayerService mediaPlayerService = MediaPlayerService.getRunningInstance();
|
||||
if (mediaPlayerService != null) mediaPlayerService.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -269,6 +269,7 @@ public class MediaPlayerLifecycleSupport
|
||||
mediaPlayerController.togglePlayPause();
|
||||
break;
|
||||
case Constants.CMD_STOP:
|
||||
// TODO: There is a stop() function, shouldn't we use that?
|
||||
mediaPlayerController.pause();
|
||||
mediaPlayerController.seekTo(0);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user