From e4bb88f1f21ea9b1f1280837a27560941ca0542c Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Sat, 17 Oct 2015 18:20:20 +0200 Subject: [PATCH] If already seeking, wait for current seek to complete --- .../service/playback/PlaybackServiceMediaPlayer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java index ca5c3e8b5..f6c71daa7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java @@ -500,12 +500,19 @@ public class PlaybackServiceMediaPlayer implements SharedPreferences.OnSharedPre statusBeforeSeeking = playerStatus; setPlayerStatus(PlayerStatus.SEEKING, media); } + if(seekLatch != null && seekLatch.getCount() > 0) { + try { + seekLatch.await(3, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Log.e(TAG, Log.getStackTraceString(e)); + } + } seekLatch = new CountDownLatch(1); mediaPlayer.seekTo(t); try { - seekLatch.await(10, TimeUnit.SECONDS); + seekLatch.await(3, TimeUnit.SECONDS); } catch (InterruptedException e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); } } else if (playerStatus == PlayerStatus.INITIALIZED) { media.setPosition(t);