mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-08 23:18:17 -07:00
Saved the playback position when the player is paused
This commit is contained in:
parent
e4d09f3bc0
commit
40866a2855
7 changed files with 101 additions and 13 deletions
|
|
@ -3,6 +3,7 @@ package com.cappielloantonio.play.service;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.AudioAttributes;
|
||||
|
|
@ -18,7 +19,6 @@ import androidx.media3.session.MediaSession;
|
|||
|
||||
import com.cappielloantonio.play.ui.activity.MainActivity;
|
||||
import com.cappielloantonio.play.util.DownloadUtil;
|
||||
import com.google.android.gms.cast.framework.CastContext;
|
||||
|
||||
public class MediaService extends MediaLibraryService {
|
||||
private static final String TAG = "MediaService";
|
||||
|
|
@ -98,6 +98,13 @@ public class MediaService extends MediaLibraryService {
|
|||
public void onMediaItemTransition(@Nullable MediaItem mediaItem, int reason) {
|
||||
MediaManager.setLastPlayedTimestamp(mediaItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsPlayingChanged(boolean isPlaying) {
|
||||
if(isPlaying) {
|
||||
MediaManager.setPlayingChangedTimestamp(player.getCurrentMediaItem(), player.getCurrentPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue