AntennaPod Rewind
I use AntennaPod to listen to podcasts.
Its a great little piece of software: one of the few open source mobile applications that feels polished. Onboarding is great, its easy to find and subscribe to new podcasts, and it has all the gratuitous settings I expect by now of open source software. The interface is mostly intuitive and it JustWorks™.
One of the podcasts I listen to is 99% Invisible. Its a show about design in all its many shapes and forms and I honestly didn’t expect to be the kind of person who cares much for “Design”. But, perhaps as a testament to the persuasiveness of Roman Mars and his team, I’m now convinced that Design is important and ubiquitous, and have started to notice a couple of things around me that make me pause and appreciate the effort that went into them.
And while using AntennaPod to listen to a podcast about design, I noticed a great little feature. If you stop the podcast and come back to it a little later, it automatically rewinds a bit so you can recall some of the context.
But it doesn’t do this all the time. If you pause and resume quickly, it takes off exactly where you left it. If you come back hours or days later it backtracks further.
Now, a little internet searching suggests this is a feature of all good podcasting apps, and has been for many years, but I’ve only really gotten into podcasts this last year1 and before now have used an app called Spotify to listen to them2.
Spotify doesn’t have this feature. Why would it? Minor standard-of-living improvements are not high on your priority list when your audience is captive and will put up with whatever you say. Smaller projects don’t have the ability to be so carefree and have to win their users3 with features.
Features like this one. What makes it even better to me is how simple it is. In fact, here is the entire source code file, sans some comments and imports, that controls that feature.
/**
* This class calculates the proper rewind time after the pause and resume.
* <p>
* User might loose context if he/she pauses and resumes the media after longer time.
* Media file should be "rewinded" x seconds after user resumes the playback.
*/
public class RewindAfterPauseUtils {
public static final long ELAPSED_TIME_FOR_SHORT_REWIND = TimeUnit.MINUTES.toMillis(1);
public static final long ELAPSED_TIME_FOR_MEDIUM_REWIND = TimeUnit.HOURS.toMillis(1);
public static final long ELAPSED_TIME_FOR_LONG_REWIND = TimeUnit.DAYS.toMillis(1);
public static final long SHORT_REWIND = TimeUnit.SECONDS.toMillis(3);
public static final long MEDIUM_REWIND = TimeUnit.SECONDS.toMillis(10);
public static final long LONG_REWIND = TimeUnit.SECONDS.toMillis(20);
public static int calculatePositionWithRewind(int currentPosition, long lastPlayedTime) {
if (currentPosition > 0 && lastPlayedTime > 0) {
long elapsedTime = System.currentTimeMillis() - lastPlayedTime;
long rewindTime = 0;
if (elapsedTime > ELAPSED_TIME_FOR_LONG_REWIND) {
rewindTime = LONG_REWIND;
} else if (elapsedTime > ELAPSED_TIME_FOR_MEDIUM_REWIND) {
rewindTime = MEDIUM_REWIND;
} else if (elapsedTime > ELAPSED_TIME_FOR_SHORT_REWIND) {
rewindTime = SHORT_REWIND;
}
int newPosition = currentPosition - (int) rewindTime;
return Math.max(newPosition, 0);
} else {
return currentPosition;
}
}
}
Smart, small and simple. No options. It just works.