OGeek|极客世界-中国程序员成长平台

标题: ios - OpenTok,TokBox ios SDK中的音频SampleBuffer在哪里 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 11:23
标题: ios - OpenTok,TokBox ios SDK中的音频SampleBuffer在哪里

我正在使用 OpenTok iOS sdk 从 iphone 流式传输到 chrome。我想做的是在流式传输时录制视频的高分辨率版本。

通过 Example 2 Let's Build OTPublisher 中的 OTVideoCapture 接口(interface)使用自定义视频采集器,我可以成功地将视频样本缓冲区记录到文件中。问题是,我找不到对从麦克风收集的音频数据的任何引用。

我假设它使用音频输入(AVCaptureDeviceInput),通过 AVCaptureAudioDataOutputSampleBufferDelegate 到音频输出(AVCaptureAudioDataOutput)在某处使用。

有谁知道如何从 OpenTok iOS SDK 访问它?



Best Answer-推荐答案


captureOutput:didOutputSampleBuffer:fromConnection , fromConnection 字段将区分音频和声音连接并提供相应的缓冲区。

要设置音频输入/输出,您可以尝试使用 Let-Build-OTPublisher initCapture 方法

    //add audio input / outputs
AVCaptureDevice * audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
_audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:nil];
if([_captureSession canAddInput:_audioInput])
{
    NSLog(@"added audio device input");
    [_captureSession addInput:_audioInput];
}

_audioOutput = [[AVCaptureAudioDataOutput alloc] init];
if([_captureSession canAddOutput:_audioOutput])
{
    NSLog(@"audio output added");
    [_captureSession addOutput:_audioOutput];
}


[_audioOutput setSampleBufferDelegate:self queue:_capture_queue];

关于ios - OpenTok,TokBox ios SDK中的音频SampleBuffer在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25245711/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4