Winston Du
Winston Du

Reputation: 390

Routing AVPlayer audio output to AVAudioEngine

Due to the richness and complexity of my app's audio content, I am using AVAudioEngine to manage all audio across the app. I am converting every audio source to be represented as a node in my AVAudioEngine graph.

For example, instead using AVAudioPlayer objects to play mp3 files in my app, I create AVAudioPlayerNode objects using buffers of those audio files.

However, I do have a video player in my app that plays video files with audio using the AVPlayer framework (I know of nothing else in iOS that can play video files). Unfortunately, there seems to be no way I can obtain the audio output stream as a node in my AVAudioEngine graph.

Any pointers?

Upvotes: 2

Views: 938

Answers (1)

childc
childc

Reputation: 49

If you have a video file, you can extract audio data and pull it out from the video.

Then you can set the volume of AVPlayer to 0. (If you didn't remove audio data from the video) and Play AVAudioPlayerNode.

If you receive the video data through network, You should make parser of the packet and divide them.

But AV-sync is very tough thing.

Upvotes: 1

Related Questions