Open JoergHamburg opened 10 years ago
I'm also having this issue, anybody managed to have a look at it?
I noticed in the sample app the background audio capability isn't checked by default. Enabling this allowed the audio to play in the background as expected
I'd be really interested if someone has converted this to run on ios7 code successfully
Thanks
ashleyevans, I was able to get this to work on ios 8.1.3 if that is any help
AudioSessionInitialize ( NULL, // 'NULL' to use the default (main) run loop NULL, // 'NULL' to use the default run loop mode ASAudioSessionInterruptionListener, // a reference to your interruption callback self // data to pass to your interruption listener callback ); UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty ( kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory ); AudioSessionSetActive(true);
Functions are deprecated in iOS7. I tried to use AVAudioSession audioSession = [AVAudioSession sharedInstance]; BOOL ok; NSError setCategoryError = nil; ok = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionDidChangeInterruptionType:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
ok = [audioSession setActive:YES error:&setCategoryError];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; [appDelegate becomeFirstResponder];
but the audio still does not play when going to lock screen. Any advice on this?
Thanks in advanced, Jörg