简体   繁体   English

ios通过蓝牙接收音频

[英]ios receive audio over bluetooth

I'm most likely not using the correct terminology in my question. 我很可能在我的问题中使用的术语不正确。

Is it somehow possible for an iphone to receive an "audio stream" from other iPhones over Bluetooth? iPhone是否可以通过蓝牙从其他iPhone接收“音频流”?

The idea is to make an app that makes it possible to listen to the music libraries of other iPhones in the Bluetooth range. 这个想法是要开发一个可以监听蓝牙范围内其他iPhone音乐库的应用程序。 All while not having access to the internet and not needing to pair up and transfer the actual song onto the phone. 所有这些都无需访问互联网,也不需要配对并将实际歌曲传输到手机上。

The thing you ask of is doable, but is not something trivial. 您所要求的事情是可行的,但并非无关紧要。 Bluetooth communication can be implemented to work like a TCP/IP socket implementation, the only problem is, there is no actual protocol to follow. 蓝牙通信可以实现为像TCP / IP套接字实现一样工作,唯一的问题是,没有实际的协议可遵循。 Usually the apps that implement bluetooth communication use they own protocols definitions in order to serve the purpose of the app. 通常,实现蓝牙通信的应用程序使用它们自己的协议定义,以达到应用程序的目的。

There are several steps that have to take in consideration: 必须考虑几个步骤:

  • The transfer speed over bluetooth, it's not fast but it's not slow either, the main problem with the transfer over bluetooth is that you have to implement the data transfer, for example in TCP/IP the whole package exchange (send/acknowledge/receive) is done by the system, there's no general protocol implementation to do such thing using bluetooth. 通过蓝牙的传输速度不是很快,但也不是很慢,通过蓝牙的传输的主要问题是必须实现数据传输,例如在TCP / IP中进行整个包交换(发送/确认/接收)是由系统完成的,没有通用的协议实现可使用蓝牙来完成。

  • The connection handling, this is something really tricky depending on OS & OS version, especially on iOS the connect/disconnect handling is clumsy & often buggy. 连接处理,这确实有些棘手,具体取决于OS和OS版本,尤其是在iOS上,连接/断开处理笨拙且经常有问题。

  • Security, without pairing and bonding there's no security. 安全,没有配对和绑定,就没有安全。 Even with pairing & bonding the security is flacky. 即使使用配对和绑定,安全性也很不稳定。 Without security you might get your app hammered down and bricked by a simple bluetooth sniffer. 没有安全性,您可能会因为简单的蓝牙嗅探器而使您的应用程序陷入困境。

  • Other apps that use bluetooth, for IoT or other gadgets this is not an actual problem, but when you have a client/server like approach via bluetooth using two mobile phone you might get in trouble because of other apps that wrongly use the bluetooth (don't close connections, try to scan to frequently) and you can't do anything about it. 对于物联网或其他小工具使用蓝牙的其他应用程序并不是一个实际问题,但是当您使用两部手机通过蓝牙进行客户端/服务器之类的方法时,您可能会因为其他错误使用蓝牙的应用程序而遇到麻烦(不要关闭连接,请尝试进行频繁扫描),您对此无能为力。

These are the things that cross trough my mind about the bluetooth communication, I've worked on several apps that connect to IoT and I can tell you it's not something trivial to implement. 这些事情使我对蓝牙通信的想法不屑一顾,我已经开发了多个连接到物联网的应用程序,我可以告诉你实现它并不是一件容易的事。 You get a lot of headache for things that you can't imagine. 对于无法想象的事情,您会感到头疼。

As an alternative you could use WI-FI without internet connection, there was a trending post some time ago about Mesh Networks that use only the WIFI signal to transmit data, not even actual wifi network, worth checking out IMO. 作为一种替代选择,您可以不使用互联网就使用WI-FI,前段时间有一篇关于网状网络的趋势报告,该网状网络仅使用WIFI信号来传输数据,甚至不使用实际的wifi网络来传输数据,值得检查IMO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM