iosobjective-cdeezer

Previous Track with Deezer SDK IOS


Im working with Deezer SDK for ios, and i wont to make request to Radio Deezer so this is what i did

- (void)requestRadioForListening:(NSString*)radioId {
    NSString* servicePath = [NSString stringWithFormat:@"%@/%@/%@", @"radio", radioId, @"tracks"];
    NSDictionary* params = [NSDictionary dictionaryWithObject:@"true" forKey:@"next"];
    DeezerRequest* request = [_deezerConnect createRequestWithServicePath:servicePath
                                                                   params:params
                                                                 delegate:self];
    [_deezerConnect launchAsyncRequest:request];
}

and now I want to play the previous track. How can I do that? what is the parameters to add to get the previous track?


Solution

  • It is unfortunatly impossible to request the previous track of a radio through the Deezer API. A radio is a forward stream (make sense, can you rewind you FM radio ?). You could however cheat a little and look at the result of the radio's tracks endpoint, surch for the current track and the previous track in the array is the one you are searching for. Of course, that's more work. Another solution would be to memorize the previous track yourself in the app.