Twilio客户端语音呼叫扬声器ON/OFF问题 [英] Twilio client voice call speaker ON/OFF issue

查看:118
本文介绍了Twilio客户端语音呼叫扬声器ON/OFF问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Twilio客户端语音呼叫服务进行呼叫.

I am using Twilio client voice call service for calling.

在这里我遇到了Spearke ON/OFF功能的问题.我可以静音/取消静音通话,但无法打开/关闭扬声器.对于这两种功能,我有一个相同的实例.我还检查了他们的演示项目基本电话,因为该扬声器的ON/OFF正常工作,并且我在项目bur中正在执行相同的操作,而无法执行相同的操作.

Here I am facing issue in spearke ON/OFF feature.I am able to Mute/Unmute call but not able to turn On/OFF speaker. I have a same instance for both functionality. I have also checked their demo project basic phone in that this speaker ON/OFF is working and I am doing same thing in my project bur not able to do the same.

这是我的代码:

if(isSpeaker == NO)
{
     isSpeaker=YES;
     [self.phone setSpeakerEnabled:YES];
}
else{
     isSpeaker=NO;
     [self.phone setSpeakerEnabled:NO];
}

self.phone是BasicPhone(其呼叫管理器类)的sharedInstance,并且我正在演示> iOS 9和项目中测试应用程序.

self.phone is the sharedInstance of BasicPhone (their call manager class) and I am testing application in > iOS 9 both demo and my project.

推荐答案

我已在iOS上使用此代码成功启用/禁用了扬声器.它不使用Twilio设备,并且在某种程度上特定于React Native,但是每个功能的核心都应该起作用:

I've used this code on iOS to successfully enable/disable speakerphone. It doesn't use the Twilio device, and is somewhat specific to React Native, but the core of each function should work:

RCT_EXPORT_METHOD(setSpeakerPhoneOn) {
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *error;

[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
}

RCT_EXPORT_METHOD(setSpeakerPhoneOff) {
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *error;

[session overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:&error];
}

这篇关于Twilio客户端语音呼叫扬声器ON/OFF问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆