Merge pull request #2675 from ByteHamster/delete-feed-while-playing

Stop playback service when feed is deleted
This commit is contained in:
Martin Fietz 2018-05-05 18:41:48 +02:00 committed by GitHub
commit 930330fbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -609,6 +609,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
public void shutdown() {
executor.shutdown();
if (mediaPlayer != null) {
try {
mediaPlayer.stop();
} catch (Exception ignore) { }
mediaPlayer.release();
}
releaseWifiLockIfNecessary();

View File

@ -188,6 +188,9 @@ public class DBWriter {
if(queue.remove(item)) {
removed.add(item);
}
if (item.getState() == FeedItem.State.PLAYING && PlaybackService.isRunning) {
context.stopService(new Intent(context, PlaybackService.class));
}
if (item.getMedia() != null
&& item.getMedia().isDownloaded()) {
File mediaFile = new File(item.getMedia()