Giter Club home page Giter Club logo

ios-sdk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-sdk's Issues

Spotify iOS Streaming SDK - what will happen?

This new SDK is a real showstopper for certain types of apps.

Since playback is now handled by the regular Spotify app, working with the audio signal at a low level is not possible.

Me and many other developers will have to continue to use the older "Spotify iOS Streaming SDK".
It has worked very very well despite a couple of annoying bugs that never has been fixed.
It broke completely when the new changes to the playlist URIs was added on September 11.
The change has been rolled back for now and everything is back working as normal. But what will happen in the future?

The affected methods in the old SDK is the following:
+(void)playlistWithURI:(NSURL *)uri accessToken:(NSString *)accessToken callback:(SPTRequestCallback)block;
+(void)playlistsWithURIs:(NSArray *)uris accessToken:(NSString *)accessToken callback:(SPTRequestCallback)block;

Will you update the older SDK so it continues to work? The changes to the playlist uri is minimal as explained here:
https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/
so it seems as a simple fix to the SDK.

The old "Spotify iOS Streaming SDK" is a beautifully designed SDK making it possible to access to raw audio samples.
This is big big advantage for Spotify when comparing to say "Apple Music".
I have many customers that has changed from "Apple Music" to Spotify only because of the feature my app offers,
and this is only possible because of the older "Spotify iOS Streaming SDK" and its support for low level audio.

So please come up with a solution so that our apps does not break again as they the did on September 11.

Not able to play a song.

I got the successful login but i can't get any playlist ,if you have a sample please share me the link.

AppRemote connect() never finishes

Trying to set up the examples. Authentication works, the app switches over to Spotify and shows success, starts music and returns to my app. SessionManager->didInitiate is called which does self.appRemote.connect(), the delegate is setup and everything.

The log only shows:

AppRemote: Connecting...

Nothing more, non of the other callbacks is ever called. Is there a way to get more logging to figure out what is going on?

Losing connection whenever the user is using my app while playing a song.

I can play songs from within my app and if I do nothing after hitting play it works ok, but whenever I scroll around to look at other songs I get the following error and playback stops:

AppRemote: Disconnected with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x283d6e220 {Error Domain=NSPOSIXErrorDomain Code=32 "Broken pipe" UserInfo={_kCFStreamErrorCodeKey=32, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

Memory and CPU utilization is a little higher at those moments then otherwise, but not exactly high either (130mb, 60% cpu utilization). This worked ok 3 weeks ago. I did switch from an iPhone 7+ to an iPhone Xs in that same time though.

how to use fetchRecommendedContentItemsforType result?

I'm trying to use the [contentAPI fetchRecommendedContentItemsForType] but the result that I get back from it seems to be a class that isn't documented (SPTAppRemoteContentItemEntity) instead of the SPTAppRemoteContentItem protocol. Perhaps I'm missing something in order to use it correctly.

Spotify starts playing even if user cancels authorization

When the user is prompted with the screen that asks for authorization to connect the app with Spotify, if the user cancels it either from the top-left button or from the black cancel button, the music starts playing nevertheless. A better UX would be just coming back to the origin app without playing.

Searching tracks by metadata

Hey there!

There're nice APIs that return track metadata: v1/audio-features/{id} and /v1/audio-analysis/{id}
I wonder, is it possible to search tracks with /v1/search using the metadata to filter tracks e.g. by danceability, energy, tempo eg?

If that's not possible right now, are there any plans for supporting this in the nearest future?

Thanks

Existing iOS SDK – Playlist Access is Broken (401 error – Invalid Playlist URI)

Issue Type: Bug
Spotify iOS SDK Version: Beta 25
User Impact: Severe
Reproducibility: 100% (first observed 9/11/2018 8:00am CDT)

When passing in a playlist URI given by a SPTPartialPlaylist object to a request for promotion to a PlaylistSnapshot object, a 401 error is returned and users cannot view their playlist tracks, play songs from their playlists, or add and remove tracks. Along with the 401, an error reason of "Invalid Playlist URI" is given.

Example of URI provided by SPTPartialPlaylist: "spotify:playlist:0tLwSYR5m7BxP9uxKHfhK1"
Broken SDK method call: [SPTPlaylistSnapshot playlistWithURI: accessToken: market: callback: ]

Error output obtained in the callback block: Error Domain=com.spotify.ios-sdk Code=401 "Invalid Playlist URI" UserInfo={NSLocalizedDescription=Invalid Playlist URI}

Judging by the changes to this GitHub project, I can tell that no work continues on the 2014-2018 'iOS SDK'. However, this is still where developer.spotify.com points developers to to report issues with the existing iOS SDK (as well as the new Remote SDK). Any help resolving this would be appreciated– hundreds of active Premium users in production are potentially affected by this issue today.

Thanks in advance!

Unit testing initiateSessionWithScope on Xcode + Simulator

The SPTSessionManager initiateSession call presents a UIAlert and then a modal web controller on the iOS Simulator within an XCTest.

Is there a way to auto-advance or override so that scope and accessToken is granted without required user interaction?

We would like to use the accessToken to test other Spotify endpoints but don't have a reliable way to unit test.

Deleted Beta Releases

Hey,

I'm glad you've continued work and created a 1.0.0 release but removing the betas is really frustrating. Our builds now fail and we're forced to spend time updating to 1.0 at a critical point in the project.

Spotify demo Objective-c login without Spotify App

With demo provide in the new SDK for objective-c if the phone has Spotify app install it works well but if the phone doesn't have the app Spotify installed I am having the error:

"INVALID_CLIENT: Invalid redirect URI"

the option is set to: SPTDefaultAuthorizationOption

On the dashboard Redirect URIs is set:
spotify-login-sdk-test-app://spotify-login-callback

On the dashboard Bundle IDs is set:
com.spotify.sdk.SPTLoginSampleApp

On the app
static NSString * const SpotifyRedirectURLString = @"spotify-login-sdk-test-app://spotify-login-callback";

URL Schemes: spotify-login-sdk-test-app

ruby file
CLIENT_CALLBACK_URL = "spotify-login-sdk-test-app://spotify-login-callback"

Did I forget something?

App Remote connection fails - Error 1000 -

I have created a project that follows the Quick Start pretty closely - Upon attempting to connect the app remote, I get the below error:

[SPT/APP][!] Connection failure: %@ Optional(Error Domain=com.spotify.app-remote 
Code=-1000 "Connection attempt failed." UserInfo={NSLocalizedDescription=Connection attempt failed., 
NSUnderlyingError=0x1c0657940 {Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x1c4842010 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}}, NSLocalizedRecoverySuggestion=Ensure the Spotify app is installed, and try to reconnect., NSLocalizedFailureReason=Could not connect to the Spotify app.})

Noting the codes for the main error and the UnderlyingError and checking the docs for SPTAppRemoteErrorCode I see -1000 meaning a Background Wakeup Error caused by a -2000 meaning an invalid arguments error, but I am setting the access token for the AppRemote.connectionParameters, and I know that this access token is valid because it is used in a successful web API request. I am out of ideas to debug this.

Any help would be greatly appreciated

+[NSError spt_transport_endOfStreamError]: unrecognized selector sent to class

Sometimes an error occur and is not correctly handled by the Framework .
For example: connect to AppRemote successfully, then stay connected and force kill Spotify, when returning in your app this error is thrown.

2018-10-21 18:32:30.685845+0200 SPTLoginSampleApp[2455:121894] +[NSError spt_transport_endOfStreamError]: unrecognized selector sent to class 0x223da1ff0
2018-10-21 18:32:30.696281+0200 SPTLoginSampleApp[2455:121894] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSError **spt_transport_endOfStreamError**]: unrecognized selector sent to class 0x223da1ff0'
*** First throw call stack:
(0x1eacc7ef8 0x1e9e95a40 0x1eabe41fc 0x1eaccd810 0x1eaccf4bc 0x100ae39d0 0x100ae3e04 0x1eac6941c 0x1eac68a08 0x1eac565b8 0x1eac56538 0x1eac55e1c 0x1eac50ce8 0x1eac505b8 0x1ecec4584 0x217547558 0x100ad4b6c 0x1ea710b94)
libc++abi.dylib: terminating with uncaught exception of type NSException

Sometimes it's also

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSError spt_transport_streamErrorWithUnderlyingError:]: unrecognized selector sent to class 0x223da1ff0'`

User's music

Is there a way to get the user's playlists / favorites / recommendations so he can choose what to play?

Unable to connect to Spotify app after acquiring access token

I'm following the steps outlined in the tutorial using the SPTSessionManager authorization flow and I'm getting the following error when attempting to connect to the spotify app:

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x282461e60 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

I've verified that I get back a valid session with an access token that I hand off to my instance of SPTAppRemote. Here's the code that I'm using:

- (void)configure
{
    SPTConfiguration *theConfig = [[SPTConfiguration alloc] initWithClientID:kXDSpotifyClientID redirectURL:[NSURL URLWithString:kXDSpotifyCallbackURL]];
    theConfig.tokenSwapURL = [NSURL URLWithString:kXDSpotifyTokenSwapServiceURL];
    theConfig.tokenRefreshURL = [NSURL URLWithString:kXDSpotifyTokenRefreshServiceURL];
    self.sessionManager = [[SPTSessionManager alloc] initWithConfiguration:theConfig delegate:self];
    self.appRemote = [[SPTAppRemote alloc] initWithConfiguration:theConfig logLevel:SPTAppRemoteLogLevelDebug];
}

-(void)initiateSession
{
    SPTScope theScopes = SPTPlaylistReadPrivateScope | SPTPlaylistModifyPublicScope | SPTPlaylistModifyPrivateScope |SPTUserFollowReadScope | SPTUserFollowModifyScope | SPTUserLibraryReadScope | SPTUserLibraryModifyScope | SPTUserTopReadScope | SPTAppRemoteControlScope;
    [self.sessionManager initiateSessionWithScope:theScopes options:SPTDefaultAuthorizationOption];
}


// called from AppDelegate
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options
{
    return [self.sessionManager application:app openURL:url options:options];
}

#pragma mark - SPTSessionManagerDelegate
- (void)sessionManager:(SPTSessionManager *)manager didInitiateSession:(SPTSession *)session
{
    self.appRemote.connectionParameters.accessToken = session.accessToken;
    self.appRemote.delegate = self;
    [self.appRemote connect];
}

- (void)sessionManager:(SPTSessionManager *)manager didFailWithError:(NSError *)error
{
    NSLog(@"Error getting session token: %@", error);
}

#pragma mark - SPTAppRemoteDelegate
- (void)appRemoteDidEstablishConnection:(SPTAppRemote *)appRemote
{
    self.appRemote.playerAPI.delegate = self;
    [self.appRemote.playerAPI subscribeToPlayerState:^(id  _Nullable result, NSError * _Nullable error) {
        NSLog(@"%@",error);
    }];
    
    self.appRemote.userAPI.delegate = self;
    [self.appRemote.userAPI subscribeToCapabilityChanges:^(id  _Nullable result, NSError * _Nullable error) {
        NSLog(@"%@",error);
    }];
}

- (void)appRemote:(SPTAppRemote *)appRemote didFailConnectionAttemptWithError:(nullable NSError *)error
{
    NSLog(@"Error connecting to Spotify app %@",error);
}

AppRemote connect results in TCP error

2018-10-09 15:30:08.046007-0600 Squffle[12505:4490112] AppRemote: Connecting...
2018-10-09 15:30:08.059834-0600 Squffle[12505:4490033] [] nw_connection_get_connected_socket 4 Connection has no connected handler
2018-10-09 15:30:08.061178-0600 Squffle[12505:4490033] TCP Conn 0x1c8360540 Failed : error 0:61 [61]

Spotify App disconnected on new song playing.

Session initiated successfully with SPTConfiguration where playURI is mentioned as blank string, with the function
sessionManager.initiateSession(with: scope, options: .default)
after that Spotify app started playing last played track.
Problem happens when we are trying to play another song through
appRemote.playerAPI!.play(uri, callback: nil)
player failed to play new song each time rather in debug we are getting some logs like

AppRemote: Sending request: <SPTAppRemoteCallRequest: 0x129ea3a10; id: 2, method: com.spotify.play_uri>

AppRemote: Disconnected with error: Error Domain=com.spotify.app-remote.transport Code=-2001 "End of stream." UserInfo={NSLocalizedRecoverySuggestion=Reconnect to the Spotify app., NSLocalizedDescription=End of stream., NSLocalizedFailureReason=One of the streams has reached the end.}

and after that delegate function
appRemote(_ appRemote: SPTAppRemote, didDisconnectWithError error: Error?) is invoked.

Any idea?
Thanks in advance

Questions about the play queue

The new API is running pretty slick, just have a couple questions about the play queue:

  • Is there a way to move something to the front of the queue?
  • Modify the queue?
  • Empty songs from the queue?

I've found that enqueueTrackUri will continuously append to the queue with no means of removal.

Spotify get all playlist name

one more thing I try in another example even I got Album list, track counts also but when I try to fetch Track its show me nil.

Here is sample code after get access Token
SPTPlaylistList.playlists(forUser: session.canonicalUsername, withAccessToken: session.accessToken, callback: { (error, response) in
// self.activityIndicator.stopAnimating()
if let listPage = response as? SPTPlaylistList, let playlists = listPage.items as? [SPTPartialPlaylist] {
print(playlists)
// self.playlists = playlists // or however you want to parse these
// self.tableView.reloadData()
if listPage.hasNextPage {
// self.getNextPlaylistPage(currentPage: listPage)
}
SPTPlaylistSnapshot.playlist(withURI: playlists[0].playableUri, accessToken: session.accessToken, callback: { (err:Error?, obj:Any?) in
var playl = obj as! SPTPlaylistSnapshot
print(playl.firstTrackPage.tracksForPlayback())
} as! SPTRequestCallback )

    }
})

Possible to auth without backend token swap?

This first iteration of my app is just a prototype and I'm hoping I don't need to bring up server infrastructure to support it at this stage. Is it possible to authenticate with SPTSessionManager without setting tokenSwapURL and tokenRefreshURL? I tried but it fails with "invalid_request".

If it matters I was previously able to auth with the older "streaming" framework.

Add bitcode support

Bitcode support should be added so bitcode doesn't need to be disabled in the project using the framework.

spotify track is not playing after I stopped `MPMusicPlayerController.systemMusicPlayer` track

In my application, I am using MPMusicPlayerController.systemMusicPlayer for the playing song of Apple music, it's working fine. But when I play back Spotify track using playSpotifyURI it's not working. I have checked logs but not showing error anywhere.

Scenario
Step 1. Play track using playSpotifyURI. It is playing fine

SPTAudioStreamingController.sharedInstance().playSpotifyURI(itemID, startingWith: 0, startingWithPosition: 0) { error in
            if error != nil {
                print("*** failed to play: \(String(describing: error))")
                return
            }else{
                print("Playing!!")
            }
        }

Step 2. stop track using.

SPTAudioStreamingController.sharedInstance().setIsPlaying(false, callback: { (error) in
                                
                            })

Step 3. play apple music song using theMPMusicPlayerController.systemMusicPlayer

func beginPlayback(itemID: String) {
        if musicPlayerController.playbackState == .playing {
            musicPlayerController.stop()
        }
        //musicPlayerController.setQueue(with: [itemID]) //1324456545
        musicPlayerController.setQueue(with: [itemID])
        musicPlayerController.prepareToPlay { (error) in
            print("prepareToPlay----------------")
        }
        musicPlayerController.play()
    }

Step 4. Stop Apple music song using.

if musicPlayerController.playbackState == .playing {
            musicPlayerController.stop()
        }

Step 5. Play track using playSpotifyURI using below code but it's not playing, I couldn't find any error.

SPTAudioStreamingController.sharedInstance().playSpotifyURI(itemID, startingWith: 0, startingWithPosition: 0) { error in
            if error != nil {
                print("*** failed to play: \(String(describing: error))")
                return
            }else{
                print("Playing!!")
            }
        }

Is there any issue of the above code? Please help me to solve an issue. Any help will be appreciated

No way to start playback of a playlist at an arbitrary position and time

I guess this is a feature request. My app is currently built using the Spotify iOS-streaming sdk which has the following method:

- (void)playSpotifyURI:(NSString *)spotifyUri startingWithIndex:(NSUInteger)index startingWithPosition:(NSTimeInterval)position callback:(SPTErrorableOperationCallback)block;

that allows for playback of a playlist at a specific position and time. It'd be nice if this sdk supported this too.

didChangePosition missing?

I could not find a way to have a playback timer in the app being updated, SPTAppRemotePlayerState has playbackPosition but this is not updated in real-time?

My case is to have the app change track after X seconds of playback.

Add canSkipTrack flag to SPTAppRemoteUserCapabilities

Currently the only capability in SPTAppRemoteUserCapabilities is canPlayOnDemand, which is false for ad supported users.

It would be great to have an additional capability indicating whether the current track can be skipped. Ad supported users can skip a couple songs before the button is disabled in control center, and I would like to disable the skip button in my project as well, once the user is unable to skip.

Bundle ID issue

Description
I registered to try the iOS App Remote, add it to my app - iCarMode.
I followed: https://developer.spotify.com/documentation/ios-app-remote/quick-start/
My app opened spotify but on callback I got this error:
error=invalid_app_identifier&error_description=The app identifier is not valid with the client ID provided
In "My dashboard" I registered my app bundle id as "iCarMode.com" although my app bundle id is "iCarMode"...but trying to fill "iCarMode" as my bundle id gets a validation error: "Not a valid Bundle ID".
Changing a bundle id on the appstore is not possible after the app exists there...
It's actually IS a valid bundleid...is there a way to fix this or bypass this?

Versions
iOS SDK version - Remote beta
Spotify app version (if native SSO flow is involved) - 8.4.69.787

Severity
Major

Steps to Reproduce
go to developer dashboard: https://developer.spotify.com/dashboard
try to fill a single word under the "Bundle Id", it will flash an error: "Not a valid Bundle ID"

Actual behaviour
error: "Not a valid Bundle ID"

Expected behaviour
"iCarMode" is the actual BundleID of my app on the AppStore...it should be valid to register it.

Logs
I've attached a picture of the error on the dashboard, and the bundleid on the AppStore.
45317289-441cb080-b542-11e8-9c74-810b9427ceb7

Not possible to play a list of tracks

The WebAPI allows you to pass an array of URI's to the start playback endpoint, but there doesn't seem to be a corresponding function on the SPTAppRemotePlayerAPI. Is this something that will be fixed or is there some other solution?

Can't reconnect appRemote

I'm finding that my applications instance of the appRemote disconnects from the Spotify app when the application is backgrounded (which I know there is another issue for). However, when coming back into the foreground it seems that when I try to reconnect the remote to spotify, it fails with an error Connection attempt failed.. The way that I've been able to reproduce it is run my application (which connects to spotify using the Session manager and then subsequently using the Remote). Once the app is running, switch over to Spotify and then switch back to the App. At which point, the apps remote will be disconnected (since it was sent into the background), but upon trying to reconnect it I get an error connecting.

Here are the logs from my device:

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x281869ce0 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

I've also tried explicitly disconnecting when my app goes into the background (thinking perhaps Spotify's remote service was holding a connection for a particular clientid/token or something).

Also should be noted, that at this point the only way I can get my app to reconnect to Spotify via remote is to close Spotify and my application and open my application back up to let the auth flow run again.

Problem initiating a session

Hey

I have this problem initiating a session, basically call to SPTSessionManager.initiateSession lands at func sessionManager(manager: SPTSessionManager, didFailWith error: Error) of SPTSessionManagerDelegate

This is the error I'm getting:

Error Domain=com.spotify.sdk.login Code=1 "invalid_request" UserInfo={NSLocalizedDescription=invalid_request}

And this is the URL that's coming back from Spotify ios app at func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool:

spotify-playground://spotify-login-callback/?code=AQAgOd0MvT01I_9Zu0a1xLimvZKZRN63d8NXugRRkbxfmFQnGaYvS7V0kUAnWU9-0Aqe0HhJeSYa1P01by1DBEnZS9drE7Dc7UrniGxBmCstiYlZvKqdwRn4c6RKj92wY2ZTv8cm9sk-AibLM8RcYidMkoFosNPEptpKNGARJdyAYTHQqOLaSFn-5V2OSKFrARCqmYy3qSgPItad1mIMRPKv1pIUTxDONGkw6-KQQgvHKknrxioaWoG9w29ifHRT7Q3Ne25tkG9AP18DdqZ0iXl_vHo325A0i6K8vx10ScFG

Any ideas?
Cheers

Play two streams simultaneously

When the Spotify app starts playing, it's automatically interrupting a stream that is playing from within my app. I could handle both with the previous SDK but I'm not sure if this is possible with the new one?

Search capability

Will there be capability to search for Artists, Tracks and Genres? The capability seems to be there on the full Spotify iOS SDK but I don't want to include a separate SDK just for that reason, plus the full iOS SDK seems to be abandonware.

Why the "ios-streaming-sdk" needs to be updated

I post this on both the "spotify/ios-sdk" and "spotify/ios-streaming-sdk" issues list so nobody misses to read it ;-)

I was delighted to see that the iOS Streaming SDK finally was updated but soon found out that the only thing fixed was related to the upcoming changes to playlist URIs as explained here:
https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/
Thanks for that but I guess most of us including me, already fixed that ourself since the "SpotifyMetadata.framework" is now open source.

Spotify then writes here:
https://developer.spotify.com/community/news/2018/09/14/updates-mobile-platform/

"The documentation and download for the streaming SDKs from 2014 are available on GitHub here for iOS and here for Android.
Note that these streaming SDKs are not actively maintained and no additional work on these are planned.
We therefore urge you to work with the new SDKs going forward."

The new SDK can in no way replace the streaming SDK.

As stated here by one member of the Spotify team (jackfreeman)
#12

snip...
"Additionally, since the Spotify app controls the audio, you will be more limited in working with the audio signal at a low level."

So for apps that needs access to the raw audio then the new SDK is useless.

Why not a least fix the very few bugs the streaming SDK contains?

In my particular case there is only one bug that affects my app, everything else works perfect.
Bug ID #858 "seekTo method is extremely slow when file caching is enabled".

There might be other bugs that affect other users but in my opinion, the streaming SDK works quite good and needs very little additional work to be perfect.

Or do as with the "SpotifyMetadata.framework" and release it as open source, then we app developers can fix the bugs and Spotify can totally forget SDK.

With the audio streaming SDK, Spotify has something that no other audio streaming companies can offer, including its biggest rival, Apple.

I don't know how many customers have been contacting me, telling me that they have now changed from using Apple Music into Spotify, and because of that, they can now work on the music they want in a way that is only possible because my app is using the features that the Spotify Streaming SDK offers.

In my opinion, the Spotify Streaming SDK is one vital cornerstone for the continuing success for Spotify. As Swedes say - "många bäckar små...".

Network connectivity is always required

On every run of my app, even when it has already the necessary permissions for remote control and the track that I attempt to play is already downloaded in the Spotify app, starting that track requires network access. It would be nice if the permissions information was stored locally on the phone and didn't have to go through the network.

Force token expire for testing

Is it possible to force token expiry for testing purpose ?

To complete my request, it's not clear what happens with STPSessionManager and AppRemote when token expires (after 1 hour).
In the sample app SPTLoginSampleAppSwift, I get an AppRemote didFailConnectionAttemptWithError after 1 hour with error "Token not valid." (by the way the updateViewBasedOnConnected do not update correctly as appRemote.isConnected return TRUE).
How to renew silently the session ?
I've implemented token swap and token refresh services on my backend.

Question behind this: are we forced to switch to SpotifyApp every 1 hour ?

appRemoteDidEstablishConnection not being called

Currently trying to migrate to this SDK from the prev. streaming one. Having a lot of trouble figuring out a particular issue re: appRemote delegate. I followed the Quick Start guide, have verified that the session successfully inits, and also see these logs...

AppRemote: Connecting...
AppRemote: Established a connection to the Spotify app.

...however none of the appRemote delegate methods are being called. I have set appRemote.delegate = self within my main AppDelegate, and have implemented all the req. delegate methods.

    func appRemoteDidEstablishConnection(_ appRemote: SPTAppRemote) {
        print("connected!", playerRemote != nil, playerRemote?.playerAPI != nil) // DOES NOT PRINT
        playerRemote?.playerAPI?.subscribe(toPlayerState: { (success, error) in
            print(success, error)
        })
    }
    
    func appRemote(_ appRemote: SPTAppRemote, didDisconnectWithError error: Error?) {
        print("disconnected!", error) // DOES NOT PRINT
        sptSessionManager?.renewSession()
    }
    
    func appRemote(_ appRemote: SPTAppRemote, didFailConnectionAttemptWithError error: Error?) {
        print("failed!", error.debugDescription) // DOES NOT PRINT
    }

For reference, here is the rest of the setup:


    // MARK: Application Delegate

    func initializeSpotify() {
        sptConfiguration = SPTConfiguration(clientID: "###", redirectURL: URL(string: "###")!)
        sptConfiguration!.tokenRefreshURL = URL(string: "###")!
        sptConfiguration!.tokenSwapURL = URL(string: "###")!
        sptConfiguration!.playURI = ""
        sptSessionManager = SPTSessionManager(configuration: sptConfiguration!, delegate: self)
        playerRemote = SPTAppRemote(configuration: sptConfiguration!, logLevel: .debug)
        **playerRemote!.delegate = self**
        
        let requestedScopes: SPTScope =  [.appRemoteControl] // .streaming?
        
        if #available(iOS 11.0, *) {
            sptSessionManager!.initiateSession(with: requestedScopes, options: .default)
        } else {
//            sptSessionManager!.initiateSession(with: requestedScopes, options: .default, presenting: <#T##UIViewController#>)
        }
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        if let _ = playerRemote?.connectionParameters.accessToken {
            // successfully reaches here and connects, resetting delegate to be extra sure (doesn't work either way)
            playerRemote!.delegate = self
            playerRemote?.connect()
        }
    }
    // MARK: SPTSessionManager Delegate
    
    func sessionManager(manager: SPTSessionManager, didInitiate session: SPTSession) {
        print("successfully init spt session", playerRemote != nil) // prints true
        playerRemote!.connectionParameters.accessToken = session.accessToken
    }
    
    func sessionManager(manager: SPTSessionManager, didFailWith error: Error) {
        print("failed to init spt session", error) // DOES NOT PRINT
        sptSessionManager?.renewSession()
    }
    
    func sessionManager(manager: SPTSessionManager, didRenew session: SPTSession) {
        print("renewed spt session", session) // DOES NOT PRINT
    }

My thoughts were maybe it had something to do with the way I was initializing the var globally? I am running this on Xcode 10.1 Beta on a physical iPhone X running iOS 12 with Spotify installed. Could this be an issue?

using appRemote when my app is backgrounded

Is it possible to connect to Spotify and start music playback when my control app is backgrounded?

I have a bluetooth LE trigger for my app (a Flic BTLE button) which, when pressed, makes my app play a Spotify URI. This works fine when the app is in the foreground.

I'd like the button to work in the background. The background mode of the flic button itself is working - it correctly triggers:

func flicButton(_ button: SCLFlicButton, didReceiveButtonClick queued: Bool, age: Int)

but, the call to connect to the Spotify app fails - i.e.

authoriseAndPlayURI and connect

calls don't work when the app is backgrounded.

Is it possible to make these remote SDK framework calls work when my app is backgrounded?

Spotify Developer Terms of Service

I saw in the "Spotify Developer Terms of Service" that I need spotify approval for use of spotify ios-sdk in a commercial app.

  1. Does remote sdk also under the same restriction?
  2. How can I get this approval?

SPTSessionManagerDelegate cancel

Hi!

I am trying to have spinner while the login is happing, but my problem is if the user after opening the Safari decide to change is mind and press the "Done" button, by doing this is canceling the login.

That event of canceling is not caught by the SPTSessionManagerDelegate, can you add a new event? I need that event to cancel the spinner.

Thank you!!!

P.S. This only happens if you are using iOS 10 that uses the SFSafariViewController if you use iOS 11 you will receive didFailWithError.

Callback for SPTAppRemotePlayerAPI pause() method never returns.

  • remote-sdk version 1.0.0
  • Spotify version 8.4.51
  • iPhone SE
  • iOS 11.3

Calling pause() on a valid SPTAppRemotePlayerAPI instance with an open connection properly pauses playback, but the callback never returns with a result or error object.

Also, once the playback has paused, the connection closes. Attempting to call connect() on the SPTAppRemotePlayerAPI object never reconnects. Alternatively, attempting to reauthorize also does not allow reconnection.

Connect to remote app without playing music

Hi!

I would like to connect to remote app without playing music. So first I just want to get playlists and show them to user and when user selects the playlist then I would like to play the music.

So far it is partially working for me - it seems very unstable.

Sometimes everything is OK and remote app connects and sometimes I get errors:

Error Domain=com.spotify.sdk.login Code=1 "invalid_grant" UserInfo={NSLocalizedDescription=invalid_grant}

AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x1cc04b400 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.}

I am doing standard procedure with session manager and backend for tokens swap.

So when delegate for established connection is called I connect to remote app.

Any ideas why is that happening on the random basis?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.