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

Can't figure out how to play song #36

Closed
ryantrappy opened this issue Oct 16, 2017 · 6 comments
Closed

Can't figure out how to play song #36

ryantrappy opened this issue Oct 16, 2017 · 6 comments

Comments

@ryantrappy
Copy link

First off this plugin looks like it is exactly what I need, but I can't seem to truly figure out how it is used. It would be awesome if there was an example application that someone could look at and figure out how to use the plugin.

`
var events = spotifySession.getEventEmitter();

        spotifySession.getEventEmitter().then( function(data){
            console.log("got event emitter");
            console.log(data);
        });

        spotifySession.play(trackInfo.track.uri, {
            token:$scope.spotifyAuthToken,
            "clientId":client_ID
        }).then(
            function(data){console.log(data)},
            function(data){console.log(data)}
            );

`

The app is an ionic app and at this point in the code I have already authenticated with OAuth. The event emitter that is printed is a promise but has no events emitted out of it and no sound plays. Any direction provided would be greatly appreciated.

@NeoLegends
Copy link
Member

This is exactly how the plugin is supposed to be used. Does the plugin return any specific error in the promise or do you instantly get an error thrown when calling the methods?

Are you on Android or iOS? Could you post some console logs (either native, via Android / iOS Debugger, or from the web context via Chrome Debugger or Safari Debugger)? This would help identifying the issue.

@ryantrappy
Copy link
Author

Since it ionic, it is both android and iOS but I am testing on iOS currently.
screen shot 2017-10-16 at 12 47 41 pm

Here is an output of the event emitter and the error I get. I am not sure why it thinks I am passing the wrong username/password as I am passing the actual auth token. I looked at #27 and their event emitter had all the possible events and other events but mine does not have any of that. Are these two related?

@NeoLegends
Copy link
Member

No. Wrong username / password indicates the token you supplied is invalid. Are you sure you‘re passing in a valid one with the required scopes („streaming“ in this case)?

@NeoLegends
Copy link
Member

The event emitter is not related to the login btw. You can login without getting an event emitter first.

@ryantrappy
Copy link
Author

That fixed it! Thank you very much. I read in another issue about required scopes but it just clicked that that meant spotify requested scopes and not the scope of the app.

@NeoLegends
Copy link
Member

Spotify does request OAuth scopes! (Remember, this is not your angular scopes, OAuth scopes represent the capabilities of the auth token).

Our Spotify OAuth plugin is specifically designed to prevent invalid-token-errors by automatically refreshing the token whenever needed. See here: https://github.com/Festify/cordova-spotify-oauth.

@NeoLegends NeoLegends mentioned this issue Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants