CN108810633B - 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
CN108810633B
CN108810633B CN201810691133.6A CN201810691133A CN108810633B CN 108810633 B CN108810633 B CN 108810633B CN 201810691133 A CN201810691133 A CN 201810691133A CN 108810633 B CN108810633 B CN 108810633B
Authority
CN
China
Prior art keywords
bullet screen
java
target
message
android client
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
CN201810691133.6A
Other languages
Chinese (zh)
Other versions
CN108810633A (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 CN201810691133.6A priority Critical patent/CN108810633B/en
Publication of CN108810633A publication Critical patent/CN108810633A/en
Application granted granted Critical
Publication of CN108810633B publication Critical patent/CN108810633B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • 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/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/254Management at additional data server, e.g. shopping server, rights management server
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

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 server preprocesses bullet screen information to be processed to obtain target bullet screen information; and the bullet screen server calls a message transfer function through a C + + bullet screen library object corresponding to a Java bullet screen library object which is pre-constructed in the Android client according to the target bullet screen message, and sends the target bullet screen message to the Android client, wherein the message transfer function is a callback function in the target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is pre-registered to the Java bullet screen library object. According to the technical scheme, the bullet screen server actively pushes the target bullet screen message to the Android client when obtaining the target bullet screen message, so that the Android client receives the target bullet screen message more timely in a passive mode, and the instantaneity of the Android client for obtaining the bullet screen message is improved.

Description

Barrage message transmission method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to computer 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
In a client (which may be referred to as an Android client) with an Android system, for application software that needs to receive a bullet screen message, a manner of obtaining the bullet screen message is usually to remotely access a bullet screen server through a network.
At present, the implementation manner of remotely accessing the bullet screen server by the Android client network to obtain the bullet screen message is as follows: the Android client periodically initiates a network request for acquiring the bullet screen message in a mode of calling a bullet screen message acquisition function written based on Java language. After receiving the network request, the bullet screen server triggers execution of corresponding code segments written based on the C + + language in the bullet screen server pointed by the bullet screen message acquisition function to acquire a C + + language-based C + + bullet screen message object corresponding to the network request, and sends the C + + bullet screen message object to the Android client in a function return value mode. And after receiving the C + + bullet screen message object, the Android client converts the C + + bullet screen message object into a Java bullet screen message object based on Java language.
The mode for acquiring the bullet screen message by the Android client in the prior art is a mode of actively and periodically calling a function, and the bullet screen message acquisition mode has two problems: firstly, the Android client frequently executes function call and barrage message object conversion operation, so that higher system resource occupancy rate is caused, and the system memory overhead is large; secondly, the duration of the periodic timer for initiating the function call is not properly set, which easily causes the loss of the bullet screen message between two adjacent function calls.
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 an Android client can acquire bullet screen messages from a bullet screen server more timely, the loss rate of the bullet screen messages is greatly reduced, and the system memory overhead is reduced to a certain extent.
In a first aspect, an embodiment of the present invention provides a bullet screen message transmission method, including:
the bullet screen server preprocesses bullet screen information to be processed to obtain target bullet screen information;
and the bullet screen server calls a message transfer function through a C + + bullet screen library object corresponding to a Java bullet screen library object which is pre-constructed in an Android client according to the target bullet screen message, and sends the target bullet screen message to the Android client, wherein the message transfer function is a callback function in a target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is pre-registered to the Java bullet screen library object.
Optionally, the act of bullet screen server preprocessing the bullet screen message to be processed, and obtaining the target bullet screen message includes:
and the bullet screen server decrypts and analyzes the bullet screen message to be processed to obtain the target bullet screen message containing the bullet screen message identification and the bullet screen message body.
Optionally, before the message transfer function is called through a C + + bullet screen library object corresponding to a Java bullet screen library object pre-constructed in the Android client, the method further includes:
the Android client constructs a Java bullet screen library object based on the C + + bullet screen library class in the bullet screen server;
the Android client builds the target Java bullet screen listener object based on the C + + listener class in the bullet screen server, wherein the target Java bullet screen listener object comprises the message transmission function;
the Android client calls a listener setting function in the Java bullet screen library object according to the target Java bullet screen listener object, and registers the target Java bullet screen listener object into the Java bullet screen library object;
accordingly, invoking the message transfer function includes:
and calling the message transmission function based on the C + + bullet screen library object corresponding to the Java bullet screen library object in the bullet screen server.
Wherein, the Android client constructs a Java bullet screen library object based on the C + + bullet screen library class in the bullet screen server, and the construction comprises:
the Android client calls a context environment obtaining function of an application program class to obtain a context environment object of an Android system;
and the Android client calls a construction function of the C + + bullet screen library class according to the context environment object to construct the Java bullet screen library object.
Wherein the Android client constructs the target Java bullet screen listener object based on the C + + listener class in the bullet screen server, and the method comprises the following steps:
the Android client side obtains a first initial Java bullet screen listener object based on the C + + listener class;
and the Android client assigns a value to the first initial Java bullet screen listener object based on a C + + bullet screen listener interface in the bullet screen server to construct the target Java bullet screen listener object, wherein the C + + bullet screen listener interface contains a predefined message transfer function.
Further, the obtaining, by the Android client, a first initial Java bullet screen listener object based on the C + + listener class includes:
the Android client defines a second initial Java bullet screen listener object based on the C + + listener class;
and the Android client initializes the second initial Java bullet screen monitor object to an empty object to obtain the first initial Java bullet screen monitor object.
Further, the Android client assigns a value to the first initial Java bullet screen listener object based on a C + + bullet screen listener interface in the bullet screen server to construct the target Java bullet screen listener object includes:
the Android client inherits the C + + bullet screen monitor interface through an interface inheritance keyword, and performs callback on the predefined message transmission function to obtain a Java bullet screen monitor interface;
and the Android client assigns a value to the first initial Java bullet screen monitor object based on the Java bullet screen monitor interface so as to construct the target Java bullet screen monitor object.
In a second aspect, an embodiment of the present invention further provides a bullet screen message transmission apparatus, where the apparatus includes:
the target bullet screen message acquisition module is used for preprocessing the bullet screen message to be processed by the bullet screen server to obtain the target bullet screen message;
and the target bullet screen message sending module is used for calling a message transfer function through a C + + bullet screen library object corresponding to a Java bullet screen library object which is constructed in advance in an Android client by the bullet screen server according to the target bullet screen message, and sending the target bullet screen message to the Android client, wherein the message transfer function is a callback function in a target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is registered to the Java bullet screen library object in advance.
Optionally, the target barrage message acquiring module is specifically configured to:
and the bullet screen server decrypts and analyzes the bullet screen message to be processed to obtain the target bullet screen message containing the bullet screen message identification and the bullet screen message body.
Optionally, on the basis of the foregoing apparatus, the apparatus further includes a monitoring setting module, where the monitoring setting module includes:
the Java bullet screen library object construction submodule is used for constructing a Java bullet screen library object by the Android client based on a C + + bullet screen library class in the bullet screen server before the bullet screen server calls a message transmission function through a C + + bullet screen library object corresponding to the Java bullet screen library object which is pre-constructed in the Android client;
a target Java bullet screen listener object constructing submodule, configured to construct, by the Android client, the target Java bullet screen listener object based on a C + + listener class in the bullet screen server, where the target Java bullet screen listener object includes the message transfer function;
and the listener registration submodule is used for calling a listener setting function in the Java bullet screen library object by the Android client according to the target Java bullet screen listener object and registering the target Java bullet screen listener object into the Java bullet screen library object.
Correspondingly, the target barrage message sending module is specifically configured to:
and calling the message transmission function based on the C + + bullet screen library object corresponding to the Java bullet screen library object in the bullet screen server.
The Java bullet screen library object construction submodule is specifically used for:
the Android client calls a context environment obtaining function of an application program class to obtain a context environment object of an Android system;
and the Android client calls a construction function of the C + + bullet screen library class according to the context environment object to construct the Java bullet screen library object.
The object building submodule of the target Java bullet screen monitor is specifically used for:
the Android client side obtains a first initial Java bullet screen listener object based on the C + + listener class;
and the Android client assigns a value to the first initial Java bullet screen listener object based on a C + + bullet screen listener interface in the bullet screen server to construct the target Java bullet screen listener object, wherein the C + + bullet screen listener interface contains a predefined message transfer function.
Further, the target Java barrage listener object building submodule is specifically configured to:
the Android client defines a second initial Java bullet screen listener object based on the C + + listener class;
and the Android client initializes the second initial Java bullet screen monitor object to an empty object to obtain the first initial Java bullet screen monitor object.
Further, the target Java barrage listener object building submodule is specifically configured to:
the Android client inherits the C + + bullet screen monitor interface through an interface inheritance keyword, and performs callback on the predefined message transmission function to obtain a Java bullet screen monitor interface;
and the Android client assigns a value to the first initial Java bullet screen monitor object based on the Java bullet screen monitor interface so as to construct the target Java bullet screen monitor object.
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 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 method and the device, the message transmission function serving as the callback function in the target Java bullet screen monitor object in the Android client is called by the bullet screen server, the target bullet screen message after the pretreatment of the bullet screen message to be treated is sent to the Android client, the bullet screen server actively pushes the target bullet screen message to the Android client when obtaining the target bullet screen message, and then the Android client receives the target bullet screen message in a passive mode more timely, so that the instantaneity of the Android client for obtaining the bullet screen message is improved, the packet loss rate of the bullet screen message is greatly reduced, and the system resource overhead of the Android client for obtaining the bullet screen message is reduced to a certain extent.
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 schematic structural diagram of a bullet screen message transmission device in a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus in the fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
The bullet screen message transmission method provided by this embodiment may be applicable to an Android client obtaining a bullet screen message from a bullet screen server, and the method may be executed by a bullet screen message transmission device configured in a device with bullet screen processing capability, such as a bullet screen server, and the device may be implemented in a software and/or hardware manner. Referring to fig. 1, the method of the present embodiment specifically includes the following steps:
s110, the bullet screen server preprocesses the bullet screen message to be processed to obtain a target bullet screen message.
The bullet screen server is a server capable of transmitting and processing bullet screen messages. The bullet screen message to be processed refers to an original bullet screen message which is obtained by the bullet screen server and is not processed. The target barrage message is a processed barrage message and can be directly sent to the Android client.
Specifically, there are usually differences in data storage formats and data transmission formats between the to-be-processed bullet screen message acquired by the bullet screen server and the target bullet screen message. In order to obtain a target bullet screen message which can be directly sent to the Android client, after the bullet screen server obtains the bullet screen message to be processed, the bullet screen server needs to preprocess the bullet screen message so as to obtain the target bullet screen message which can adapt to the Android client.
Illustratively, the act server preprocesses the act message to be processed, and obtaining the target act message includes: and the bullet screen server decrypts and analyzes the bullet screen message to be processed to obtain a target bullet screen message containing the bullet screen message identification and the bullet screen message body.
The bullet screen message identifier refers to a character capable of identifying a bullet screen message, and may be any combination of numbers, letters, symbols and 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 refers to a carrier of the bullet screen message, and the bullet screen message body contains specific bullet screen message contents.
Specifically, the bullet screen message to be processed obtained by the bullet screen server is encrypted, and the data format of the bullet screen message to be processed is the data format specified in the bullet screen sending end, so the bullet screen server needs to decrypt the obtained bullet screen message to be processed. And analyzing and reconstructing the decrypted barrage message to obtain a barrage message identifier and specific barrage message content, namely a barrage message body, storing the barrage message identifier and the barrage message body into a specified data format sent to the Android client, and marking the barrage message identifier and the barrage message body as a target barrage message so as to send the barrage message in the following process.
And S120, the bullet screen server calls a message transfer function through a C + + bullet screen library object corresponding to a Java bullet screen library object which is pre-constructed in the Android client according to the target bullet screen message, and sends the target bullet screen message to the Android client.
The Java bullet screen library object refers to a bullet screen library object written in Java language in an Android client, and the process of the Java bullet screen library object is described in the following description. The C + + bullet screen library object refers to a bullet screen library object written in the C + + language, and is an object generated in the bullet screen server based on a bullet screen library class written in the C + + language (i.e., a C + + bullet screen library class). And the message transmission function is a callback function in a target Java bullet screen monitor object in the Android client. Here, the target Java bullet screen listener object refers to a Java language-based instantiated (or called as assignment) listener object in the Android client, and is used for monitoring the bullet screen library object, where the target Java bullet screen listener object needs to be registered in advance to the Java bullet screen library object for the implementation of the monitoring, and a specific registration process can be described in the following embodiments. The callback function refers to a function called by a function pointer, when a party providing function implementation initializes, the function pointer of the callback function is registered to a caller, and when a specific event or condition occurs, the caller calls the callback function by using the function pointer to process the event. In this embodiment, the message transfer function as the callback function is to perform function definition and function implementation in the Android client, and the Android client registers a function pointer of the message transfer function to the bullet screen server, and the bullet screen server calls the message transfer function at a specific time, that is, the execution of a message transfer function body in the Android client is triggered through the function pointer of the message transfer function, so as to implement transmission of the bullet screen message.
Specifically, the bullet screen server obtains the function pointer of the message transfer function in advance before executing the step, and as can be known from the description in the following embodiments, what actually holds the function pointer of the message transfer function is the C + + bullet screen library object corresponding to the Java bullet screen library object. When the bullet screen server obtains the target bullet screen message, the target bullet screen message is used as a function input parameter according to the input parameter form of the message transmission function, the message transmission function is triggered and called through the C + + bullet screen library object, namely function calling of a trigger function pointer is carried out, the function input parameter is transmitted to the Android client side to execute the message transmission function in the Android client side, and therefore the target bullet screen message is transmitted to the Android client side.
Exemplarily, before the bullet screen server calls the message transfer function through the C + + bullet screen library object corresponding to the Java bullet screen library object pre-constructed in the Android client, the method further includes: the Android client constructs a Java bullet screen library object based on a C + + bullet screen library class in the bullet screen server; the Android client builds a target Java bullet screen monitor object based on a C + + monitor class in the bullet screen server, wherein the target Java bullet screen monitor object comprises a message transfer function; and the Android client calls a monitor setting function in the Java bullet screen library object according to the target Java bullet screen monitor object, and registers the target Java bullet screen monitor object into the Java bullet screen library object.
The Java bullet screen library object refers to a bullet screen library object written in Java language in an Android client. The C + + listener class refers to a listener class written in C + + language in the bullet screen server. The listener setup function is a function that binds a listener object to a listened object, and is defined in the C + + bullet library class.
Specifically, before the bullet screen server executes the operation called by the message transfer function, a function pointer of the message transfer function needs to be acquired first, that is, the Android client needs to set the callback function in advance, and register the callback function in the bullet screen server is realized.
During specific implementation, the Android client calls the C + + bullet screen library class in the bullet screen server to construct a Java bullet screen library object, the Java bullet screen library object is a Java object in the Android client, and the Java bullet screen library object can be directly used in a Java programming environment subsequently without code conversion. The Java bullet screen library object actually points to the C + + bullet screen library object, and subsequent operations on the Java bullet screen library object may be mapped to operations on the C + + bullet screen library object.
And when/before/after the Android client constructs the Java bullet screen library object, the Android client calls a C + + listener class in the bullet screen server to construct a target Java bullet screen listener object, and similarly, the target Java bullet screen listener object is a Java interface in the Android client and can be directly used in a Java programming environment subsequently without code conversion. The construction of the target Java bullet screen listener object can be defined by directly calling a C + + class in a bullet screen server and further calling a related C + + interface for instantiation; or a Java interface in the Android client can be constructed based on the C + + class or the interface in the bullet screen server, and then instantiated based on the Java interface, so that the code conversion process between the C + + language and the Java language is reduced, and the development process is simplified. In the instantiation process of the target Java bullet screen listener object, the target Java bullet screen listener object inherits and realizes a callback function in a related C + + interface in a bullet screen server, namely the target Java bullet screen listener object contains an realized message transmission function.
After the Java bullet screen library object and the target Java bullet screen listener object are constructed, the callback function can be registered. And the Android client calls a listener setting function in the Java bullet screen library object, and registers the target Java bullet screen listener object to the Java bullet screen library object, so that the bridging relation between the Java bullet screen library object and the target Java bullet screen listener object is realized. Since the Java bullet screen library object actually points to the C + + bullet screen library object, the actual execution result of the above process is that the C + + bullet screen library object is triggered by the Java bullet screen library object to call its listener setting function, and the target Java bullet screen listener object is registered to the C + + bullet screen library object, that is, the monitoring interface corresponding to the target Java bullet screen listener object and its internal callback function pointer are both registered to the C + + bullet screen library object in the bullet screen server, so that the bullet screen server has the function pointer of the message transmission function, and a message channel between the bullet screen server and the Android client is constructed.
According to the technical scheme, the message transmission function serving as the callback function in the target Java bullet screen monitor object in the Android client is called by the bullet screen server, the target bullet screen message after the pretreatment of the bullet screen message to be processed is sent to the Android client, the bullet screen server actively pushes the obtained target bullet screen message to the Android client, and then the Android client receives the target bullet screen message more timely in a passive mode, so that the instantaneity of the Android client for obtaining the bullet screen message is improved, the packet loss rate of the bullet screen message is greatly reduced, and the system resource overhead of the Android client for obtaining the bullet screen message is reduced to a certain extent.
Example two
In this embodiment, a bridging relationship between a bullet screen library object and a bullet screen listener object is pre-established in an Android client, so that a message transmission channel between a bullet screen server and the Android client is established for detailed description. Specifically, in this embodiment, based on the first embodiment, further optimization is performed on the "Android client constructs a Java bullet screen library object based on a C + + bullet screen library class in the bullet screen server. On the basis, the target Java bullet screen monitor object can be further constructed on the basis of the C + + monitor class in the bullet screen server by the Android client side for optimization. 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:
s210, the Android client calls a context environment obtaining function of the application program class to obtain a context environment object of the Android system.
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 Java bullet screen library object mDanmukuClient is constructed based on a C + + bullet screen library class DanmukuClient, and the specific construction process is to call a construction function of the C + + bullet screen library class DanmukuClient. The prototype of the constructor is private DanmukuClient (final Context), and it can be seen that a Context object of a Context type needs to be transmitted in the construction process, so that the Context object needs to be obtained from an Android system before a Java bullet screen library object mDanmukuClient is constructed. In specific implementation, the context object of the Android system can be acquired by invoking a context environment acquisition function getApplicationContext in the Application of the Android system Application.
And S220, calling a construction function of the C + + bullet screen library class by the Android client according to the context environment object, and constructing a Java bullet screen library object.
Specifically, after the Android client side obtains a Context environment object Context of the Android system, the Context environment object Context is used as a function input parameter, a construct function private DanmukuClient (final Context) of a C + + bullet screen library class DanmukuClient is called, a function return value is obtained, and the function return value is a Java bullet screen library object mDanmukuClient.
S230, the Android client acquires a first initial Java bullet screen listener object based on the C + + listener class.
The first initial Java bullet screen listener object refers to a Java bullet screen listener object after initialization.
Specifically, to implement the monitoring of the bullet screen library object, a bullet screen listener object needs to be constructed. The specific construction mode is that the Android client calls a C + + listener class DanmuListener to define and initialize one listener object, namely the first initial Java bullet screen listener object.
Illustratively, the Android client acquiring the first initial Java bullet screen listener object based on the C + + listener class includes: the Android client defines a second initial Java bullet screen monitor object based on the C + + monitor class; and the Android client initializes the second initial Java bullet screen monitor object to an empty object to obtain the first initial Java bullet screen monitor object.
The second initial Java bullet screen listener object refers to a Java bullet screen listener object which is not initialized and instantiated.
Specifically, the Android client defines a barrage listener object mmondanrurecvlistener, i.e., a second initial Java barrage listener object, by calling the C + + listener class DanmuListener. And then, initializing a defined second initial Java bullet screen listener object mOnDanmum RecvListener, specifically initializing to be an empty object (null), and obtaining a first initial Java bullet screen listener object. The concrete implementation is as follows: private DanmuListener OnDanmuRecvListener null for subsequent suitable instantiation operations.
S240, the Android client assigns a value to the first initial Java bullet screen monitor object based on a C + + bullet screen monitor interface in the bullet screen server to construct a target Java bullet screen monitor object.
The C + + bullet screen listener interface refers to a bullet screen listener interface written based on the C + + language, and includes a predefined message transfer function (predefined message transfer function) that is not implemented with a function. The C + + bullet screen listener interface is stored in the bullet screen server.
Specifically, after the Android client acquires the first initial Java bullet screen listener object, the first initial Java bullet screen listener object needs to be instantiated. Since the bullet screen listener object needs to monitor the C + + bullet screen library object and realize transmission of the bullet screen message, an implementation form of an interface is selected in this embodiment to establish a transmission channel for the bullet screen server and the Android client. In specific implementation, the Android client calls a C + + bullet screen monitor interface in a bullet screen server in a lifecycle function onCreate of an Android system application program to assign a first initial Java bullet screen monitor object. The C + + bullet screen listener interface includes a predefined message transfer function, and the predefined message transfer function needs to be implemented, that is, instantiated, in the process of assigning a value to the first initial Java bullet screen listener object by using the C + + bullet screen listener interface.
Exemplarily, the Android client assigns a value to the first initial Java bullet screen listener object based on a C + + bullet screen listener interface in the bullet screen server to construct the target Java bullet screen listener object includes: the Android client inherits the keywords through the interface, inherits the C + + bullet screen monitor interface, and performs callback on a predefined message transmission function to obtain a Java bullet screen monitor interface; and the Android client assigns a value to the first initial Java bullet screen monitor object based on the Java bullet screen monitor interface so as to construct a target Java bullet screen monitor object.
The interface inheritance keyword is a keyword specified in the C + + language and used for carrying out interface inheritance. The Java barrage monitor interface refers to a barrage monitor interface in Java language.
Specifically, the Android client inherits the keyword instances through the interface to realize inheritance of the C + + bullet screen listener interface jnidanmu. class MyDanmuListener instances JniDanmu. DanmuInfoListener. The Java bullet screen monitor interface MyDanmuListener is a Java interface, and can be directly used when a target Java bullet screen monitor object is subsequently constructed without code conversion between C + + language and Java language. In addition, in the construction process of the Java bullet screen listener interface, a predefined message transfer function public void onMessage (int type, String msg) included in the C + + bullet screen listener interface jnidanmu. In this embodiment, the function of the callback function in the C + + bullet screen listener interface only needs to perform parameter transfer, so that the callback function is not implemented with a specific function body inside, but is implemented with a function by performing callback once. Of course, if the callback function needs operations such as barrage message processing besides parameter transfer, the specific function code needs to be implemented in the callback function implementation process.
After the Java bullet screen listener interface is obtained, the Java bullet screen listener interface is required to perform assignment of the first initial Java bullet screen listener object. Specifically, an instantiation process is performed in the lifecycle function OnCreate of the Android system in a manner of mlondanmumrecvlistener ═ new MyDanmuListener (), and a target Java barrage listener object mlondanmutrecvlistener with a data type of MyDanmuListener is constructed.
And S250, calling a monitor setting function in the Java bullet screen library object by the Android client according to the target Java bullet screen monitor object, and registering the target Java bullet screen monitor object into the Java bullet screen library object.
Specifically, the process of setting the bridging relationship between the Java bullet screen library object and the target Java bullet screen listener object may specifically be: and calling a monitor setting function setListener (MyDanmuListener) through a Java bullet library object mDanmukuClient by taking a target Java bullet screen monitor object mOnDanmuRecvListener with a data type of MyDanmuListener as a function input parameter, and registering the target Java bullet screen monitor object mOnDanmuRecvListener into the Java bullet screen library object mDanmukuClient.
According to the technical scheme, the context environment object of the Android system is obtained through the Android client, the construction function of the C + + bullet screen library class is called according to the context environment object, the Java bullet screen library object is constructed, and a basis for transmitting the monitoring interface in the Android client to the bullet screen server is established. The method comprises the steps that a first initial Java bullet screen monitor object is obtained through an Android client based on a C + + monitor class in a bullet screen server, and is assigned based on a C + + bullet screen monitor interface in the bullet screen server to construct a target Java bullet screen monitor object, and a monitoring interface is provided for establishing a bridging relation between the Android client and the bullet screen server. By registering the target Java bullet screen listener object into the Java bullet screen library object, the C + + bullet screen library object in the bullet screen server has a monitoring interface and a callback function pointer of the bullet screen listener object in the Android client side, so that the bullet screen server can push the obtained target bullet screen message to the Android client side, the Android client side can obtain the bullet screen message more timely, the obtaining efficiency of the Android client side for obtaining the bullet screen message is improved, and the system memory overhead of the Android client side is reduced.
The following is an embodiment of a bullet screen message transmission apparatus provided in an embodiment of the present invention, and the apparatus and the bullet screen message transmission method in the foregoing embodiments belong to the same inventive concept, and details that are not described in detail in the embodiment of the bullet screen message transmission apparatus may refer to the embodiment of the bullet screen message transmission method.
EXAMPLE III
The present embodiment provides a bullet screen message transmission apparatus, referring to fig. 3, the apparatus specifically includes:
a target bullet screen message obtaining module 310, configured to pre-process the bullet screen message to be processed by the bullet screen server, so as to obtain a target bullet screen message;
and the target bullet screen message sending module 320 is configured to call a message transfer function by the bullet screen server according to the target bullet screen message through a C + + bullet screen library object corresponding to a Java bullet screen library object pre-constructed in the Android client, and send the target bullet screen message to the Android client, where the message transfer function is a callback function in a target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is pre-registered in the Java bullet screen library object.
Optionally, the target barrage message obtaining module 310 is specifically configured to:
and the bullet screen server decrypts and analyzes the bullet screen message to be processed to obtain a target bullet screen message containing the bullet screen message identification and the bullet screen message body.
Optionally, on the basis of the foregoing apparatus, the apparatus further includes a listening setting module 330, where the listening setting module 330 includes:
the Java bullet screen library object construction submodule is used for constructing a Java bullet screen library object by the Android client based on a C + + bullet screen library class in the bullet screen server before the bullet screen server calls a message transfer function through the C + + bullet screen library object corresponding to the Java bullet screen library object which is pre-constructed in the Android client;
the target Java bullet screen monitor object construction sub-module is used for constructing a target Java bullet screen monitor object by the Android client based on a C + + monitor class in the bullet screen server, and the target Java bullet screen monitor object comprises a message transmission function;
and the listener registration submodule is used for calling a listener setting function in the Java bullet screen library object by the Android client according to the target Java bullet screen listener object and registering the target Java bullet screen listener object into the Java bullet screen library object.
Correspondingly, the target barrage message sending module is specifically configured to:
and calling a message transfer function based on the C + + bullet screen library object corresponding to the Java bullet screen library object in the bullet screen server.
The Java bullet screen library object construction submodule is specifically used for:
the Android client calls a context environment obtaining function of an application program class to obtain a context environment object of an Android system;
and the Android client calls a construction function of the C + + bullet screen library class according to the context environment object to construct a Java bullet screen library object.
The object building submodule of the target Java bullet screen monitor is specifically used for:
the Android client side obtains a first initial Java bullet screen monitor object based on the C + + monitor class;
the Android client assigns a value to the first initial Java bullet screen monitor object based on a C + + bullet screen monitor interface in the bullet screen server to construct a target Java bullet screen monitor object, wherein the C + + bullet screen monitor interface comprises a predefined message transfer function.
Further, the target Java barrage listener object building submodule is specifically configured to:
the Android client defines a second initial Java bullet screen monitor object based on the C + + monitor class;
and the Android client initializes the second initial Java bullet screen monitor object to an empty object to obtain the first initial Java bullet screen monitor object.
Further, the target Java barrage listener object building submodule is specifically configured to:
the Android client inherits the keywords through the interface, inherits the C + + bullet screen monitor interface, and performs callback on a predefined message transmission function to obtain a Java bullet screen monitor interface;
and the Android client assigns a value to the first initial Java bullet screen monitor object based on the Java bullet screen monitor interface so as to construct a target Java bullet screen monitor object.
Through the bullet screen message transmission device provided by the third embodiment of the invention, the bullet screen server actively pushes the obtained target bullet screen message to the Android client, so that the Android client receives the target bullet screen message more timely in a passive mode, the instantaneity of the Android client for obtaining the bullet screen message is improved, the packet loss rate of the bullet screen message is greatly reduced, and the system resource overhead of the Android client for obtaining the bullet screen message is reduced to a certain extent.
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.
It should be noted that, in the embodiment of the bullet screen message transmission device, each included unit and module are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
Example four
Referring to fig. 4, the present embodiment provides an apparatus 400 comprising: one or more processors 420; the storage device 410 is configured to store one or more programs, and when the one or more programs are executed by the one or more processors 420, the one or more processors 420 implement the bullet screen message transmission method provided in the embodiment of the present invention, including:
the bullet screen server preprocesses bullet screen information to be processed to obtain target bullet screen information;
and the bullet screen server calls a message transfer function through a C + + bullet screen library object corresponding to a Java bullet screen library object which is pre-constructed in the Android client according to the target bullet screen message, and sends the target bullet screen message to the Android client, wherein the message transfer function is a callback function in the target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is pre-registered to the Java bullet screen library object.
Of course, those skilled in the art can understand that the processor 420 may also implement the technical solution of the bullet screen message transmission method provided in any embodiment of the present invention.
The apparatus 400 shown in fig. 4 is only an example and should not bring any limitations to the functionality or scope of use of the embodiments of the present invention.
As shown in fig. 4, the apparatus 400 includes a processor 420, a storage device 410, an input device 430, and an output device 440; the number of the processors 420 in the device may be one or more, and one processor 420 is taken as an example in fig. 4; the processor 420, the storage device 410, the input device 430 and the output device 440 of the apparatus may be connected by a bus or other means, for example, the bus 450 in fig. 4.
The storage device 410 is a computer-readable storage medium, and can be used to store 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 target bullet screen message acquisition module and a target bullet screen message sending module in the bullet screen message transmission device).
The storage device 410 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 410 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, the storage 410 may further include memory located remotely from the processor 420, which may be connected to the device 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 means 430 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 440 may include a display device such as a display screen.
EXAMPLE five
The present embodiments provide a storage medium containing computer-executable instructions that, when executed by a computer processor, are operable to perform a method of bullet screen message transmission, the method comprising:
the bullet screen server preprocesses bullet screen information to be processed to obtain target bullet screen information;
and the bullet screen server calls a message transfer function through a C + + bullet screen library object corresponding to a Java bullet screen library object which is pre-constructed in the Android client according to the target bullet screen message, and sends the target bullet screen message to the Android client, wherein the message transfer function is a callback function in the target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is pre-registered to the Java bullet screen library object.
Of course, the storage medium provided in the embodiments of the present invention includes computer-executable instructions, and the computer-executable instructions are not limited to the above method operations, and may also perform related operations in the bullet screen message transmission method provided in any 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, where the computer software product 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 described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. A bullet screen message transmission method is characterized by comprising the following steps:
the bullet screen server preprocesses bullet screen information to be processed to obtain target bullet screen information;
the Android client constructs a Java bullet screen library object based on the C + + bullet screen library class in the bullet screen server;
the Android client builds a target Java bullet screen monitor object based on the C + + monitor class in the bullet screen server, wherein the target Java bullet screen monitor object comprises a message transmission function;
the Android client calls a listener setting function in the Java bullet screen library object according to the target Java bullet screen listener object, and registers the target Java bullet screen listener object into the Java bullet screen library object;
the bullet screen server calls a message transmission function through a C + + bullet screen library object corresponding to the Java bullet screen library object which is pre-constructed in the Android client according to the target bullet screen message, and sends the target bullet screen message to the Android client;
the message transmission function is a callback function in the target Java bullet screen monitor object in the Android client, and the target Java bullet screen monitor object is registered to the Java bullet screen library object in advance.
2. The method of claim 1, wherein the bullet screen server preprocesses the bullet screen message to be processed, and obtaining the target bullet screen message comprises:
and the bullet screen server decrypts and analyzes the bullet screen message to be processed to obtain the target bullet screen message containing the bullet screen message identification and the bullet screen message body.
3. The method of claim 1, wherein the Android client constructs the Java bullet screen library object based on a C + + bullet screen library class in the bullet screen server, and comprises:
the Android client calls a context environment obtaining function of an application program class to obtain a context environment object of an Android system;
and the Android client calls a construction function of the C + + bullet screen library class according to the context environment object to construct the Java bullet screen library object.
4. The method according to claim 1, wherein the Android client constructs the target Java bullet screen listener object based on a C + + listener class in the bullet screen server, including:
the Android client side obtains a first initial Java bullet screen listener object based on the C + + listener class;
and the Android client assigns a value to the first initial Java bullet screen listener object based on a C + + bullet screen listener interface in the bullet screen server to construct the target Java bullet screen listener object, wherein the C + + bullet screen listener interface contains a predefined message transfer function.
5. The method according to claim 4, wherein the Android client obtaining a first initial Java bullet screen listener object based on the C + + listener class comprises:
the Android client defines a second initial Java bullet screen listener object based on the C + + listener class;
and the Android client initializes the second initial Java bullet screen monitor object to an empty object to obtain the first initial Java bullet screen monitor object.
6. The method of claim 4, wherein the Android client assigns a value to the first initial Java bullet screen listener object to construct the target Java bullet screen listener object based on a C + + bullet screen listener interface in the bullet screen server comprises:
the Android client inherits the C + + bullet screen monitor interface through an interface inheritance keyword, and performs callback on the predefined message transmission function to obtain a Java bullet screen monitor interface;
and the Android client assigns a value to the first initial Java bullet screen monitor object based on the Java bullet screen monitor interface so as to construct the target Java bullet screen monitor object.
7. A bullet screen message transmission device configured in a bullet screen server, comprising:
the target bullet screen message acquisition module is used for preprocessing the bullet screen message to be processed to obtain a target bullet screen message;
the monitoring setting module comprises:
the Java bullet screen library object construction submodule is used for constructing a Java bullet screen library object by the Android client based on the C + + bullet screen library class in the bullet screen server;
the target Java bullet screen monitor object construction sub-module is used for constructing a target Java bullet screen monitor object by the Android client based on the C + + monitor class in the bullet screen server, wherein the target Java bullet screen monitor object comprises a message transmission function;
the monitor registration submodule is used for calling a monitor setting function in a Java bullet screen library object by the Android client according to the target Java bullet screen monitor object and registering the target Java bullet screen monitor object into the Java bullet screen library object;
and the target bullet screen message sending module is used for calling a message transfer function through a C + + bullet screen library object corresponding to the Java bullet screen library object which is pre-constructed in the Android client according to the target bullet screen message, and sending the target bullet screen message to the Android client, wherein the message transfer function is a callback function in the target Java bullet screen listener object in the Android client, and the target Java bullet screen listener object is pre-registered to the Java bullet screen library object.
8. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the bullet screen message transmission method of any one of claims 1-6.
9. 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 6.
CN201810691133.6A 2018-06-28 2018-06-28 Barrage message transmission method, device, equipment and storage medium Active CN108810633B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810691133.6A CN108810633B (en) 2018-06-28 2018-06-28 Barrage message transmission method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810691133.6A CN108810633B (en) 2018-06-28 2018-06-28 Barrage message transmission method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108810633A CN108810633A (en) 2018-11-13
CN108810633B true CN108810633B (en) 2020-10-16

Family

ID=64072390

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810691133.6A Active CN108810633B (en) 2018-06-28 2018-06-28 Barrage message transmission method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108810633B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112565824B (en) * 2020-12-03 2021-09-14 腾讯科技(深圳)有限公司 Method, device, terminal and storage medium for generating bullet screen
CN113115059B (en) * 2021-03-29 2022-07-05 武汉斗鱼鱼乐网络科技有限公司 Bullet screen connection monitoring method, device, equipment and storage medium
CN115442635A (en) * 2021-06-04 2022-12-06 武汉斗鱼鱼乐网络科技有限公司 Method, device, equipment and storage medium for cross-platform security filtration of bullet screen

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102215243A (en) * 2010-04-12 2011-10-12 华为技术有限公司 Event synchronization method, system, client and server
CN106303730A (en) * 2016-07-28 2017-01-04 百度在线网络技术(北京)有限公司 A kind of for providing the method and apparatus of combination barrage information
WO2018002420A1 (en) * 2016-06-29 2018-01-04 Nokia Technologies Oy Rendering of user-defined messages having 3d motion information
CN107770563A (en) * 2017-10-10 2018-03-06 武汉斗鱼网络科技有限公司 A kind of barrage message treatment method and device
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102215243A (en) * 2010-04-12 2011-10-12 华为技术有限公司 Event synchronization method, system, client and server
WO2018002420A1 (en) * 2016-06-29 2018-01-04 Nokia Technologies Oy Rendering of user-defined messages having 3d motion information
CN106303730A (en) * 2016-07-28 2017-01-04 百度在线网络技术(北京)有限公司 A kind of for providing the method and apparatus of combination barrage information
CN107770563A (en) * 2017-10-10 2018-03-06 武汉斗鱼网络科技有限公司 A kind of barrage message treatment method and device
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
实时弹幕系统的设计与实现;huang100qi;《https://blog.csdn.net/huang100qi/article/details/52460175》;20160907;第1-3页 *

Also Published As

Publication number Publication date
CN108810633A (en) 2018-11-13

Similar Documents

Publication Publication Date Title
CN108023808B (en) Message distribution method and device in application program
CN108810633B (en) Barrage message transmission method, device, equipment and storage medium
CN106293972B (en) single-page application page communication method and device
CN115516840A (en) Information processing method, device, system, medium, chip and program
CN110795741B (en) Method and device for carrying out security processing on data
CN108882053B (en) Bullet screen message distribution method, device, equipment and storage medium
CN108347472B (en) Configuration method of IP address, cloud server, cloud platform and readable storage medium
CN111008254B (en) Object creation method, device, computer equipment and storage medium
US10313230B1 (en) System and method for unmarshalled routing
CN109388388B (en) Information interaction method, device, equipment and storage medium between function modules
CN114327710B (en) Function management method, management device, terminal equipment and readable storage medium
CN111865978A (en) Method, device, equipment and medium for updating request identifier of micro-service
CN108052401B (en) System attribute monitoring method, terminal device and computer readable storage medium
CN109144520B (en) Information interaction method, device, equipment and storage medium among different objects in Android
CN108924653B (en) Bullet screen message distribution method, device, equipment and storage medium
CN111381868B (en) Method and device for implementing embedded system driving layer
CN109005468B (en) Bullet screen message distribution method, device, equipment and storage medium
CN108810645B (en) Bullet screen message distribution method, device, equipment and storage medium
CN112073488A (en) Method and device for processing request
US9537931B2 (en) Dynamic object oriented remote instantiation
CN112131263B (en) Software package acquisition method, system, device, electronic equipment and storage medium
CN109005448B (en) Bullet screen message distribution method, device, equipment and storage medium
CN108810644B (en) Bullet screen message distribution method, device, equipment and storage medium
CN109246484B (en) Barrage message transmission method, device, equipment and storage medium
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