US-12627387-B2 - Communication method, electronic device, and system for cross-device switching of multimedia content playback
Abstract
A method implemented by a communication system, including at least a first electronic device and a second electronic device, includes that the first electronic device plays multimedia content. The first electronic device sends first synchronization information through broadcast, so that the second electronic device receives the first synchronization information, where the first synchronization information includes at least a first address, and the first address is an obtaining address of the multimedia content. In response to a preset operation, the first electronic device establishes a near field wireless communication connection to the second electronic device, and the second electronic device caches the multimedia content based on at least the first address. The first electronic device sends a control instruction to the second electronic device by using the near field wireless communication connection. The second electronic device plays the multimedia content based on the control instruction.
Inventors
- Chong Chen
- Shuo Zhang
- Hao Wang
- Songping Yao
- Wenhao JIANG
Assignees
- HUAWEI TECHNOLOGIES CO., LTD.
Dates
- Publication Date
- 20260512
- Application Date
- 20210901
- Priority Date
- 20201028
Claims (20)
- 1 . A method comprising: playing, by a first electronic device, multimedia content; sending, by the first electronic device, first synchronization information in a broadcast transmission, wherein the first synchronization information comprises a first playback progress, a first playback speed of the multimedia content, and at least a first address, and wherein the first address is an address to obtain the multimedia content; receiving, by a second electronic device the first synchronization information; establishing, by the first electronic device in response to a preset operation, a near-field wireless communication connection to the second electronic device; caching, by the second electronic device in response to the preset operation, the multimedia content based on at least the first address by: further receiving, by the second electronic device, the first synchronization information at a first time point; detecting, by the second electronic device, the preset operation at a second time point; determining, by the second electronic device, an estimated playback progress based on the first playback progress, the first playback speed, the first time point, and the second time point; and further caching, by the second electronic device, the multimedia content based on the estimated playback progress and the first address; sending, by the first electronic device using the near-field wireless communication connection, a control instruction to the second electronic device; and playing, by the second electronic device, the multimedia content based on the control instruction.
- 2 . The method of claim 1 , further comprising: determining, by the second electronic device, a corrected time period based on a time period required for completing establishing the near-field wireless communication connection or based on data statistics analysis; determining, by the second electronic device, a corrected second time point based on a sum of the second time point and the corrected time period; determining, by the second electronic device, a time difference based on a difference between the corrected second time point and the first time point; determining, by the second electronic device, a corrected playback progress based on a product of the first playback speed and the time difference; and further determining, by the second electronic device, the estimated playback progress based on a sum of the first playback progress and the corrected playback progress, wherein the estimated playback progress is further based on the corrected time period.
- 3 . The method of claim 1 , wherein the control instruction comprises second synchronization information, wherein the second synchronization information comprises a second address, a second playback progress, and a second playback speed, wherein the second address, the second playback progress, and the second playback speed are of multimedia content, and wherein the method further comprises: playing, by the first electronic device, the multimedia content at a third time point, wherein the third time point is a time point at which establishing the near-field wireless communication connection is completed; comparing, by the second electronic device, the second address, the second playback speed, and the second playback progress with the first address, the first playback speed, the estimated playback progress, and a cache progress to obtain a comparison result, wherein the cache progress is a progress of cashing multimedia content by the second electronic device at the third time point; and caching or playing, by the second electronic device, the multimedia content based on the comparison result.
- 4 . The method of claim 3 , wherein caching or playing the multimedia content based on the comparison result comprises: determining, by the second electronic device, whether the comparison result comprises one or more results including that the first address is different from the second address, the second playback progress is less than the estimated playback progress, or the second playback progress is greater than the cache progress; caching, by the second electronic device, when the comparison result comprises one or more of the results, the multimedia content based on the second address and the second playback progress; and playing, by the second electronic device, when the comparison result does not comprise any one of the results, the multimedia content based on the second playback progress and the second playback speed.
- 5 . The method of claim 1 , wherein the first electronic device comprises a near-field communication (NFC) module, wherein an NFC tag is set on the second electronic device and stores identification information of the second electronic device, the method further comprises: reading, by the first electronic device, the identification information using the NFC module, wherein the reading is the preset operation; further establishing, by the first electronic device, the near-field wireless communication connection based on the identification information; detecting, by the second electronic device, a reading operation; and further caching, by the second electronic device, the multimedia content based on the first address in response to detecting the reading operation.
- 6 . The method of claim 5 , wherein the identification information comprises at least one of a media access control (MAC) address of the second electronic device, an Internet Protocol (IP) address of the second electronic device, or an identifier (ID) of the second electronic device.
- 7 . The method of claim 1 , wherein sending the first synchronization information in a broadcast transmission comprises: sending, by the first electronic device, a data packet using a first preset sending periodicity, wherein the data packet comprises the first synchronization information; and sending, by the first electronic device, when the first address or a multimedia content playback parameter changes, the data packet using a second preset sending periodicity within a first preset time period, wherein the second preset sending periodicity is less than the first preset sending periodicity, and wherein the multimedia content playback parameter comprises at least a playback speed.
- 8 . The method of claim 7 , wherein the data packet further comprises a hash value of an identifier (ID) of an electronic device that meets a requirement, and wherein the hash value determines whether to parse the data packet when the data packet is received.
- 9 . The method of claim 1 , wherein before sending, by the first electronic device, the first synchronization information, the method further comprises: enabling, by the first electronic device, a near-field discovery function; enabling, by the second electronic device, a near-field discoverability function; and finding, by the first electronic device, a potential target device, wherein the potential target device is an electronic device that is bound to or has a same account as the first electronic device, an electronic device that has the near-field wireless communication connection to the first electronic device before a first preset time period, or an electronic device that has a preset configuration file.
- 10 . The method of claim 9 , wherein enabling the near-field discovery function comprises: determining, by the first electronic device, whether the first electronic device establishes the near-field wireless communication connection to another electronic device within a second preset time period; and enabling, by the first electronic device, the near-field discovery function when the first electronic device establishes the near-field wireless communication connection to another electronic device within the second preset time period.
- 11 . The method of claim 1 , wherein the near-field wireless communication connection is a BLUETOOTH Low Energy (BLE) connection, and wherein establishing, by the first electronic device, the near-field wireless communication connection comprises establishing with the second electronic device, the BLE connection using a first preset BLE connection parameter and a second preset BLE connection parameter, wherein the first preset BLE connection parameter comprises at least one of a preset BLE scanning periodicity or a preset connection scanning duty cycle parameter, and wherein the second preset BLE connection parameter comprises a preset BLE broadcast sending periodicity.
- 12 . A first electronic device comprising: a memory configured to store instructions; and one or more processors coupled to the memory and configured to execute the instructions to cause the first electronic device to: play multimedia content; send first synchronization information in a broadcast transmission to a second electronic device, wherein the first synchronization information comprises at least a first address, and wherein the first address is an address to obtain the multimedia content; send, through the broadcast transmission, a data packet using a first preset sending periodicity, wherein the data packet comprises the first synchronization information; send, when the first address or a multimedia content playback parameter changes, the data packet using a second preset sending periodicity within a first preset time period, wherein the second preset sending periodicity is less than the first preset sending periodicity, and wherein the multimedia content playback parameter comprises at least a playback speed; establish a near-field wireless communication connection to the second electronic device in response to a preset operation to signal the second electronic device to cache the multimedia content based on at least the first address; and send a control instruction to the second electronic device using the near-field wireless communication connection to signal the second electronic device to play the multimedia content based on the control instruction.
- 13 . The first electronic device of claim 12 , wherein the data packet further comprises a hash value of an identifier (ID) of an electronic device that meets a requirement, and wherein the hash value determines whether to parse the data packet when the data packet is received.
- 14 . The first electronic device of claim 12 , wherein before executing the instructions that cause the first electronic device to send the first synchronization information, the one or more processors, when executing the instructions, further cause the first electronic device to find a potential target device, wherein the potential target device is an electronic device that is bound to or has a same account as the first electronic device, an electronic device that has a near-field wireless communication connection to the first electronic device before a second preset time period, or an electronic device that has a preset configuration file.
- 15 . A second electronic device comprising: a memory configured to store instructions; and one or more processors coupled to the memory and configured to execute the instructions to cause the second electronic device to: receive, from a first electronic device, first synchronization information in a broadcast transmission, wherein the first synchronization information comprises a first playback progress, a first playback speed of multimedia content, and at least a first address, and wherein the first address is an address to obtain the multimedia content being played at the first electronic device; establish a near-field wireless communication connection with the first electronic device in response to a preset operation; cache, in response to the preset operation, the multimedia content based on at least the first address, wherein, when executed by the one or more processors, the instructions further cause the second electronic device to: further receive the first synchronization information at a first time point; detect the preset operation at a second time point; determine an estimated playback progress based on the first playback progress, the first playback speed, the first time point, and the second time point; and further cache the multimedia content based on the estimated playback progress and the first address; receive, using the near-field wireless communication connection, a control instruction from the first electronic device; and play the multimedia content based on the control instruction.
- 16 . The second electronic device of claim 15 , wherein, when executed by the one or more processors, the instructions further cause the second electronic device to: determine a corrected time period based on a time period required for completing establishing the near-field wireless communication connection or based on data statistics analysis; determine a corrected second time point based on a sum of the second time point and the corrected time period; determine a time difference based on a difference between the corrected second time point and the first time point; determine a corrected playback progress based on a product of the first playback speed and the time difference; and further determine the estimated playback progress based on a sum of the first playback progress and the corrected playback progress, wherein the estimated playback progress is further based on the corrected time period.
- 17 . The second electronic device of claim 15 , wherein the control instruction comprises second synchronization information, wherein the second synchronization information comprises a second address, a second playback progress, and a second playback speed, wherein the second address, the second playback progress, and the second playback speed are respectively an obtaining address, a playback progress, and a playback speed of multimedia content, and wherein, when executed by the one or more processors, the instructions further cause the second electronic device to: compare the second electronic device, the second address, the second playback speed, and the second playback progress with the first address, the first playback speed, the estimated playback progress, and a cache progress to obtain a comparison result, wherein the cache progress is a progress of cashing multimedia content by the second electronic device at a third time point at which establishing the near-field wireless communication connection is completed; and cache or play the multimedia content based on the comparison result.
- 18 . The second electronic device of claim 17 , wherein, when executed by the one or more processors, the instructions further cause the second electronic device to: determine whether the comparison result comprises one or more results including that the first address is different from the second address, the second playback progress is less than the estimated playback progress, or the second playback progress is greater than the cache progress; cache, when the comparison result comprises the one or more of the results, the multimedia content based on the second address and the second playback progress; and play, when the comparison result does not comprise any one of the results, the multimedia content based on the second playback progress and the second playback speed.
- 19 . The second electronic device of claim 15 , wherein the first electronic device comprises a near-field communication (NFC) module, wherein an NFC tag is set on the second electronic device and stores identification information of the second electronic device, and wherein, when executed by the one or more processors, the instructions further cause the second electronic device to: detect a reading operation of the first electronic device using the NFC module, wherein the reading operation is the preset operation; establish with the first electronic device the near-field wireless communication connection based on the identification information; and cache the multimedia content based on the first address in response to detecting the reading operation.
- 20 . The second electronic device of claim 19 , wherein the identification information comprises at least one of a media access control (MAC) address of the second electronic device, an Internet protocol (IP) address of the second electronic device, or an identifier (ID) of the second electronic device.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS This is a U.S. National Stage of International Patent Application No. PCT/CN2021/116018 filed on Sep. 1, 2021, which claims priority to Chinese Patent Application No. 202011176711.6 filed on Oct. 28, 2020, both of which are hereby incorporated by reference in their entireties. TECHNICAL FIELD This application relates to the field of communication technologies, and in particular, to a communication method, an electronic device, and a system. BACKGROUND With the popularity of smartphones and smart speakers, music playback online on a smartphone can be switched to playback on a smart speaker, implementing cross-device switching of media playback. When the existing smartphone and smart speaker implement cross-device switching of media playback, a Bluetooth connection between the smartphone and the smart speaker needs to be first established, and then, streaming media data is transmitted by using Bluetooth. After transmission of the streaming media data is completed, streaming media can be played on the smart speaker to implement cross-device switching of media playback. It can be learned that there is a problem of poor user experience because a relatively long delay exists in cross-device switching of media playback due to the Bluetooth connection and serial execution of media data transmission. SUMMARY Embodiments of this application provide a communication method, an electronic device, and a system, to resolve a problem of a relatively long delay when multimedia content is played across devices. According to a first aspect, this application provides a communication method. The communication method is applied to a communication system, the communication system includes at least a first electronic device and a second electronic device, and the method includes: The first electronic device plays multimedia content. The first electronic device sends first synchronization information through broadcast, so that the second electronic device receives the first synchronization information, where the first synchronization information includes at least a first address, and the first address is an obtaining address of the multimedia content. In response to a preset operation, the first electronic device establishes a near field wireless communication connection to the second electronic device, and the second electronic device caches the multimedia content based on at least the first address. The first electronic device sends a control instruction to the second electronic device by using the near field wireless communication connection. The second electronic device plays the multimedia content based on the control instruction. In this embodiment of this application, before establishing the near field wireless communication connection to the second electronic device, the first electronic device sends, through broadcast, the first synchronization information that includes at least the first address, so that the second electronic device receives the first synchronization information, to implement parallel execution. The first electronic device establishes the near field wireless communication connection to the second electronic device, and the second electronic device caches, based on the first address, multimedia content that is being played by the first electronic device, to reduce a delay caused when multimedia content is switched between devices for playing, and improve user using experience. In a possible implementation, the first synchronization information further includes a first playback progress and a first playback speed of the multimedia content. That the second electronic device caches the multimedia content based on at least the first address in response to the preset operation includes: The second electronic device caches the multimedia content based on an estimated playback progress and the first address, where the estimated playback progress is determined based on the first playback progress, the first playback speed, a first time point, and a second time point, the first time point is a time point at which the second electronic device receives the first synchronization information, and the second time point is a time point at which the second electronic device detects that the preset operation occurs. According to the possible implementation, the second electronic device determines the estimated playback progress based on the first playback progress, the first playback speed, the first time point, and the second time point, and starts to cache the multimedia content from the estimated playback progress, so that a cache speed is increased, and a delay caused when multimedia content is switched for playing is further reduced. In a possible implementation, the estimated playback progress is further determined based on a corrected time period. The second electronic device determines the estimated playback progress based on a sum of the first playback progress and a correct