Kaynağa Gözat

rollback change related to alarm playback, fix stutter when changing tab

yattoz 2 yıl önce
ebeveyn
işleme
c5c4bdd838

+ 5 - 1
app/src/main/java/fr/forum_thalie/tsumugi/RadioService.kt Dosyayı Görüntüle

514
         if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
514
         if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
515
             return
515
             return
516
         }
516
         }
517
+        if (mediaSession.controller.playbackState.state == PlaybackStateCompat.STATE_PLAYING && !isRinging && isAlarmStopped)
518
+        {
519
+            return //nothing to do here
520
+        }
517
 
521
 
518
         PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_PLAYING
522
         PlayerStore.instance.playbackState.value = PlaybackStateCompat.STATE_PLAYING
519
 
523
 
530
         }
534
         }
531
 
535
 
532
         // START PLAYBACK, LET'S ROCK
536
         // START PLAYBACK, LET'S ROCK
537
+        player.playWhenReady = true
533
         nowPlayingNotification.update(this, isUpdatingNotificationButton =  true, isRinging = isRinging)
538
         nowPlayingNotification.update(this, isUpdatingNotificationButton =  true, isRinging = isRinging)
534
 
539
 
535
         playbackStateBuilder.setState(
540
         playbackStateBuilder.setState(
539
             SystemClock.elapsedRealtime()
544
             SystemClock.elapsedRealtime()
540
         )
545
         )
541
         mediaSession.setPlaybackState(playbackStateBuilder.build())
546
         mediaSession.setPlaybackState(playbackStateBuilder.build())
542
-        player.playWhenReady = true
543
 
547
 
544
         //[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
548
         //[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
545
     }
549
     }