I am playing the audio from an url using AVPlayer, but when the iPhone is connected to a Bluetooth device it is not playing via Bluetooth, how to play via Bluetooth if it is
You need to set a category and options on the AVAudioSession.
Try this when the app starts:
//configure audio session
NSError *setCategoryError = nil;
BOOL setCategorySuccess = [[AVAudioSession sharedInstance]
setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionAllowBluetooth
error:&setCategoryError];
if (setCategorySuccess) {
NSLog(@"Audio Session options set.");
} else {
NSLog(@"WARNING: Could not set audio session options.");
}