Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to play a song? #23

Closed
jifalops opened this issue Oct 7, 2019 · 1 comment
Closed

How to play a song? #23

jifalops opened this issue Oct 7, 2019 · 1 comment
Labels

Comments

@jifalops
Copy link

jifalops commented Oct 7, 2019

This package doesn't have this api yet but even when I do it myself I'm left scratching my head on how to play a song. Following the Spotify API reference, I have:

Future<void> play([String uri]) async {
  if (client != null) {
    try {
      await client.put('https://api.spotify.com/v1/me/player/play', body: {
        'context_uri': uri,
      });
    } on SpotifyException catch (e) {
      print('${e.status}: ${e.message}');
    }
  } else {
    print('No client available.');
  }
}

but when I call spotify.users.currentlyPlaying() afterwards player.isPlaying is always false. Not to mention I have no clue where to get the actual stream so I can pass it to an audio player.

@rinukkusu
Copy link
Owner

Hi, the API doesn't expose any stream from what I know. After calling the /me/player/play endpoint, does any spotify instance you have running start playing that song? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants