After a setting all the parameters for the player factory init
, prepared the player for a preview, I know that my player is initialized by the player state (1). Also, the buffer callback prints out some numbers.
But when I try to call the play
method, it gives a bad access error about the [RealPLayer BufferFlushed]
.
To me it seems like a null reference problem, but the player factory class is a singleton and I've declared it in the init
.
What could it be?
player init
- (id)init { if (self = [super init]) { deezerPlayer = [PlayerFactory createPlayerWithNetworkType:NetWork_WIFI_AND_3G andBufferProgressInterval:50.f]; [deezerPlayer setPlayerDelegate:self]; [deezerPlayer setBufferDelegate:self]; } return self; }
this is the prepare for preview called from another class with the url and id needed
- (void) initPlayerForPreviewWithUrl:(NSString *)url andTrackId:(NSString *)trackId{ NSLog(@"INIT PLAYER WITH LINK: %@ AND ID: %@",url,trackId); [deezerPlayer preparePlayerForPreviewWithURL:url trackID:trackId andDeezerConnect:[[deezerClass deezerSession] deezerConnect]]; }
after that i call the play method from the same other class
- (void)play { [deezerPlayer play]; }
at this point, it gives the error
this is the invoking class
- (void)setTheData{ [[playerController currentPlayer] initPlayerForPreviewWithUrl:sop.currentSongLink andTrackId:sop.currentSongId]; } - (IBAction)togglePlayPause:(id)sender { if(playPause.selected) { [[playerController currentPlayer] pause]; [playPause setSelected:NO]; } } else { [[playerController currentPlayer] play]; [playPause setSelected:YES]; } }
Note that current player istances of player controller is The deezerplayer in The other class
If you give, wrong song "id" - "streamId" match for the player you get that EXC_BAD_ACCESS. Also note that, if you try to play a song which is indicated as "readable = 0" in the API's JSON response, you may get the same error. I hope Deezer will fix this crash and give an appropriate error message.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.