Give it some time to read current position

This commit is contained in:
Martin Fietz 2016-02-18 08:40:15 +01:00
parent b65efb3cba
commit d818901b80

View File

@ -604,7 +604,11 @@ public class PlaybackServiceMediaPlayer implements SharedPreferences.OnSharedPre
* Returns the position of the current media object or INVALID_TIME if the position could not be retrieved.
*/
public int getPosition() {
if (!playerLock.tryLock()) {
try {
if (!playerLock.tryLock(50, TimeUnit.MILLISECONDS)) {
return INVALID_TIME;
}
} catch (InterruptedException e) {
return INVALID_TIME;
}