CN109327726B - Barrage message processing method and device, terminal and storage medium - Google Patents

Barrage message processing method and device, terminal and storage medium Download PDF

Info

Publication number
CN109327726B
CN109327726B CN201811163520.9A CN201811163520A CN109327726B CN 109327726 B CN109327726 B CN 109327726B CN 201811163520 A CN201811163520 A CN 201811163520A CN 109327726 B CN109327726 B CN 109327726B
Authority
CN
China
Prior art keywords
bullet screen
current
screen distribution
live broadcast
class
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.)
Active
Application number
CN201811163520.9A
Other languages
Chinese (zh)
Other versions
CN109327726A (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201811163520.9A priority Critical patent/CN109327726B/en
Publication of CN109327726A publication Critical patent/CN109327726A/en
Application granted granted Critical
Publication of CN109327726B publication Critical patent/CN109327726B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/488Data services, e.g. news ticker
    • H04N21/4884Data services, e.g. news ticker for displaying subtitles

Abstract

The embodiment of the invention discloses a method, a device, a terminal and a storage medium for processing a bullet screen message. When detecting that a current live broadcast room is started, acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of a current class corresponding to the current live broadcast room; taking a current listener interface object which is initialized in a current class as a current transfer parameter, calling a listener setting method in a bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class so as to establish a reference relation between a current live broadcast room and the bullet screen distribution object; and receiving the bullet screen information distributed by the bullet screen distribution object in the current live broadcast based on the reference relation. By adopting the technical scheme, the automatic identification of the current live broadcast room is realized, and the bullet screen message is distributed and processed, so that the distribution efficiency of the bullet screen and the maintainability of the code are greatly improved.

Description

Barrage message processing method and device, terminal and storage medium
Technical Field
The embodiment of the invention relates to the technical field of barrage, in particular to a method, a device, a terminal and a storage medium for processing barrage messages.
Background
With the development of the network interaction platform, more and more users can communicate by logging in the network interaction platform. Among them, webcast is an application very popular with users. The user can express the emotion of the user by sending the barrage in the live broadcast watching process. The bullet screen service comprises important functions of receiving, processing and pushing bullet screens of users. After receiving the bullet screen message sent by the bullet screen server, the client needs to distribute the bullet screen message to the live broadcast room in which the client is running.
Currently, different types of live broadcast rooms generally perform distribution processing of barrage messages through different barrage distribution channels. If the types of the live rooms are increased, distribution channels are increased, and the maintainability of the codes is reduced.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a terminal and a storage medium for processing a barrage message, which are used for automatically identifying a current live broadcast room and distributing and processing the barrage message, so that the distribution efficiency of the barrage and the maintainability of codes are greatly improved.
In a first aspect, an embodiment of the present invention provides a method for processing a bullet screen message, where the method includes:
when the start of a current live broadcast room is detected, acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of the current class corresponding to the current live broadcast room;
taking the current listener interface object which is initialized in the current class as a current transfer parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object;
and receiving the bullet screen message distributed by the bullet screen distribution object in the current live broadcast based on the reference relation.
Further, acquiring a single bullet screen distribution object of a preset bullet screen distribution class includes:
and obtaining the bullet screen distribution object of the preset bullet screen distribution class by calling an object obtaining method in the preset bullet screen distribution class.
Further, a function of calling a listener setting method in the bullet screen distribution object is realized to establish a reference relationship between the current live broadcast room and the bullet screen distribution object, and the method is realized by the following steps:
calling a listener assignment method, and assigning the current listener interface object to a preset listener interface variable in the bullet screen distribution class;
using the assigned preset listener interface variable as a target listener interface object in the bullet screen distribution class;
and establishing a reference relation between the current live broadcast room and the bullet screen distribution object through the target listener interface object.
Further, the current listener interface object completes initialization by calling a constructor of an implementation class of a preset listener interface protocol, and the implementation class inherits from the preset listener interface protocol through keyword instances.
Further, the preset listener interface protocol comprises a receiving method of the barrage message;
correspondingly, receiving, by the current live broadcast, the bullet screen message distributed by the bullet screen distribution object includes:
and the current live broadcast room receives the bullet screen information distributed by the bullet screen distribution object through the receiving method.
Further, the method further comprises:
and when detecting that the page of the current live broadcast room is destroyed, calling a listener interface emptying method of the bullet screen distribution object in the destruction function of the current class to delete the reference relation.
Further, the function of calling the interface clearing method of the bullet screen distribution object is realized by executing the following steps:
and calling a null object setting method, and assigning the null object to the preset listener interface variable.
In a second aspect, an embodiment of the present invention further provides a device for processing a bullet screen message, where the device includes:
the system comprises a bullet screen distribution object acquisition module, a bullet screen distribution object acquisition module and a bullet screen distribution object acquisition module, wherein the bullet screen distribution object acquisition module is used for acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of a current class corresponding to a current live broadcast room when the current live broadcast room is detected to be started;
a reference relationship establishing module, configured to use a current listener interface object that completes initialization in the current class as a current transfer parameter, call a listener setting method in the bullet screen distribution object, and use the current listener interface object as a target listener interface object in the bullet screen distribution class, so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object;
and the bullet screen message receiving module is used for receiving bullet screen messages distributed by the bullet screen distribution objects in the current live broadcast based on the reference relation.
Further, the bullet screen distribution object obtaining module is specifically configured to:
when the current live broadcast room is detected to be started, in a life cycle function of a current class corresponding to the current live broadcast room, an object obtaining method in a preset bullet screen distribution class is called to obtain a bullet screen distribution object of the preset bullet screen distribution class.
Further, a function of calling a listener setting method in the bullet screen distribution object is realized to establish a reference relationship between the current live broadcast room and the bullet screen distribution object, and the method is realized by the following steps:
calling a listener assignment method, and assigning the current listener interface object to a preset listener interface variable in the bullet screen distribution class;
using the assigned preset listener interface variable as a target listener interface object in the bullet screen distribution class;
and establishing a reference relation between the current live broadcast room and the bullet screen distribution object through the target listener interface object.
Further, the current listener interface object completes initialization by calling a constructor of an implementation class of a preset listener interface protocol, and the implementation class inherits from the preset listener interface protocol through keyword instances.
Further, the preset listener interface protocol comprises a receiving method of the barrage message;
correspondingly, the bullet screen message receiving module is specifically configured to:
and the current live broadcast room receives the bullet screen information distributed by the bullet screen distribution object through the receiving method.
Further, the apparatus further comprises:
and the reference relation deleting module is used for calling a listener interface clearing method of the bullet screen distribution object in the destruction function of the current class to delete the reference relation when detecting that the page of the current live broadcast room is destroyed.
Further, the reference relationship deleting module is specifically configured to:
and when detecting that the page of the current live broadcast room is destroyed, calling an empty object setting method in the destruction function of the current class, and assigning an empty object to the preset monitor interface variable to delete the reference relationship.
In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for processing the bullet screen message provided by any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the method for processing a bullet screen message provided in any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, when the current live broadcast room is detected to be started, a single bullet screen distribution object of the preset bullet screen distribution class is obtained in the life cycle function of the class corresponding to the live broadcast room. The current listener interface object which is initialized in the class corresponding to the live broadcast room is used as the current transmission parameter, a listener setting method in the bullet screen distribution object is called, and the current listener interface object can be used as a target listener interface object in the bullet screen distribution class, so that the bullet screen distribution object points to the current live broadcast room, a reference relation between the current live broadcast room and the bullet screen distribution object is established, and a unique channel between the current live broadcast room and the bullet screen distribution object is established. Based on the reference relation, the bullet screen distribution object can send bullet screen information to the current live broadcast room, and the bullet screen distribution efficiency is improved.
Drawings
Fig. 1 is a flowchart of a method for processing a bullet screen message according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for processing a bullet screen message according to a second embodiment of the present invention;
fig. 3 is a block diagram of a bullet screen message processing apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
For the purpose of clearly and clearly describing the embodiments of the present invention, the following first briefly introduces the implementation principle of the present invention:
in order to avoid establishing a plurality of channels between different types of live broadcast rooms and barrage distribution objects, the technical scheme of the embodiment of the invention establishes a one-to-one reference relationship between the barrage distribution objects and listener interface objects of the live broadcast rooms so as to send barrage messages to the live broadcast rooms. The reference relation is established by using a listener interface object of the live broadcast room as a parameter to be transmitted to the bullet screen distribution class, so that the bullet screen distribution object points to the live broadcast room of only one type. When different live broadcast rooms are started, the listener interface objects in the bullet screen distribution objects can be automatically switched, so that bullet screen messages are automatically distributed to the live broadcast room which is currently running.
Because the reference relation between the bullet screen distribution object and the live broadcast room is established in the embodiment of the invention so as to distribute the bullet screen message according to the type of the live broadcast room, when the bullet screen distribution object only points to the monitor interface object of one type of the live broadcast room, the bullet screen distribution object can distribute the bullet screen message by using the bullet screen receiving method in the monitor interface object. In order to enable the listener interface objects corresponding to different live rooms to have the bullet screen receiving method, the embodiment of the invention firstly defines a preset listener interface protocol of a bullet screen message, the protocol is of a listener interface type, and the listener interface object corresponding to the live room can have the bullet screen receiving method by inheriting the class corresponding to the live room to the preset listener interface protocol.
Specifically, the method for defining the receiving protocol danmurouterelistener is as follows:
Public interface DanmuRouterListener{
Public void onReceiveGiftBean(GiftBean giftBean);
Public void onReceiveTipsBean(TipsBean tipsBean)
}
the preset listener interface protocol danmurouterelistener includes some columns of methods for receiving barrage messages, and each method corresponds to one type of barrage information. That is to say, a set of bullet screen messages become a unique Bean object after being analyzed, and then the Bean object is sent to the live broadcast room through the defined receiving methods.
Example one
Fig. 1 is a flowchart of a method for processing a bullet screen message according to an embodiment of the present invention, where the method may be executed by a device for processing a bullet screen message, the device may be implemented by software and/or hardware, and the device may be integrated in a mobile terminal such as a mobile phone, a tablet computer, and the like. Referring to fig. 1, the method of the present embodiment specifically includes:
s110, when the current live broadcast room is detected to be started, acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of the current class corresponding to the current live broadcast room.
Each live broadcast room can be used as an Activity page corresponding to a predefined class. Each live broadcast room calls a life cycle function onCreate when being started, and the function mainly carries out some necessary initialization work when the live broadcast room is started.
The current live broadcast room in this embodiment may be any type of live broadcast room supported by the application program for display, such as a half-screen live broadcast room, a color value live broadcast room, a game live broadcast room, and the like. When the current live broadcast room is detected to be started, the bullet screen distribution object of the preset bullet screen distribution class can be obtained by calling an object obtaining method Danmu client.
The method for acquiring the object in the bullet screen distribution class is a singleton mode, namely, the same object is returned each time the method is called. In this embodiment, for any type of live broadcast room, the method is called to obtain the bullet screen distribution object mDanmuClient in the preset bullet screen distribution class.
In this embodiment, after the bullet screen distribution object is obtained, a function in the bullet screen distribution object may be called to transfer parameters to the bullet screen distribution object, so as to establish a reference relationship between the live broadcast room and the bullet screen distribution object.
S120, taking the current listener interface object which is initialized in the current class as a current transmission parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object.
Optionally, initializing a current listener interface object in a current class corresponding to the current live broadcast room, and enabling the current listener interface object to have a receiving method of each bullet screen message in a preset listener interface protocol by inheriting the predefined preset listener interface protocol with the current class corresponding to the live broadcast room. When the current listener interface object is subsequently transmitted to the bullet screen distribution object as a parameter, the bullet screen distribution object can send the bullet screen message to the current listener interface object by using the bullet screen message receiving method.
Preferably, the current listener interface object may further complete initialization by calling a constructor of an implementation class of the preset listener interface protocol, where the implementation class inherits from the preset listener interface protocol through keyword instances.
Specifically, the method for defining the preset listener interface protocol to realize the DanmuRouterListenerImp class includes:
Public class DanmuRouterListenerImp implements DanmuRouterListener{
@override
Public void onReceiveGiftBean(GiftBean giftBean){}
@override
Public void onReceiveTipsBean(TipsBean tipsBean){}
}
after the realization type DanmuRouterListenerImp inherits the preset listener interface protocol DanmuRouterListener through keywords, all the bullet screens in the protocol DanmuRouterListener can realize the onReceiver receiving method. The function of each implementation is added with an @ override mark for indicating that the function is a duplicate of a method in the preset listener interface protocol.
Since the current live broadcast room has acquired the bullet screen distribution objects, some methods in the bullet screen distribution objects can be called. In this embodiment, after the current listener interface object is initialized, the initialized current listener interface object can be transferred to the bullet screen distribution object by calling the listener setting method setdanmunRouterLister () in the bullet screen distribution object, so that the bullet screen distribution object has the listener interface object of the current live broadcast room, that is, the target listener interface object in the bullet screen distribution class is the current listener interface object of the current live broadcast room, and thus, the reference relationship between the current live broadcast room and the bullet screen distribution object is established.
And S130, receiving the bullet screen information distributed by the bullet screen distribution object in the current live broadcast based on the reference relation.
After the reference relationship is established, when the bullet screen message comes subsequently, the bullet screen distribution object can send the bullet screen message to the corresponding current live broadcast room through the bullet screen message receiving method.
According to the technical scheme of the embodiment of the invention, when the current live broadcast room is detected to be started, a single bullet screen distribution object of the preset bullet screen distribution class is obtained in the life cycle function of the class corresponding to the live broadcast room. And taking the current listener interface object which completes initialization in the class corresponding to the live broadcast room as the current transfer parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class, so that the bullet screen distribution object points to the current live broadcast room to establish a reference relation between the current live broadcast room and the bullet screen distribution object, namely establishing a unique channel between the current live broadcast room and the bullet screen distribution object. Based on the reference relation, the bullet screen distribution object can send bullet screen information to the current live broadcast room, and the bullet screen distribution efficiency is improved.
Example two
Fig. 2 is a flowchart of a method for processing a bullet screen message according to a second embodiment of the present invention, which is optimized based on the above embodiments, and explanations of terms that are the same as or correspond to the above embodiments are not repeated herein. Referring to fig. 2, the method provided in this embodiment includes:
s210, when the current live broadcast room is detected to be started, in a life cycle function of a current class corresponding to the current live broadcast room, an object obtaining method in a preset bullet screen distribution class is called to obtain a bullet screen distribution object of the preset bullet screen distribution class.
S220, taking the current listener interface object which is initialized in the current class as a current transmission parameter, calling a listener setting method in the bullet screen distribution object, calling a listener assignment method in the listener setting method, and assigning the current listener interface object to a preset listener interface variable in the bullet screen distribution class.
In this embodiment, sending the bullet screen message to the live broadcast room having a reference relationship with the bullet screen distribution object is performed through a pre-listener interface variable mdanmum routerlistener in the bullet screen distribution class.
The pre-listener interface variable needs to be initialized when in use, and if a traditional method for initializing an object is utilized, a barrage message cannot be distributed to a live broadcast room. In this embodiment, the preset listener interface variable is initialized outside the bullet screen distribution class, and specifically, the initialization is implemented in the following manner:
a listener setting method for initializing a bullet screen distribution object is predefined in a bullet screen distribution class, and the method is defined as follows:
public void setDanmuRouterListener (DanmuRouterListener). This is a public type of function that other classes can call through bullet-screen distribution objects. The function parameter is an object of the listener interface danmurouterelistener type.
In the method for setting the monitor, a current monitor interface object can be assigned to a preset monitor interface variable in a bullet screen distribution class by calling a monitor assignment method mdamu routerlistener ═ listener. This process is actually an initialization process for the preset listener interface variables. In this embodiment, the assigned preset listener interface variable is the current listener interface object of the current live broadcast room, and the initialization of the current listener interface object is completed in the live broadcast room, so that the process of initializing the preset listener interface variable can be regarded as being completed in the live broadcast room. If a traditional mode of assigning the variables is adopted, namely, the preset monitor interface variables are assigned inside the bullet screen distribution class, the reference relation between bullet screen distribution objects and the live broadcast room cannot be established, and bullet screen messages cannot be distributed to the live broadcast room. And assigning a preset monitor interface variable in the bullet screen distribution class through a current monitor interface object of the current live broadcast room, and establishing a reference relation between the current live broadcast room and the bullet screen distribution object through the assigned preset monitor interface variable.
And S230, taking the assigned preset listener interface variable as a target listener interface object in the bullet screen distribution class, and establishing a reference relation between the current live broadcast room and the bullet screen distribution object through the target listener interface object.
In this embodiment, a channel between the current live broadcast room and the bullet screen distribution object is established through the target listener interface object. For any newly started live broadcast room, if the live broadcast room is started, the target listener interface object can be automatically switched to the listener interface object of the current live broadcast room. For the bullet screen distribution object, it is not necessary to know which live broadcast room corresponds to, and the bullet screen message is simply distributed to the current listener interface object.
S240, receiving the bullet screen information distributed by the bullet screen distribution object in the current live broadcast based on the reference relation.
On the basis of the above embodiment, the automatic switching of the monitor interface objects corresponding to the live broadcast rooms is completed by utilizing the preset monitor interface variables in the bullet screen distribution classes, the bullet screen distribution objects do not need to know which corresponding live broadcast room corresponds to, and the bullet screen information is distributed to the current monitor interface objects, so that the distribution efficiency of the bullet screen information is improved, and the distribution flow of the bullet screen is simplified.
It should be noted that, after the reference relationship is established, as long as the application program does not exit, the bullet screen distribution object always holds a listener interface object of the live broadcast room, so that the bullet screen distribution object cannot be released, and therefore the corresponding live broadcast room cannot be released, thereby causing the problem of memory leakage.
Further, on the basis of any of the above embodiments, in order to solve the problem of memory leakage, after the reference relationship between the bullet screen distribution object and the current live broadcast room is established, if it is detected that the page of the current live broadcast room is destroyed, a listener interface clearing method of the bullet screen distribution object is called in the destruction function onDestory () of the current class to delete the reference relationship.
When the page is destroyed, the Android system automatically calls back a lifecycle function, which is the last step of the lifecycle of the live broadcast room. In the destruction function of the live broadcast room, a method clearweb router () is cleared by calling a listener interface of a bullet screen distribution object, so as to remove the reference relationship between the bullet screen distribution object and the live broadcast room when the live broadcast room is destroyed.
The listener interface clearing method cleardanumrouterlistener () corresponds to the listener setting method setdanumrouterlistener method, and can be defined as follows:
Public void clearDanmuRouterListener(){}。
specifically, in the method for emptying the monitor interface of the bullet screen distribution object, the empty object can be assigned to a preset monitor interface variable, namely mdanmum RouterListener null, by calling an empty object setting method, so that the target monitor interface object in the bullet screen distribution class is emptied, the reference relation between the bullet screen distribution object and the current live broadcast room is switched, the bullet screen distribution class is ensured not to have the reference relation between the current live broadcast room, and the system can be used for recycling the live broadcast room. It should be further noted that when a page in any live broadcast room is destroyed, the reference relationship can be removed through an interface clearing method, that is, when the next live broadcast room is started, the destruction function is executed in the previous live broadcast room, so that the problem of memory leakage can be solved on the premise that the bullet screen message is distributed to different live broadcast rooms.
EXAMPLE III
Fig. 3 is a block diagram of a structure of a device for processing a bullet screen message according to a third embodiment of the present invention, as shown in fig. 3, the device includes: a bullet screen distribution object acquisition module 310, a reference relationship establishment module 320, and a bullet screen message receiving module 330, wherein,
the bullet screen distribution object obtaining module 310 is configured to, when it is detected that the current live broadcast room is started, obtain a singleton bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of a current class corresponding to the current live broadcast room;
a reference relationship establishing module 320, configured to use a current listener interface object that completes initialization in the current class as a current transfer parameter, call a listener setting method in the bullet screen distribution object, and use the current listener interface object as a target listener interface object in the bullet screen distribution class, so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object;
and a bullet screen message receiving module 330, configured to receive, based on the reference relationship, a bullet screen message distributed by the bullet screen distribution object between the current live broadcasts.
According to the technical scheme of the embodiment of the invention, when the current live broadcast room is detected to be started, a single bullet screen distribution object of the preset bullet screen distribution class is obtained in the life cycle function of the class corresponding to the live broadcast room. And taking the current listener interface object which completes initialization in the class corresponding to the live broadcast room as the current transfer parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class, so that the bullet screen distribution object points to the current live broadcast room to establish a reference relation between the current live broadcast room and the bullet screen distribution object, namely establishing a unique channel between the current live broadcast room and the bullet screen distribution object. Based on the reference relation, the bullet screen distribution object can send bullet screen information to the current live broadcast room, and the bullet screen distribution efficiency is improved.
On the basis of the foregoing embodiment, the bullet screen distribution object obtaining module 310 is specifically configured to:
when the current live broadcast room is detected to be started, in a life cycle function of a current class corresponding to the current live broadcast room, an object obtaining method in a preset bullet screen distribution class is called to obtain a bullet screen distribution object of the preset bullet screen distribution class.
On the basis of the above embodiment, the function of calling the listener setting method in the bullet screen distribution object is realized to establish the reference relationship between the current live broadcast room and the bullet screen distribution object, and the method is realized by the following steps:
calling a listener assignment method, and assigning the current listener interface object to a preset listener interface variable in the bullet screen distribution class;
using the assigned preset listener interface variable as a target listener interface object in the bullet screen distribution class;
and establishing a reference relation between the current live broadcast room and the bullet screen distribution object through the target listener interface object.
On the basis of the above embodiment, the current listener interface object completes initialization by calling a constructor of an implementation class of a preset listener interface protocol, and the implementation class is inherited from the preset listener interface protocol by keyword instances.
On the basis of the above embodiment, the preset listener interface protocol includes a receiving method of the barrage message;
correspondingly, the bullet screen message receiving module is specifically configured to:
and the current live broadcast room receives the bullet screen information distributed by the bullet screen distribution object through the receiving method.
On the basis of the above embodiment, the apparatus further includes:
and the reference relation deleting module is used for calling a listener interface clearing method of the bullet screen distribution object in the destruction function of the current class to delete the reference relation when detecting that the page of the current live broadcast room is destroyed.
On the basis of the above embodiment, the reference relationship deletion module is specifically configured to:
and when detecting that the page of the current live broadcast room is destroyed, calling an empty object setting method in the destruction function of the current class, and assigning an empty object to the preset monitor interface variable to delete the reference relationship.
The processing device of the bullet screen message provided by the embodiment of the invention can execute the processing method of the bullet screen message provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in the above embodiments, reference may be made to a method for processing a bullet screen message provided in any embodiment of the present invention.
Example four
Fig. 4 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention. Fig. 4 illustrates a block diagram of an exemplary terminal 12 suitable for use in implementing embodiments of the present invention. The terminal 12 shown in fig. 4 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. 4, the terminal 12 is embodied in the form of a general purpose computing device. The components of the terminal 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Terminal 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by terminal 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. The terminal 12 can further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
The terminal 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the terminal 12, and/or any devices (e.g., network card, modem, etc.) that enable the terminal 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the terminal 12 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 20. As shown, the network adapter 20 communicates with the other modules of the terminal 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the terminal 12, 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.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, implementing a method for processing a bullet screen message provided in any embodiment of the present invention, the method including:
when the start of a current live broadcast room is detected, acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of the current class corresponding to the current live broadcast room;
taking the current listener interface object which is initialized in the current class as a current transfer parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object;
and receiving the bullet screen message distributed by the bullet screen distribution object in the current live broadcast based on the reference relation.
EXAMPLE five
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method for processing a bullet screen message provided in any embodiment of the present invention is implemented, where the method includes:
when the start of a current live broadcast room is detected, acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of the current class corresponding to the current live broadcast room;
taking the current listener interface object which is initialized in the current class as a current transfer parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object;
and receiving the bullet screen message distributed by the bullet screen distribution object in the current live broadcast based on the reference relation.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer 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 computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, 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. In the context of this document, a computer 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.
A computer readable signal medium may include a propagated data signal with computer 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 computer readable signal medium may also be any computer readable medium that is not a computer 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 computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer 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, Smalltalk, 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's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for processing a barrage message is characterized by comprising the following steps:
when the start of a current live broadcast room is detected, acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of the current class corresponding to the current live broadcast room;
taking the current listener interface object initialized in the current class as a current transfer parameter, calling a listener setting method in the bullet screen distribution object, and taking the current listener interface object as a target listener interface object in the bullet screen distribution class to establish a reference relationship between the current live broadcast room and the bullet screen distribution object, including:
inheriting a current class corresponding to the current live broadcast room to a predefined preset listener interface protocol, so that the current listener interface object has a receiving method of each barrage message in the preset listener interface protocol; when the current listener interface object is taken as a parameter and transmitted to the bullet screen distribution object, the bullet screen distribution object transmits a bullet screen message to the current listener interface object by using a bullet screen message receiving method;
and receiving the bullet screen message distributed by the bullet screen distribution object in the current live broadcast based on the reference relation.
2. The method of claim 1, wherein obtaining singleton bullet screen distribution objects of a preset bullet screen distribution class comprises:
and obtaining the bullet screen distribution object of the preset bullet screen distribution class by calling an object obtaining method in the preset bullet screen distribution class.
3. The method according to claim 1, wherein the function of calling a listener setting method in the bullet screen distribution object is implemented to establish a reference relationship between the current live broadcast room and the bullet screen distribution object, and is implemented by the following steps:
calling a listener assignment method, and assigning the current listener interface object to a preset listener interface variable in the bullet screen distribution class;
using the assigned preset listener interface variable as a target listener interface object in the bullet screen distribution class;
and establishing a reference relation between the current live broadcast room and the bullet screen distribution object through the target listener interface object.
4. The method of claim 1, wherein the current listener interface object is initialized by calling a constructor of an implementation class of a preset listener interface protocol, the implementation class inherited from the preset listener interface protocol via keyword instances.
5. The method according to claim 4, wherein the predetermined listener interface protocol includes a receiving method of a barrage message;
correspondingly, receiving, by the current live broadcast, the bullet screen message distributed by the bullet screen distribution object includes:
and the current live broadcast room receives the bullet screen information distributed by the bullet screen distribution object through the receiving method.
6. The method of claim 3, further comprising:
and when detecting that the page of the current live broadcast room is destroyed, calling a listener interface emptying method of the bullet screen distribution object in the destruction function of the current class to delete the reference relation.
7. The method of claim 6, wherein the function of calling the interface clearing method of the bullet screen distribution object is realized by executing the following steps:
and calling a null object setting method, and assigning the null object to the preset listener interface variable.
8. A bullet screen message processing device, comprising:
the system comprises a bullet screen distribution object acquisition module, a bullet screen distribution object acquisition module and a bullet screen distribution object acquisition module, wherein the bullet screen distribution object acquisition module is used for acquiring a single bullet screen distribution object of a preset bullet screen distribution class in a life cycle function of a current class corresponding to a current live broadcast room when the current live broadcast room is detected to be started;
a reference relationship establishing module, configured to use a current listener interface object that completes initialization in the current class as a current transfer parameter, call a listener setting method in the bullet screen distribution object, and use the current listener interface object as a target listener interface object in the bullet screen distribution class, so as to establish a reference relationship between the current live broadcast room and the bullet screen distribution object;
a bullet screen message receiving module, configured to receive, based on the reference relationship, a bullet screen message distributed by the bullet screen distribution object between the current live broadcasts;
the reference relationship establishing module is specifically configured to:
inheriting a current class corresponding to the current live broadcast room to a predefined preset listener interface protocol, so that the current listener interface object has a receiving method of each barrage message in the preset listener interface protocol; and when the current listener interface object is taken as a parameter and transmitted to the bullet screen distribution object, the bullet screen distribution object transmits the bullet screen message to the current listener interface object by using a bullet screen message receiving method.
9. A terminal, characterized in that the terminal comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of bullet screen message processing as claimed in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method for processing a bullet screen message according to any one of claims 1 to 7.
CN201811163520.9A 2018-09-30 2018-09-30 Barrage message processing method and device, terminal and storage medium Active CN109327726B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811163520.9A CN109327726B (en) 2018-09-30 2018-09-30 Barrage message processing method and device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811163520.9A CN109327726B (en) 2018-09-30 2018-09-30 Barrage message processing method and device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109327726A CN109327726A (en) 2019-02-12
CN109327726B true CN109327726B (en) 2021-04-09

Family

ID=65266647

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811163520.9A Active CN109327726B (en) 2018-09-30 2018-09-30 Barrage message processing method and device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109327726B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115442635A (en) * 2021-06-04 2022-12-06 武汉斗鱼鱼乐网络科技有限公司 Method, device, equipment and storage medium for cross-platform security filtration of bullet screen

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101599029A (en) * 2009-07-09 2009-12-09 浪潮电子信息产业股份有限公司 Utilize case mechanism in the intermodule method of transferring data among a kind of flex
CN102707973B (en) * 2012-05-04 2015-12-09 惠州Tcl移动通信有限公司 Based on the method and system of the application program launching of android system
JP2015050486A (en) * 2013-08-29 2015-03-16 株式会社リコー Content distribution system, content reproduction system, and content distribution method
JP2015115678A (en) * 2013-12-10 2015-06-22 ヴイ・インターネットオペレーションズ株式会社 Video distribution system and program
CN106326016A (en) * 2016-07-28 2017-01-11 武汉票据交易中心有限公司 Multi-thread event dispatching method and system
WO2018165919A1 (en) * 2017-03-15 2018-09-20 深圳大趋智能科技有限公司 Method and apparatus for loading animation on application program startup page, and terminal
CN108153620A (en) * 2017-12-27 2018-06-12 深圳豪客互联网有限公司 A kind of course control method and device

Also Published As

Publication number Publication date
CN109327726A (en) 2019-02-12

Similar Documents

Publication Publication Date Title
WO2020108085A1 (en) Resource allocation method and apparatus, terminal, and storage medium
CN109213611B (en) Cross-process communication method, device, terminal and storage medium
CN109275042B (en) Bullet screen message distribution method, bullet screen message distribution device, terminal and storage medium
CN106098061B (en) Voice interaction method and device based on android system
CN109302639B (en) Bullet screen message distribution method, bullet screen message distribution device, terminal and storage medium
CN110390493B (en) Task management method and device, storage medium and electronic equipment
CN112615758B (en) Application identification method, device, equipment and storage medium
JP2021518955A (en) Processor core scheduling method, equipment, terminals and storage media
CN108882053B (en) Bullet screen message distribution method, device, equipment and storage medium
CN110780871A (en) Negative one-screen loading method and device, terminal and computer readable storage medium
CN107817962B (en) Remote control method, device, control server and storage medium
CN112769876B (en) Method, device, equipment and medium for acquiring equipment channel information
CN111478781A (en) Message broadcasting method and device
CN109413507B (en) Method, device, terminal and medium for processing reference relationship between barrage library and live broadcast room
CN109327726B (en) Barrage message processing method and device, terminal and storage medium
CN109686415B (en) Data transmission method, management platform, electronic device and storage medium
CN109348303B (en) Bullet screen message distribution method, bullet screen message distribution device, terminal and storage medium
CN113986995A (en) Request distribution method and device, storage medium and electronic equipment
CN109413498B (en) Bullet screen message distribution method, bullet screen message distribution device, terminal and storage medium
CN111865630A (en) Topology information acquisition method, device, terminal and storage medium
CN109068170B (en) Storage method, device, terminal and storage medium for barrage message
CN114363654A (en) Video plug-flow method, device, terminal equipment and storage medium
CN114339420A (en) Stream pulling method and device, electronic equipment and storage medium
CN108848398B (en) Method, device, terminal and storage medium for distributing local barrage messages
CN113452948A (en) Conference terminal control method, conference terminal control device, conference terminal equipment and storage medium

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