如何在 iOS 中将自定义音频与视频同步?

How to sync custom audio with video in iOS?

我正在尝试制作具有自定义音频效果的视频播放器。为了执行效果,我编写了一个音频单元。要播放视频流,我使用带有静音的 AVPlayer。问题是音频和视频不同步。当我暂停并恢复播放时,它变得很糟糕。

您能否就如何同步这两件事提出任何想法?也许使用其他东西代替 AVPlayer?

提前致谢。

我将回答我自己的问题。 有一个叫做 MTAudioProcessingTap 的东西。它允许像音频单元一样在 AVPlayer 中进行音频操作。 有一个 link 了解更多详情:https://chritto.wordpress.com/2013/01/07/processing-avplayers-audio-with-mtaudioprocessingtap/.=