Disclosure of Invention
In order to overcome the problem of insufficient user communication during the broadcasting of the anchor or at least partially solve the problem, the invention provides an information loading method and device.
According to an aspect of the present invention, there is provided an information loading method, including:
acquiring the number of user connections and the partition to which the live broadcast room belongs;
if the user connection number is smaller than a first preset threshold value, mirror loading is carried out on user login information in the partition and bullet screen information in the partition;
and displaying the user login information and the barrage information loaded by the mirror image in the live broadcast room.
Specifically, the method further comprises the following steps:
if the user connection number is larger than or equal to the first preset threshold value, acquiring the frequency of sending the bullet screen according to the historical bullet screen number or the real-time bullet screen number;
and if the frequency of sending the barrage is less than a second preset threshold value, carrying out mirror image loading on the user login information in the partition and the barrage information in the partition.
Specifically, mirror loading is performed on user login information in the partition and bullet screen information in the partition, and the mirror loading includes:
and loading the user login information in the partition, and preloading the bullet screen information in the partition.
Specifically, the mirror image loading of the user login information and the barrage information in the partition includes:
acquiring the login time of a user and the time for sending bullet screen information;
loading the user login information in the partition in the reverse order according to the login time,
and loading the bullet screen information in the subareas in a reverse order according to the time for sending the bullet screen information.
Specifically, the method further comprises the following steps:
and acquiring the user connection number of the live broadcast room again every a first preset time length.
Specifically, the method further comprises the following steps:
and if the mirror image loading time length is judged to exceed the second preset time length, stopping the mirror image loading.
According to another aspect of the present invention, there is provided an information loading apparatus including:
the acquisition unit is used for acquiring the user connection number and the partition of the live broadcast room;
the loading unit is used for carrying out mirror loading on the user login information in the partition and the barrage information in the partition when the user connection number is smaller than a first preset threshold value;
and the display unit is used for displaying the user login information and the barrage information loaded by the mirror image in the live broadcast room.
Specifically, the obtaining unit is further configured to:
when the user connection number is larger than or equal to the first preset threshold value, acquiring the frequency of sending the bullet screen according to the historical bullet screen number or the real-time bullet screen number;
accordingly, the load unit is further configured to: and when the bullet screen sending frequency is smaller than a second preset threshold value, carrying out mirror image loading on the user login information in the partition and the bullet screen information in the partition.
Specifically, the loading unit is specifically configured to:
and loading the user login information in the partition, and preloading the bullet screen information in the partition.
Specifically, the obtaining unit is further configured to:
and acquiring the user connection number of the live broadcast room again every a first preset time length.
According to the information loading method and device, under the condition that the preset loading condition is met, the user login information and the barrage information of the partition to which the live broadcast room belongs are displayed in the live broadcast room through mirror image loading, an atmosphere for a plurality of users to enter is created for the anchor broadcast, the enthusiasm of the anchor broadcast is improved, and the user experience of the anchor broadcast is improved.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Fig. 1 is a flowchart of an information loading method according to an embodiment of the present invention. As shown in fig. 1, includes: s1, acquiring the user connection number and the partition of the live broadcast room; s2, if the user connection number is smaller than a first preset threshold value, mirror loading is carried out on the user login information in the partition and the bullet screen information in the partition; and S3, displaying the user login information and the barrage information loaded by the mirror image in the live broadcast room.
Specifically, in S1, when the anchor needs to perform a login operation before starting the live broadcast, and the anchor starts the live broadcast room after logging in, the server determines whether there is a breach record of deduction or blocking in the current anchor, and if all points of the anchor are deducted or there is a breach record of blocking, the anchor is prompted to fail to start the live broadcast, otherwise, the anchor normally starts the live broadcast room. And after the anchor starts the live broadcast room, the server acquires the user connection number and the affiliated subarea of the live broadcast room. The number of the user connections is the total number of the users entering the live broadcast room except the anchor broadcast, and the partitions of the live broadcast room are divided according to the types of the live broadcast. In S2, the server determines whether to perform mirror image loading according to the user connection number, that is, if the user connection number is smaller than a first preset threshold, mirror image loading may be performed on the user login information in the partition to which the live broadcast room belongs, mirror image loading may also be performed on the user login information in the partition and the bullet screen information in the partition at the same time, otherwise, mirror image loading is not performed. The user login information may be user information that is being logged in. The user login information may include a user image and a user name, and may also be the total number of users logged in the partition to which the current live broadcast room belongs. The bullet screen information can comprise a user name and a user message, and can also be information which is selected and sent by the user on an interface. The mirror loading is a redundant loading processing mode, and the user login information and the barrage information in the partition of the live broadcast room are loaded into the memory in a redundant mode. The present embodiment is not limited to the case where the anchor has just opened the live room.
Specifically, when the anchor logs in, the server determines whether the anchor login is successful by $ socket ═ Usersocket _ create (AF _ INET, SOCK _ STREAM,0) or die ("server connection failure |). As shown in fig. 2, after the server obtains the operation of the anchor to start live broadcasting, the bullet screen service, namely Return BarrageService () is loaded by default. After the bullet screen service is connected, a preloading service, namely PrestrainService () is started. After the preloading service is started, the preloading program and the mirror program can be directly started for loading, or the mirror loading can be performed under a certain condition, that is, the barrage service acquires the user connection number of the live broadcast room, that is, $ ActualUsers ═ barrage service.connect.number (LiveRoomID) and the affiliated partition, and transmits the user connection number to the preloading service. The preloading service judges whether the user connection number is smaller than the first preset threshold, if the first preset threshold is 50, if the user connection number is smaller than the first preset threshold, namely if ($ ActualUsers <50), a preloading program, namely Return RoomImageservice () and a mirror program are started. And the mirror image program loads the user login information and the barrage information in the partition to which the live broadcast room belongs into the memory. The present embodiment is not limited to a specific implementation of the program.
According to the embodiment, when the number of the user connections is few, the user login information and the barrage information are simultaneously subjected to mirror loading, so that the anchor can simultaneously watch the user login information and the barrage information of the partition to which the anchor room belongs, the formality of user access is improved, an atmosphere with high user participation and entering of a plurality of users is created for the anchor, the enthusiasm of anchor broadcasting is improved, and the user experience of the anchor is improved. Meanwhile, the loading efficiency is improved through memory loading.
On the basis of the above embodiment, the present embodiment further includes: if the user connection number is larger than or equal to the first preset threshold value, acquiring the frequency of sending the bullet screen according to the historical bullet screen number or the real-time bullet screen number; and if the frequency of sending the barrage is less than a second preset threshold value, carrying out mirror image loading on the user login information in the partition and the barrage information in the partition.
Specifically, the historical bullet screen number is the total number of bullet screens of the live broadcast room acquired by the server. The server also obtains the time from the beginning of sending the first bullet screen to the end of sending the last bullet screen, divides the total number of the bullet screens by the time to obtain the number of the bullet screens sent per minute, and takes the number of the bullet screens sent per minute as the frequency of sending the bullet screens. The server can also obtain the number of the live barrages in the live broadcast room, and the number of the barrages sent in the last minute is used as the frequency for sending the barrages. If the server judges that the user connection number is larger than or equal to the first preset threshold value, the server further judges whether the bullet screen sending frequency is smaller than the second preset threshold value. And if the frequency of sending the bullet screen is less than the second preset threshold value, carrying out mirror image loading, otherwise, not carrying out mirror image loading.
Specifically, as shown in fig. 2, if the server determines that the number of user connections is greater than the first preset threshold, the server performs the next determination, that is, Return BarrageServiceShow (). The server may obtain the total number of barrages of the live broadcast room in Barrage servicemessage (), that is, (Barrage $ Barrage message sum) $ Barrage message sum ═ Barrage service.message.minimum (LiveRoomID), and the time from the start of the first Barrage transmission to the end of the last Barrage transmission. The server can also directly take the number of the bullet screens sent in the last minute as the frequency for sending the bullet screens. Assuming that the first preset threshold is 50, the user connection number is greater than 50, and the second preset threshold is 10, determining whether the frequency of sending the bullet screen is less than 10, i.e., $ BarrageMessageSum <10, if the frequency of sending the bullet screen is greater than 10, stopping mirror loading, closing a preloading service, i.e., $ RequestUserType, otherwise, starting a preloading program, i.e., Return roommageservice (). The present embodiment is not limited to a specific implementation of the program.
According to the method and the device, the statistical dimensionality is increased under the condition that the user connection number reaches the standard but the user participation degree is low, the formality of user access is improved by carrying out mirror image loading on the user login information and the bullet screen information, an atmosphere for a plurality of users to enter is created for the anchor, the enthusiasm of anchor broadcasting is improved, and the user experience of the anchor broadcasting is improved.
On the basis of the foregoing embodiment, in this embodiment, mirror loading is performed on user login information and barrage information in a partition to which the live broadcast room belongs, where the mirror loading includes: and loading the user login information in the partition, and preloading the bullet screen information in the partition.
Specifically, because the data magnitude of the user login information is small, direct loading can be performed. And the bullet screen information data has a large magnitude, so that the bullet screen information cannot be directly loaded, and if the bullet screen information is directly loaded, the server can be crashed. The server acquires the login time of a user and the time for sending the bullet screen information, loads the user login information in the partition in a reverse order according to the login time, and loads the bullet screen information in the partition in a reverse order according to the time for sending the bullet screen information. Therefore, the latest user login information and the latest barrage information are loaded firstly. The server may specify the number of loaded bullet screen information pieces per minute as required, for example, 10 bullet screen information pieces per minute are loaded, the latest 10 bullet screen information pieces are loaded, and may also specify the loading frequency of each piece of bullet screen information, for example, loading at the frequency of 6S each piece. And the effective user login number and the effective bullet screen number are not counted by using the user login information and the bullet screen information loaded by the mirror image.
Specifically, the user login information in the Partition to which the live broadcast room belongs is loaded, that is, $ userprtition ═ sql (select Partition form web _ Partition _ old where UserType ═ UserType'). And preloading bullet screen information in the partition to which the live broadcast room belongs, namely, ImageBarrageDetailed ═ BarrageService.Message.Detailed ($ UserPartion). And loading rules are used for reverse loading according to time, namely LoadmermeryLogin (ImageUserLogin), LoadmermeryDetailed (ImageBarrageDetailed), and synchronously loading the user login information and the barrage information into a memory. The present embodiment is not limited to a specific implementation of the program.
According to the method and the device for loading the bullet screen information, the mirror image loading is carried out on the user login information and the bullet screen information, the formality of user access is improved, an atmosphere for a plurality of users to enter is created for the anchor, the enthusiasm of anchor broadcasting is improved, and the user experience of the anchor is improved.
On the basis of the above embodiment, the present embodiment further includes: and acquiring the user connection number of the live broadcast room again every a first preset time length.
Specifically, after mirror loading is carried out on the user login information and the barrage information for the first time, the server obtains the user connection number of the live broadcast room again every first preset time. And the server judges whether the user connection number is smaller than a first preset threshold value, and if the user connection number is smaller than the first preset threshold value, the mirror image loading and displaying of the user login information and the barrage information are continued. In one case, as shown in fig. 2, if the number of user connections is greater than or equal to the first preset threshold, the server may stop the mirror loading and stop the preloading service. In another case, as shown in fig. 3, when the number of user connections is greater than or equal to the first preset threshold, the server may also continue to obtain the frequency of sending the bullet screens according to the number of historical bullet screens or the number of real-time bullet screens. And the server judges whether the frequency of sending the bullet screen is less than the second preset threshold value. And if the frequency of sending the bullet screen is less than the second preset threshold value, carrying out mirror image loading, otherwise, not carrying out mirror image loading.
The embodiment judges whether the preset loading condition is met or not at intervals, terminates the mirror image loading and the preloading service under the condition that the preset loading condition is not met, and reduces the waste of resources.
On the basis of the above embodiment, the present embodiment further includes: and if the mirror image loading time length is judged to exceed the second preset time length, stopping the mirror image loading.
Specifically, as shown in fig. 2 and fig. 3, the duration of the mirror loading is limited to a second preset duration, and if the second preset duration is exceeded, the mirror loading is automatically stopped, and the preloading service, i.e., close (PrestrainService ()), is closed. And after closing, restoring the normal human atmosphere display of the anchor by adopting a gradual and gradual decreasing mode. And clearing the bullet screen record of the mirror loading, namely EliminateBarrage (record). The embodiment limits the occupation time of the resources, and reduces the waste of the resources.
According to the embodiment, under the condition that the preset loading condition is met, the user login information and the barrage information of the partition to which the live broadcast room belongs are displayed in the live broadcast room through mirror image loading, so that an atmosphere for entering of a plurality of users is created for the anchor, the enthusiasm of the anchor is improved, and the user experience of the anchor is improved.
Fig. 4 is a structural diagram of an information loading apparatus according to an embodiment of the present invention. As shown in fig. 4, the device comprises an acquisition unit 1, a loading unit 2 and a display unit 3, wherein:
the acquisition unit 1 is configured to acquire the number of user connections and the partition to which the user connections belong in the live broadcast room; the loading unit 2 is configured to perform mirror loading on the user login information in the partition and the barrage information in the partition when the user connection number is smaller than a first preset threshold; the display unit 3 is used for displaying the user login information and the barrage information loaded by the mirror image in the live broadcast room.
Specifically, when the anchor needs to perform login operation before the live broadcast is started, the anchor starts the live broadcast room after logging in, the server judges whether the current anchor has a deduction or forbidden illegal record, if all the points of the anchor are deducted or the forbidden illegal record exists, the anchor is prompted to be incapable of starting the live broadcast, and otherwise, the anchor normally starts the live broadcast room. After the anchor starts the live broadcast room, the obtaining unit 1 obtains the user connection number and the partition of the live broadcast room. The number of the user connections is the total number of the users entering the live broadcast room except the anchor broadcast, and the partitions of the live broadcast room are divided according to the types of the live broadcast. And the loading unit 2 judges whether to perform mirror loading according to the user connection number, namely if the user connection number is smaller than a first preset threshold value, performing mirror loading on user login information and barrage information in the partition to which the live broadcast room belongs, and otherwise, not performing mirror loading. The user login information may be user information that is being logged in. The user login information may include a user image and a user name, and may also be the total number of users logged in the partition to which the current live broadcast room belongs. The bullet screen information can comprise a user name and a user message, and can also be information which is selected and sent by the user on an interface. The mirror loading is a redundant loading processing mode, and the user login information and the barrage information in the partition of the live broadcast room are loaded into the memory in a redundant mode. And the display unit 3 displays the user login information and the barrage information in the current live broadcast room. The present embodiment is not limited to the case where the anchor has just opened the live room.
According to the method and the device, when the number of the user connections is few, the mirror loading is carried out on the user login information and the bullet screen information, the formality of user access is improved, an atmosphere for a plurality of users to enter is created for the anchor, the enthusiasm of anchor broadcasting is improved, and the user experience of the anchor broadcasting is improved.
On the basis of the above example, in this embodiment, the obtaining unit 1 is further configured to obtain, when the number of user connections is greater than or equal to the first preset threshold, a frequency of sending the bullet screen according to the number of historical bullet screens or the number of real-time bullet screens; correspondingly, the loading unit 2 is further configured to perform mirror loading on the user login information in the partition and the bullet screen information in the partition when the frequency of sending the bullet screen is smaller than a second preset threshold.
Specifically, the historical bullet screen number is the total number of bullet screens of the live broadcast room acquired by the acquisition unit 1. The acquiring unit 1 further acquires the time from the beginning of the transmission of the first bullet screen to the end of the transmission of the last bullet screen, divides the total number of the bullet screens by the time to acquire the number of the bullet screens transmitted per minute, and takes the number of the bullet screens transmitted per minute as the frequency of the transmission of the bullet screens. The acquiring unit 1 may further acquire the number of live barrage pieces in the live broadcast room, and the number of barrage pieces sent in the last minute is used as the frequency of sending the barrage. If the loading unit 2 determines that the number of user connections is greater than the first preset threshold, the loading unit 2 further determines whether the frequency of sending the bullet screen is less than the second preset threshold. And if the frequency of sending the bullet screen is less than the second preset threshold value, carrying out mirror image loading, otherwise, not carrying out mirror image loading.
According to the method and the device, the statistical dimensionality is increased under the condition that the user connection number reaches the standard but the user participation degree is low, the formality of user access is improved by carrying out mirror image loading on the user login information and the bullet screen information, an atmosphere for a plurality of users to enter is created for the anchor, the enthusiasm of anchor broadcasting is improved, and the user experience of the anchor broadcasting is improved.
On the basis of the above example, in this embodiment, the loading unit 2 is specifically configured to load the user login information in the partition, and preload the barrage information in the partition.
Specifically, because the data magnitude of the user login information is small, direct loading can be performed. And the bullet screen information data has a large magnitude, so that the bullet screen information cannot be directly loaded, and if the bullet screen information is directly loaded, the server can be crashed. The acquiring unit 1 is further configured to acquire login time of a user and time for sending bullet screen information, and correspondingly, the loading unit 2 is further configured to load the login information of the user in the partition in reverse order according to the login time, and load the bullet screen information in the partition in reverse order according to the time for sending the bullet screen information. Therefore, the latest user login information and the latest barrage information are loaded firstly. The loading unit 2 can specify the number of loaded bullet screen information per minute according to the requirement. Meanwhile, the loading frequency of each piece of bullet screen information can be specified. And the effective user login number and the effective bullet screen number are not counted by using the user login information and the bullet screen information loaded by the mirror image.
According to the method and the device for loading the bullet screen information, under the condition that the preset loading condition is met, the user login information and the bullet screen information are subjected to mirror image loading, the formality of user access is improved, an atmosphere for entering of a plurality of users is created for the anchor broadcast which is just started, the enthusiasm of the anchor broadcast is improved, and the user experience of the anchor broadcast is improved.
On the basis of the above example, the acquiring unit 1 in this embodiment is further configured to: and acquiring the user connection number of the live broadcast room again every a first preset time length.
Specifically, the obtaining unit 1 obtains the number of user connections in the live broadcast room again every a first preset time after mirror loading is performed on the user login information and the barrage information for the first time. The loading unit 2 judges whether the user connection number is smaller than a first preset threshold, if so, the mirror loading is continuously performed on the user login information and the bullet screen information, and the display unit 3 continuously displays the user login information and the bullet screen information. In one case, as shown in fig. 2, the loading unit 2 is further configured to stop mirror loading and stop preloading service when the number of user connections is greater than or equal to the first preset threshold. In another case, as shown in fig. 3, when the number of user connections is greater than or equal to the first preset threshold, the obtaining unit 1 may continue to obtain the frequency of sending the bullet screens according to the number of historical bullet screens or the number of real-time bullet screens. And the loading unit 2 judges whether the frequency of sending the bullet screen is less than the second preset threshold value. And if the frequency of sending the bullet screen is less than the second preset threshold value, carrying out mirror image loading, otherwise, not carrying out mirror image loading.
The embodiment judges whether the preset loading condition is met or not at intervals, terminates the mirror image loading and the preloading service under the condition that the preset loading condition is not met, and reduces the waste of resources.
Finally, the method of the present application is only a preferred embodiment and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.