0
votes

I want to play an mp3 file from speaker phone and record by microphone simultaneously. I used the code below to route an audio from earpiece to speakerphone:

AudioRoutingManager audioManager = AudioRoutingManager.GetDefault();
audioManager.SetAudioEndpoint(AudioRoutingEndpoint.Speakerphone);

but it made my app crash. I follow this post http://blogs.msdn.com/b/matthew_van_eerde/archive/2014/03/17/a-mental-model-for-the-windows-phone-audioroutingmanager-api.aspx

1

1 Answers

0
votes

I did try add this

AudioRoutingManager.GetDefault().AudioEndpointChanged += MainPage_AudioEndpointChanged;

and

private void MainPage_AudioEndpointChanged(AudioRoutingManager sender, object args)
{
    AudioRoutingManager.GetDefault().SetAudioEndpoint(AudioRoutingEndpoint.Speakerphone);
}