Wowza GoCoder实时流无法在启用音频的情况下工作

时间:2018-08-07 04:41:51

标签: ios live-streaming wowza

我正在将Wowza GoCoder SDK版本:1.5.1.949用于我的iOS应用。

视频正在实时流式传输到在我的服务器上设置的Wowza Streaming Engine

下面是我如何配置示例应用程序中给出的组件的代码。

self.goCoder = [WowzaGoCoder sharedInstance];

    // Specify the view in which to display the camera preview
    if (self.goCoder != nil) {

        // Request camera and microphone permissions
        [WowzaGoCoder requestPermissionForType:WowzaGoCoderPermissionTypeCamera response:^(WowzaGoCoderCapturePermission permission) {
            NSLog(@"Camera permission is: %@", permission == WowzaGoCoderCapturePermissionAuthorized ? @"authorized" : @"denied");
        }];

        [WowzaGoCoder requestPermissionForType:WowzaGoCoderPermissionTypeMicrophone response:^(WowzaGoCoderCapturePermission permission) {
            NSLog(@"Microphone permission is: %@", permission == WowzaGoCoderCapturePermissionAuthorized ? @"authorized" : @"denied");
        }];

        [self.goCoder registerVideoEncoderSink:self];

        self.goCoderConfig.videoEnabled = YES;
        self.goCoderConfig.audioEnabled = YES;

        self.goCoderConfig.backgroundBroadcastEnabled = TRUE;

        self.goCoder.config = self.goCoderConfig;

        self.goCoder.cameraView = self.view;

        // Start the camera preview
        self.goCoderCameraPreview = self.goCoder.cameraPreview;
        [self.goCoderCameraPreview startPreview];

    }

当我通过调用启用音频时出现问题

self.goCoderConfig.audioEnabled = YES;

如果将其设置为false,则在没有音频的情况下流式传输也可以正常工作。

WowzaStatusCallback's onWOWZError方法上,我遇到以下错误:

Error Domain=com.wowza.gocoder.sdk Code=15 "An error occurred when trying to connect to host: XXX.XXX.XX.XXX" UserInfo={NSLocalizedDescription=An error occurred when trying to connect to host: XXX.XXX.XX.XXX}.

无需额外配置,音频流就可以在Android应用上正常运行。

下面是停止广播之前设备的日志。

2018-08-07 09:55:35.658 appname[1282:305177] WowzaGoCoderSDK: Could not enable metering
2018-08-07 09:55:35.659 appname[1282:305177] WowzaGoCoderSDK: Could not set audio bit rate to target of &d
2018-08-07 09:55:35.661 appname[1282:305177] WowzaGoCoderSDK: Couldn't get queue's maximum output packet size
2018-08-07 09:55:35.662 appname[1282:305177] WowzaGoCoderSDK: AudioQueueAllocateBuffer failed
2018-08-07 09:55:35.663 appname[1282:305177] WowzaGoCoderSDK: ERROR: the PCM encoder could not be started with the specified audio settings

谁能告诉我我要去哪里错了,或者可以采取什么措施来解决问题?

1 个答案:

答案 0 :(得分:0)

在if块之外尝试self.goCoderConfig.videoEnabled = YES; self.goCoderConfig.audioEnabled = YES;