CN112069353A - Music playing control method and device, storage medium and electronic equipment - Google Patents

Music playing control method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112069353A
CN112069353A CN202010969795.2A CN202010969795A CN112069353A CN 112069353 A CN112069353 A CN 112069353A CN 202010969795 A CN202010969795 A CN 202010969795A CN 112069353 A CN112069353 A CN 112069353A
Authority
CN
China
Prior art keywords
operation information
music
music playing
client
unit time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010969795.2A
Other languages
Chinese (zh)
Other versions
CN112069353B (en
Inventor
刘佳林
孙海宁
展智泉
刘东东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Cloud Music Technology Co Ltd
Original Assignee
Hangzhou Netease Cloud Music Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Netease Cloud Music Technology Co Ltd filed Critical Hangzhou Netease Cloud Music Technology Co Ltd
Priority to CN202010969795.2A priority Critical patent/CN112069353B/en
Publication of CN112069353A publication Critical patent/CN112069353A/en
Application granted granted Critical
Publication of CN112069353B publication Critical patent/CN112069353B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/60Information retrieval; Database structures therefor; File system structures therefor of audio data
    • G06F16/64Browsing; Visualisation therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Electrophonic Musical Instruments (AREA)
  • Reverberation, Karaoke And Other Acoustics (AREA)

Abstract

The embodiment of the invention relates to a music playing control method, a music playing control device, a storage medium and electronic equipment, and relates to the technical field of computers. The music playing control method comprises the following steps: acquiring operation information of each client in the same music play group aiming at music play, wherein at least two clients are in the music play group; aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction; and when the preset unit time is over, sending the aggregation instruction to each client side, so that each client side synchronizes the music playing information of the music playing group according to the aggregation instruction. The invention realizes the synchronization of music playing among different clients in the music listening service, and has lower system performance overhead.

Description

Music playing control method and device, storage medium and electronic equipment
Technical Field
Embodiments of the present invention relate to the field of computer technologies, and in particular, to a music playing control method, a music playing control apparatus, a computer-readable storage medium, and an electronic device.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims and the description herein is not admitted to be prior art by inclusion in this section.
Most of the existing music apps (applications) support only one person to listen to music. If the user wants to invite other users to listen to music together, the other users can enter a music playing interface after clicking the link to listen to the shared music tracks through the form of sharing the link.
Disclosure of Invention
However, after the user shares the links of the music with other users, different users listen to the same music separately, and a true meaning that multiple users listen to the music together is not realized, that is, different users listen to the same music synchronously, and the operation of one user (such as cutting a song, dragging a progress bar, etc.) is synchronously given to other users. The technical difficulty of the prior art for realizing music listening together is as follows: when a plurality of users perform different operations at the same or similar time, the server needs to process and synchronize each operation to the client, so that the performance overhead is high, and the response is easy to slow; most importantly, when a plurality of operations are synchronized to each user, the operations received by different users may be in different orders due to the influence of network transmission fluctuation, so that the synchronization of music playing cannot be ensured.
Therefore, a music playing control method is highly needed to improve the response speed and accuracy of the server in processing the related operations of multiple users listening to music together, and ensure the synchronization of music playing among multiple users.
In this context, embodiments of the present invention desirably provide a music playback control method, a music playback control apparatus, a computer-readable storage medium, and an electronic device.
According to a first aspect of embodiments of the present invention, there is provided a music playback control method including: acquiring operation information of each client in the same music play group aiming at music play, wherein at least two clients are in the music play group; aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction; and when the preset unit time is over, sending the aggregation instruction to each client side, so that each client side synchronizes the music playing information of the music playing group according to the aggregation instruction.
In an optional implementation manner, the obtaining operation information of each client in the same music play group for music playing includes: and creating the music playing group, and acquiring the operation information of each client aiming at music playing through the music playing group.
In an optional implementation manner, after the operation information of each client for music playing is acquired by the music playing group, any one of the operation information is stored in the following manner: determining a key of any operation information according to the unique identifier of the music play group and the receiving time of any operation information; and storing any operation information to a data set corresponding to the key.
In an optional implementation manner, the determining a key of any operation information according to the unique identifier of the music play group and the receiving time of any operation information includes: calculating a unit time sequence corresponding to any operation information according to the receiving time of any operation information and the preset unit time; and determining the key of any operation information according to the unique identifier of the music playing group and the unit time sequence corresponding to any operation information.
In an alternative embodiment, in the data set, the operation information is arranged in order of receiving time.
In an optional implementation manner, the aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction includes: and when each preset unit time is finished, executing a pre-established delay aggregation task to aggregate the operation information of each client in the preset unit time.
In an optional embodiment, the method further comprises: establishing a time wheel with the preset unit time as unit scales; and creating a linked list at each scale of the time wheel, and pointing to the corresponding delay aggregation task in the preset unit time, so as to trigger and execute the corresponding delay aggregation task pointed by the linked list when each scale is reached.
In an optional implementation manner, the aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction includes: and with the preset unit time as a period, performing aggregation processing on the operation information of each client in each period to obtain an aggregation instruction of each period.
In an optional implementation manner, the aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction includes: and after the previous aggregation processing is carried out, the received first piece of operation information of each client is taken as the start of the current preset unit time, and the operation information of each client in the current preset unit time is aggregated to obtain an aggregation instruction of the current preset unit time.
In an optional implementation manner, the aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction includes: and respectively carrying out aggregation processing on each type of the operation information of each client in the preset unit time to obtain each type of aggregation instruction.
In an optional implementation manner, the aggregating each type of operation information of each client in a preset unit time includes: and according to a preset aggregation rule, performing aggregation processing on each type of operation information of each client in the preset unit time respectively to obtain an aggregation instruction of each type.
In an optional implementation manner, the aggregating, according to a preset aggregation rule, each type of the operation information of each client in the preset unit time to obtain an aggregation instruction of each type includes: and in the operation information of the playing operation types of the clients in the preset unit time, taking the operation information with the latest receiving time as an aggregation instruction of the playing operation types.
In an optional implementation manner, the aggregating, according to a preset aggregation rule, each type of the operation information of each client in the preset unit time to obtain an aggregation instruction of each type includes: and merging the operation information of the list operation types of the clients in the preset unit time to obtain the aggregation instruction of the list operation types.
In an optional implementation manner, the obtaining operation information of each client in the same music play group for music playing includes: and acquiring the operation information which is sent by each client and is based on a preset general instruction protocol.
In an optional implementation manner, the operation information based on the preset general instruction protocol includes any one or more of the following information: operation type, music before operation identification, music after operation identification, playing progress, playing state and operation instruction sequence number.
In an optional implementation manner, the sending the aggregation instruction to each of the clients includes: and sending the aggregation instruction to each client through a long connection established in advance.
In an optional embodiment, the method further comprises: and establishing the long connection with each client through an instant communication module.
In an optional implementation manner, the operation information is information that the client performs an operation in the interface of the music play group.
According to a second aspect of an embodiment of the present invention, there is provided a music playback control method including: when the server is in the music playing group, sending operation information aiming at music playing to the server; acquiring an aggregation instruction fed back by a server end when a preset unit time is over, wherein the aggregation instruction is obtained by aggregating operation information of each client of the music playing group aiming at music playing in the preset unit time by the server end; and synchronizing the music playing information of the music playing group according to the aggregation instruction.
In an optional implementation manner, the sending, to the server, operation information for music playing includes: and sending the operation information based on a preset general instruction protocol to the server.
In an optional implementation manner, before sending the operation information based on a preset general instruction protocol to the server, the method further includes: responding to a music playing operation, and executing the music playing operation based on a local instruction protocol; and generating the operation information corresponding to the music playing operation based on the preset general instruction protocol.
In an optional implementation manner, the operation information based on the preset general instruction protocol includes any one or more of the following information: operation type, music before operation identification, music after operation identification, playing progress, playing state and operation instruction sequence number.
In an optional implementation manner, the obtaining an aggregation instruction fed back by the server at the end of the preset unit time includes: and receiving an aggregation instruction fed back by the server end when the preset unit time is over through a pre-established long connection.
In an optional embodiment, the method further comprises: and establishing the long connection with an instant communication module of the server.
In an optional implementation manner, the operation information is information that is operated in an interface of the music play set.
In an optional implementation manner, the synchronizing the music playing information of the music playing group according to the aggregation instruction includes: and synchronizing the music playing state and/or the playlist information of the music playing group according to the aggregation instruction.
According to a third aspect of embodiments of the present invention, there is provided a music playback control apparatus including: the system comprises an operation information acquisition unit, a music playing unit and a music playing unit, wherein the operation information acquisition unit is used for acquiring operation information of all clients in the same music playing group aiming at music playing, and at least two clients are in the music playing group; the aggregation processing unit is used for aggregating the operation information of each client in preset unit time to obtain an aggregation instruction; and the aggregation instruction sending unit is used for sending the aggregation instruction to each client when the preset unit time is over, so that each client synchronizes the music playing information of the music playing group according to the aggregation instruction.
In an optional implementation, the operation information obtaining unit is configured to: and creating the music playing group, and acquiring the operation information of each client aiming at music playing through the music playing group.
In an optional embodiment, the operation information obtaining unit is configured to store any one of the obtained operation information by: determining a key of any operation information according to the unique identifier of the music play group and the receiving time of any operation information; and storing any operation information to a data set corresponding to the key.
In an optional implementation, the operation information obtaining unit is configured to: calculating a unit time sequence corresponding to any operation information according to the receiving time of any operation information and the preset unit time; and determining the key of any operation information according to the unique identifier of the music playing group and the unit time sequence corresponding to any operation information.
In an alternative embodiment, in the data set, the operation information is arranged in order of receiving time.
In an optional implementation manner, the aggregation processing unit is configured to: and when each preset unit time is finished, executing a pre-established delay aggregation task to aggregate the operation information of each client in the preset unit time.
In an optional implementation manner, the aggregation processing unit is configured to: establishing a time wheel with the preset unit time as unit scales; and creating a linked list at each scale of the time wheel, and pointing to the corresponding delay aggregation task in the preset unit time, so as to trigger and execute the corresponding delay aggregation task pointed by the linked list when each scale is reached.
In an optional implementation manner, the aggregation processing unit is configured to: and with the preset unit time as a period, performing aggregation processing on the operation information of each client in each period to obtain an aggregation instruction of each period.
In an optional implementation manner, the aggregation processing unit is configured to: and after the previous aggregation processing is carried out, the received first piece of operation information of each client is taken as the start of the current preset unit time, and the operation information of each client in the current preset unit time is aggregated to obtain an aggregation instruction of the current preset unit time.
In an optional implementation manner, the aggregation processing unit is configured to: and respectively carrying out aggregation processing on each type of the operation information of each client in the preset unit time to obtain each type of aggregation instruction.
In an optional implementation manner, the aggregation processing unit is configured to: and according to a preset aggregation rule, performing aggregation processing on each type of operation information of each client in the preset unit time respectively to obtain an aggregation instruction of each type.
In an optional implementation manner, the aggregation processing unit is configured to: and in the operation information of the playing operation types of the clients in the preset unit time, taking the operation information with the latest receiving time as an aggregation instruction of the playing operation types.
In an optional implementation manner, the aggregation processing unit is configured to: and merging the operation information of the list operation types of the clients in the preset unit time to obtain the aggregation instruction of the list operation types.
In an optional implementation, the operation information obtaining unit is configured to: and acquiring the operation information which is sent by each client and is based on a preset general instruction protocol.
In an optional implementation manner, the operation information based on the preset general instruction protocol includes any one or more of the following information: operation type, music before operation identification, music after operation identification, playing progress, playing state and operation instruction sequence number.
In an optional implementation manner, the aggregation instruction sending unit is configured to: and sending the aggregation instruction to each client through a long connection established in advance.
In an optional implementation manner, the aggregation instruction sending unit is configured to: and establishing the long connection with each client through an instant communication module.
In an optional implementation manner, the operation information is information that the client performs an operation in the interface of the music play group.
According to a fourth aspect of the embodiments of the present invention, there is provided a music playback control apparatus including: the operation information sending unit is used for sending operation information aiming at music playing to the server side when the server side is in the music playing group; the aggregation instruction acquisition unit is used for acquiring an aggregation instruction fed back by a server end when a preset unit time is over, wherein the aggregation instruction is obtained by aggregating operation information of each client of the music playing group aiming at music playing in the preset unit time by the server end; and the playing information synchronizing unit is used for synchronizing the music playing information of the music playing group according to the aggregation instruction.
In an optional implementation manner, the operation information sending unit is configured to: and sending the operation information based on a preset general instruction protocol to the server.
In an optional embodiment, the apparatus further comprises an operation information processing unit configured to: responding to a music playing operation, and executing the music playing operation based on a local instruction protocol; and generating the operation information corresponding to the music playing operation based on the preset general instruction protocol.
In an optional implementation manner, the operation information based on the preset general instruction protocol includes any one or more of the following information: operation type, music before operation identification, music after operation identification, playing progress, playing state and operation instruction sequence number.
In an optional implementation manner, the aggregation instruction obtaining unit is configured to: and receiving an aggregation instruction fed back by the server end when the preset unit time is over through a pre-established long connection.
In an optional implementation manner, the aggregation instruction obtaining unit is configured to: and establishing the long connection with an instant communication module of the server.
In an optional implementation manner, the operation information is information that is operated in an interface of the music play set.
In an optional implementation manner, the play information synchronization unit is configured to: and synchronizing the music playing state and/or the playlist information of the music playing group according to the aggregation instruction.
According to a fifth aspect of embodiments of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements any one of the music playback control methods described above.
According to a sixth aspect of the embodiments of the present invention, there is provided an electronic apparatus comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the music playback control methods described above via execution of the executable instructions.
According to the music playing control method and device, the computer readable storage medium and the electronic equipment provided by the embodiment of the invention, the operation information of each client of the music playing group for music playing is obtained, aggregation processing is carried out according to the preset unit time, and the obtained aggregation instruction is returned to the client so as to realize the synchronization of the music playing information of each client. On one hand, the server side aggregates the operation information of each client side into an aggregation instruction, and returns the aggregation instruction to the client side to replace all operation information in the preset unit time, so that the interaction times with the client side are reduced, the performance overhead of a system is saved, the slow response brought by the high concurrency of the server side is favorably relieved, and the blocking phenomenon is improved. On the other hand, the aggregation instruction is an equivalent instruction, and the instruction content is determined, so that the music playing information obtained by the client executing the aggregation instruction is ensured to be synchronous, and the condition that the music playing is not synchronous due to different orders of executing a plurality of operations by different clients is avoided. On the other hand, the scheme enables each client to synchronize the music playing related operation information once in each preset unit time, so that the quasi-real-time synchronization effect is realized, and the user has low perception on the preset unit time, so that the experience close to real-time synchronization can be obtained.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 shows a system architecture diagram according to an embodiment of the invention;
fig. 2 is a flowchart illustrating a music play control method according to an embodiment of the present invention;
FIG. 3 illustrates a flow diagram for storing operational information, according to an embodiment of the present invention;
FIG. 4 illustrates a flow diagram of determining keys for operational information according to an embodiment of the present invention;
FIG. 5 shows a schematic diagram of an aggregation process according to an embodiment of the invention;
FIG. 6 shows a schematic diagram of another polymerization process according to an embodiment of the invention;
FIG. 7 shows a flow chart for setting a time wheel according to an embodiment of the invention;
FIG. 8 shows a schematic view of a time wheel according to an embodiment of the invention;
FIG. 9 is a diagram illustrating a connection between a server and a client according to an embodiment of the present invention;
fig. 10 shows an interaction flowchart of a music playback control method according to an embodiment of the present invention;
fig. 11 is a flowchart illustrating another music play control method according to an embodiment of the present invention;
fig. 12 is a block diagram showing a music playback control apparatus according to an embodiment of the present invention;
fig. 13 is a block diagram showing another music playback control apparatus according to an embodiment of the present invention;
fig. 14 shows a block diagram of an electronic device according to an embodiment of the invention.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Thus, the present invention may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to an embodiment of the present invention, a music playback control method, a music playback control apparatus, a computer-readable storage medium, and an electronic device are provided.
In this document, any number of elements in the drawings is by way of example and not by way of limitation, and any nomenclature is used solely for differentiation and not by way of limitation.
The principles and spirit of the present invention are explained in detail below with reference to several representative embodiments of the invention.
Summary of The Invention
The inventor finds that in the existing music App, after users share links of music with other users, different users respectively and independently listen to the same music, so that the fact that multiple users listen to the music together is not really achieved, namely different users listen to the same music synchronously, and operations (such as song cutting, progress bar dragging and the like) of one user can be synchronously given to other users. The technical difficulty of the prior art for realizing music listening together is as follows: when a plurality of users perform different operations at the same or similar time, the server needs to process and synchronize each operation to the client, so that the performance overhead is high, and the response is easy to slow; most importantly, when a plurality of operations are synchronized to each user, the operations received by different users may be in different orders due to the influence of network transmission fluctuation, so that the synchronization of music playing cannot be ensured.
In view of the above, the basic idea of the present invention is: the method comprises the steps of obtaining operation information of each client of a music playing group aiming at music playing, carrying out aggregation processing according to preset unit time, and returning an obtained aggregation instruction to the clients so as to realize music playing information synchronization of the clients. On one hand, the server side aggregates the operation information of each client side into an aggregation instruction, and returns the aggregation instruction to the client side to replace all operation information in the preset unit time, so that the interaction times with the client side are reduced, the performance overhead of a system is saved, the slow response brought by the high concurrency of the server side is favorably relieved, and the blocking phenomenon is improved. On the other hand, the aggregation instruction is an equivalent instruction, and the instruction content is determined, so that the music playing information obtained by the client executing the aggregation instruction is ensured to be synchronous, and the condition that the music playing is not synchronous due to different orders of executing a plurality of operations by different clients is avoided. On the other hand, the scheme enables each client to synchronize the music playing related operation information once in each preset unit time, so that the quasi-real-time synchronization effect is realized, and the user has low perception on the preset unit time, so that the experience close to real-time synchronization can be obtained.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Application scene overview
It should be noted that the following application scenarios are merely illustrated to facilitate understanding of the spirit and principles of the present invention, and the embodiments of the present invention are not limited in this respect. Rather, embodiments of the present invention may be applied to any scenario where applicable.
Embodiments of the invention support two or more people listening to music simultaneously, for example: in the music App, a user A and a user B enter an interface for listening to music together to listen to the same music tracks synchronously, in the process, when any one party or both parties carry out operation aiming at music playing, a server side aggregates operation information and returns an aggregation instruction to the user A and the user B, and the user A and the user B synchronously adjust music playing information by executing the aggregation instruction to ensure the synchronism of music playing.
Exemplary method
An exemplary embodiment of the present invention first provides a music play control method. Fig. 1 shows a system architecture diagram of an environment in which the method operates. As shown in fig. 1, the system architecture 100 may include: a first client 110, a second client 120, and a server 130. The first client 110 and the second client 120 are client devices used by users participating in listening to music together, and may be, for example, a smart phone, a tablet computer, a personal computer, a smart wearable device, a smart vehicle-mounted device, a game console, and the like. The server 130 may include a music App or a backend system of a third party platform.
The first client 110 and the second client 120 interact with the server 130 respectively to achieve synchronization of music playing information, so that users of the first client 110 and the second client 120 listen to music together.
It should be noted that, the number of the clients in the present exemplary embodiment is not limited, and for example, a third client, a fourth client, and the like may be further added to the system architecture 100 to implement that any number of users listen to music together.
Fig. 2 shows an exemplary flow of a music playing control method that can be executed by the server 130, including:
in step S210, operation information of each client in the same music play group for music playing is obtained.
Step S220, performing aggregation processing on the operation information of each client in a preset unit time to obtain an aggregation instruction.
Step S230, when the preset unit time is over, sending the aggregation instruction to each client, so that each client synchronizes the music playing information of the music playing group according to the aggregation instruction.
Each step in fig. 2 is described in detail below:
in step S210, operation information of each client in the same music play group for music playing is obtained.
The music playing group may be a resource set established by the server for providing music listening service, and includes a storage resource for recording client information and music playing information, a process or thread resource for performing music playing processing, a related queue resource, and the like. Clients in the same music play group can display the same music interface and have synchronous music play information. For example, the user a invites the user B to listen to music together, the server establishes a music play group into which the user a and the user B join, and subsequently, if the user B invites the user C again, the server joins the user C into the music play group. The music playing group can be represented in a room form, for example, a user a can establish a room for listening to music together in App through the room establishing function, and the server synchronously establishes a music playing group corresponding to the room in the background; and when the user B joins the room, the server side joins the user B into the music playing group.
Different music play groups are usually in an isolated state to prevent the mess of information. When the server side creates the music playing groups, unique Identification (ID) can be distributed to the server side so as to distinguish different music playing groups and realize isolation. For example, in a Java environment, the ID of a music play group may be generated by the tool class java.util.uuid, denoted roomID, and the generation process may be shown as the following pseudo code:
Figure BDA0002683686170000121
the unique identification of the music play set may be regarded as a parameter or attribute of the music play set by which ID information is recorded. In addition, more parameters can be set for the music playing group to represent other information of the music playing group. For example, a RoomInfoDTO class is set, which includes the following 5 parameters:
roomID, the unique identification of a music play group, may employ String data (character strings);
creatorID, user ID for creating a music play group, Long data (Long integer data) may be adopted;
createTime, the time to create a music play group, which may be Long data;
status, states of the music play group, including active, inactive, closed, etc., different states may be represented by different values, and String data may be used;
clientInfo, which represents client information in the music play set, such as the version of the client, the operating system used, and the like, may employ an object list.
By setting the parameters, the information of the music playing group can be comprehensively and effectively recorded; moreover, when the information of the music playing group changes, such as the state of the music playing group changes, a new user is added, the original user quits, and the like, the latest information can be synchronized by updating the parameter values without recording or deleting the data of the historical version.
If the client performs operations for music playing, including pausing the playing, continuing the playing, adjusting the playing progress (e.g., dragging the progress bar), switching music tracks (e.g., switching to the previous or next one), adjusting the music list (including adding and deleting tracks in the list, adjusting the order of tracks, etc.), adjusting the playing mode (e.g., switching between playing modes such as sequential playing, random playing, single track circulation, list circulation, etc.), etc., the operation information can be sent to the server, so that the server can process the operation information of different clients, and the synchronization of music playing among different clients is realized.
In an optional implementation manner, the server may create a music play group, and obtain operation information of each client for music play through the music play group. Namely, the operation information of the client is recorded in the music playing group where the client is located, thereby realizing the isolation of the operation information among different music playing groups. Furthermore, the client can send the operation information to a message queue of the music playing group, and the server receives each piece of operation information in sequence through the message queue so as to ensure the logical sequence between different pieces of operation information.
In general, when a user listens to music alone, if an operation for music playback is performed, the operation may be performed locally without being transmitted to a server. The service provider generally provides different versions of clients for different operating systems (e.g., iOS, Android, Windows, etc.), and each version of client can execute an instruction protocol based on the corresponding system. If a user performs an operation of switching music tracks, the instruction protocols for implementing the operation in the iOS and the Android systems are different, and the client of each system includes a corresponding set of instruction protocols.
Within the same music play group, there may be clients of different systems, using different native command protocols. If the iOS user performs the operation of switching music tracks, the iOS client processes the music tracks into corresponding operation information, and the operation information may not be recognized by the Android client. Based on this, in an optional implementation, a set of instruction protocols may be additionally set, which can be adapted to clients of different systems at the same time, and are called preset general instruction protocols, and the preset general instruction protocols may be deployed at the server and clients of various systems at the same time. The client responds to the music playing operation, can execute the music playing operation based on the local instruction protocol, generates operation information corresponding to the music playing operation based on the preset general instruction protocol, and sends the operation information to the server. Therefore, the operation information acquired by the server is operation information based on a preset general instruction protocol, and the operation information sent by any client is in the same protocol format, so that the server can conveniently perform unified processing subsequently.
In an optional implementation manner, the operation information based on the preset general instruction protocol may include any one or more of the following information:
the operation type, which type of operation the user has performed, includes PLAY (PLAY), PAUSE (PAUSE), PREVIOUS (PREVIOUS), NEXT (NEXT), and song-to-song (GOTO, which means to switch to a specified one, for example, the user clicks a certain song in the list);
a music identifier before operation, namely a music ID played before the operation of a user;
the operated music identifier is the ID of the music played after the user operates the music identifier;
playing the progress, namely, a timestamp of the position of the music progress bar after the user operates the music progress bar;
playing states, namely the playing states of music including playing, pausing and the like after the operation of a user;
the operation instruction serial number and the identification number allocated by the system for the current operation generally have uniqueness.
Each item of information may be represented by a specific parameter, for example, table 1 shows the parameter name and exemplary parameter value of each item of information.
TABLE 1
Name (R) Value of Means of
commandType PLAY Type of operation
formerSongID 85910 Music mark before operation
targetSongID 86640 Operated music mark
progress 13319 Progress of play
playStatus PAUSE Playing state
commandSeq 52007 Operating instruction sequence number
The preset general instruction protocol can form corresponding relations with local instruction protocols of various systems, for example, the corresponding relation is established between "commandType" in the preset general instruction protocol and operation type parameters in the local instruction protocol, and the corresponding relation is established between other parameters, so that the client can convert operation information of the local instruction protocol into operation information of the preset general instruction protocol.
In an optional implementation manner, the operation information acquired by the server in step S210 may be information of an operation performed by the client in an interface of the music play group. The interface of the music playing group is a music playing interface, when a user operates in the interface, the server needs to acquire operation information to be synchronously sent to other clients, when the user operates outside the interface, the server does not need to acquire the operation information, for example, when the user operates outside the interface, the server switches to other interfaces to operate, the operation is executed locally at the client and does not need to be sent to the server, or the server module outside the music playing group acquires the operation information.
In the present exemplary embodiment, in order to implement step S210, at least two clients are required to be in the music play group, and specifically, the relationship between the number of clients and the music play group may be determined in the following two ways:
(1) when at least two clients all listen to the music interface together, a music play group is established. For example, the user a invites the user B to listen to music together, before the user B accepts the invitation, the user a is in a state of listening to music alone, and the server does not establish a music playing group, so that music playing operation information performed by the user a is not sent to the server, and only needs to be locally executed. When the user B accepts the invitation to jump to the music playing interface, the server establishes a music playing group and adds the users A and B into the music playing group, and from the moment, the users A and B enter a music playing state together, and the operation information needs to be sent to the server.
(2) And when at least two clients enter the music playing group, setting the music playing group to be in an active state. For example, a user a establishes a music room together, a server establishes a music play group, at this time, only a user a is in the room, the server sets the state of the music play group to inactive (or idle, dormant, etc.), at this time, the music play operation information of the user a is not sent to the server, and the music play group may not run a related process or thread for processing the operation information; when other users join the room, the server sets the state of the music playing group to be active, which also indicates that the users enter the state of listening to music together, the music playing operation information of the users needs to be sent to the server, and the process or the thread starts to run in the music playing group.
In step S220, the operation information of each client in the preset unit time is aggregated to obtain an aggregation instruction.
The aggregation processing means that a plurality of pieces of operation information are comprehensively superposed to obtain an aggregation instruction, and the aggregation instruction is equivalent to completely executing the plurality of pieces of operation information once. The preset unit time is a time interval for performing aggregation processing and is also a time interval for synchronizing music playing information. In the present exemplary embodiment, instead of synchronizing the operation information to other clients each time the client performs an operation for music playing, the aggregation processing of the operation information is performed every preset unit time, and then an aggregation instruction is sent to each client, which is equivalent to performing synchronization once, for example, synchronization may be performed once at the end of every preset unit time. Therefore, the interaction times of synchronous operation information between the client and the server are reduced, and the possible operation sequence disorder caused by the operation of different clients at the same or similar time is avoided. The preset unit time can be determined according to the performance of the server, the network performance, the requirements of the actual scene and the like, and can also be dynamically adjusted in the process of listening to the music together. Generally, when the preset unit time is short, for example, set to 100ms, the user can obtain a feeling approaching real-time synchronization, and even cannot completely perceive a difference from the real-time synchronization.
In practical applications, the start and stop of the preset unit time may be determined in different manners, and thus, step S220 may include the following two implementation manners:
(1) and aggregating the operation information of each client in each period by taking the preset unit time as the period to obtain an aggregation instruction of each period. For example, the preset unit time is 100ms, the music play group may be established or the music play group enters an active state (i.e. the second user enters a room listening to music together), which is the start of the first preset unit time, and the time plus 100ms is the end of the first preset unit time and is the start of the second preset unit time, and there is no interval between two adjacent preset unit times. The start-stop time of each preset unit time is thus determined, so that by simply setting the timer, the aggregation processing of the operation information can be performed at the end of each preset unit time.
(2) And after the last aggregation processing, with the received first piece of operation information of each client as the start of the current preset unit time, performing aggregation processing on the operation information of each client in the current preset unit time to obtain an aggregation instruction of the current preset unit time. For example, after the last aggregation process is performed, after 3s of time, the next piece of operation information is received, that is, the client does not perform operations related to music playing in the 3s of time, and the received next piece of operation information is taken as the start of the current preset unit time without counting in the preset unit time; there may be a certain interval between two adjacent preset unit times. Therefore, the number of the operation information received by the server in each preset unit time can be increased on the whole, the times of aggregation processing performed by the server and the times of interaction with the client are further reduced, and the efficiency is improved.
In order to aggregate the operation information, in an optional implementation manner, the Server may store the operation information after obtaining the operation information, for example, a distributed cache Redis (Remote Dictionary service, which is a database) may be used to store the operation information. Taking any piece of operation information i as an example, the storage process is shown in fig. 3, and includes:
step S310, the server side can determine a key (key) of the operation information i according to the unique identifier of the music playing group and the receiving time of the operation information i;
step S320, storing the operation information i in the data set corresponding to the key.
The receiving time of the operation information i is a timestamp of the arrival at the server, and the server time can be used as a standard, so that adverse effects caused by inconsistent system time of each client are avoided. The commandOccuredTime represents the receiving time of the operation information, and the corresponding key can be: key ═ roomID + "_" + commanduccuredtime. The system establishes a corresponding data set for each key for storing the operation information.
In an optional implementation manner, the server may obtain the operation information item by item through the message queue, so that multiple pieces of operation information belonging to the same music play group are not received at the same time, thereby ensuring that the key of the operation information has uniqueness.
In another alternative embodiment, referring to fig. 4, step S310 may include:
step S410, calculating a unit time ordinal corresponding to the operation information i according to the receiving time of the operation information i and a preset unit time;
step S420, determining the key of the operation information i according to the unique identifier of the music play group and the unit time sequence corresponding to the operation information i.
The unit time ordinal number indicates within which preset unit time the receiving time of the operation information i is, and according to a starting and stopping determination mode of the preset unit time, the unit time ordinal number can be calculated by adopting a corresponding method:
(1) if the preset unit time is taken as a period, and the start and the end of the preset unit time are determined according to a strict period, the unit time sequence corresponding to the operation information i may be int (command interrupt time/T), where T represents the preset unit time, that is, an integer part is taken as the unit time sequence after the receiving time is divided by the preset unit time. Thus, the pseudo code to generate a key is as follows:
Figure BDA0002683686170000181
for example, roomID of a music play group is 2784c514-29c0-7128-f163-xx, the receiving time commandOccuredTime of the operation information is 1594801634985, and T is 1000. And calculating to obtain:
key=2784c514-29c0-7128-f163-xx_1594801634
the commandOccuredTime takes operation information in the range of 1594801634000-1594801634999, and keys are 2784c514-29c0-7128-f163-xx _ 1594801634.
(2) If the first piece of operation information of each client is received after the aggregation processing is carried out for the last time and is used as the start of the current preset unit time, the start time stamp of the preset unit time can be recorded at the start time of each preset unit time, the unique ordinal number is distributed, the receiving time is subtracted from the start time stamp of the preset unit time every time the operation information is received, and if the difference value is smaller than T, the ordinal number of the preset unit time is assigned to the unit time ordinal number corresponding to the operation information.
In any of the above methods, the operation information received in the same preset unit time has the same unit time sequence, and the operation information belonging to the same music play group and received in the same preset unit time has the same key. The number of the operation information corresponding to each key is more than one, and the operation information is stored in the same data set, so that the operation information is aggregated by taking the data set as a unit.
In an alternative embodiment, the operation information in the data set may be arranged in the order of the receiving time, for example, in the reverse order of the receiving time, and the operation information with the latest receiving time is arranged at the top. For example, an ordered set zset data structure in Redis may be employed to store operation information, the pseudo code of which is as follows:
Figure BDA0002683686170000191
wherein the score (representing the weight in zset) of the data can be stored as the receiving time of the operation information, and the data is sorted by the score in zset, thereby realizing the ordered arrangement of the operation information in each preset unit time.
Based on the zset data structure, before aggregation processing, the server may obtain an operation information list in a preset unit time, as shown in the following pseudo code:
Figure BDA0002683686170000192
the operation information list contains sequence information so that the server side can conveniently carry out aggregation processing according to the sequence of different operation information.
In an optional implementation manner, when the server performs aggregation processing, aggregation processing may be performed on each type of operation information of each client in a preset unit time, so as to obtain an aggregation instruction of each type. For example, the operation objects in the music-listening interface can be divided into different types, and when the user operates, the type to which the operation object belongs is the type of the operation information; or the operation information is divided into a play operation type and a list operation type, the play operation type refers to a type of operation which affects the music play state (such as a currently played track, a play progress, a play or pause state, and the like), the list operation type refers to a type of operation which affects the play list information (such as adding and deleting tracks in a list, changing the play mode, the play order, and the like), and the two types of operation information are respectively subjected to aggregation processing.
In an optional implementation manner, the server may perform aggregation processing on each type of operation information of each client within a preset unit time according to a preset aggregation rule, so as to obtain an aggregation instruction of each type. The aggregation rule may be specifically set according to the requirement of an actual scene, and the disclosure is not limited. Aggregation rules may be set separately for each type of operation information, for example:
and in the operation information of the playing operation types of each client in the preset unit time, taking the operation information with the latest receiving time as an aggregation instruction of the playing operation types. Referring to fig. 5, a user a performs an operation of switching to the next one, a user B performs an operation of dragging the progress bar, and a user C performs an operation of switching to the track 7, where the time when the operation information of the user C reaches the server is the latest, and an aggregation instruction of the three pieces of operation information is to switch to the track 7, that is, the operation information of the user C.
And in the operation information of the playing operation types of each client in the preset unit time, the operation information with the highest priority and the latest receiving time is used as an aggregation instruction of the playing operation types. For example, the operation priority of switching the song is higher than the operation of adjusting the progress, so that the operation of switching the song with the latest receiving time is selected, and the operation information of the operation is used as an aggregation instruction; and if the operation for adjusting the progress later in the receiving time exists in the preset unit time, performing invalidation processing on the operation.
And merging the operation information of the list operation types of the clients in the preset unit time to obtain the aggregation instruction of the list operation types. Referring to fig. 6, the user a performs operations of adding a track 1 and deleting a track 2, the user B performs an operation of adding a track 3, and the user C performs an operation of adding a track 4, and the aggregate instruction of the four pieces of operation information is to add tracks 1, 3, and 4 and delete a track 2, that is, to completely merge each piece of operation information.
It should be noted that the number of aggregation commands per preset unit time is not limited to one, and for example, aggregation commands of the play operation type and aggregation commands of the list operation type in a preset unit time may be obtained through the above processing.
In an optional implementation manner, the server may execute a pre-established delay aggregation task when each preset unit time is finished, so as to aggregate the operation information of each client within the preset unit time. The delayed aggregation task is a task executed after a preset unit time based on the start of the preset unit time.
In an alternative embodiment, the delay aggregation task may be established at a starting time of a preset unit time, and the delay time is set to be one preset unit time.
The main contents of the delay aggregation task may include: reading all operation information in a preset unit time, and executing aggregation processing; in some embodiments, sending the aggregation instruction after the aggregation processing to each client may be further included.
In an alternative embodiment, the delay aggregation task may be implemented by a time wheel, as shown in fig. 7, including:
step S710, establishing a time wheel with preset unit time as unit scales;
and S720, creating a linked list at each scale of the time wheel, pointing to the corresponding delay aggregation task in the preset unit time, and triggering and executing the delay aggregation task pointed by the corresponding linked list when each scale is reached.
The time wheel can refer to fig. 8, each scale is a preset unit time T, one round (round) of the time wheel is 512 scales, and the number can be set according to the requirement. The initialization of the time wheel can be shown with reference to the following pseudo code:
HashedWheelTimer playHashWheelTimer=new
hashed Wheeltimer (playthreadfactor, 100L, TimeUnit. MILLISECONDS)// set unit time with 100ms as the time wheel
A linked list is created at each scale of the time wheel, and specifically, the linked list may be created at a position indicated by a scale mark, for example, the linked list is created at a scale mark between 2 and 3 in fig. 8, and points to the delay aggregation task of preset unit time 2, so that when a pointer of the time wheel points to the scale mark, the delay aggregation task is found by the linked list and executed. It should be noted that the linked list of each scale mark may be established immediately after the time wheel is initialized, or the linked list of the next scale mark may be established when the pointer points to the previous scale mark. In fact, building a linked list, i.e. representing adding a delay aggregation task to a time round, can be referred to the following pseudo code:
Figure BDA0002683686170000211
through the arrangement of the time wheel, the association of the timer and the time delay aggregation task is realized, and the time delay aggregation task can be controlled more accurately and conveniently.
In step S230, when the preset unit time is over, the aggregation instruction is sent to each client, so that each client synchronizes the music playing information of the music playing group according to the aggregation instruction.
The music playing information includes music playing state, playing mode, list information, and the like. Because the aggregation instruction is an equivalent instruction obtained by aggregating all the operation information in the preset unit time, the same music playing information can be obtained after each client executes the aggregation instruction, and synchronization is realized. That is, when each preset unit time is over, synchronization is performed once, so that the user obtains experience similar to real-time synchronization.
Since the server may need to send the aggregation command to the client in each preset unit time, the process of listening to music together usually lasts from several minutes to several tens of minutes, and thus there is a frequent requirement for sending the aggregation command in the process. Based on this, in an optional implementation manner, the server may pre-establish a long connection with each client, and send the aggregation instruction through the long connection, where compared with a conventional short connection between the server and the client, the long connection may ensure stability of sending the aggregation instruction and reduce connection response times; and moreover, as the sending of the aggregation instruction is close to the timing behavior, the long connection does not need to be frequently detected by both sides, and the efficiency is improved.
Fig. 9 shows an exemplary connection manner between a server and a client. The server may form a regular connection with each client through a short connection of HTTP (Hyper Text Transfer Protocol), where the connection is used to send operation information or interaction of operation behavior that is performed by the client and is unrelated to listening to music together (such as changing personal information, collecting, forwarding, and commenting on a certain song). In addition, the server may deploy an IM (Instant Messaging) module, for example, a special IM server is provided in the background system, so as to provide the client with an Instant chat function; the IM module may establish a long connection with each client, and the server may send the aggregation instruction through the long connection, for example, after the server generates the aggregation instruction, the server may send the aggregation instruction to the client by calling an interface of the IM module. Therefore, special long connection does not need to be established additionally, and system resources are saved.
In an alternative embodiment, the aggregation instruction may be based on the above-mentioned preset general instruction protocol, which is already deployed on the clients of different systems, so that the clients, after receiving the aggregation instruction, may execute the aggregation instruction based on the preset general instruction protocol.
Exemplary embodiments of the present invention also provide a music play control method performed by a client. Referring to fig. 10, the music play control method may include the following steps S1010 to S1030:
step S1010, when the server is in the music play group, sending operation information for music play to the server.
For a client, joining a group listening to music together, entering an interface listening to music together, creating a room listening to music together, etc., may indicate that the client enters a music play group. In this state, when the user performs an operation related to listening to music together, the operation related to listening to music together is triggered to be sent to the server, and the operation related to listening to music together may be an operation performed by the user in an interface of a music play group (i.e., an interface for listening to music together).
In an optional implementation manner, the client may send operation information based on a preset general instruction protocol to the server, where the preset general instruction protocol has universality for clients of different systems, and may generally include any one or more of information of an operation type, a music identifier before operation, a music identifier after operation, a play progress, a play state, and an operation instruction sequence number, and specifically refer to the content in table 1. Therefore, the operation information sent by different clients has the same protocol format, and the server side can conveniently perform unified processing.
In an optional implementation manner, the client may respond to the music playing operation, execute the music playing operation based on the local instruction protocol, and then generate operation information corresponding to the music playing operation based on the preset general instruction protocol. After receiving the operation of the user, the client executes the operation based on the local instruction protocol, and then converts the operation into operation information based on a preset general instruction protocol so as to send the operation information to the server. Therefore, when a user performs operation, the operation is firstly locally effective, and then is synchronized to other clients in an aggregation instruction mode through aggregation processing of the server. Therefore, the problem that the user cannot take effect immediately after operation and the user mistakenly thinks that software setting or network exists is solved.
Step S1020, acquiring an aggregation instruction fed back by the server when the preset unit time is over, where the aggregation instruction is obtained by aggregating, by the server, operation information of each client of the music play group for music play in the preset unit time.
The server performs the aggregation process, and reference may be made to the content of step S220. The server generally returns an aggregation instruction of each preset unit time to the client when the preset unit time is ended.
In an alternative embodiment, the client may receive, through a long connection established in advance, an aggregation instruction fed back by the server at the end of a preset unit time. Because the aggregation instruction is received in each preset unit time, interaction is carried out with the server side in a long connection mode, interaction stability can be improved, and connection response times are reduced.
In an alternative embodiment, the client may establish a long connection with the IM module of the server. Because the IM module needs to provide chat service for the client through the long connection, the long connection is borrowed to send and receive the aggregation instruction, and a special long connection does not need to be established additionally, so that system resources are saved.
Step S1030, synchronizing the music playing information of the music playing group according to the aggregation instruction.
The aggregation instruction may include information of state change, and the client adjusts the music playing information of the music playing group to the state in the aggregation instruction by executing the aggregation instruction. Generally, the music playing information of a music playing group mainly includes two aspects: music playing state, playlist information. The client may synchronize the music play status and/or playlist information of the music play group according to the aggregation instruction, thereby maintaining synchronization with information of other clients.
In an optional implementation manner, the aggregation instruction adopts a format of a preset universal protocol instruction, which includes each item of information shown in table 1, and the client adjusts the music playing information of the music playing group in the local according to various information after operation, such as the operated music identifier, the operated music progress, the operated music playing state, and the like, so that the music playing information is consistent with the state in the aggregation instruction.
In an optional implementation manner, the server may generate aggregation instructions corresponding to different operation types within a preset unit time, and feed the aggregation instructions back to the client. The client may execute different types of aggregation instructions, such as an aggregation instruction of a play operation type to synchronously adjust a music play state, an aggregation instruction of a list operation type to synchronously adjust playlist information, and the like.
By the method shown in fig. 10, the client side realizes information synchronization with other client sides in the process of listening to music together by executing the aggregation instruction, so that the interaction times between the client side and the server side are reduced, the performance overhead of the system is saved, the synchronization sequence of the operation information between different client sides is avoided, and the accuracy of information synchronization is improved.
Fig. 11 shows an interaction flow of the music playing control method in the present exemplary embodiment, where the inviting side and the invited side are both clients, the inviting side is a client that invites other users to listen to music together, and the invited side is a client that is invited to listen to music together. The process specifically comprises the following steps:
the inviting end initiates an invitation, and the server forwards the invitation to the invited end after receiving the invitation; if the invited end accepts the invitation, the invitation is fed back to the server end, the server end informs the inviting end, then a music playing group is established, and the inviting end and the invited end are added into the group.
After a music playing group is established, within a first preset unit time T, the inviting end can send current local playing information, such as a playing track, progress, playlist information, a playing mode and the like, to the server end, and when the first preset unit time is over, the server end generates an aggregation instruction containing the current playing information of the inviting end and sends the aggregation instruction to the inviting end and the invited end; the inviting end and the invited end execute the aggregation instruction to carry out one-time synchronization, and the invited end is actually synchronized to be consistent with the current playing information of the inviting end.
And in a second preset unit time T, the inviting end performs progress dragging operation, the invited end performs song cutting operation, the server end receives the two operation information, generates an aggregation instruction and sends the aggregation instruction to the inviting end and the invited end, so that the inviting end and the invited end are synchronized again.
And in a third preset unit time T, the inviting end and the invited end do not perform related operations, and the server end does not send an aggregation instruction.
And by analogy, processing is respectively carried out in each preset unit time T until the invitation end and the invited end finish listening to the music together, for example, all users quit an interface for listening to the music together. Therefore, the synchronization of music playing among the clients in the whole process of listening to the music together is realized.
Exemplary devices
An exemplary embodiment of the present invention also provides a music playback control apparatus, which is explained below with reference to fig. 12 and 13.
Fig. 12 shows a music playback control apparatus 1200 that can be configured in a server, including:
an operation information obtaining unit 1210 configured to obtain operation information of each client in the same music play group for music playing, where at least two clients are in the music play group;
the aggregation processing unit 1220 is configured to aggregate the operation information of each client within a preset unit time to obtain an aggregation instruction;
the aggregation instruction sending unit 1230 is configured to send the aggregation instruction to each client when the preset unit time is over, so that each client synchronizes the music playing information of the music playing group according to the aggregation instruction.
In an alternative embodiment, the operation information obtaining unit 1210 is configured to:
and creating a music playing group, and acquiring the operation information of each client aiming at the music playing through the music playing group.
In an alternative embodiment, the operation information obtaining unit 1210 is configured to store any obtained operation information by:
determining a key of any operation information according to the unique identifier of the music play group and the receiving time of any operation information;
and storing any operation information into the data set corresponding to the key.
In an alternative embodiment, the operation information obtaining unit 1210 is configured to:
calculating a unit time sequence corresponding to any operation information according to the receiving time of any operation information and a preset unit time;
and determining the key of any operation information according to the unique identifier of the music play group and the unit time sequence corresponding to any operation information.
In an alternative embodiment, the operation information is arranged in the data set according to the order of the receiving time.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and when each preset unit time is finished, executing a pre-established delay aggregation task to aggregate the operation information of each client in the preset unit time.
In an optional implementation, the aggregation processing unit 1220 is configured to:
establishing a time wheel with preset unit time as unit scales;
and creating a linked list at each scale of the time wheel, pointing to the corresponding delay aggregation task in preset unit time, and triggering and executing the delay aggregation task pointed by the corresponding linked list when each scale is reached.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and aggregating the operation information of each client in each period by taking the preset unit time as the period to obtain an aggregation instruction of each period.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and after the last aggregation processing, with the received first piece of operation information of each client as the start of the current preset unit time, performing aggregation processing on the operation information of each client in the current preset unit time to obtain an aggregation instruction of the current preset unit time.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and respectively carrying out aggregation processing on each type of operation information of each client in preset unit time to obtain each type of aggregation instruction.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and according to a preset aggregation rule, performing aggregation processing on each type of operation information of each client in a preset unit time to obtain an aggregation instruction of each type.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and in the operation information of the playing operation types of each client in the preset unit time, taking the operation information with the latest receiving time as an aggregation instruction of the playing operation types.
In an optional implementation, the aggregation processing unit 1220 is configured to:
and merging the operation information of the list operation types of the clients in the preset unit time to obtain the aggregation instruction of the list operation types.
In an alternative embodiment, the operation information obtaining unit 1210 is configured to:
and acquiring operation information which is sent by each client and is based on a preset general instruction protocol.
In an optional implementation manner, the operation information based on the preset general instruction protocol includes any one or more of the following information:
operation type, music before operation identification, music after operation identification, playing progress, playing state and operation instruction sequence number.
In an optional implementation, the aggregation instruction sending unit 1230 is configured to:
and sending the aggregation instruction to each client through the long connection established in advance.
In an optional implementation, the aggregation instruction sending unit 1230 is configured to:
and respectively establishing long connection with each client through the instant communication module.
In an optional implementation manner, the operation information is information that the client performs an operation in an interface of the music play group.
Fig. 13 shows a music playback control apparatus 1300 that can be configured to a client, including:
an operation information transmitting unit 1310 configured to transmit operation information for music playing to the server when the server is in the music playing group;
an aggregation instruction obtaining unit 1320, configured to obtain an aggregation instruction fed back by the server when the preset unit time ends, where the aggregation instruction is obtained by aggregating, by the server, operation information of each client of the music playing group in the preset unit time for music playing;
the playing information synchronizing unit 1330 is configured to synchronize the music playing information of the music playing group according to the aggregation instruction.
In an optional implementation, the operation information sending unit 1310 is configured to:
and sending the operation information based on the preset general instruction protocol to the server.
In an alternative embodiment, the music playback control apparatus 1300 may further include an operation information processing unit configured to:
responding to the music playing operation, and executing the music playing operation based on the local instruction protocol;
and generating operation information corresponding to the music playing operation based on a preset general instruction protocol.
In an optional implementation manner, the operation information based on the preset general instruction protocol includes any one or more of the following information:
operation type, music before operation identification, music after operation identification, playing progress, playing state and operation instruction sequence number.
In an alternative embodiment, the aggregate instruction fetch unit 1320 is configured to:
and receiving an aggregation instruction fed back by the server end when the preset unit time is over through the pre-established long connection.
In an alternative embodiment, the aggregate instruction fetch unit 1320 is configured to:
and establishing long connection with an instant communication module of the server.
In an optional implementation manner, the operation information is information that is operated in an interface of the music play group.
In an alternative embodiment, the playing information synchronization unit 1330 is configured to:
and synchronizing the music playing state and/or the playlist information of the music playing group according to the aggregation instruction.
In addition, other specific details of the embodiments of the present invention have been described in detail in the embodiments of the present invention of the above method, and are not described herein again.
Exemplary storage Medium
Exemplary embodiments of the present invention also provide a computer readable storage medium, which may be embodied as a program product, for example, in the form of a portable compact disc read only memory (CD-ROM) and including program code, and which may be executed on a device, for example, a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RE, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Exemplary electronic device
An exemplary embodiment of the present invention also provides an electronic device, which is described below with reference to fig. 14.
The electronic device 1400 shown in fig. 14 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 14, the electronic device 1400 is embodied in the form of a general purpose computing device. The components of the electronic device 1400 may include, but are not limited to: at least one processing unit 1410, at least one memory unit 1420, a bus 1430 that couples various system components including the processing unit 1410 and the memory unit 1420, and a display unit 1440.
Where the storage unit stores program code, which may be executed by processing unit 1410, causes processing unit 1410 to perform steps according to various exemplary embodiments of the present invention described in the "exemplary methods" section above in this specification. For example, processing unit 1410 may perform method steps as shown in fig. 2, and so on.
The storage unit 1420 may include volatile memory units, such as a random access memory unit (RAM)1421 and/or a cache memory unit 1422, and may further include a read-only memory unit (ROM) 1423.
Storage unit 1420 may also include a program/utility 1424 having a set (at least one) of program modules 1425, such program modules 1425 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The bus 1430 may include a data bus, an address bus, and a control bus.
The electronic device 1400 may also communicate with one or more external devices 1500 (e.g., keyboard, pointing device, bluetooth device, etc.), which may be through an input/output (I/O) interface 1450. The electronic device 1400 further includes a display unit 1440 connected to the input/output (I/O) interface 1450 for displaying. Also, the electronic device 1400 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 1460. As shown, the network adapter 1460 communicates with the other modules of the electronic device 1400 via the bus 1430. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 1400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
It should be noted that although in the above detailed description several modules or sub-modules of the apparatus are mentioned, such division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (10)

1. A music playback control method, comprising:
acquiring operation information of each client in the same music play group aiming at music play, wherein at least two clients are in the music play group;
aggregating the operation information of each client in a preset unit time to obtain an aggregation instruction;
and when the preset unit time is over, sending the aggregation instruction to each client side, so that each client side synchronizes the music playing information of the music playing group according to the aggregation instruction.
2. The method according to claim 1, wherein the obtaining operation information of clients in the same music play group for music playing comprises:
and creating the music playing group, and acquiring the operation information of each client aiming at music playing through the music playing group.
3. The method according to claim 2, wherein after the operation information of each client for music playing is acquired by the music playing group, any one of the operation information is stored by:
determining a key of any operation information according to the unique identifier of the music play group and the receiving time of any operation information;
and storing any operation information to a data set corresponding to the key.
4. The method according to claim 3, wherein the determining the key of any operation information according to the unique identifier of the music play group and the receiving time of any operation information comprises:
calculating a unit time sequence corresponding to any operation information according to the receiving time of any operation information and the preset unit time;
and determining the key of any operation information according to the unique identifier of the music playing group and the unit time sequence corresponding to any operation information.
5. The method of claim 4, wherein the operation information is arranged in order of receiving time in the data set.
6. A music playback control method, comprising:
when the server is in the music playing group, sending operation information aiming at music playing to the server;
acquiring an aggregation instruction fed back by a server end when a preset unit time is over, wherein the aggregation instruction is obtained by aggregating operation information of each client of the music playing group aiming at music playing in the preset unit time by the server end;
and synchronizing the music playing information of the music playing group according to the aggregation instruction.
7. A music playback control apparatus, comprising:
the system comprises an operation information acquisition unit, a music playing unit and a music playing unit, wherein the operation information acquisition unit is used for acquiring operation information of all clients in the same music playing group aiming at music playing, and at least two clients are in the music playing group;
the aggregation processing unit is used for aggregating the operation information of each client in preset unit time to obtain an aggregation instruction;
and the aggregation instruction sending unit is used for sending the aggregation instruction to each client when the preset unit time is over, so that each client synchronizes the music playing information of the music playing group according to the aggregation instruction.
8. A music playback control apparatus, comprising:
the operation information sending unit is used for sending operation information aiming at music playing to the server side when the server side is in the music playing group;
the aggregation instruction acquisition unit is used for acquiring an aggregation instruction fed back by a server end when a preset unit time is over, wherein the aggregation instruction is obtained by aggregating operation information of each client of the music playing group aiming at music playing in the preset unit time by the server end;
and the playing information synchronizing unit is used for synchronizing the music playing information of the music playing group according to the aggregation instruction.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 6.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-6 via execution of the executable instructions.
CN202010969795.2A 2020-09-15 2020-09-15 Music playing control method and device, storage medium and electronic equipment Active CN112069353B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010969795.2A CN112069353B (en) 2020-09-15 2020-09-15 Music playing control method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010969795.2A CN112069353B (en) 2020-09-15 2020-09-15 Music playing control method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112069353A true CN112069353A (en) 2020-12-11
CN112069353B CN112069353B (en) 2024-04-02

Family

ID=73695931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010969795.2A Active CN112069353B (en) 2020-09-15 2020-09-15 Music playing control method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112069353B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112911368A (en) * 2021-01-15 2021-06-04 北京字跳网络技术有限公司 Interaction method, interaction device, electronic equipment and storage medium
CN113014994A (en) * 2021-04-14 2021-06-22 杭州网易云音乐科技有限公司 Multimedia playing control method and device, storage medium and electronic equipment
CN113360509A (en) * 2021-06-03 2021-09-07 广州小鹏智慧充电科技有限公司 Collected music synchronization method and device
CN114584822A (en) * 2022-03-03 2022-06-03 北京字跳网络技术有限公司 Synchronous playing method, device, terminal equipment and storage medium
CN114827698A (en) * 2022-03-22 2022-07-29 北京字跳网络技术有限公司 Synchronization method and device of playing information, terminal equipment and storage medium
CN114979083A (en) * 2022-05-13 2022-08-30 杭州网易云音乐科技有限公司 Audio playing method, audio playing device, equipment, medium and computing equipment

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5864868A (en) * 1996-02-13 1999-01-26 Contois; David C. Computer control system and user interface for media playing devices
GB0426847D0 (en) * 2004-12-08 2005-01-12 Ibm Method and system of committing operations of a synchronised transaction
US20070116316A1 (en) * 2002-05-06 2007-05-24 David Goldberg Music headphones for manual control of ambient sound
US20090249222A1 (en) * 2008-03-25 2009-10-01 Square Products Corporation System and method for simultaneous media presentation
KR20130089895A (en) * 2012-01-10 2013-08-13 지만석 Method of listening music via internet music streaming server
CN104618785A (en) * 2014-04-16 2015-05-13 腾讯科技(北京)有限公司 Audio and video playing method, device and system
US20160234345A1 (en) * 2015-02-05 2016-08-11 Qwire Holdings Llc Media player distribution and collaborative editing
US20170289202A1 (en) * 2016-03-31 2017-10-05 Microsoft Technology Licensing, Llc Interactive online music experience
CN107924391A (en) * 2015-04-20 2018-04-17 盈发伟公司 The method and apparatus of shared collaborative editing document
CN107943777A (en) * 2017-12-14 2018-04-20 北京久蓉科技有限公司 A kind of collaborative editing, cooperative processing method, device, equipment and storage medium
CN111385632A (en) * 2020-03-06 2020-07-07 腾讯科技(深圳)有限公司 Multimedia interaction method

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5864868A (en) * 1996-02-13 1999-01-26 Contois; David C. Computer control system and user interface for media playing devices
US20070116316A1 (en) * 2002-05-06 2007-05-24 David Goldberg Music headphones for manual control of ambient sound
GB0426847D0 (en) * 2004-12-08 2005-01-12 Ibm Method and system of committing operations of a synchronised transaction
US20090249222A1 (en) * 2008-03-25 2009-10-01 Square Products Corporation System and method for simultaneous media presentation
WO2009120301A2 (en) * 2008-03-25 2009-10-01 Square Products Corporation System and method for simultaneous media presentation
KR20130089895A (en) * 2012-01-10 2013-08-13 지만석 Method of listening music via internet music streaming server
CN104618785A (en) * 2014-04-16 2015-05-13 腾讯科技(北京)有限公司 Audio and video playing method, device and system
US20160234345A1 (en) * 2015-02-05 2016-08-11 Qwire Holdings Llc Media player distribution and collaborative editing
CN107924391A (en) * 2015-04-20 2018-04-17 盈发伟公司 The method and apparatus of shared collaborative editing document
US20170289202A1 (en) * 2016-03-31 2017-10-05 Microsoft Technology Licensing, Llc Interactive online music experience
CN108886523A (en) * 2016-03-31 2018-11-23 微软技术许可有限责任公司 Interactive online music experience
CN107943777A (en) * 2017-12-14 2018-04-20 北京久蓉科技有限公司 A kind of collaborative editing, cooperative processing method, device, equipment and storage medium
CN111385632A (en) * 2020-03-06 2020-07-07 腾讯科技(深圳)有限公司 Multimedia interaction method

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112911368A (en) * 2021-01-15 2021-06-04 北京字跳网络技术有限公司 Interaction method, interaction device, electronic equipment and storage medium
US12081835B2 (en) 2021-01-15 2024-09-03 Beijing Zitiao Network Technology Co., Ltd. Interactive method, electronic device and storage medium for opening a video sharing room
CN113014994A (en) * 2021-04-14 2021-06-22 杭州网易云音乐科技有限公司 Multimedia playing control method and device, storage medium and electronic equipment
CN113360509A (en) * 2021-06-03 2021-09-07 广州小鹏智慧充电科技有限公司 Collected music synchronization method and device
CN114584822A (en) * 2022-03-03 2022-06-03 北京字跳网络技术有限公司 Synchronous playing method, device, terminal equipment and storage medium
WO2023165384A1 (en) * 2022-03-03 2023-09-07 北京字跳网络技术有限公司 Synchronous playback method and apparatus, terminal device and storage medium
CN114584822B (en) * 2022-03-03 2023-09-15 北京字跳网络技术有限公司 Synchronous playing method and device, terminal equipment and storage medium
CN114827698A (en) * 2022-03-22 2022-07-29 北京字跳网络技术有限公司 Synchronization method and device of playing information, terminal equipment and storage medium
WO2023179406A1 (en) * 2022-03-22 2023-09-28 北京字跳网络技术有限公司 Playing information synchronization method and apparatus, and terminal device and storage medium
CN114827698B (en) * 2022-03-22 2024-02-02 北京字跳网络技术有限公司 Method, device, terminal equipment and storage medium for synchronizing play information
CN114979083A (en) * 2022-05-13 2022-08-30 杭州网易云音乐科技有限公司 Audio playing method, audio playing device, equipment, medium and computing equipment
CN114979083B (en) * 2022-05-13 2024-06-25 杭州网易云音乐科技有限公司 Audio playing method, audio playing device, equipment, medium and computing equipment

Also Published As

Publication number Publication date
CN112069353B (en) 2024-04-02

Similar Documents

Publication Publication Date Title
CN112069353B (en) Music playing control method and device, storage medium and electronic equipment
US20210119953A1 (en) Method and system for synchronizing instant messages between multiple clients
US20160072865A1 (en) Active offline storage management for streaming media application used by multiple client devices
US20140298179A1 (en) Method and device for playback of presentation file
CN110765744A (en) Multi-person collaborative document editing method and system
US9055193B2 (en) System and method of a remote conference
JP2014523568A (en) Efficient conditioning
US20150106730A1 (en) Framework for screen content sharing system with generalized screen descriptions
JP2022527232A (en) Mini-program processing methods, devices, equipment and storage media
US20230285854A1 (en) Live video-based interaction method and apparatus, device and storage medium
CN111259022B (en) Information synchronization method, synchronization system, computer equipment and medium
US11863600B2 (en) Techniques for efficient communication during a video collaboration session
WO2023179406A1 (en) Playing information synchronization method and apparatus, and terminal device and storage medium
US20150032805A1 (en) Method for Sharing Media Content, Terminal Device, and Content Sharing System
CN108415908B (en) Multimedia data processing method and server
EP3276886B1 (en) Time series messaging persistence and publication
US11632581B2 (en) Playlist switching method, apparatus and system, terminal and storage medium
CN113676761B (en) Multimedia resource playing method and device and main control equipment
US10484485B2 (en) Context-aware task processing for multiple devices
CN113346973B (en) Event prompting method and device, electronic equipment and computer readable storage medium
CN104917754A (en) Video data sending and receiving methods, servers and clients
US11456981B2 (en) System and method for capturing, storing, and transmitting presentations
US20230283740A1 (en) Front-end clipping using visual cues
US11627182B2 (en) Share based augmented reality content service system
US20230370399A1 (en) Information display method and apparatus, and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant