我正在使用 Exoplayer 版本 2.11.0,我想知道当用户向右滑动它时是否有可能停止 PlayerNotificationManager(类似于 Spotify)。默认情况下我只能调用 useStopAction(true) https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ui/PlayerNotificationManager.html 这并不能令我满意。
最佳答案
@Override
public void onNotificationPosted(int notificationId, Notification notification, boolean ongoing) {
if (ongoing) {
// Make sure the service will not get destroyed while playing media.
startForeground(notificationId, notification);
} else {
// Make notification cancellable.
stopForeground(false);
}
}
关于java - Exoplayer PlayerNotificationManager onSwipe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60046205/