CN110881145B - Bullet screen display method and device and electronic equipment - Google Patents

Bullet screen display method and device and electronic equipment Download PDF

Info

Publication number
CN110881145B
CN110881145B CN201811029877.8A CN201811029877A CN110881145B CN 110881145 B CN110881145 B CN 110881145B CN 201811029877 A CN201811029877 A CN 201811029877A CN 110881145 B CN110881145 B CN 110881145B
Authority
CN
China
Prior art keywords
bullet screen
textview
screen
unique identifier
target
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
CN201811029877.8A
Other languages
Chinese (zh)
Other versions
CN110881145A (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 CN201811029877.8A priority Critical patent/CN110881145B/en
Publication of CN110881145A publication Critical patent/CN110881145A/en
Application granted granted Critical
Publication of CN110881145B publication Critical patent/CN110881145B/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/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/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
    • H04N21/4438Window management, e.g. event handling following interaction with the user interface

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention discloses a bullet screen display method and device and electronic equipment. The method provided by the embodiment of the invention comprises the following steps: defining a List set; constructing a Map variable, and constructing a mapping relation between a barrage TextView control and a unique identifier of the barrage in a codeToTextView set of the Map variable; acquiring a bullet screen display setting instruction of a user; taking out target unique identifiers corresponding to all currently displayed bullet screen textView controls from the List set according to the instruction, and finding out the corresponding target textView controls according to the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object; adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the current height position information of the target textView control in the bullet screen container object; and displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object. The embodiment of the invention effectively ensures the accuracy of the bullet screen data.

Description

Bullet screen display method and device and electronic equipment
Technical Field
The invention relates to the technical field of video playing, in particular to a bullet screen display method and device and electronic equipment.
Background
At any time, the network video application is more and more widely developed in various industries due to the progress of network communication technology and the acceleration of broadband networks. The intuitive and vivid high-definition video application can greatly shorten the distance between users, achieve the best communication effect and has relatively lowest cost, thereby being popular among users in various industries.
The barrage is a great characteristic of internet videos. The bullet screen refers to a comment directly appearing on a video, can appear on the video in a special-effect mode of scrolling, staying or even more actions, and is a short comment sent by a person watching the video. "barrage video" as the name implies has a "barrage" of video. Many websites provide the functionality of video delivery barrage.
In the prior art, the bullet screen display mode is generally: each bullet screen information occupies one row, and then after the bullet screen information appears from the left side of the corresponding row, the bullet screen information is displayed in a rolling mode until the bullet screen information disappears from the right side; alternatively, the bullet screen information appears from the right side of the row and disappears by scrolling to the left side.
However, when the bullet screen content is too much, the normal viewing of the video by the user is easily affected. The prior art does not support personalized customization of bullet screen display, and when bullet screen content influences watching, a user can only select to close all bullet screens.
Disclosure of Invention
The embodiment of the invention provides a bullet screen display method, a bullet screen display device and electronic equipment, which effectively ensure the accuracy of bullet screen data, and the speed of bullet screen does not have any influence on the accuracy of data in a set.
In a first aspect, the present application provides a bullet screen display method, including:
defining a List set, wherein the List set is used for storing the currently running bullet screen information;
constructing a Map variable, and constructing a mapping relation between a bullet screen TextView control and a unique identifier of a bullet screen in a codeToTextView set of the Map variable, wherein the unique identifier of the bullet screen is String type data;
when the bullet screen is ready to enter a screen to execute the mobile animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen, and adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set;
storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set;
when the textView control displayed on the current screen moves out of the screen, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set;
acquiring a bullet screen display setting instruction of a user, wherein the instruction comprises bullet screen display area height setting information;
taking out target unique identifiers corresponding to all currently displayed barrage textView controls from the List set according to the instruction, and finding corresponding target textView controls according to the target unique identifiers;
acquiring the current height position information of the target textView control in the bullet screen container object;
adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the height position information of the target textView control in the bullet screen container object;
and displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
In a second aspect, the present application provides a bullet screen display device, comprising:
the definition unit is used for defining a List set, and the List set is used for storing the currently running bullet screen information;
the constructing unit is used for constructing a Map variable and constructing a mapping relation between a barrage TextView control and a unique identifier of a barrage in a codeToTextView set of the Map variable, wherein the unique identifier of the barrage is String type data;
the adding unit is used for acquiring the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen and adding the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen into the List set when the bullet screen is ready to enter the screen to execute the mobile animation;
the storage unit is used for storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set;
the removing unit is used for acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set when the textView control displayed on the current screen moves out of the screen, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set;
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a bullet screen display setting instruction of a user, and the instruction comprises bullet screen display area height setting information; taking out target unique identifiers corresponding to all currently displayed barrage textView controls from the List set according to the instruction, and finding corresponding target textView controls according to the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object;
the adjusting unit is used for adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the height position information of the target textView control in the bullet screen container object;
and the display unit is used for displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
In a third aspect, the present invention also provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program may implement the method of any of the first aspects.
The embodiment of the invention defines a List set; constructing a Map variable, and constructing a mapping relation between a bullet screen TextView control and a unique identifier of a bullet screen in a codeToTextView set of the Map variable; when the bullet screen is ready to enter a screen to execute the mobile animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen, and adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set; storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set; when the textView control displayed on the current screen moves out of the screen, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set; acquiring a bullet screen display setting instruction of a user; taking out target unique identifiers corresponding to all currently displayed bullet screen textView controls from the List set according to the instruction, and finding out the corresponding target textView controls according to the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object; adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the height position information of the target textView control in the bullet screen container object; and displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object. The embodiment of the invention adopts the set List to store the currently running bullet screen information, thereby effectively ensuring the accuracy of the data in the listDanmu set and having no influence on the accuracy of the data in the set by the speed of the bullet screen.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a bullet screen display method in an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 3 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 4 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 5 is a schematic diagram of another embodiment of the bullet screen display method in the embodiment of the present invention;
fig. 6 is a schematic diagram of an embodiment of a bullet screen display device in an embodiment of the present invention;
fig. 7 is a schematic view of another embodiment of the bullet screen display device in the embodiment of the invention;
fig. 8 is a schematic view of another embodiment of the bullet screen display device in the embodiment of the invention;
fig. 9 is a schematic diagram of an embodiment of an electronic device in an embodiment of the present invention.
Detailed Description
The bullet screen display method in the embodiment of the invention is applied to the bullet screen display device, the bullet screen display device is positioned in electronic equipment, and the electronic equipment can be electronic equipment such as a mobile phone, a tablet personal computer or a personal computer, and can also be electronic equipment of a display screen in the future.
Referring to fig. 1, an embodiment of a bullet screen display method according to an embodiment of the present invention includes:
s101, constructing a view control;
when the screen bullet screen is realized, firstly, a view control needs to be dynamically constructed, and the bullet screen is usually text information, so that the screen bullet screen text information can be dynamically constructed through a TextView control in an Android system, namely, the TextView is called to construct an empty textView control, and specifically, the TextView is called to construct an empty textView control, namely, new textView ().
And S102, filling style information related to the bullet screen in the view control.
After the view control is constructed, the newly constructed view control needs to be filled with style information related to a bullet screen next, and further, filling the style information related to the bullet screen in the view control includes: setting text information of the bullet screen information to white by calling textView. Setsize (15sp) sets the font to 15sp size by calling textview; settext sets specific bullet screen content information by calling textview. And filling the style information of the dynamically constructed barrage information textView control. After the textView control is built, the control needs to be added into the bullet screen area, and for convenience of description, a container of bullet screen content is marked as danmuContainer, and specific bullet screen information content is contained in the danmuContainer.
And S103, initializing the position information of the view control.
Before adding the textView control in the danmuContainer container, the position information of the textView control needs to be initialized correspondingly.
And S104, acquiring a layout parameter object.
The obtaining of the layout parameter object includes: a layout parameter object params of the ViewGroup is obtained by calling the view group.
And S105, setting bullet screen layout position information according to the layout parameter object.
Specifically, the setting of the bullet screen layout position information according to the layout parameter object includes: calling a params.width in the params object to view group.layout params.wrap _ content T to set the width information to the size of the package content, namely the width can be dynamically changed along with the length of the font; similarly, the height information is set as the package CONTENT through the parameter of the parameter object, and the height information of the text is dynamically adapted.
And S106, adding the bullet screen layout position information into the view control.
After setting the bullet screen layout position information, applying the set bullet screen layout position information to a dynamically constructed textView control by calling a textView.
And S107, adding the view control into a preset bullet screen container object.
Specifically, the dynamically built textView control is added to the bullet screen container object danmuContainer by calling danmuContainer.
And S108, acquiring a bullet screen display setting instruction of the user.
Specifically, the setting information of the height of the bullet screen display area is included in the instruction, the setting information of the height of the bullet screen display area includes the setting information of the height of the bullet screen display area, for example, the bullet screen display is switched from a full screen to a half screen, the full screen height of the bullet screen is danmuHeight, and then the height information of the bullet screen display area in the setting information of the height of the bullet screen display area is danmuHeight/2.
In the embodiment of the present invention, the entire height information of the bullet screen container is obtained by calling danmuContainer. getheight () in the danmuContainer, and in general, the height information of the danmuContainer and the height information of the video window are completely the same, and the value of the danmuContainer. getheight () is marked as danmuHeight in the embodiment of the present invention; next, a Random number generator Random is constructed by calling a Random function, specifically, a Random number generator Random is constructed by calling Random new (), a height information between 0 and danmu height is obtained by calling Random. Next, the height position information of the generated textView control in the parent layout danmuContainer needs to be dynamically changed, specifically, the position information of the textView control from the top in the parent layout is set by calling params. The following is a general animation effect, and the control is moved from one side of the screen to the other side.
And S109, adjusting the height position information of the view control in the bullet screen container object according to the instruction, and displaying the bullet screen in the video according to the height position information.
Also taking switching of the full screen and the half screen as an example, the button for switching the full screen and the half screen is assumed to be defined as a button, and one piece of listener information is set for the button by setting a clicked listener for the button, specifically by calling a button. The callback function of the listener is triggered back when the user clicks the button. The invention dynamically modifies the value information of danmuHeight in the callback function, specifically by calling danmuHeight to danmuHeight/2, so that the value information of danmuHeight is half of the original value. When the logic is executed again, the position information of the barrage can only occupy a random value within half of the original screen, so that the switching work of the half-screen barrage is completed. If the user clicks the button again while the half screen pops, it is only necessary to restore it to the full screen state by calling the method of danmuHeight 2. Therefore, the switching method from the full screen to the half screen bullet screen and from the half screen bullet screen to the full screen bullet screen is completed, and the bullet screen in the video is displayed according to the height position information.
The embodiment of the invention can effectively and freely switch the display height of the bullet screen content, supports the personalized setting of bullet screen display, and can normally display the video information on the screen through the switching, so that the bullet screen display is more reasonable.
The problem of the intermediate state in the bullet screen switching process is that if a bullet screen executes animation on the lower setting part of the screen, the user feels that the bullet screen cannot be effective immediately after clicking the half screen, but the bullet screen can be effective after a period of time.
The embodiment of the invention provides a set of solutions for solving the problems, the problem of low switching speed can be effectively solved through the method, and the currently displayed content can be automatically switched to be within the set display range when a user clicks a half-screen bullet screen. Referring to fig. 2, another embodiment of the bullet screen display method in the embodiment of the present invention includes:
s201, a management queue for displaying the bullet screen is constructed.
Specifically, a management Queue for displaying the bullet screen is constructed, the management Queue is used for maintaining the bullet screen information currently displayed in the middle of the screen, the constructed management Queue information is Queue < String > danmu showqueue, and then the initialization operation needs to be performed on the bullet screen Queue danmu showqueue currently displayed, and a specific initialization method is danmu showqueue ═ new Queue < String >.
S202, establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen.
The management queue danmu showqueue constructed in the above manner stores String-type data, the bullet screen information in the conventional scheme is a textView control, if real bullet screen textView control information is cached in the management queue, the memory overhead of the textView control is large, so that the memory overhead of the danmu showqueue queue is very large, but in order to ensure maintenance of the bullet screen information, the unique identifier hashCode of the bullet screen is stored in the embodiment of the present invention, and the unique identifier hashCode is String-type data. The memory overhead of the unique identifier hashCode of the bullet screen is very small, so that the corresponding relation between the textView control of the bullet screen and the unique identifier hashCode can be effectively established.
S203, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring a unique identifier of the bullet screen corresponding to the textView control displayed by the current screen;
specifically, when the bullet screen is ready to enter the screen to execute the moving animation, the hashCode in the textView object is obtained, and specifically, the unique bullet screen identifier tvHashCode corresponding to the textView control displayed on the current screen is obtained by calling a textView.
S204, storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue.
Add (tvHashCode) in the danmuShowQueue queue is called to store the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the danmuShowQueue queue.
S205, when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
Specifically, when the textView control displayed on the current screen moves out of the screen, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen is removed from the danmuShowQueue queue by calling danmuShowQueue.
In the embodiment of the invention, when a plurality of barrages are displayed on the screen, data are added and removed from the danmu ShowQueue queue according to the sequence, and the data which come first can be lost from the screen first because the basic barrage information runs at a constant speed. Through dynamic addition and deletion, the data in the final danmu ShowQueue is always the bullet screen content being displayed in the current screen.
S206, acquiring a bullet screen display setting instruction of the user, wherein the instruction comprises bullet screen display area height setting information.
The implementation process of this step may specifically refer to the content described in step S108.
S207, taking out the target unique identifiers corresponding to all currently displayed barrage textView controls from the management queue according to the instruction, and finding the corresponding target textView controls according to the target unique identifiers.
Specifically, the target unique identifier information corresponding to all the currently displayed textView controls is taken out from the danmu ShowQueue queue, and the corresponding target textView controls are found through the unique identifier information of the bullet screen.
S208, acquiring the current height position information of the target textView control in the bullet screen container object.
Specifically, the obtaining of the current height position information of the target textView control in the bullet screen container object includes: calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control; get the height position information of the target textView control in the bullet screen container object by calling params.
S209, adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the current height position information of the target textView control in the bullet screen container object;
s210, displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
Taking the example that the popup display is switched from the full screen to the half screen, when detecting that the user clicks the state of switching the half screen, that is, receiving a popup display setting instruction of the user, all hash code information of currently displayed popup view needs to be taken out from a danmu ShowQueue pair, finding a corresponding textView control through the hash code, then calling textView.getLayoutParams () in the textView control to obtain layout parameter information params of the textView control, then calling a params.getHeight () method in the params to obtain height information of the textView, and marking the height information as tvHeight.
Then, the value information of tvHeight is changed to half of the original value by tvHeight ═ tvHeight/2. And (3) storing new tvHeight value information into the params by calling a params.height ═ tvHeight method in the obtained params object, and setting new layout information into a textView control by calling textView.setLayoutParams (params) in the textView object, so that the height information of the textView control becomes half of the original height information, and the whole bullet screen becomes the target of the half-screen bullet screen.
According to the embodiment of the invention, the corresponding textView control is found through the unique identifier, so that the bullet screen is rapidly switched to take effect, the problem of low switching speed can be effectively solved, after a user clicks and sets the height of the bullet screen, the currently displayed content is automatically switched to the set height range to be displayed, and the bullet screen display switching efficiency is high.
The default condition for implementation in the embodiment shown in fig. 2 is that the bullet screen runs at a constant speed, so that the accuracy of the data in the danmu showqueue can be guaranteed. However, the requirement is always changed, and the scheme cannot be normally executed when the moving speed of the bullet screen is not constant. Therefore, the embodiment of the invention also provides a bullet screen display method, which solves the problem of how to maintain bullet screen data under the condition of non-uniform speed in the scheme.
Please refer to fig. 3, which is a schematic diagram of another embodiment of a bullet screen display method according to an embodiment of the present invention, the method includes:
s301, defining a List set.
Since the danmuShowQueue in the above scheme is a queue, and the data structure of the queue has a sequence, which is not very suitable for implementation and development of the scheme algorithm in this embodiment, the data set is designed without using the danmuShowQueue, but instead, a set List is used to store currently running bullet screen information, that is, the List set is used to store currently running bullet screen information.
Defining a List set, wherein the specific defining method is List < String > listDanmu, and the listDanmu is the List set, and then initializing the listDanmu set, wherein the specific initializing method is to initialize the listDanmu set by calling the listDanmu ═ new List < String > () method.
S302, constructing a Map variable, and constructing a mapping relation between a barrage TextView control and a unique identifier of the barrage in a codeToTextView set of the Map variable.
Wherein the unique identifier of the bullet screen is a String type of data.
Constructing a Map variable: private Map < TextView, String > codeToTextView;
and constructing a mapping relation between the TextView control and the unique identifier hashCode of the bullet screen inside the Map variable codeToTextView set.
In addition, before the codeToTextView set is used, an initialization operation needs to be performed on the codeToTextView set first, and specifically, a method for initializing the codeToTextView set is realized by calling new HashMap < TextView, String > ().
S303, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen, and adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set.
When a bullet screen is ready to enter a screen to execute moving animation, namely when a textView control needs to be displayed on the screen, firstly, a textView.
Adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set, wherein the adding comprises the following steps: add the unique identifier of the bullet screen corresponding to the textView control of the current screen display to the List set by calling listdanmu.
S304, storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set.
Specifically, the storing the mapping relationship between the textView control displayed on the current screen and the unique identifier of the bullet screen into the codeToTextView set includes: put (textView, tvHashCode) method is called to store the mapping relation between the textView control of the current screen display and the unique identifier of the bullet screen into the codeToTextView set.
S305, when the textView control displayed on the current screen moves out of the screen, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set.
Specifically, when the textView control displayed on the current screen moves out of the screen, obtaining the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relationship in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set, including: when the textView control displayed on the current screen moves out of the screen, acquiring a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen by calling codeToTextView.
Remove the unique identifier of the bullet screen corresponding to the textView control of the current screen display from the list set by calling listDanmu.
It can be seen from the implementation manner that whichever textView control is moved out, the hashCode corresponding to the textView control is moved out from the listDanmu set, so that the problem of sequentiality in the management team in the scheme is avoided, the accuracy of the data in the listDanmu set is effectively ensured, and the speed of the bullet screen does not have any influence on the accuracy of the data in the listDanmu set.
S306, acquiring a bullet screen display setting instruction of the user, wherein the instruction comprises bullet screen display area height setting information.
Reference may be made in particular to what is described in the above embodiments.
S307, taking out all target unique identifiers corresponding to currently displayed bullet screen textView controls from the List set according to the instruction, and finding out the corresponding target textView controls according to the target unique identifiers;
specifically, the extracting, according to the instruction, the target unique identifier corresponding to all currently displayed barrage textView controls from the List set, and finding the corresponding target textView control by using the target unique identifier includes: and taking out target unique identifier information corresponding to all textView controls currently displayed from the list set, and finding the corresponding target textView controls through the unique identifier information of the bullet screen.
S308, acquiring the current height position information of the target textView control in the bullet screen container object.
Specifically, the obtaining of the current height position information of the target textView control in the bullet screen container object includes: calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control; get the height position information of the target textView control in the bullet screen container object by calling params.
S309, adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the current height position information of the target textView control in the bullet screen container object.
S310, displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
The steps S309 and S310 may specifically refer to the contents described in the above embodiments, and are not described herein again.
The embodiment of the invention adopts the set List to store the currently running bullet screen information, thereby effectively ensuring the accuracy of the data in the listDanmu set and having no influence on the accuracy of the data in the set by the speed of the bullet screen.
The foregoing embodiment shown in fig. 2 and the embodiment shown in fig. 3 have an obvious improvement in bullet screen switching speed, but there are some problems that the switching is too abrupt, and suddenly a full screen bullet screen directly flickers into a half screen bullet screen effect, so that a person feels that the display screen flickers, which is very unfriendly to the user experience of the user, and a more friendly switching transition mode is further provided in the embodiment of the present invention, and a more natural transition switching method is provided under the condition of ensuring the switching speed, specifically referring to fig. 4, which is another embodiment of the bullet screen display method in the embodiment of the present invention, and the method includes:
s401, a management queue for displaying the bullet screen is constructed.
The management queue is used for maintaining bullet screen information displayed in the middle of a current screen; the constructed management Queue information is Queue < String > danmu showqueue, and then the currently displayed barrage Queue danmu showqueue needs to be initialized, wherein the specific initialization method is danmu showqueue < String >.
S402, establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen.
The management queue danmu showqueue constructed in the above manner stores String-type data, the bullet screen information in the conventional scheme is a textView control, if real bullet screen textView control information is cached in the management queue, the memory overhead of the textView control is large, so that the memory overhead of the danmu showqueue queue is very large, but in order to ensure maintenance of the bullet screen information, the unique identifier hashCode of the bullet screen is stored in the embodiment of the present invention, and the unique identifier hashCode is String-type data.
The memory overhead of the unique identifier hashCode of the bullet screen is very small, so that the corresponding relation between the textView control of the bullet screen and the unique identifier hashCode can be effectively established.
S403, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen.
Specifically, when the bullet screen is ready to enter the screen to execute the moving animation, the hashCode in the textView object is obtained, and specifically, the unique bullet screen identifier tvHashCode corresponding to the textView control displayed on the current screen is obtained by calling a textView.
S404, storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue.
Specifically, when the bullet screen is ready to enter the screen to execute the moving animation, the hashCode in the textView object is obtained, and specifically, the unique bullet screen identifier tvHashCode corresponding to the textView control displayed on the current screen is obtained by calling a textView.
S405, when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
Specifically, when the textView control displayed on the current screen moves out of the screen, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen is removed from the danmuShowQueue queue by calling danmuShowQueue.
In the embodiment of the invention, when a plurality of barrages are displayed on the screen, data are added and removed from the danmu ShowQueue queue according to the sequence, and the data which come first can be lost from the screen first because the basic barrage information runs at a constant speed. Through dynamic addition and deletion, the data in the final danmu ShowQueue is always the bullet screen content being displayed in the current screen.
S406, acquiring a bullet screen display setting instruction of a user; taking out all target unique identifiers corresponding to currently displayed barrage textView controls from the management queue according to the instruction, and finding out the corresponding target textView controls according to the target unique identifiers;
specifically, the description in steps S206 and S207 may be referred to, and will not be described herein.
S407, setting the horizontal movement distance Sx of the target textView control on the screen.
In order to realize smooth switching to the half-screen bullet screen, it is expected that the entire switching process is completed while horizontally moving by a distance of Sx at the time of design. Wherein Sx is a threshold value which must be smaller than the width of the screen, and the excessive smoothness can be indirectly adjusted by adjusting the distance of Sx.
And S408, marking the horizontal moving speed of the bullet screen as Vx, and calculating the time dT of the smooth change of the bullet screen through Sx/Vx.
Specifically, the moving speed of the bullet screen is usually determined, and the horizontal moving speed of the bullet screen is marked as Vx, so that the smoothly varying time dT can be calculated by Sx/Vx.
And S409, calculating the vertical distance and the vertical speed Vy of movement in the dT time according to the bullet screen display area height setting information.
Taking the example of switching the bullet screen from full screen to half screen, the distance to be converted for the vertical direction is tvHeight-tvHeight/2, that is, the vertical distance to be completed in the time of dT is tvHeight/2, so the vertical movement speed can be calculated to be tvHeight/2dT, and we mark the speed as Vy.
According to the relation of physical speed, the speed is decomposed into 2 directions of Vx and Vy, and then the real direction of the movement of the whole textView control is the oblique line direction. That is, the motion trajectory of the final textView control will be a uniform oblique line motion, so that the problem of directly switching to 1/2-high flashing does not occur.
S410, acquiring a horizontal animation preset by a target textView control, and constructing a vertical animation for the target textView control according to the dT and the Vy; defining a combined animation, and adding the horizontal animation and the vertical animation to an object of the combined animation.
In this embodiment, a preset horizontal animation of the target textView control is obtained, and a specific obtaining manner is that the current horizontal animation animX can be obtained by calling textView.
As Vy and dT are obtained, a longitudinally moving animation can be added to the textView control, and the specific animation construction process is to define an objectAnamator type mAnimatranslateY object. Specifically, constructing a vertical animation for the target textView control according to dT and Vy comprises the following steps:
defining a m animatatortranslatiey object of the object identifier type;
calling object identifier of (orthogonal view, "translation y", tvHeight ') to construct a vertical animation with a motion speed Vy, wherein the object identifier of (orthogonal view) function is to execute a vertical animation on a target textView control, the starting point of the vertical animation is tvHeight, the target end point is tvHeight', and the return value is the information of the matimatorrranslatiney object;
set the execution period of the vertical animation dT into the object, animatatortranslatiey (dT), by calling animatatortranslatiey in the animatatortlatiey object.
In the embodiment of the present invention, a combined animation animoset needs to be defined, and the animoset is initialized by calling a constructor in the animoset, specifically, by calling animoset ═ new animoset (). And then call animset.add (animX) and animset.add (manimatatortranslatiey), thus adding both horizontal and vertical animations to the animSet object.
S411, starting execution of the horizontal animation and the vertical animation by calling the combined animation, and realizing bullet screen display based on the target textView control in the video.
And finally, starting the execution of the horizontal animation and the vertical animation by calling an aniset.
The embodiment of the invention adjusts the smoothness degree of the whole switching by adjusting the size of Sx, thereby realizing the aim of smooth switching, and the switching of the bullet screen can be smoother and the bullet screen display is more reasonable.
The above-defined Sx is a fixed value information, when the bullet screen information moves to the end of the approach of the screen, a problem occurs at this time that the remaining distance is smaller than Sx, and at this time, if the bullet screen information is executed according to the above-mentioned implementation manner, the bullet screen cannot move to the set range and is already moved out of the screen, so that the effect that a control logic is abnormal is brought to a human. Specifically, please refer to fig. 5, which is a schematic diagram of another embodiment of a bullet screen display method according to an embodiment of the present invention, the method includes:
s501, a management queue for displaying the bullet screen is constructed.
S502, establishing a corresponding relation between the bullet screen textView control and the unique identifier of the bullet screen.
Wherein the unique identifier of the bullet screen is a String type of data.
S503, when the bullet screen is ready to enter the screen to execute the moving animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen.
S504, storing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into a management queue.
And S505, when the textView control displayed on the current screen moves out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue.
S506, acquiring a bullet screen display setting instruction of a user, taking out all target unique identifiers corresponding to currently displayed bullet screen textView controls from the management queue according to the instruction, and finding out the corresponding target textView controls according to the target unique identifiers.
S507, setting the horizontal movement distance Sx of the target textView control on the screen.
In this embodiment, steps S501 to S507 may refer to specific implementation processes in steps S401 to S407 in the embodiment shown in fig. 4, and details are not described here.
S508, calculating the realtyDistance of the distance which the target textView control needs to move out of the screen completely.
When a user clicks a bullet screen switching button, firstly acquiring the current position information of a textView control, specifically acquiring layout parameter information layout parameters of the current textView control by calling textView.
The textView control has width information of itself, the obtained position information is usually the position information of the upper left corner of the textView control, so the example of completely removing the view is to add the length information of the textView control, and the length information of the textView control is obtained by calling textView. getWidth () in the textView control, where the length information is marked as textViewWidth.
The distance that the current textView control needs to move completely out of the screen is textViewX + textViewWidth, which is specifically labeled reallDistance here.
S509, comparing the size between Sx and reallDistance, if the value of Sx is larger than the value of reallDistance, marking the horizontal moving speed of the bullet screen as Vx, and calculating the time dT of smooth change of the bullet screen through reallDistance/Vx.
Specifically, the size information of realtydistance and Sx needs to be compared, and if the value of Sx is greater than the value of realtydistance, we shall take the value of Sx as the standard at this time, and the specific implementation manner is as shown in the embodiment of fig. 4. If the value of Sx is smaller than the value of realyDistance, calculating the time dT' of the smooth change of the bullet screen through Sx/Vx; calculating the vertical distance and the vertical speed Vy 'of movement within the time dT' according to the setting information of the height of the bullet screen display area; acquiring a horizontal animation preset by the target textView control; constructing a second vertical animation for the target textView control according to the dT 'and the Vy'; defining a combined animation, and adding the horizontal animation and the second vertical animation to an object of the combined animation; and starting execution of the horizontal animation and the second vertical animation by calling the combined animation, and realizing bullet screen display based on the target textView control in the video. The specific implementation process can refer to the embodiment shown in fig. 4.
If the value of Sx is larger than the value of reallDistance, the fact that the remaining distance is not enough to move the view into the screen is indicated at this time, therefore, special processing needs to be carried out on the situation, namely, the horizontal moving speed of the bullet screen is marked as Vx, and the time dT of smooth change of the bullet screen is calculated through reallDistance/Vx.
And S510, calculating the vertical distance and the vertical speed Vy moving in the dT' time according to the setting information of the bullet screen display area height.
In this embodiment, also taking a half-screen as an example, obtaining the vertical movement distance tvHeight/2 (the specific obtaining method is the same as that described in the above fig. 4 embodiment), if the vertical speed is tvHeight/2dT, marking the speed as Vy will occur to be just removed to reach within the half-screen, and in this case, the meaning of entering the half-screen is lost already at first, in order to ensure that the view textView control reaches within the half-screen before being removed, therefore, a special process needs to be performed on Vy, and the speed of Vy needs to be increased to 1.5 times of the original speed, that is, 1.5Vy, so that the faster movement of the longitudinal speed can be ensured, and thus, the view can reach inside the half-screen without being moved out.
Besides the increase of the y-axis speed by one bit, the effect can be achieved by reducing the speed of Vx, for example, the speed of Vx can be reduced to half of the original speed, namely 1/2Vx, and the effect is consistent, and even the two effects can be superposed to achieve a more friendly transition experience.
S511, acquiring a horizontal animation preset by the target textView control; constructing a first vertical animation for the target textView control according to the dT and the 1.5 Vy; a combined animation is defined, and a horizontal animation and a first vertical animation are added to an object of the combined animation.
In this embodiment, a preset horizontal animation of the target textView control is obtained, and a specific obtaining manner is that the current horizontal animation animX can be obtained by calling textView.
Constructing a first vertical animation for the target textView control according to dT and 1.5Vy, wherein the first vertical animation comprises the following steps:
defining a m animatatortranslatiey object of the object identifier type;
calling object identifier of (orthogonal view, "translation y", tvHeight ') to construct a first vertical animation with a motion speed of 1.5Vy, wherein the object identifier of (orthogonal view) function is to execute the first vertical animation on a target textView control, the starting point of the first vertical animation is tvHeight, the target end point is tvHeight', and the returned value is the information of the object of the matimator transform;
set the execution period of the first vertical animation dT into the object, animatatortranslatiey (dT), by calling animatatortranslatiey in the animatatortyobject.
In the embodiment of the present invention, a combined animation animoset needs to be defined, and the animoset is initialized by calling a constructor in the animoset, specifically, by calling animoset ═ new animoset (). And then call animset.add (animX) and animset.add (mannimatatortranslatiney), thus adding both the horizontal animation and the first vertical animation to the animSet object.
S512, the execution of the horizontal animation and the first vertical animation is started by calling the combined animation, and the bullet screen display based on the target textView control is realized in the video.
And finally, starting the execution of the horizontal animation and the first vertical animation by calling an aniset.
In the embodiment of the invention, the sizes of the reallDistance and Sx of the moving distances of the screen are completely removed by comparing the textView control, when the reallDistance is smaller than Sx, the vertical moving speed is adjusted to 1.5Vy, and the nose hair bullet screen can not move to the set range and can already move out of the screen, so that the bullet screen display is more reasonable while the personalized setting of bullet screen display is supported.
The following describes an embodiment of a bullet screen display device according to an embodiment of the present invention.
Referring to fig. 6, which is a schematic view of an embodiment of a bullet screen display device according to an embodiment of the present invention, the device includes:
the building unit 601 is used for building a view control;
a filling unit 602, configured to fill style information related to a bullet screen in the view control;
an initializing unit 603, configured to perform an initializing operation on the position information of the view control;
a first obtaining unit 604 for obtaining a layout parameter object;
a setting unit 605, configured to set bullet screen layout position information according to the layout parameter object;
an adding unit 606, configured to add the bullet screen layout position information to the view control, and add the view control to a preset bullet screen container object;
a second obtaining unit 607, configured to obtain a setting instruction of the bullet screen display of the user, where the instruction includes setting information of the height of the bullet screen display area;
and the display unit 608 is configured to adjust the height position information of the view control in the bullet screen container object according to the instruction, and display a bullet screen in a video according to the height position information.
Optionally, the building unit 601 is specifically configured to:
calling the textView to construct an empty textView control;
the filling unit 602 is specifically configured to:
setting text information of the bullet screen information to white by calling textView.
Setsize (15sp) sets the font to 15sp size by calling textview;
settext sets specific bullet screen content information by calling textview.
Optionally, the first obtaining unit 604 is specifically configured to:
obtaining a layout parameter object params of the Viewgroup by calling a ViewGroup.layout params () method;
the setting unit 605 is specifically configured to:
calling a params.width in the params object, i.e. ViewGroup.layout of params.WRAP _ CONTENT, to set the width information to the size of the package CONTENT;
the height information is set as the wrapping CONTENT through the parameter of the parameter object, and the height information of the text is dynamically adapted.
Optionally, the adding unit 606 is specifically configured to:
applying the set bullet screen layout position information params to the textView control by calling textView.
Add View in danmuContainer object is called (textView adds textView control to the bullet screen container object danmuContainer.
Optionally, the display unit 608 is specifically configured to:
acquiring the entire height information danmuHeight of the bullet screen container by calling danmuContainer.getHeight () in the danmuContainer container;
constructing a Random number generator Random by calling Random ();
netfloat (danmuHeight) in the random object is called to obtain height information randomheight between 0 and danmuHeight;
and setting position information of the textView control from the top in the father layout by calling a params.marginTop ═ randomHeight method according to the height setting information of the bullet screen display area, so as to adjust the height position information of the bullet screen and display the bullet screen in the video according to the height position information.
Referring to fig. 7, a schematic diagram of another embodiment of a bullet screen display device according to an embodiment of the present invention is shown, the device including:
the constructing unit 701 is configured to construct a management queue for displaying a bullet screen, where the management queue is used to maintain bullet screen information displayed in the middle of a current screen;
the establishing unit 702 is configured to establish a correspondence between a barrage textView control and a unique identifier of a barrage, where the unique identifier of the barrage is String-type data;
a first obtaining unit 703, configured to obtain a unique identifier of a bullet screen corresponding to a textView control displayed on a current screen when the bullet screen is ready to enter the screen to execute a moving animation;
a queue management unit 704, configured to store the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the management queue; when the textView control displayed on the current screen is moved out of the screen, moving the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen out of the management queue;
a second obtaining unit 705, configured to obtain a bullet screen display setting instruction of a user, where the instruction includes bullet screen display area height setting information;
a third obtaining unit 706, configured to take out, according to the instruction, target unique identifiers corresponding to all currently-displayed barrage textView controls from the management queue, and find corresponding target textView controls according to the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object;
an adjusting unit 707, configured to adjust height position information of the target textView control in the bullet screen container object according to the bullet screen display area height setting information and the height position information of the target textView control currently in the bullet screen container object;
and the display unit 708 is used for displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
Optionally, the first obtaining unit 703 is specifically configured to: and acquiring the unique identifier tvHashCode of the bullet screen corresponding to the textView control displayed on the current screen by calling the textView.
Optionally, the management queue is a danmu showqueue queue, and the queue management unit 704 is specifically configured to:
calling danmuShowQueue.add (tvHashCode) in the danmuShowQueue queue to store the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the danmuShowQueue queue;
when the textView control of the current screen display moves out of the screen, the unique identifier of the bullet screen corresponding to the textView control of the current screen display is removed from the danmuShowQueue queue by calling danmuShowQueue.
Optionally, the third obtaining unit 706 is specifically configured to:
taking out target unique identifier information corresponding to all textView controls currently displayed from the danmuShowQueue queue, and finding out corresponding target textView controls according to the unique identifier information of the bullet screen;
the obtaining of the height position information of the target textView control currently in the bullet screen container object comprises:
calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control;
get the height position information of the target textView control in the bullet screen container object by calling params.
Referring to fig. 8, a schematic view of another embodiment of a bullet screen display device according to an embodiment of the present invention is shown, the device including:
a defining unit 801, configured to define a List set, where the List set is used to store currently-running bullet screen information;
the constructing unit 802 is configured to construct a Map variable, and construct a mapping relationship between a barrage TextView control and a unique identifier of a barrage within a codeToTextView set of the Map variable, where the unique identifier of the barrage is String-type data;
an adding unit 803, configured to, when a bullet screen is ready to enter a screen to execute a moving animation, obtain a unique identifier of the bullet screen corresponding to a textView control displayed on a current screen, and add the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen to a List set;
the storage unit 804 is used for storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set;
a removing unit 805, configured to, when a textView control displayed on a current screen moves out of the screen, obtain, through a mapping relationship in a codeToTextView set, a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen, and remove, from the List set, the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen;
an obtaining unit 806, configured to obtain a bullet screen display setting instruction of a user, where the instruction includes height setting information of a bullet screen display area; taking out target unique identifiers corresponding to all currently displayed barrage textView controls from the List set according to the instruction, and finding corresponding target textView controls according to the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object;
an adjusting unit 807, configured to adjust the height position information of the target textView control in the bullet screen container object according to the bullet screen display area height setting information and the height position information of the target textView control currently in the bullet screen container object;
and the display unit 808 is configured to display a bullet screen in a video according to the adjusted height position information of the target textView control in the bullet screen container object.
Optionally, the adding unit 803 is specifically configured to:
and acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen by calling textView.
Optionally, the adding unit 803 is further specifically configured to:
add the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen into the List set by calling listDanmu.
The storage unit 804 is specifically configured to: put (textView, tvHashCode) method is called to store the mapping relation between the textView control of the current screen display and the unique identifier of the bullet screen into the codeToTextView set.
Optionally, the removing unit 805 is specifically configured to: when the textView control displayed on the current screen moves out of the screen, acquiring a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen by calling codeToTextView.
Remove the unique identifier of the bullet screen corresponding to the textView control of the current screen display from the list set by calling listDanmu.
An embodiment of the present invention further provides an electronic device, please refer to fig. 9, where the electronic device includes:
a memory 901, a processor 902 and a computer program 903 stored on the memory and operable on the processor, wherein the bullet screen display method can be implemented when the processor 902 executes the computer program 903.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A bullet screen display method is characterized by comprising the following steps:
defining a List set, wherein the List set is used for storing the currently running bullet screen information;
constructing a Map variable, and constructing a mapping relation between a bullet screen textView control and a unique identifier of a bullet screen in a codeToTextView set of the Map variable, wherein the unique identifier of the bullet screen is String type data;
when the bullet screen is ready to enter a screen to execute the mobile animation, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen, and adding the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen into the List set;
storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set;
when the textView control displayed on the current screen moves out of the screen, acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set;
acquiring a bullet screen display setting instruction of a user, wherein the instruction comprises bullet screen display area height setting information;
taking out target unique identifiers corresponding to all currently displayed barrage textView controls from the List set according to the instruction, and finding corresponding target textView controls according to the target unique identifiers;
acquiring the current height position information of the target textView control in the bullet screen container object;
adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the height position information of the target textView control in the bullet screen container object;
and displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
2. The method of claim 1, wherein the obtaining of the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen comprises:
and acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen by calling textView.
3. The method of claim 2, wherein adding the unique identifier of the bullet screen corresponding to the textView control of the current screen display to the List set comprises:
add the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen into the List set by calling listDanmu.
The storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set comprises the following steps:
put (textView, tvHashCode) method is called to store the mapping relation between the textView control of the current screen display and the unique identifier of the bullet screen into the codeToTextView set.
4. The method of claim 3, wherein when the textView control of the current screen display moves out of the screen, obtaining the unique identifier of the bullet screen corresponding to the textView control of the current screen display through a mapping relation in the codeToTextView set, and removing the unique identifier of the bullet screen corresponding to the textView control of the current screen display from the List set comprises:
when the textView control displayed on the current screen moves out of the screen, acquiring a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen by calling codeToTextView.
Remove the unique identifier of the bullet screen corresponding to the textView control of the current screen display from the list set by calling listDanmu.
5. The method of claim 4, wherein the retrieving, according to the command, target unique identifiers corresponding to all currently-displayed bullet screen textView controls from the List set, and finding corresponding target textView controls according to the target unique identifiers comprises:
target unique identifier information corresponding to all textView controls currently displayed is taken out from the list set, and the corresponding target textView controls are found through the unique identifier information of the bullet screen;
the obtaining of the height position information of the target textView control currently in the bullet screen container object comprises:
calling textView in the target textView control, getLayoutParams () to obtain layout parameter information params of the target textView control;
get the height position information of the target textView control in the bullet screen container object by calling params.
6. A bullet screen display device, characterized in that the device comprises:
the definition unit is used for defining a List set, and the List set is used for storing the currently running bullet screen information;
the constructing unit is used for constructing a Map variable and constructing a mapping relation between a barrage textView control and a unique identifier of a barrage in a codeToTextView set of the Map variable, wherein the unique identifier of the barrage is String type data;
the adding unit is used for acquiring the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen and adding the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen into the List set when the bullet screen is ready to enter the screen to execute the mobile animation;
the storage unit is used for storing the mapping relation between the textView control displayed on the current screen and the unique identifier of the bullet screen into a codeToTextView set;
the removing unit is used for acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen through the mapping relation in the codeToTextView set when the textView control displayed on the current screen moves out of the screen, and removing the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen from the List set;
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a bullet screen display setting instruction of a user, and the instruction comprises bullet screen display area height setting information; taking out target unique identifiers corresponding to all currently displayed barrage textView controls from the List set according to the instruction, and finding corresponding target textView controls according to the target unique identifiers; acquiring the current height position information of the target textView control in the bullet screen container object;
the adjusting unit is used for adjusting the height position information of the target textView control in the bullet screen container object according to the height setting information of the bullet screen display area and the height position information of the target textView control in the bullet screen container object;
and the display unit is used for displaying the bullet screen in the video according to the height position information of the adjusted target textView control in the bullet screen container object.
7. The apparatus according to claim 6, wherein the adding unit is specifically configured to:
and acquiring the unique identifier of the bullet screen corresponding to the textView control displayed on the current screen by calling textView.
8. The apparatus according to claim 7, wherein the adding unit is further configured to:
add the unique identifier of the bullet screen corresponding to the textView control displayed by the current screen into the List set by calling listDanmu.
The storage unit is specifically configured to: put (textView, tvHashCode) method is called to store the mapping relation between the textView control of the current screen display and the unique identifier of the bullet screen into the codeToTextView set.
9. The apparatus according to claim 8, wherein the removal unit is specifically configured to: when the textView control displayed on the current screen moves out of the screen, acquiring a unique identifier of a bullet screen corresponding to the textView control displayed on the current screen by calling codeToTextView.
Remove the unique identifier of the bullet screen corresponding to the textView control of the current screen display from the list set by calling listDanmu.
10. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program may implement the method of any of claims 1 to 5.
CN201811029877.8A 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment Active CN110881145B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811029877.8A CN110881145B (en) 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811029877.8A CN110881145B (en) 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110881145A CN110881145A (en) 2020-03-13
CN110881145B true CN110881145B (en) 2021-11-09

Family

ID=69727129

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811029877.8A Active CN110881145B (en) 2018-09-05 2018-09-05 Bullet screen display method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110881145B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014209233A1 (en) * 2013-06-26 2014-12-31 Vodoke Asia Pacific Limited System and method for delivering content to a display screen
WO2017002602A1 (en) * 2015-06-30 2017-01-05 ソニー株式会社 Reception device, reception method, transmission device, and transmission method
CN106331832A (en) * 2016-09-14 2017-01-11 腾讯科技(深圳)有限公司 Information display method and information display device
CN107257507A (en) * 2017-07-05 2017-10-17 武汉斗鱼网络科技有限公司 Barrage display methods, device and electronic equipment
CN107277641A (en) * 2017-07-04 2017-10-20 上海全土豆文化传播有限公司 A kind of processing method and client of barrage information
CN107734373A (en) * 2017-10-12 2018-02-23 网易(杭州)网络有限公司 Barrage sending method and device, storage medium, electronic equipment
CN108055569A (en) * 2017-12-19 2018-05-18 广州虎牙信息科技有限公司 Direct broadcasting room barrage sending method, device and corresponding terminal

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014209233A1 (en) * 2013-06-26 2014-12-31 Vodoke Asia Pacific Limited System and method for delivering content to a display screen
WO2017002602A1 (en) * 2015-06-30 2017-01-05 ソニー株式会社 Reception device, reception method, transmission device, and transmission method
CN106331832A (en) * 2016-09-14 2017-01-11 腾讯科技(深圳)有限公司 Information display method and information display device
CN107277641A (en) * 2017-07-04 2017-10-20 上海全土豆文化传播有限公司 A kind of processing method and client of barrage information
CN107257507A (en) * 2017-07-05 2017-10-17 武汉斗鱼网络科技有限公司 Barrage display methods, device and electronic equipment
CN107734373A (en) * 2017-10-12 2018-02-23 网易(杭州)网络有限公司 Barrage sending method and device, storage medium, electronic equipment
CN108055569A (en) * 2017-12-19 2018-05-18 广州虎牙信息科技有限公司 Direct broadcasting room barrage sending method, device and corresponding terminal

Also Published As

Publication number Publication date
CN110881145A (en) 2020-03-13

Similar Documents

Publication Publication Date Title
CN109117237B (en) Bullet screen display method and device and electronic equipment
US11488346B2 (en) Picture rendering method and apparatus, storage medium, and electronic apparatus
CN112465939B (en) Panoramic video rendering method and system
CN110769302B (en) Live broadcast interaction method, device, system, terminal equipment and storage medium
US10546038B2 (en) Intelligent browser-based display tiling
US20190230311A1 (en) Video interface display method and apparatus
CN108337547B (en) Character animation realization method, device, terminal and storage medium
CN107092643A (en) A kind of barrage rendering intent and device
CN107025100A (en) Play method, interface rendering intent and device, the equipment of multi-medium data
US9177531B2 (en) Image processing device and non-transitory computer-readable storage medium storing image processing program
CN108905203B (en) Information processing method, information processing apparatus, storage medium, and electronic apparatus
US9754391B2 (en) Webpage display method and apparatus
CN112843680A (en) Picture display method and device, terminal equipment and storage medium
CN114003160A (en) Data visualization display method and device, computer equipment and storage medium
CN109388737B (en) Method and device for sending exposure data of content item and storage medium
CN110891190B (en) Bullet screen display method and device and electronic equipment
CN104615738A (en) Remote sync based mobile terminal photo sharing method
CN110881145B (en) Bullet screen display method and device and electronic equipment
CN110881138B (en) Bullet screen display method and device and electronic equipment
CN103678261A (en) Method, device and equipment for rapidly displaying TTFs
CN109361961B (en) Bullet screen display method and device and electronic equipment
CN109800039B (en) User interface display method and device, electronic equipment and storage medium
CN106874387A (en) A kind of adaptive H TML roll screens show the method for real time information
CN113810755B (en) Panoramic video preview method and device, electronic equipment and storage medium
CN111773679B (en) Method and device for processing icons in game

Legal Events

Date Code Title Description
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