2011-11-06 1 views
0

시스템 사운드 서비스를 사용하여 응용 프로그램에서 오디오를 재생합니다. 스피커, 헤드폰 또는 도크 USB 카 스테레오 연결을 사용할 때 완벽하게 작동합니다. 그러나 전화가 자동차 블루투스 시스템에 연결되어 있으면 오디오가 재생되지 않습니다.시스템 사운드 서비스 자동차의 블루투스에 연결된 경우 오디오가 재생되지 않습니다.

블루투스 장치에 연결되어있어 시스템 사운드 서비스가 블루투스를 통해 오디오로 보내려고한다고 상상합니다.

오디오 경로가 블루투스를 통해 소리를 보내지 못하도록하는 방법을 아는 사람이 있습니까?

여기에 내가 사용하고있는 코드는 다음과 같습니다

CFURLRef  soundFileURLRef; 
SystemSoundID soundFileObject; 

CFBundleRef mainBundle; 
mainBundle = CFBundleGetMainBundle(); 

// Get the URL to the sound file to play 
soundFileURLRef = CFBundleCopyResourceURL (
               mainBundle, 
               CFSTR ("Alert6"), 
               CFSTR ("aif"), 
               NULL 
               ); 

// Create a system sound object representing the sound file 
    AudioServicesCreateSystemSoundID (
             soundFileURLRef, 
             &soundFileObject 
            ); 

AudioServicesPlaySystemSound (soundFileObject); 

어떤 아이디어?

답변

0

당신은 내장 스피커

UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; // lets the system sounds come out of the speaker 
OSStatus err = AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride); 
if (err != noErr) { 
    // handle error 
} 
+0

안녕 코니 출력을 대체 할 수 있습니다. 나는 이것을 전에 시도했으나 효과가 없다. 헤드폰이나 블루투스를 연결할 때 사운드 출력을 무시해야합니까? –

관련 문제