2

New to iOS 12 development and wondering if someone can help. I am trying to take the audio from the recording of Broadcast Upload Extension.

Specifically, from this code:

override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
        switch sampleBufferType {

            case RPSampleBufferType.audioApp:
                // Handle audio sample buffer for app audio
               // NEED HELP HERE
                break

        }
    }

How do I take the CMSampleBuffer during the processing and keep appending the buffer to an audio file which then I can play later?

I will figure out how to play the file, I just need some guidance please for what to do with the CMSampleBuffer to eventually get it into one audio file.

Thank you so much for any help or suggestions

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • I believe you need an AVAssetWriter and AVAssetWriterInput. You should append your CMSampleBuffer to the AVAssetWriterInput. The writer will write to specific URL which is somewhere on your file system. Check the docu for these two classes. It shouldn't be to hard, if you still need help just say it. – Darkwonder Aug 14 '19 at 13:34
  • As mentioned in [my other comment](https://stackoverflow.com/a/64445721/6053417), it looks like `AVAssetWriter` is not usable from within a Broadcast Extension as it requires Foreground Privileges. – T1T4N Oct 20 '20 at 13:04

0 Answers0