[Solved] iOS – Why wont my audio play in the background? [closed]


screenshot

I have changed to iOS 5.1, because i don’t want to update my phone to a beta version of iOS… There are compile errors in this case.

it would be helpful if you show how is created the player:

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                                         pathForResource:_detailItem
                                         ofType:@"mp3"]];
    NSError *error;
    player = [[AVAudioPlayer alloc]
              initWithContentsOfURL:url
              error:&error];

I am using other player, which is playing in background the radio URL nicelly:

    streamPlayer = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:radioUrl]];
    streamPlayer.movieSourceType = MPMovieSourceTypeStreaming;
    streamPlayer.useApplicationAudioSession = NO;

maybe the

streamPlayer.useApplicationAudioSession = NO;

is the key? I forgot, and I can’t launch your code.

solved iOS – Why wont my audio play in the background? [closed]