Skip to content

Commit

Permalink
Merge pull request #68 from techmaved/fix/playback
Browse files Browse the repository at this point in the history
fix: playback issues
  • Loading branch information
techmaved authored Oct 20, 2024
2 parents 38599a1 + 421e43e commit 3192989
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,22 +266,22 @@ class PlaybackService : MediaLibraryService() {

audioManager?.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_MUTE, AudioManager.FLAG_SHOW_UI)
spotifyAppRemote?.playerApi?.play(currentMediaItem?.localConfiguration?.uri.toString())?.setResultCallback {
runBlocking {
CoroutineScope(Dispatchers.IO).launch {
guardValidSpotifyApi { api: SpotifyClientApi ->
try {
api.player.startPlayback(contextUri = contextUri, offsetPlayableUri = playableUri)

delay(2000)
delay(1000)
spotifyAppRemote?.playerApi?.playerState?.setResultCallback {
if (it.isPaused) {
spotifyAppRemote?.playerApi?.seekTo(0)
spotifyAppRemote?.playerApi?.resume()
}

audioManager?.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE , AudioManager.FLAG_SHOW_UI)
}
} catch (e: Throwable) {}
}

audioManager?.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE , AudioManager.FLAG_SHOW_UI)
}
}
}
Expand Down

0 comments on commit 3192989

Please sign in to comment.