With the development of multimedia technologies, in an increasing number of application scenarios, multiple devices need to be used to constitute a synchronous playback system for synchronous audio playback, to implement synchronization of sounds played from the multiple devices, so as to implement a function and an effect that are difficult to be implemented by a single device. For example, synchronous audio playback performed by a synchronous playback system constituted by multiple mobile phones can implement effects that cannot be implemented by a single mobile phone, such as multi-channel surround sound and mobile phone speaker array.
In the prior art, an audio playback manner generally used by a synchronous playback system is controlling devices in the synchronous playback system to play an audio file simultaneously. The prior art has the following characteristic, when an audio file is played in a synchronous playback system, the audio file is generally divided into several audio clips, and then the audio clips are played one by one. However, playback of each audio clip requires processing procedures such as decoding, audio mixing, digital signal processing (DSP), and output, and therefore, there is a time difference from start of playback of an audio clip to actual generation of a sound, and this time difference is a playback delay. A value of the playback delay is determined by a hardware configuration and a software environment of a device, and when hardware configurations or software environments of various devices are different, values of playback delays are also different.
Because playback delays of various devices are different, when various devices start to play a same audio clip simultaneously, sounds are actually generated by the various devices at different time points. When hardware configurations or software environments between various devices differ greatly, a time deviation in actual generation of sounds also becomes large. For example, in a case in which a HUAWEI MATE1 mobile phone and a HUAWEI HONOR mobile phone start to decode a same audio clip simultaneously, a time difference in actual generation of sounds may be 130 milliseconds (ms) to 168 ms. Further, a time deviation between various devices is generated when each audio clip is played, and with an increasing number of played audio clips, the time deviation in actual generation of sounds between various devices gradually accumulates. As a result, the problem of time inconsistency between various devices in actual generation of sounds becomes increasingly serious, which makes it difficult to implement synchronous audio playback.