Specifying audio output device for video?

I'm trying to port my QuickTime-using app to AVFoundation. My app plays both video and audio, and offers a choice of audio output devices (sometimes I want to use a different output device from the standard system output device). In QuickTime, I use QTAudioContextCreateForAudioDevice / SetMovieAudioContext to do this.


For audio only, I was able to create an AVAudioEngine, hook up an AVAudioPlayerNode to it and successfully change the AVAudioOutputNode's output device. But for a video playback (such as with AVPlayer), I can't figure out how to pick an audio device. I did find MTAudioProcessingTap which I guess I could use to get audio samples, but this seems like it might be the wrong thing to do given I don't need to do any postprocessing.


Any pointers appreciated — thanks!

Accepted Answer

Checking with a collegue familiar with the transition from QuickTime to AVFoundation confirmed that there is no equivalent of this old QT API for AVPlayer video playback in AVFoundation.

On OS X to direct the movies audio output you could have the user select the sound output device in System Preferences they want or in code set it yourself <https://developer.apple.com/library/mac/samplecode/HALExamples/Listings/ConfigDefaultOutput_c.html> while on iOS there's the MPVolumeView route picker.

Specifying audio output device for video?
 
 
Q