mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Fixed crash on Android 9 when playing a video.
This commit is contained in:
parent
8f7b4b8257
commit
e1d3b95f73
1 changed files with 8 additions and 1 deletions
|
@ -10,6 +10,7 @@ import android.media.AudioFocusRequest
|
|||
import android.media.AudioManager
|
||||
import android.media.AudioManager.OnAudioFocusChangeListener
|
||||
import android.media.MediaMetadata
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import android.os.SystemClock
|
||||
import android.support.v4.media.MediaMetadataCompat
|
||||
|
@ -278,7 +279,13 @@ class MediaPlaybackService : Service() {
|
|||
|
||||
Logger.i(TAG, "Updating notification bitmap=${if (bitmap != null) "yes" else "no."} channelId=${channel.id} icon=${icon} video=${video?.name ?: ""} playWhenReady=${playWhenReady} session.sessionToken=${session.sessionToken}");
|
||||
|
||||
startForeground(MEDIA_NOTIF_ID, notif, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
// For API 29 and above
|
||||
startForeground(MEDIA_NOTIF_ID, notif, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
|
||||
} else {
|
||||
// For API 28 and below
|
||||
startForeground(MEDIA_NOTIF_ID, notif);
|
||||
}
|
||||
|
||||
_notif_last_bitmap = bitmap;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue