CN108966035B - Barrage message transmission method, device, equipment and storage medium - Google Patents

Barrage message transmission method, device, equipment and storage medium Download PDF

Info

Publication number
CN108966035B
CN108966035B CN201811019410.5A CN201811019410A CN108966035B CN 108966035 B CN108966035 B CN 108966035B CN 201811019410 A CN201811019410 A CN 201811019410A CN 108966035 B CN108966035 B CN 108966035B
Authority
CN
China
Prior art keywords
bullet screen
broadcast
target
distribution
protocol
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
CN201811019410.5A
Other languages
Chinese (zh)
Other versions
CN108966035A (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 CN201811019410.5A priority Critical patent/CN108966035B/en
Publication of CN108966035A publication Critical patent/CN108966035A/en
Application granted granted Critical
Publication of CN108966035B publication Critical patent/CN108966035B/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/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/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • 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/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • H04N21/4312Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations
    • H04N21/4314Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations for fitting data in a restricted space on the screen, e.g. EPG data in a rectangular grid
    • 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/438Interfacing the downstream path of the transmission network originating from a server, e.g. retrieving MPEG packets from an IP network
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/64Addressing
    • H04N21/6405Multicasting

Abstract

The embodiment of the invention discloses a bullet screen message transmission method, a bullet screen message transmission device, bullet screen message transmission equipment and a storage medium. The method comprises the following steps: the bullet screen receiving object calls a first bullet screen transmission function through a pre-obtained forwarding protocol object according to the target bullet screen message so as to transmit the target bullet screen message to the forwarding protocol object; the forwarding protocol object calls back the first bullet screen transmission function to obtain a target bullet screen message, and triggers and judges whether a target bullet screen distribution object is initialized or not; if not, the broadcast publishing object constructs a broadcast intention object according to the target object information and the target bullet screen message of the target bullet screen distribution object, and broadcasts the broadcast intention object; and the broadcast receiving object receives the broadcast intention object and sends the target bullet screen message in the broadcast intention object to the target bullet screen distribution object. Through the technical scheme, the bullet screen message is rapidly transmitted between the bullet screen receiving module and the bullet screen distributing module, and the timeliness of bullet screen message transmission is improved.

Description

Barrage message transmission method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to an information transmission technology, in particular to a bullet screen message transmission method, a bullet screen message transmission device, bullet screen message transmission equipment and a storage medium.
Background
Barrage messages are heavily used in audio-video playback/live broadcast applications, such as fighting fish. In general, a bullet screen message is sent from a server (i.e., a bullet screen server) for transmitting and processing the bullet screen message to a bullet screen receiving module for receiving the bullet screen message in application software, and further sent from the bullet screen receiving module to a bullet screen distributing module for distributing the bullet screen message. The information interaction between the bullet screen receiving module and the bullet screen distributing module is realized based on the interaction interfaces respectively provided by the two functional modules.
However, in the above interaction mode based on the function module interaction interface, a dependency relationship between two function modules needs to be established, which makes the coupling between the two function modules stronger, is not favorable for independent development of the function modules, and may cause low transmission timeliness of the bullet screen message. In addition, if the bullet screen distribution object in the bullet screen distribution module is not initialized, the above interaction mode cannot transmit the bullet screen message.
Disclosure of Invention
The embodiment of the invention provides a bullet screen message transmission method, a bullet screen message transmission device, bullet screen message transmission equipment and a storage medium, so that the bullet screen messages can be rapidly transmitted between a bullet screen receiving module and a bullet screen distributing module, and the timeliness of bullet screen message transmission is improved.
In a first aspect, an embodiment of the present invention provides a bullet screen message transmission method, including:
the bullet screen receiving object calls a first bullet screen transmission function through a pre-obtained forwarding protocol object according to the target bullet screen message so as to transmit the target bullet screen message to the forwarding protocol object, wherein the forwarding protocol object is obtained by the data forwarding object inheriting a pre-defined first bullet screen transmission protocol, and the first bullet screen transmission protocol comprises the first bullet screen transmission function;
the forwarding protocol object calls back the first bullet screen transmission function to obtain a target bullet screen message, and triggers and judges whether a target bullet screen distribution object is initialized or not;
if not, the broadcast publishing object constructs a broadcast intention object according to the target object information and the target bullet screen message of the target bullet screen distribution object, and broadcasts the broadcast intention object;
and the broadcast receiving object receives the broadcast intention object and sends the target bullet screen message in the broadcast intention object to the target bullet screen distribution object so as to enable the target bullet screen distribution object to obtain the target bullet screen message.
In a second aspect, an embodiment of the present invention further provides a bullet screen message transmission apparatus, where the apparatus includes: the system comprises a bullet screen receiving module, a data forwarding module, a broadcast releasing module and a broadcast receiving module;
the bullet screen receiving module is used for calling a first bullet screen transmission function through a pre-obtained forwarding protocol object according to the target bullet screen message so as to transmit the target bullet screen message to the forwarding protocol object, wherein the forwarding protocol object is obtained by inheriting a pre-defined first bullet screen transmission protocol by a data forwarding object, and the first bullet screen transmission protocol comprises the first bullet screen transmission function;
the data forwarding module is used for calling back the first bullet screen transmission function, obtaining a target bullet screen message and triggering and judging whether a target bullet screen distribution object is initialized or not;
the broadcast release module is used for constructing a broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen message and broadcasting the broadcast intention object if the target bullet screen distribution object is not initialized;
and the broadcast receiving module is used for receiving the broadcast intention object and sending the target bullet screen message in the broadcast intention object to the target bullet screen distribution object so as to enable the target bullet screen distribution object to obtain the target bullet screen message.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus 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 bullet screen message transmission method provided by any embodiment of the present 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, when executed by a processor, implements the bullet screen message transmission method provided in any embodiment of the present invention.
According to the embodiment of the invention, the data forwarding object is arranged between the bullet screen receiving object and the bullet screen distributing object, so that the transmission of the bullet screen message between the two independent modules is realized, the coupling relation between the bullet screen receiving module and the bullet screen distributing module is eliminated, and the program development difficulty is reduced. The method comprises the steps of obtaining a forwarding protocol object in advance through a bullet screen receiving object, establishing a data transmission channel between the bullet screen receiving object and a data forwarding object, and transmitting a target bullet screen message received by the bullet screen receiving object from a bullet screen server to the data forwarding object based on a first bullet screen transmission function serving as a callback function. Whether a target bullet screen distribution object is initialized or not is judged by triggering in a first bullet screen transmission function of a forwarding protocol object, and a broadcast channel is used for transmitting a target bullet screen message when the target bullet screen distribution object is not initialized, so that the data forwarding object determines a channel for transmitting the target bullet screen message to the target bullet screen distribution object by the data forwarding object according to the initialization state of the target bullet screen distribution object while acquiring the target bullet screen, the target bullet screen message is transmitted to the target bullet screen distribution object in time, and the success rate and the timeliness of bullet screen message transmission are improved.
Drawings
Fig. 1 is a flowchart of a bullet screen message transmission method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a bullet screen message transmission method in the second embodiment of the present invention;
fig. 3 is a flowchart of a bullet screen message transmission method in the third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a bullet screen message transmission apparatus in a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus in the fifth 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.
Example one
The bullet screen message transmission method provided by the embodiment can be applied to audio and video playing/live broadcast application software in an Android client, and transmits bullet screen messages received by the bullet screen receiving module to the bullet screen distributing module. The method can be executed by a bullet screen message transmission device, the device can be realized in a software and/or hardware mode, and the device can be integrated in equipment provided with audio/video playing/live broadcasting application software adapted to an Android system, for example, typical user terminal equipment such as a mobile phone, a tablet computer or a smart television is provided. Referring to fig. 1, the method of the present embodiment specifically includes the following steps:
s110, the bullet screen receiving object calls a first bullet screen transmission function according to the target bullet screen message through a forwarding protocol object obtained in advance so as to transmit the target bullet screen message to the forwarding protocol object.
The bullet screen receiving object is an object in a bullet screen receiving module for receiving bullet screen messages sent by a bullet screen server. The bullet screen receiving module defines a bullet screen receiving class for realizing the bullet screen message receiving operation, and the bullet screen receiving object is an example of the bullet screen receiving class and is a specific executor of the bullet screen message receiving operation. The target bullet screen message is a bullet screen message waiting for being transmitted from a bullet screen receiving object to a target bullet screen distributing object. Here, the bullet screen distribution object refers to an object in a bullet screen distribution module for distributing bullet screen messages, a bullet screen distribution class is defined in the bullet screen distribution module for realizing bullet screen message distribution operation, and the bullet screen distribution object is an example of the bullet screen distribution class and is a specific executor of bullet screen message distribution operation. The target bullet screen distribution object refers to a bullet screen distribution object for distributing the target bullet screen message.
The forwarding protocol object is obtained by the data forwarding object inheriting a first bullet screen transmission protocol which is defined in advance, and the first bullet screen transmission protocol comprises a first bullet screen transmission function. Here, the data forwarding object refers to an object in a module for performing data forwarding, in which a class data distribution is defined for implementing a data forwarding operation, and is an example of a data forwarding class, which is an actual executor of a bullet screen message forwarding operation. The first bullet screen transmission protocol is a predefined communication protocol between components for bullet screen message transmission, and comprises a protocol internal function for realizing bullet screen message transmission operation, namely a first bullet screen transmission function. After the data forwarding object inherits the first barrage transmission protocol through keywords inherited by the interface protocol specified in the Java language, the data forwarding object has the communication function of the first barrage transmission protocol, and also can rewrite and implement the protocol internal function, so that the data forwarding object also has the first barrage transmission function, which is a data forwarding object and a repeater protocol object at the same time. For example, the code implementation of the first bullet screen transmission protocol may be: public interface IDanmumProtocl { onReceiveMsg (String type, String info); }.
Public is a public authority modifier, so that other classes and objects can also access the first bullet screen message transmission protocol IDanmumProtocl. The interface is an interface type qualifier which indicates that the first bullet screen message transmission protocol IDanmumProtocl is an interface implementation mechanism, and is convenient for multi-state inheritance of other classes. String type and String info are function input parameters of a first bullet screen transmission function onReceiveMsg respectively, and the function input parameters comprise a bullet screen message identification type of a character String type and bullet screen message body information info of the character String type. The bullet screen message identifier refers to a character capable of identifying a bullet screen message, and can be a number, a letter, a symbol and any combination of the above characters, and the bullet screen message identifier should be a unique and global identifier of a bullet screen message. The bullet screen message body information refers to the carrier of the bullet screen message, and the bullet screen message body information contains specific bullet screen message contents.
Specifically, the bullet screen receiving object receives a target bullet screen message from the bullet screen server. And then, the bullet screen receiving object analyzes the target bullet screen message according to the function input parameter form of the first bullet screen transmission function to obtain an analysis result. Then, the bullet screen receiving object uses the parsing result as a function input parameter, and calls a first bullet screen transmission function inherited from the bullet screen receiving object, namely, a data distribution on receiving msg (String type, String info), through a forwarding protocol object obtained in advance so as to transmit the target bullet screen message to the forwarding protocol object. In the embodiment of the present invention, the first barrage transfer function is designed as a callback function, and the call operation in the barrage receiving object is only to transfer the target barrage message from the interface provided by the forwarding protocol object to the forwarding protocol object through the function pointer of the first barrage transfer function, and automatically trigger the execution of the first barrage transfer function, that is, trigger the execution of S120.
In the above process, the bullet screen receiving object obtains the forwarding protocol object in advance before the execution of S110, and the obtaining mode may be an interactive interface provided by the bullet screen receiving object and the data forwarding object; or the corresponding object may be transmitted as a function parameter by a function call mode.
And S120, calling back the first bullet screen transmission function by the forwarding protocol object, acquiring a target bullet screen message, and triggering and judging whether a target bullet screen distribution object is initialized.
Specifically, after the first bullet screen transmission function is called in the bullet screen receiving object, the forwarding protocol object is triggered to execute the first bullet screen transmission function so as to receive the target bullet screen message transmitted as the function input parameter. The receiving of the target bullet screen message is also used as a trigger condition for judging whether the target bullet screen distribution object is initialized or not by the forwarding protocol object. In specific implementation, the function implementation of the first bullet screen transfer function in the forwarding protocol object includes not only a receiving operation of the target bullet screen message, but also a determining operation of whether the target bullet screen distribution object is initialized. Therefore, after the forwarding protocol object receives the target bullet screen message through the first bullet screen transmission function, the judgment of whether the target bullet screen distribution object is initialized or not is automatically triggered. For example, a DanmuSender-null statement is automatically triggered to determine whether the target bullet screen distribution object DanmuSender has been initialized. If the result is false, the target bullet screen distribution object is initialized; if the result is true, it indicates that the target bullet screen distribution object is not initialized, then S130 is executed.
And judging whether the target bullet screen distribution object is initialized or not, wherein the purpose is to determine whether the target bullet screen message can be transmitted through a communication channel which is established between the data forwarding object and the target bullet screen distribution object and is referred by object bridging. If the target bullet screen distribution object is not initialized, the communication channel which is referenced by the object bridge cannot be successfully established in advance, the bullet screen message cannot be normally transmitted, and the bullet screen message needs to be transmitted through another communication channel in time, so that the success rate of bullet screen message transmission is improved. The initialization judgment is carried out in the first bullet screen transmission function, so that the judgment operation is automatically triggered in time, and then when the target bullet screen distribution object is initialized, the bullet screen message transmission of the communication channel which is quoted by the object in a bridging mode is triggered in time, and the timeliness of the bullet screen message transmission is improved.
S130, if not, the broadcast publishing object constructs a broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen information, and broadcasts the broadcast intention object.
The broadcast publishing object refers to an instantiation object in a module for publishing system broadcast in an Android system. The object information is attribute information of one object, and for example, information such as a package name of a java package (i.e., an object package name) where the object is located, a class name of a class to which the object belongs (i.e., an object class name), and an object name. The target object information refers to object information of a target bullet screen distribution object. The broadcast intention object refers to an intention object intent broadcasted during broadcast sending, and is a data carrier of broadcast messages in the Android system.
Specifically, when the forwarding protocol object determines that the target bullet screen distribution object is not initialized, an additional communication channel needs to be started to transmit the target bullet screen message. In the embodiment of the present invention, the other communication channel is a system broadcast channel of an Android system. In specific implementation, the first bullet screen transmission function may be set to a function return value of a boolean type, and when the return value is true, the broadcast publishing object constructs the broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen message. And then, the broadcast distribution object broadcasts the broadcast intention object out to complete the distribution of the broadcast message.
The broadcasting of the broadcast intention object by the broadcast distribution object includes: the broadcast issuing object calls a context environment obtaining function of an application program class to obtain a context environment object of the Android system; the broadcast publishing object takes the broadcast intention object as a function input parameter through the context environment object, calls a broadcast sending function and broadcasts the broadcast intention object.
The Application program type Application is a system type provided by an Android system developer, is used in an Application program development process, and can realize instantiation of an Application type when an Application program is developed. The context object is an abstract class and the Android system provides for the implementation of classes through which access to application specific resources and classes is allowed.
Specifically, the broadcast object acquires the system-provided context object mContext by calling a context acquisition function getApplicationContext in Application class Application in the Android system. Then, the broadcast distribution object calls a broadcast transmission function mcontext. sendbroadcast (intent) in the context environment object with the broadcast intent object intent as a function input parameter, and broadcasts the broadcast intent object intent as a system broadcast message. In this way, the broadcast intention object containing the target bullet screen message is sent to the Android system event bus. Other objects (i.e., broadcast receiving objects) registered as system broadcast receivers that can receive the broadcast intention object.
And S140, the broadcast receiving object receives the broadcast intention object and sends the target bullet screen message in the broadcast intention object to the target bullet screen distribution object so that the target bullet screen distribution object obtains the target bullet screen message.
Specifically, the broadcast receiving object filters through the broadcast message to receive the broadcast intention object, and parses the broadcast intention object to obtain the target bullet screen message encapsulated therein. The broadcast message filtering herein is to compare at least one broadcast receiving action description set when the broadcast receiving object registers the broadcast receiving action description with the broadcast sending action description encapsulated in the broadcast intention object, and receive the broadcast intention object if one of the comparison results is successfully paired (the two action descriptions are completely consistent). The description of the broadcast reception action and the description of the broadcast transmission action herein are explained in the following embodiments. And then, sending the target bullet screen message to a target bullet screen distribution object. Thus, the target bullet screen message is transmitted to the target bullet screen distribution object through the broadcast channel by the forwarding protocol object corresponding to the data forwarding object. In the embodiment of the present invention, the broadcast receiving object and the target bullet screen distribution object are set to be able to directly refer to the objects, for example, the two objects are located in one functional module, or an external class and an internal class are used for each other. Therefore, the broadcast receiving object can obtain the target bullet screen distribution object in a direct reference mode, and further send the target bullet screen message to the target bullet screen distribution object.
According to the technical scheme, the data forwarding object is arranged between the bullet screen receiving object and the bullet screen distributing object, so that the transmission of bullet screen messages between the two independent modules is realized, the coupling relation between the bullet screen receiving module and the bullet screen distributing module is eliminated, and the program development difficulty is reduced. The method comprises the steps of obtaining a forwarding protocol object in advance through a bullet screen receiving object, establishing a data transmission channel between the bullet screen receiving object and a data forwarding object, and transmitting a target bullet screen message received by the bullet screen receiving object from a bullet screen server to the data forwarding object based on a first bullet screen transmission function serving as a callback function. Whether a target bullet screen distribution object is initialized or not is judged by triggering in a first bullet screen transmission function of a forwarding protocol object, and a broadcast channel is used for transmitting a target bullet screen message when the target bullet screen distribution object is not initialized, so that the data forwarding object determines a channel for transmitting the target bullet screen message to the target bullet screen distribution object by the data forwarding object according to the initialization state of the target bullet screen distribution object while acquiring the target bullet screen, the target bullet screen message is transmitted to the target bullet screen distribution object in time, and the success rate and the timeliness of bullet screen message transmission are improved.
On the basis of the above technical solution, before the broadcast reception object receives the broadcast intention object, the method further includes: when the broadcast receiving class corresponding to the broadcast receiving object is the internal class of the bullet screen distribution class corresponding to the bullet screen distribution object, the broadcast registration object determines the description of the broadcast receiving action according to the target object information; the broadcast registration object determines the description of the broadcast receiving object according to the target object information, the internal class identification and the internal class information; and the broadcast registration object adopts a static registration mode to register the system broadcast receiver according to the broadcast receiving object description and the broadcast receiving action description to obtain the broadcast receiving object.
Wherein the broadcast registration object is an instantiation object in a function module performing broadcast receiver registration. The broadcast receiving action description refers to a description or illustration of an action function of a receivable broadcast message, and is usually an abbreviation or a keyword of a broadcast receiving action, and may be an action description provided by a system or a pre-defined action description. The broadcast receiving action description is generally an action description set in the broadcast message filtering segment intent-filter when registering a broadcast receiver, and is used for filtering the system broadcast message and filtering out the broadcast message containing the broadcast sending action description corresponding to the broadcast receiving action description. That is, for the same broadcast message, the broadcast transmission action description set at the time of transmission thereof is completely identical to the broadcast reception action description set at the time of registration of the broadcast receiver that receives the broadcast message. The broadcast transmission action description herein refers to a description or illustration of action functions that a transmitted broadcast message has. The inner class designation refers to a designation used to characterize an inner class where one class is another, such as "$". The class information refers to attribute information of a class, such as a class name. The inner class information refers to class information of an inner class, such as a class name of the inner class. The broadcast reception object description refers to a description or illustration of an object that can receive a broadcast message.
Specifically, if an object is to receive a system broadcast message, it needs to be pre-registered as a system broadcast receiver, and the broadcast receiving object is a registration object obtained by pre-registering a general object as a system broadcast receiver. When the broadcast receiving class to which the broadcast receiving object belongs is an internal class of the bullet screen distribution class, each of the bullet screen distribution objects obtained by instantiating the bullet screen distribution class corresponds to an instantiated object of an internal class, and a corresponding system broadcast receiver needs to be registered for each of the bullet screen distribution objects in advance.
Since the bullet screen message in the embodiment of the present invention needs to be sent to a specific bullet screen distribution object, at least information for distinguishing the bullet screen distribution object needs to be set in the broadcast receiving action description, and the object package name and the object class name (information such as the object name may be added if necessary) can be used for uniquely distinguishing one object. Therefore, in the present embodiment, the broadcast registration object determines a broadcast reception action description, such as "com. To set up the system broadcast receiver, it also needs to set up the description of the broadcast receiving object, so the broadcast registration object determines the description of the broadcast receiving object according to the object class name MyView, the internal class identifier $ and the internal class name staticireceiver in the target object information, such as "MyView. The order of the steps of determining the broadcast reception action description and determining the broadcast reception object description herein is not limited. Then, in order to implement fast registration of the system broadcast receiver, a static registration manner is adopted in this embodiment, which reduces the process of instantiation of the broadcast receiving object. Specifically, the broadcast registration object writes the broadcast receiving object description and the broadcast receiving action description into an application description file android manifest.
<receiver android:name="MyView.$StaticReceiver">
<intent-filter>
<action android:name="com.MyView.newinstance"/>
</intent-filter>
</receiver>。
On the basis of the above technical solution, before the broadcast reception object receives the broadcast intention object, the method further includes: when the broadcast receiving class corresponding to the broadcast receiving object is an independent class of a functional module which is located at the same position as the bullet screen distribution object, the broadcast registration object determines the description of each broadcast receiving action according to the object information of each bullet screen distribution object in the functional module; the broadcast registration object determines the description of the broadcast receiving object according to the independent class information; the broadcast registration object registers the system broadcast receiver according to the broadcast reception object description and the respective broadcast reception action descriptions, to obtain a broadcast reception object.
The independent class information refers to information of a class having no dependency relationship with other classes, such as a class name of the independent class.
Specifically, when the broadcast receiving class to which the broadcast receiving object belongs is an independent class having no dependency relationship with the bullet screen distribution class, it is possible to register a total broadcast receiver without registering a broadcast receiver for each bullet screen distribution object. In order to realize rapid transmission of information between the broadcast receiving object and the bullet screen distribution object, the independent class that needs to be registered as the system broadcast receiver is set as a functional module in the same place as the bullet screen distribution class in this embodiment. Therefore, each bullet screen distribution object in the same functional module shares one system broadcast receiver, so that the number of the system broadcast receivers can be reduced to a certain extent, the system memory and the power consumption are saved, and the transmission rate of bullet screen messages is further improved; and the transmission of the broadcast message can be rapidly carried out, and the timeliness of the transmission of the bullet screen message is ensured.
In specific implementation, the broadcast registration object generates broadcast receiving action descriptions corresponding to the bullet screen distribution objects one to one according to the object information of the bullet screen distribution objects. In addition, the broadcast registration object generates a broadcast reception object description of the independent class based on information such as the class name of the independent class. And then, the broadcast registration object adopts a dynamic registration mode or a static registration mode, and generates registration codes of the broadcast register according to the broadcast receiving object description and each broadcast receiving action description. When the application is compiled or run, the independent class is registered as a system broadcast receiver to obtain a broadcast reception object.
Example two
In this embodiment, based on the first embodiment, further optimization is performed on "the broadcast publishing object constructs the broadcast intention object according to the target object information of the target barrage distribution object and the target barrage message". On the basis, optimization can be further performed on that the broadcast receiving object sends the target bullet screen message in the broadcast intention object to the target bullet screen distribution object. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. Referring to fig. 2, the bullet screen message transmission method provided in this embodiment includes:
s201, the bullet screen receiving object calls a first bullet screen transmission function according to the target bullet screen message through a forwarding protocol object obtained in advance so as to transmit the target bullet screen message to the forwarding protocol object.
S202, the protocol object is forwarded to call back the first bullet screen transmission function, a target bullet screen message is obtained, and whether a target bullet screen distribution object is initialized or not is triggered and judged.
S203, if not, the broadcast issuing object determines the broadcast sending action description according to the target object information, and calls a pre-constructed broadcast action setting function of the initial intention object by taking the broadcast sending action description as a function input parameter, and sets the action description for the initial intention object to obtain an intermediate intention object.
Here, the initial intention object refers to an intention object that is initially defined, and in which data is not filled. For example, an initial Intent object is pre-constructed through an Intent object construction function of an Android system, and a code implementation may be an Intent () function. The broadcast action setting function refers to a function of setting an action in an intention object. The intermediate intention object refers to an intention object in which an action description is set, which corresponds to the initial intention object.
Specifically, when the target bullet screen distribution object is not initialized, the broadcast distribution object generates the broadcast sending action description "com. Then, the broadcast publishing object takes the broadcast sending action description "com.myview.newchoice" as a function input parameter, calls the broadcast action setting function setAction of the initial intention object, and sets the broadcast sending action description as the action description of the initial intention object, and the code implementation may be: internal.setaction ("com.myview.newchoice"), obtains an intermediate intent object.
And S204, the broadcast release object calls a data storage function of the pre-constructed initial data wrapper object according to the target bullet screen message, stores the target bullet screen message to the initial data wrapper object, and obtains the target data wrapper object.
The data wrapper object is a data container class used for storing data in Android development and used for data transmission among components in an Android system. The data wrapper object in this embodiment stores the target barrage message. The initial data wrapper object refers to the initially defined data wrapper object within which no population of data has occurred. For example, an initial data wrapper object mb is constructed in advance through a data wrapper object constructor of an Android system, and a code implementation may be a new Bundle (). The target data wrapper object corresponds to the initial data wrapper object, which refers to the data wrapper object populated with data. The data store function is a function of the data wrapper object for which data is populated.
Specifically, when the forwarding protocol object judges that the target bullet screen distribution object is not initialized, the broadcast release object obtains the target bullet screen message. For convenience of subsequent data transmission, the target bullet screen message obtained by broadcasting the release object still keeps the form of bullet screen message identification type and bullet screen message body information info. Then, the broadcast release object calls a character string type data storage function and a serialization type data storage function in the initial data wrapper object respectively, and stores the bullet screen message identification type and the bullet screen message body information info in the initial data wrapper object, and the code implementation is mBundle. Thus, the target data wrapper object mBundle after the bullet screen message is filled is obtained.
S205, the broadcast release object takes the target data wrapper object as a function input parameter, calls a data packet setting function of the intermediate intention object, stores the target data wrapper object to the intermediate intention object, and obtains the broadcast intention object.
The data packet setting function refers to a function for setting data for an intention object in the intention object.
Specifically, to obtain the broadcast intent object, a target data wrapper object encapsulating specific broadcast message data is populated into the intermediate intent object. In specific implementation, the broadcast publishing object uses the obtained target data wrapper object mb as a function input parameter, calls a data packet setting function of the intermediate intention object, stores the target data wrapper object to the intermediate intention object, and can realize the code of the internal. Thus, a broadcast intention object including a broadcast transmission action description and a target bullet screen message is obtained.
And S206, broadcasting the broadcasting intention object by the broadcasting publishing object.
S207, the broadcast reception object receives the broadcast intention object.
And S208, when the target bullet screen distribution object is not initialized, the broadcast receiving object calls an initialization function to initialize the target bullet screen distribution object.
The initialization function is a function for initializing an object, and may be a system function such as a constructor or a custom function defined by user programming.
Specifically, since the initialization process of the bullet screen distribution object needs a certain time, after the protocol object is forwarded to determine that the protocol object is not initialized and the operations of transmitting the target bullet screen message through each broadcast channel are performed, it is possible that the target bullet screen distribution object completes the initialization operations. Therefore, in order to avoid the repeated execution of the initialization operation, the present embodiment determines once again whether the target bullet screen distribution object is initialized after the broadcast reception object receives the broadcast intention object. And if not, calling an initialization function to perform initialization operation to obtain an initialized target bullet screen distribution object. If it has been initialized, S209 is performed.
S209, the broadcast receiving object calls a data packet acquisition function through the broadcast intention object to obtain a target data wrapper object.
The data packet obtaining function refers to a function for obtaining the data wrapper object from the intention object.
Specifically, after the broadcast receiving object receives the broadcast intention object, the broadcast intention object needs to be parsed to obtain the target bullet screen message contained therein. The specific process is as follows: the broadcast receiving object firstly calls a data packet acquisition function (intent. getchunk ()) in the broadcast intention object to acquire a target data wrapper object (mBundle) contained in the broadcast intention object.
S210, the broadcast receiving object calls a data acquisition function of the target data wrapper object, acquires a target bullet screen message and sends the target bullet screen message to a target bullet screen distribution object.
The data acquisition function refers to a function for acquiring data contained in the data wrapper object from the data wrapper object.
Specifically, after the broadcast receiving object obtains the target data wrapper object, a string type data obtaining function mbondle. getstring (type) and a serialization type data obtaining function mbondle. getSerrializable (info) of the target data wrapper object are respectively called, and a bullet screen message identification type and bullet screen message body information info corresponding to the target bullet screen message are obtained. Thus, the broadcast receiving object obtains the entire target bullet screen message. Then, the broadcast receiving object transmits the target barrage message to the target barrage distribution object.
According to the technical scheme of the embodiment, the broadcast sending action description is determined by the broadcast publishing object according to the target object information, so that the broadcast sending action description and the broadcast receiving action description are set to be the same. When the target bullet screen distribution object is not initialized, the broadcast receiving object calls the initialization function to initialize the target bullet screen distribution object, so that the target bullet screen object is initialized, repeated initialization operation is reduced to a certain extent, time consumption in the target bullet screen message transmission process is reduced, and timeliness of target bullet screen message transmission is further improved. Constructing a target bullet screen message and a broadcast sending action description as a broadcast intention object; the broadcast receiving object analyzes the broadcast intention object to obtain the target bullet screen message, and transmits the target bullet screen message to the target bullet screen distribution object, so that the target bullet screen message is transmitted in an integrity mode through the broadcast channel, and the transmission success rate of the target bullet screen message is improved.
EXAMPLE III
In this embodiment, on the basis of the first embodiment, a step of transmitting a target bullet screen message after determining initialization of a target bullet screen distribution object is added. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. Referring to fig. 3, the bullet screen message transmission method provided in this embodiment includes:
s310, the bullet screen receiving object calls a first bullet screen transmission function according to the target bullet screen message through a forwarding protocol object obtained in advance so as to transmit the target bullet screen message to the forwarding protocol object.
S320, the protocol object is forwarded to call back the first bullet screen transmission function, a target bullet screen message is obtained, and whether a target bullet screen distribution object is initialized or not is triggered and judged.
S330, if not, the broadcast publishing object constructs the broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen information, and broadcasts the broadcast intention object.
And S340, the broadcast receiving object receives the broadcast intention object and sends the target bullet screen message in the broadcast intention object to the target bullet screen distributing object so that the target bullet screen distributing object obtains the target bullet screen message.
And S350, if so, the forwarding protocol object triggers the target bullet screen message in the first bullet screen transmission function, and calls the second bullet screen transmission function through the pre-obtained distribution protocol object so as to transmit the target bullet screen message to the distribution protocol object.
The delivery protocol object is obtained by inheriting a predefined second bullet screen transmission protocol for the target bullet screen delivery object, and the second bullet screen transmission protocol comprises a second bullet screen transmission function. Here, the second bullet screen transmission protocol is a predefined communication protocol between components for bullet screen message transmission, and includes a second bullet screen transmission function, which is a function within the protocol for implementing bullet screen message transmission operation. After the target bullet screen distribution object inherits the second bullet screen transmission protocol through the interface protocol inheriting keyword instances, the target bullet screen distribution object has the communication function of the second bullet screen transmission protocol, and also can rewrite and realize the protocol internal function, so that the target bullet screen distribution object also has the second bullet screen transmission function which is a bullet screen distribution object and a distribution protocol object at the same time.
Illustratively, the function input parameters of the first bullet screen transfer function and the second bullet screen transfer function are the same. Such as the number of function input parameters, data type, and parameter ordering, etc. The advantage that sets up like this lies in, follow-up utilizing two bullet screen transfer functions to carry out the data transmission in-process, and the data that transmit need not carry out protocol conversion, such as the conversion of data format or data type etc. further improves data transmission efficiency, and then improves the ageing of target bullet screen message transmission. For example, the code implementation of the second bullet screen transmission protocol IViewProtocl may be: public interface IViewProtocl { onReceiveMsg (String type, String info); }.
Specifically, after the forwarding protocol object judges that the target bullet screen distribution object is initialized, the broadcast channel does not need to be started, and the target bullet screen message is transmitted through the communication channel referenced by the object bridge. At this time, the result false of the initialized judgment in the first barrage transfer function in the forwarding protocol object is used as a trigger condition for the forwarding protocol object to call the second barrage transfer function. In specific implementation, the function implementation of the first barrage transfer function in the forwarding protocol object includes not only the receiving operation and the initialization judgment operation of the target barrage message, but also the calling operation of the second barrage transfer function as a callback function. Therefore, when the first bullet screen transmission function receives the target bullet screen message and judges that the target bullet screen distribution object is initialized, the calling of the second bullet screen transmission function is automatically triggered. The calling process is that in the first barrage transmission function, the target barrage message corresponding to the received function input parameter, such as a barrage message identification type and barrage message body information info, is taken as the function input parameter again, and a second barrage transmission function inherited from the first barrage transmission function, namely, the DanmuSender. Therefore, the first bullet screen transmission function in the forwarding protocol object transmits the target bullet screen message to the bullet screen distribution protocol object through the interface provided by the distribution protocol object through the function pointer of the second bullet screen transmission function, and automatically triggers the execution of the second bullet screen transmission function body, namely triggers the execution of the step S360.
Similarly, in the above process, the forwarding protocol object at least obtains the distribution protocol object in advance before the step is executed, and the obtaining mode may be an interactive interface provided by the data forwarding object and the bullet screen distribution object, or may be a mode of transmitting the corresponding object as a function parameter by a function call mode.
And S360, the distribution protocol object calls back the second bullet screen transmission function to obtain the target bullet screen message.
Specifically, after the second barrage transfer function is called in the forwarding protocol object, the distribution protocol object is triggered to execute the second barrage transfer function so as to receive the target barrage message transmitted as the function input parameter. Therefore, the target bullet screen message is quickly transmitted to the bullet screen distribution object by the bullet screen receiving object through the communication channel which is established between the data forwarding object and the target bullet screen distribution object and is referenced by the object bridge.
According to the technical scheme of the embodiment, the distribution protocol object is obtained in advance through the forwarding protocol object, and a data transmission channel between the data forwarding object and the target bullet screen distribution object is established. The second bullet screen transmission function serving as the callback function is triggered in the first bullet screen transmission function, so that the data forwarding object transmits the obtained target bullet screen message to the target bullet screen distribution object while acquiring the target bullet screen, and the timeliness of bullet screen message transmission is improved.
On the basis of the technical scheme, the forwarding protocol object is obtained in advance in the following mode:
the data forwarding object calls a first object obtaining function through the bullet screen receiving class to obtain a bullet screen receiving object; the data forwarding object converts the data forwarding object into a forwarding protocol object according to a first bullet screen transmission protocol; and the data forwarding object receives the object through the bullet screen, takes the forwarding protocol object as a function input parameter, calls a first object transmission function in the bullet screen receiving object, and sends the forwarding protocol object to the bullet screen receiving object.
The first object obtaining function is an internal function (also called member function) in the bullet screen receiving class, and is used for obtaining the objects in the bullet screen receiving class. The first object transfer function is a function defined in the bullet screen reception class for performing object transfer. For example, the first object transfer function may be defined as: public void setidanmutocl (idanmutocl mm) { idanmutocl iDanmu ═ mm; }. The function input parameter mm of the first object transfer function setidanmupotocl is an object whose data type is the first barrage transfer protocol idanmupotocl type. iDanmu is an object variable in the barrage receiving object, wherein one data type is also the first barrage transmission protocol idanmupotcl type.
Illustratively, the bullet screen receiving object is a singleton object. In this embodiment, the bullet screen receiving class is set to the singleton mode, so that the bullet screen receiving class can only have one bullet screen receiving object. The advantage of this arrangement is that the bullet screen receiving object is set as a global object so that other classes or objects can be directly fetched.
Specifically, in the embodiment of the present invention, the establishment of the communication channel between the bullet screen receiving object and the data forwarding object is implemented in a manner of mutually acquiring corresponding objects. Because the bullet screen receiving object is a singleton object, the data forwarding object can directly acquire the bullet screen receiving object. In specific implementation, the data forwarding object calls a first object obtaining function getInstence () in the bullet screen receiving class to obtain a function return value, and the function return value is the bullet screen receiving object. At this time, the data transfer object holds the bullet screen receiving object.
Then, it is necessary to implement that the bullet screen receiving object holds the data forwarding object. Before this, it is considered that the data forwarding object to be acquired by the bullet screen receiving object needs to have the first bullet screen transmission function, and the data forwarding object should only have the communication function of the first bullet screen transmission protocol object, so as to facilitate subsequent function call based on the first bullet screen transmission protocol. Therefore, before the bullet screen receiving object obtains the data forwarding object, the data forwarding object inheriting the first bullet screen transmission protocol needs to be forcibly converted into the forwarding protocol object only having the function of the first bullet screen transmission protocol object according to the first bullet screen transmission protocol in the life cycle function of the data forwarding object. The code implementation can be as follows:
(IDanmumProtocl) DataDistribution. Since the data forwarding object already holds the bullet screen receiving object, the transponder protocol object after forced conversion also holds the bullet screen receiving object.
After the above operation, the transfer protocol object holds the bullet screen receiving object, and the bullet screen receiving object includes the first object transmission function, so in the life cycle function of the data transfer object, the transfer protocol object is used as the function input parameter mm, the bullet screen receiving object held by the transfer protocol object calls the first object transmission function setidenmupalcl (mm) in the bullet screen receiving object, assigns the transfer protocol object to the object variable iDanmu in the bullet screen receiving object, and thus the bullet screen receiving object holds the transfer protocol object. At this time, if the bullet screen receiving object and the data forwarding object are in a state of holding objects with each other, a communication channel between the bullet screen receiving object and the data forwarding object is established.
Further, the distribution protocol object is obtained in advance by: the target bullet screen distribution object calls a second object acquisition function through a data forwarding class to acquire a data forwarding object; the target bullet screen distribution object converts the target bullet screen distribution object into a distribution protocol object according to a second bullet screen transmission protocol; and the target bullet screen distribution object calls a second object transmission function in the data forwarding object by using the distribution protocol object as a function input parameter through the data forwarding object, and sends the distribution protocol object to the data forwarding object.
Wherein the second object obtaining function is an internal function (also called member function) in the data forwarding class, and is used for obtaining the object in the data forwarding class. The second object transfer function is a function defined in the data forwarding class for performing object transfer. For example, the second object transfer function may be defined as: public void setiviewrotocl (iviewrotocl nn) { iviewrotocl iView ═ nn; }. The function input parameter nn of the second object transfer function setIViewProtocl is an object whose data type is the type of the second bullet screen transfer protocol IViewProtocl. And the iView is an object variable of which one data type in the bullet screen receiving object is also a second bullet screen transmission protocol IViewProtocl type.
Illustratively, the data forwarding object is a singleton object. In this embodiment, the data forwarding class is set to the singleton mode, so that the data forwarding class can only have one data forwarding object. The benefit of this is that the data forwarding object is set as a global object so that other classes or objects can be directly fetched.
Specifically, in the embodiment of the present invention, the establishment of the communication channel between the data forwarding object and the target bullet screen distribution object is realized by mutually acquiring corresponding objects. Because the data forwarding object is a singleton object, the target bullet screen distribution object can directly acquire the data forwarding object. In specific implementation, the target bullet screen distribution object calls a second object obtaining function getInstance () in the data forwarding class to obtain a function return value, and the function return value is the data forwarding object. At this time, the target bullet screen distribution object holds the data forwarding object.
And then, the data forwarding object is required to be held with the target bullet screen distribution object. In this case, it is considered that the target bullet screen distribution object to be acquired by the data forwarding object needs to have the second bullet screen transmission function, and the target bullet screen distribution object should only have the communication function of the second bullet screen transmission protocol object, so as to facilitate subsequent function call based on the second bullet screen transmission protocol. Therefore, before the data forwarding object obtains the target bullet screen distribution object, the target bullet screen distribution object inheriting the second bullet screen transmission protocol needs to be forcibly converted into a distribution protocol object only having the function of the second bullet screen transmission protocol object according to the second bullet screen transmission protocol in the life cycle function of the target bullet screen distribution object. The code implementation can be as follows: (IViewProtocl) DanmuSender. Since the target bullet screen distribution object already holds the data forwarding object, the distribution protocol object after forced conversion also holds the data forwarding object.
After the above operations, the distribution protocol object holds the data forwarding object, and the data forwarding object includes the second object transmission function, so in the life cycle function of the target bullet screen distribution object, the distribution protocol object is used as the function input parameter nn, the second object transmission function setiviewprotocl (nn) in the distribution protocol object is called through the data forwarding object held by the distribution protocol object, the distribution protocol object is assigned to the object variable iView in the data forwarding object, and thus the data forwarding object holds the distribution protocol object. At this time, when the data transfer object and the target bullet screen distribution object are in a mutually held state, a communication channel between the data transfer object and the target bullet screen distribution object is established.
Example four
The present embodiment provides a bullet screen message transmission apparatus, referring to fig. 4, the apparatus specifically includes:
a bullet screen receiving module 410, a data forwarding module 420, a broadcast publishing module 430 and a broadcast receiving module 440;
the bullet screen receiving module 410 is configured to call a first bullet screen transmission function according to a target bullet screen message through a pre-obtained forwarding protocol object, so as to transmit the target bullet screen message to the forwarding protocol object, where the forwarding protocol object is obtained by inheriting a pre-defined first bullet screen transmission protocol by a data forwarding object, and the first bullet screen transmission protocol includes a first bullet screen transmission function;
the data forwarding module 420 is configured to call back the first bullet screen transmission function, obtain a target bullet screen message, and trigger and determine whether a target bullet screen distribution object is initialized;
the broadcast publishing module 430 is configured to construct a broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen message and broadcast the broadcast intention object if the target bullet screen distribution object is not initialized;
the broadcast receiving module 440 is configured to receive the broadcast intention object, and send a target bullet screen message in the broadcast intention object to the target bullet screen distribution object, so that the target bullet screen distribution object obtains the target bullet screen message.
Optionally, the broadcast publishing module 430 comprises a broadcast intention object constructing sub-module for:
determining broadcast sending action description according to target object information, calling a pre-constructed broadcast action setting function of an initial intention object by taking the broadcast sending action description as a function input parameter, setting action description for the initial intention object, and obtaining an intermediate intention object, wherein the object information comprises an object package name and an object class name;
calling a data storage function of a pre-constructed initial data wrapper object according to the target bullet screen message, and storing the target bullet screen message to the initial data wrapper object to obtain a target data wrapper object;
and taking the target data wrapper object as a function input parameter, calling a data packet setting function of the intermediate intention object, storing the target data wrapper object to the intermediate intention object, and obtaining the broadcast intention object.
Optionally, the broadcast receiving module 440 includes a bullet screen message transmission sub-module, configured to:
when the target bullet screen distribution object is not initialized, an initialization function is called to initialize the target bullet screen distribution object;
calling a data packet acquisition function through the broadcast intention object to obtain a target data wrapper object;
and calling a data acquisition function of the target data wrapper object, acquiring a target bullet screen message, and sending the target bullet screen message to a target bullet screen distribution object.
On the basis of the above device, the device further includes a broadcast registration module, configured to:
before the broadcast receiving object receives the broadcast intention object, when the broadcast receiving class corresponding to the broadcast receiving object is the internal class of the bullet screen distribution class corresponding to the bullet screen distribution object, determining the broadcast receiving action description according to the target object information;
determining a broadcast receiving object description according to the target object information, the internal class identifier and the internal class information;
and according to the broadcast receiving object description and the broadcast receiving action description, registering the system broadcast receiver by adopting a static registration mode to obtain a broadcast receiving object.
Optionally, the broadcast registration module is further configured to:
before the broadcast receiving object receives the broadcast intention object, when the broadcast receiving class corresponding to the broadcast receiving object is an independent class of a functional module which is positioned at the same position as the bullet screen distribution object, determining each broadcast receiving action description according to the object information of each bullet screen distribution object in the functional module;
determining a broadcast receiving object description according to the independent class information;
the system broadcast receiver is registered according to the broadcast receiving object description and each broadcast receiving action description to obtain a broadcast receiving object.
Optionally, on the basis of the device, the device further comprises a bullet screen dispensing module;
the data forwarding module 420 is further configured to: after the transfer protocol object judges whether the bullet screen distribution object is initialized, if so, the transfer protocol object triggers a target bullet screen message in a first bullet screen transmission function, and calls a second bullet screen transmission function through a distribution protocol object obtained in advance to transmit the target bullet screen message to the distribution protocol object, wherein the distribution protocol object is obtained by inheriting a second bullet screen transmission protocol defined in advance by the target bullet screen distribution object, the second bullet screen transmission protocol comprises a second bullet screen transmission function, and the function input parameters of the first bullet screen transmission function and the second bullet screen transmission function are the same;
and the bullet screen distribution module is used for calling back the second bullet screen transmission function to obtain the target bullet screen message.
Further, the data forwarding module includes a forwarding protocol object obtaining sub-module, configured to enable the barrage receiving object to obtain the forwarding protocol object in advance in the following manner:
the data forwarding object calls a first object obtaining function through a bullet screen receiving class to obtain a bullet screen receiving object, wherein the bullet screen receiving object is a singleton object;
the data forwarding object converts the data forwarding object into a forwarding protocol object according to a first bullet screen transmission protocol;
the data forwarding object receives the object through the bullet screen, takes the forwarding protocol object as a function input parameter, calls a first object transmission function in the bullet screen receiving object, and sends the forwarding protocol object to the bullet screen receiving object;
the bullet screen distribution module comprises a distribution protocol object acquisition module and is used for enabling the data forwarding object to acquire a distribution protocol object in advance in the following way:
the target bullet screen distribution object calls a second object acquisition function through a data forwarding class to acquire a data forwarding object, wherein the data forwarding object is a singleton object;
the target bullet screen distribution object converts the bullet screen distribution object into a distribution protocol object according to a second bullet screen transmission protocol;
and the target bullet screen distribution object calls a second object transmission function in the data forwarding object by using the distribution protocol object as a function input parameter through the data forwarding object, and sends the distribution protocol object to the data forwarding object.
Through the bullet screen message transmission device provided by the fourth embodiment of the invention, the bullet screen message is rapidly transmitted between the bullet screen receiving module and the bullet screen distributing module, and the timeliness of bullet screen message transmission is improved.
The bullet screen message transmission device provided by the embodiment of the invention can execute the bullet screen message transmission method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Referring to fig. 5, the present embodiment provides an apparatus 500 comprising: one or more processors 520; the storage device 510 is configured to store one or more programs, and when the one or more programs are executed by the one or more processors 520, the one or more processors 520 implement the bullet screen message transmission method provided in the embodiment of the present invention.
The device 500 shown in fig. 5 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention. As shown in fig. 5, the apparatus 500 includes a processor 520, a storage device 510, an input device 530, and an output device 540; the number of the processors 520 in the device may be one or more, and one processor 520 is taken as an example in fig. 5; the processor 520, the memory device 510, the input device 530 and the output device 540 of the apparatus may be connected by a bus or other means, such as by a bus 550 in fig. 5.
The storage device 510 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the bullet screen message transmission method in the embodiment of the present invention (for example, a bullet screen receiving module, a data forwarding module, a broadcast issuing module, and a broadcast receiving module in the bullet screen message transmission device).
The storage device 510 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the storage 510 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, storage 510 may further include memory located remotely from processor 520, which may be connected to devices over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus. The output device 540 may include a display device such as a display screen.
EXAMPLE six
The present embodiment provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to execute the bullet screen message transmission method provided by the embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) to execute the bullet screen message transmission method provided in the embodiments of the present invention.
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 illustrated 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 bullet screen message transmission method is characterized by comprising the following steps:
the method comprises the steps that a bullet screen receiving object calls a first bullet screen transmission function through a pre-obtained forwarding protocol object according to a target bullet screen message so as to transmit the target bullet screen message to the forwarding protocol object, wherein the forwarding protocol object is obtained by enabling a data forwarding object to inherit a pre-defined first bullet screen transmission protocol, and the first bullet screen transmission protocol comprises the first bullet screen transmission function; the forwarding protocol object calls back the first bullet screen transmission function to obtain the target bullet screen message, and triggers and judges whether a target bullet screen distribution object is initialized or not;
if not, the broadcast publishing object constructs a broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen message, and broadcasts the broadcast intention object;
the broadcast receiving object receives the broadcast intention object and sends the target bullet screen message in the broadcast intention object to the target bullet screen distribution object so that the target bullet screen distribution object obtains the target bullet screen message;
wherein the forwarding protocol object is obtained in advance by:
the data forwarding object calls a first object obtaining function through a bullet screen receiving class to obtain the bullet screen receiving object, wherein the bullet screen receiving object is a singleton object;
the data forwarding object converts the data forwarding object into the forwarding protocol object according to the first bullet screen transmission protocol;
and the data forwarding object calls a first object transmission function in the bullet screen receiving object by taking the forwarding protocol object as a function input parameter through the bullet screen receiving object, and sends the forwarding protocol object to the bullet screen receiving object.
2. The method of claim 1, wherein the constructing of the broadcast intention object by the broadcast publishing object according to the target object information of the target barrage distribution object and the target barrage message comprises:
the broadcast publishing object determines broadcast sending action description according to the target object information, calls a pre-constructed broadcast action setting function of an initial intention object by taking the broadcast sending action description as a function input parameter, sets action description for the initial intention object and obtains an intermediate intention object, wherein the object information comprises an object package name and an object class name;
the broadcast release object calls a data storage function of a pre-constructed initial data wrapper object according to the target bullet screen message, stores the target bullet screen message to the initial data wrapper object and obtains a target data wrapper object;
and the broadcast release object takes the target data wrapper object as a function input parameter, calls a data packet setting function of the intermediate intention object, stores the target data wrapper object to the intermediate intention object and obtains the broadcast intention object.
3. The method of claim 2, wherein the broadcast receiving object sending the target barrage message in the broadcast intention object to the target barrage distribution object comprises:
when the target bullet screen distribution object is not initialized, the broadcast receiving object calls an initialization function to initialize the target bullet screen distribution object;
the broadcast receiving object calls a data packet acquisition function through the broadcast intention object to obtain the target data wrapper object;
and the broadcast receiving object calls a data acquisition function of the target data wrapper object, acquires the target bullet screen message and sends the target bullet screen message to the target bullet screen distribution object.
4. The method of claim 1, further comprising, before the broadcast receiving object receives the broadcast intent object:
when the broadcast receiving class corresponding to the broadcast receiving object is the internal class of the bullet screen distribution class corresponding to the bullet screen distribution object, the broadcast registration object determines the description of the broadcast receiving action according to the target object information;
the broadcast registration object determines the description of the broadcast receiving object according to the target object information, the internal class identification and the internal class information;
and the broadcast registration object adopts a static registration mode to register a system broadcast receiver according to the broadcast receiving object description and the broadcast receiving action description to obtain the broadcast receiving object.
5. The method of claim 1, further comprising, before the broadcast receiving object receives the broadcast intent object:
when the broadcast receiving class corresponding to the broadcast receiving object is an independent class of a functional module which is located at the same position as the bullet screen distribution object, the broadcast registration object determines the description of each broadcast receiving action according to the object information of each bullet screen distribution object in the functional module;
the broadcast registration object determines the description of a broadcast receiving object according to the independent class information;
and the broadcast registration object registers the system broadcast receiver according to the broadcast receiving object description and each broadcast receiving action description to obtain the broadcast receiving object.
6. The method of claim 1, wherein after the forwarding protocol object determines whether the bullet screen distribution object is initialized, the method further comprises:
if so, the forwarding protocol object triggers a second bullet screen transmission function in the first bullet screen transmission function according to the target bullet screen message, and transmits the target bullet screen message to the distribution protocol object by using a pre-obtained distribution protocol object, wherein the distribution protocol object is obtained by inheriting a pre-defined second bullet screen transmission protocol to the target bullet screen distribution object, the second bullet screen transmission protocol comprises the second bullet screen transmission function, and the function input parameters of the first bullet screen transmission function and the second bullet screen transmission function are the same;
and the distribution protocol object calls back the second bullet screen transmission function to obtain the target bullet screen message.
7. The method of claim 6, wherein the distribution protocol object is pre-obtained by:
the target bullet screen distribution object calls a second object acquisition function through a data forwarding class to acquire the data forwarding object, wherein the data forwarding object is a singleton object;
the target bullet screen distribution object converts the bullet screen distribution object into a distribution protocol object according to the second bullet screen transmission protocol;
and the target bullet screen distribution object calls a second object transmission function in the data forwarding object by using the distribution protocol object as a function input parameter through the data forwarding object, and sends the distribution protocol object to the data forwarding object.
8. A bullet screen message transmission device, comprising: the system comprises a bullet screen receiving module, a data forwarding module, a broadcast releasing module and a broadcast receiving module;
the bullet screen receiving module is used for calling a first bullet screen transmission function through a pre-obtained forwarding protocol object according to a target bullet screen message so as to transmit the target bullet screen message to the forwarding protocol object, wherein the forwarding protocol object is obtained by inheriting a pre-defined first bullet screen transmission protocol by a data forwarding object, and the first bullet screen transmission protocol comprises the first bullet screen transmission function;
the data forwarding module is used for calling back the first bullet screen transmission function, obtaining the target bullet screen message and triggering and judging whether a target bullet screen distribution object is initialized or not;
the broadcast release module is used for constructing a broadcast intention object according to the target object information of the target bullet screen distribution object and the target bullet screen message and broadcasting the broadcast intention object if the target bullet screen distribution object is not initialized;
the broadcast receiving module is configured to receive the broadcast intention object, and send the target bullet screen message in the broadcast intention object to the target bullet screen distribution object, so that the target bullet screen distribution object obtains the target bullet screen message;
the data forwarding module comprises a forwarding protocol object obtaining submodule and is used for enabling the barrage receiving object to obtain the forwarding protocol object in advance in the following mode:
the data forwarding object calls a first object obtaining function through a bullet screen receiving class to obtain the bullet screen receiving object, wherein the bullet screen receiving object is a singleton object;
the data forwarding object converts the data forwarding object into the forwarding protocol object according to the first bullet screen transmission protocol;
and the data forwarding object calls a first object transmission function in the bullet screen receiving object by taking the forwarding protocol object as a function input parameter through the bullet screen receiving object, and sends the forwarding protocol object to the bullet screen receiving object.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by one or more of the processors, cause the one or more processors to implement the bullet screen message transmission method of 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, carries out the bullet screen message transmission method according to any one of claims 1 to 7.
CN201811019410.5A 2018-09-03 2018-09-03 Barrage message transmission method, device, equipment and storage medium Active CN108966035B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811019410.5A CN108966035B (en) 2018-09-03 2018-09-03 Barrage message transmission method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811019410.5A CN108966035B (en) 2018-09-03 2018-09-03 Barrage message transmission method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108966035A CN108966035A (en) 2018-12-07
CN108966035B true CN108966035B (en) 2021-02-02

Family

ID=64475612

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811019410.5A Active CN108966035B (en) 2018-09-03 2018-09-03 Barrage message transmission method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108966035B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113347467B (en) * 2021-06-01 2022-07-05 武汉斗鱼鱼乐网络科技有限公司 Loudspeaker information adjusting method and device, server and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105872653A (en) * 2016-03-21 2016-08-17 乐视网信息技术(北京)股份有限公司 Transmission method and device of barrage
WO2017020663A1 (en) * 2015-07-31 2017-02-09 腾讯科技(深圳)有限公司 Live-comment video live broadcast method and apparatus, video source device, and network access device
CN106488294A (en) * 2016-09-28 2017-03-08 乐视控股(北京)有限公司 Barrage information transfer, display packing and device
CN106612463A (en) * 2015-10-27 2017-05-03 中兴通讯股份有限公司 Barrage processing methods and system, and terminal
CN107911708A (en) * 2017-11-09 2018-04-13 腾讯数码(天津)有限公司 Barrage display methods, live broadcasting method and relevant apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017020663A1 (en) * 2015-07-31 2017-02-09 腾讯科技(深圳)有限公司 Live-comment video live broadcast method and apparatus, video source device, and network access device
CN106612463A (en) * 2015-10-27 2017-05-03 中兴通讯股份有限公司 Barrage processing methods and system, and terminal
CN105872653A (en) * 2016-03-21 2016-08-17 乐视网信息技术(北京)股份有限公司 Transmission method and device of barrage
CN106488294A (en) * 2016-09-28 2017-03-08 乐视控股(北京)有限公司 Barrage information transfer, display packing and device
CN107911708A (en) * 2017-11-09 2018-04-13 腾讯数码(天津)有限公司 Barrage display methods, live broadcasting method and relevant apparatus

Also Published As

Publication number Publication date
CN108966035A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108023808B (en) Message distribution method and device in application program
CN109246220B (en) Message pushing system and method
CN110633442A (en) Pushing method and device and electronic equipment
CN106293972B (en) single-page application page communication method and device
CN110753129A (en) Message transmission method, system, device, equipment and computer readable storage medium
CN108882053B (en) Bullet screen message distribution method, device, equipment and storage medium
CN111258723B (en) Transaction processing method, device, system, medium and equipment of distributed system
CN109343983B (en) Information interaction method, device, equipment and storage medium between function modules
CN108462894B (en) Live broadcast room broadcast processing method and device and readable storage medium
CN109062650B (en) Bullet screen message distribution method, device, equipment and storage medium
CN108810633B (en) Barrage message transmission method, device, equipment and storage medium
CN114416075A (en) Service processing method and device
CN108966035B (en) Barrage message transmission method, device, equipment and storage medium
CN104063285B (en) A kind of message broadcast communication method based between vehicle-mounted software platform process inner module
CN109388388B (en) Information interaction method, device, equipment and storage medium between function modules
CN108052401B (en) System attribute monitoring method, terminal device and computer readable storage medium
CN109005468B (en) Bullet screen message distribution method, device, equipment and storage medium
CN109144520B (en) Information interaction method, device, equipment and storage medium among different objects in Android
CN113127775B (en) Page loading method, device, equipment and storage medium
CN109274988B (en) Bullet screen message distribution method, device, equipment and storage medium
CN113312103A (en) Software definition method and device for intelligent camera, electronic equipment and storage medium
CN108924653B (en) Bullet screen message distribution method, device, equipment and storage medium
CN108810645B (en) Bullet screen message distribution method, device, equipment and storage medium
CN110324722B (en) Method, device, equipment and storage medium for acquiring data in live broadcast room
CN109218841B (en) Barrage message transmission method, device, 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