gpt4 book ai didi

ios - AVCaptureDevice 在模拟器上始终为 null

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:11:33 25 4
gpt4 key购买 nike

我正在 try catch 实时麦克风音频数据。

我从 AVCaptureSession 的苹果示例中获取了以下内容。

AVCaptureSession *captureSession = [[AVCaptureSession alloc] init];

AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];

NSError *error = nil;
AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioCaptureDevice error:&error];

if (audioInput) {
[captureSession addInput:audioInput];
}
else {
// Handle the failure.
NSLog(@"ERROR");
}

audioCaptureDeviceaudioInput 均为 null。

最佳答案

是的,应该是。因为模拟器没有任何麦克风。您应该始终在真实设备上测试任何与音频、视频和渲染相关的任务。

看看Limitations of Testing in iOS Simulator

Hardware Limitations While most of the functionality of iOS devicescan be simulated in iOS Simulator, there are some hardware featuresthat must be tested directly on a device. The hardware features thatcannot be simulated are:

Accelerometer

Gyroscope

Camera

Proximity

Sensor Microphone Input

关于ios - AVCaptureDevice 在模拟器上始终为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43103216/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com