Update notification when play queue is edited
This commit is contained in:
parent
a13e6b69e3
commit
1605e50cef
|
@ -642,6 +642,12 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||
duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayQueueEdited() {
|
||||
updatePlayback();
|
||||
NotificationUtil.getInstance().createNotificationIfNeededAndUpdate(this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {
|
||||
|
|
|
@ -255,21 +255,21 @@ public class MediaSourceManager {
|
|||
|
||||
// Loading and Syncing
|
||||
switch (event.type()) {
|
||||
case INIT:
|
||||
case REORDER:
|
||||
case ERROR:
|
||||
case SELECT:
|
||||
case INIT: case REORDER: case ERROR: case SELECT:
|
||||
loadImmediate(); // low frequency, critical events
|
||||
break;
|
||||
case APPEND:
|
||||
case REMOVE:
|
||||
case MOVE:
|
||||
case RECOVERY:
|
||||
case APPEND: case REMOVE: case MOVE: case RECOVERY:
|
||||
default:
|
||||
loadDebounced(); // high frequency or noncritical events
|
||||
break;
|
||||
}
|
||||
|
||||
// update ui and notification
|
||||
switch (event.type()) {
|
||||
case APPEND: case REMOVE: case MOVE: case REORDER:
|
||||
playbackListener.onPlayQueueEdited();
|
||||
}
|
||||
|
||||
if (!isPlayQueueReady()) {
|
||||
maybeBlock();
|
||||
playQueue.fetch();
|
||||
|
|
|
@ -69,7 +69,7 @@ public interface PlaybackListener {
|
|||
MediaSource sourceOf(PlayQueueItem item, StreamInfo info);
|
||||
|
||||
/**
|
||||
* Called when the play queue can no longer to played or used.
|
||||
* Called when the play queue can no longer be played or used.
|
||||
* Currently, this means the play queue is empty and complete.
|
||||
* Signals to the listener that it should shutdown.
|
||||
* <p>
|
||||
|
@ -77,4 +77,13 @@ public interface PlaybackListener {
|
|||
* </p>
|
||||
*/
|
||||
void onPlaybackShutdown();
|
||||
|
||||
/**
|
||||
* Called whenever the play queue was edited (items were added, deleted or moved),
|
||||
* use this to e.g. update notification buttons or fragment ui.
|
||||
* <p>
|
||||
* May be called at any time.
|
||||
* </p>
|
||||
*/
|
||||
void onPlayQueueEdited();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue