java - Exoplayer PlayerNotificationManager onSwipe

标签 java android exoplayer2.x

我正在使用 Exoplayer 版本 2.11.0,我想知道当用户向右滑动它时是否有可能停止 PlayerNotificationManager(类似于 Spotify)。默认情况下我只能调用 useStopAction(true) https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ui/PlayerNotificationManager.html 这并不能令我满意。

enter image description here

最佳答案

   @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/

相关文章:

java - 程序输出一个看起来像给定尺寸的英国国旗的图案

java - bean 初始化失败 SpelEvaluationException : EL1012E: Cannot index into a null value in spring batch Error

android - Groupie RecyclerView单击特定项目

java - Android Exoplayer - 如何在离线播放时显示可用品质(轨道)

android - 不推荐使用 SimpleExoPlayer.Builder(this).build()

java - 使用 jsoup 从其他 h3/class 类中的类中提取 href

java - 无法将invokeAndWait中的值分配给全局字符串变量

java - Android:NTLM 身份验证、ksoap 和持久连接

Android Studio 不启动 : Could not find or load main class com. intellij.idea.Main

android - ExoPlayer的PlayerView如何使用TextureView代替SurfaceView?