Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play different music in a short period of time,the player can not be stopped #25

Open
a363211861 opened this issue May 20, 2013 · 1 comment

Comments

@a363211861
Copy link

In my viewController, call the playInfo: function many times in a short period of time,then pop the viewController(viewDidDisappear: is called),music is still playing。

-(void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];

[_audioPlayer stop];
_audioPlayer.delegate = nil;
_audioPlayer = nil;

}

-(void)playInfo:(NSDictionary *)info
{
self.musicInfo = info;

if (_audioPlayer) {
    [_audioPlayer stop];
    _audioPlayer.delegate = nil;
}
_audioPlayer = [[AudioPlayer alloc] init];
_audioPlayer.delegate = self;

NSURL *url = [self getPlayURL:info];
[_audioPlayer setDataSource:[_audioPlayer dataSourceFromURL:url] withQueueItemId:url];
}

@a363211861
Copy link
Author

I found dealloc method of audioPlayer never been called,In my project.  I think the reason may be retain cycle on self with blocks。 such as the code:
[fastApiQueue addOperationWithBlock:^
{
pthread_mutex_lock(&playerMutex);
{
.......
[self clearQueue];
.......
}
pthread_mutex_unlock(&playerMutex);
}];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant