iosobjective-cdeezer

Deezer iOS SDK - Play specific track from radio


I'm currently working with Deezer SDK to play a radio from deezer in my app. Is possible to play a radio even if the user has not authorized my app.

Is there a way to play a specific track from a Radio?

I'm following this guide but it seems that this was possible in the old Sdk but not in the new. In the old sdk there were also more Delegate methods such as

- (void)player:(PlayerFactory *)player timeChanged:(long)time

But my main goal would be to play a track from a radio, in order to be sure to not play the same track two times in a row.

Is there someone that knows how to accomplish my goal?


Solution

  • It's possible to play a radio even you aren't connected if you want you can take a look here :

    Of course you can play a specific track from a radio, a radio is like, a playlist or an album, it's a DZRObjectList.

    From your DZRObjectList, you can call :

    - (void)allObjectsWithManager:(DZRRequestManager *)manager callback:(void (^)(NSArray *objs, NSError *error))callback;
    

    Every object should be a track, so you can achieve your goal by making a check directly on the array.

    Best Regards,

    EDIT

    This is an example :

    DZRRadio *yourDZRRadio;
    DZRRequestManager *manager = [[DZRRequestManager defaultManager] subManager];
    [yourDZRRadio valueForKey:@"tracks" withRequestManager:manager callback:^(DZRObjectList *objectList, NSError *error) {
        if (objectList != nil) {
            [objectList allObjectsWithManager:manager callback:^(NSArray *tracks, NSError *error) {
                /*
                 *  Here you have tracks from your radio so you can send it to your player :)
                 */
            }];
        } else {
    
        }
    }];