Search code examples
deezer

Invalid URL in iOS SDK Deezer player


I have problem with iOS SDK from Deezer. I initialize a connection with Deezer:

_deez = [[DeezerConnect alloc] initWithAppId:kDeezerAppId andDelegate:self];

// List of permissions available from the Deezer SDK web site */
NSMutableArray* permissionsArray = [NSMutableArray arrayWithObjects:@"basic_access", @"offline_access", @"manage_library", @"delete_library", nil];

[_deez authorize:permissionsArray];

Login is successfull. After login I want to initialize a player I use:

 _player = [PlayerFactory createPlayer];
[_player setPlayerDelegate:self];
[_player setBufferDelegate:self];
 [_player preparePlayerForTrackWithDeezerId:trackid
                                    stream:stream
                          andDeezerConnect:_deez];

And I get in bufferDidFailWithError:

Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0x194370a0 {NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0x190894f0 "unsupported URL"}

Maybe the problem is in stream. What is that?

Thanks.


Solution

  • If you try to listen to an album or a playlist, do you check the "readable" value received with each track object ?

    Example of JSon received for a track :

        tracks =     {
             data =         (
                        {
                artist =                 {
                    id = 1234;
                    name = toto;
                };
                duration = 1;
                id = 6789;
                link = "";
                preview = "";
                rank = 1;
                readable = 0;
                stream = 0;
                title = Title;
                type = track;
            },
    

    If "readable" and "stream" are both equals to false, you can not read the track.