问题描述
我想在两个iOS设备之间实现语音聊天,而不使用蓝牙范围内的WiFi或蜂窝网络.
I want to implement the voice chat between two iOS devices without using WiFi or cellular network within the range of Bluetooth.
我已经使用多对等连接框架在蓝牙范围内进行了文本聊天,但是我也想像蓝牙范围内的文本聊天一样进行语音聊天.
I have done the text chat within Bluetooth range using multipeer connectivity framework, But I also want to do voice chat like text chat within the Bluetooth range.
我发现我们可以使用GameKit进行语音聊天,但是我还没有找到任何教程参考,如何实现语音聊天.
I found that we can implement the voice chat using GameKit but I have not found any reference of tutorial yet, How to Implement voice chat.
更新:我发现iOS 7.0之后不推荐使用GameKit VoiceChatService.还有另一种方法可以在同一网络上呼叫另一台iOS设备.
UPDATE:I found that the GameKit VoiceChatService has been deprecated after iOS 7.0.is There another way to call another iOS device on the same network.
我发现此应用 https://itunes.apple.com/us/app/ip2pvoicechat-bluetooth-wifi/id908638157?mt=8 工作呼叫同一WiFi网络上的用户.
I found that this app https://itunes.apple.com/us/app/ip2pvoicechat-bluetooth-wifi/id908638157?mt=8 work calls the user on the same wifi network.
谢谢.
推荐答案
如果您已经建立了蓝牙连接,则应该开始发送音频数据块.
If you already have a Bluetooth connection, you should just start sending chunks of audio data.
几年前,我建立了一个图书馆,可以读取/播放音频流.有关更多信息,请参见 eppz!capture . EPPZCapture
和 EPPZCaptureBufferParser
.他们一起提供/消费 CMSampleBufferRef
.
I made a library years ago that can read / play audio stream. See eppz!capture for more. EPPZCapture
and EPPZCaptureBufferParser
in particular. They provide / consume CMSampleBufferRef
together.
我不支持此代码,但是您可以将其用作自己的流代码的灵感来源.
I don't support this code, but you can use it as some source of inspiration for your own streaming code.
但是,有很多类似的库,例如 https://github.com/tumtumtum/StreamingKit, https://github.com/muhku/FreeStreamer , https://github.com/mattgallagher/AudioStreamer .
However, there are countless libraries for that, like https://github.com/tumtumtum/StreamingKit, https://github.com/muhku/FreeStreamer, https://github.com/mattgallagher/AudioStreamer.
此外,我认为您仍然可以使用 GKVoiceChat
,那里有课程.上面的文档甚至都没有显示过时(编译器可能会显示).
Furthermore, I think you can still use GKVoiceChat
, classes are there. Docs above don't even show deprecation (while the compiler may show).
这篇关于通过蓝牙或在iOS中的本地WiFi网络之间进行点对点语音聊天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!