Browse Source

Re-enabled media session on service start. Do not condition radio resumption to having a cookie, since those are only valid when authenticated anonymously.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
fe224b097a
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 2
      app/src/main/java/com/github/apognu/otter/playback/PlayerService.kt
  2. 15
      app/src/main/java/com/github/apognu/otter/playback/RadioPlayer.kt

2
app/src/main/java/com/github/apognu/otter/playback/PlayerService.kt

@ -97,6 +97,8 @@ class PlayerService : Service() {
} }
} }
Otter.get().mediaSession.active = true
mediaControlsManager = MediaControlsManager(this, scope, Otter.get().mediaSession.session) mediaControlsManager = MediaControlsManager(this, scope, Otter.get().mediaSession.session)
player = SimpleExoPlayer.Builder(this).build().apply { player = SimpleExoPlayer.Builder(this).build().apply {

15
app/src/main/java/com/github/apognu/otter/playback/RadioPlayer.kt

@ -35,14 +35,19 @@ class RadioPlayer(val context: Context, val scope: CoroutineScope) {
private val favoritedRepository = FavoritedRepository(context) private val favoritedRepository = FavoritedRepository(context)
init { init {
Cache.get(context, "radio_type")?.readLine()?.log()
Cache.get(context, "radio_id")?.readLine()?.log()
Cache.get(context, "radio_session")?.readLine()?.log()
Cache.get(context, "radio_cookie")?.readLine()?.log()
Cache.get(context, "radio_type")?.readLine()?.let { radio_type -> Cache.get(context, "radio_type")?.readLine()?.let { radio_type ->
Cache.get(context, "radio_id")?.readLine()?.toInt()?.let { radio_id -> Cache.get(context, "radio_id")?.readLine()?.toInt()?.let { radio_id ->
Cache.get(context, "radio_session")?.readLine()?.toInt()?.let { radio_session -> Cache.get(context, "radio_session")?.readLine()?.toInt()?.let { radio_session ->
Cache.get(context, "radio_cookie")?.readLine()?.let { radio_cookie -> val cachedCookie = Cache.get(context, "radio_cookie")?.readLine()
currentRadio = Radio(radio_id, radio_type, "", "")
session = radio_session currentRadio = Radio(radio_id, radio_type, "", "")
cookie = radio_cookie session = radio_session
} cookie = cachedCookie
} }
} }
} }

Loading…
Cancel
Save