Streaming AVPlayer radio transmitter without listening through bluetooth speaker

I am using AVPlayer

for my radio streaming application. But my problem is that my clients are complaining about not being able to listen when they are using a bluetooth speaker. Is there any special permission I need to grant in the application. Please let me know what the problem might be. Thanks to

This is how I handled Audiosession

audioPlayer=[Player sharedManager];
NSError *sessionError = nil;
[[AVAudioSession sharedInstance] setActive:true error:&sessionError];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&sessionError];
/* Pick any one of them */
// 1. Overriding the output audio route
// UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
//AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride);
@try {
    [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&sessionError];
} @catch (NSException *exception) {
    NSLog(@"-----EXCEPTION-----%@",exception);
} @finally {

}

// 2. Changing the default output audio route
// UInt32 doChangeDefaultRoute = 1;
//AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryDefaultToSpeaker, sizeof(doChangeDefaultRoute), &doChangeDefaultRoute);

      

+3


source to share





All Articles