问题
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.
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.
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.
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.
Thanks in advance.
回答1:
If you already have a Bluetooth connection, you should just start sending chunks of audio data.
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.
However, there are countless libraries for that, like https://github.com/tumtumtum/StreamingKit, https://github.com/muhku/FreeStreamer, https://github.com/mattgallagher/AudioStreamer.
Furthermore, I think you can still use GKVoiceChat, classes are there. Docs above don't even show deprecation (while the compiler may show).
来源:https://stackoverflow.com/questions/44943520/peer-to-peer-voice-chat-between-via-bluetooth-or-in-a-local-wifi-network-in-ios