简体   繁体   English

在3g网络上同步播放的最佳方法

[英]Best way to synchronize playback over 3g networks

I am trying to figure out a way to synchronize rhythm playback on 2+ mobile android devices. 我试图找出一种方法来同步2+移动android设备上的节奏播放。

Achieving good precision on WiFi / LAN is simple (Very low latency) but I need a good solution for 3G networks with variable high latency.. 在WiFi / LAN上实现良好的精度很简单(非常低的延迟),但是我需要一个针对可变高延迟的3G网络的好的解决方案。

One idea I came up with is sending and timing messages and using average time-spans to compensate latency but this idea seems absurd and I'm kinda sure there are better other ways to solve this.. 我想到的一个想法是发送和计时消息,并使用平均时间间隔来补偿延迟,但是这个想法似乎很荒谬,我敢肯定,还有其他更好的方法可以解决此问题。

care to help? 想要帮助吗?

I would first of all try to create a as close as possible synchronized clock across all devices that you can use as a reference. 首先,我将尝试在所有可用作参考的设备上创建尽可能接近的同步时钟。

When devices communicate they always include their local synchronized time with the message, this way you can always figure out the difference between when you received the message and when it was transmitted, and also always know that the time the message states you should play a beat is the same across all devices. 当设备进行通信时,它们始终将本地同步时间与消息一起包括在内,这样您就可以始终确定接收消息的时间与发送消息的时间之间的时差,并且还始终知道消息指出您应该播放节拍的时间在所有设备上都相同。

The real difficulty here being synchronizing the watches.. I would start by reading this article http://en.wikipedia.org/wiki/Network_Time_Protocol 真正的困难在于手表的同步。我将从阅读本文开始: http://en.wikipedia.org/wiki/Network_Time_Protocol

There is a JAVA based NTP client here: http://commons.apache.org/net/examples/ntp/NTPClient.java 这里有一个基于Java的NTP客户端: http : //commons.apache.org/net/examples/ntp/NTPClient.java

If you get that to work, there are a number of NTP servers across the world. 如果您可以使用它,那么全世界有许多NTP服务器。 http://www.pool.ntp.org/en/use.html http://www.pool.ntp.org/en/use.html

I have actually recently tried to solve the very same question myself. 实际上,我最近试图自己解决同样的问题。 The best solution I have found was the NTP (Network Time Protocol). 我发现的最佳解决方案是NTP(网络时间协议)。

The main drawback is that it can take long time to synchronise over a high latency network. 主要缺点是在高延迟网络上进行同步可能需要很长时间。 So you need to have an app that is running quite a while before you need to have the devices synchronized. 因此,您需要有一个运行了一段时间的应用程序,然后才能使设备同步。

The application I´m working on is not yet tested with perfect timings so I can´t promise that this is a viable solution. 我正在处理的应用程序尚未经过完美的时序测试,因此我不能保证这是一个可行的解决方案。 But one worth trying. 但值得一试。

If your devices are close enough together, you could see whether you are able to use Bluetooth to speed up peer-to-peer synchronisation, while using NTP to get the global time -- probably by adding Bluetooth-linked phones as extra remotes in your NTP config. 如果设备之间的距离足够近,则可以查看是否能够使用蓝牙来加快点对点同步,同时使用NTP来获取全球时间-可能是通过将与蓝牙连接的电话添加为您的额外遥控器来实现的NTP配置 This would entail pairing end-user devices, which may be an issue for you. 这将需要与最终用户设备配对,这可能对您来说是个问题。

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

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