A bullet screen display method and device, storage medium and electronic device

By obtaining the barrage type selected by the user and judging ballistic permissions in the video playback platform, and generating and displaying barrage entity objects, the problem of difficulty in displaying different barrage effects in the existing technology is solved, and the user experience and interactivity are improved.

CN116095419BActive Publication Date: 2024-11-22HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211572466.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-08
Publication Date
2024-11-22
Estimated Expiration
2042-12-08

AI Technical Summary

Technical Problem

It is difficult for existing video playback platforms to effectively display different barrage effects, affecting user experience and interactivity.

Method used

By obtaining the type of barrage selected by the user, we judge whether the ballistics in the video playback interface allow the addition of barrage, and generate the barrage entity object based on the barrage type, set its attributes and animation effects to display barrage in the video playback interface.

Benefits of technology

The function of displaying different barrage effects is realized, increasing user stickiness and interactivity, and ensuring the smoothness of video playback and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116095419B_ABST
    Figure CN116095419B_ABST
Patent Text Reader

Abstract

The present application provides a method and device for displaying barrage, a storage medium and an electronic device. The method first obtains the barrage to be displayed, and obtains the type of barrage selected by the user for the barrage to be displayed through the barrage type selection box of the video playback interface. Different barrage types correspond to different barrage effects. Then, based on the barrage type, a barrage entity object is generated that inherits the target barrage effect implementation method in the preset barrage component. The target trajectory is a trajectory that allows the addition of barrage, and each attribute to be set is set based on the trajectory information of the barrage to be displayed and the target trajectory. Finally, after completing the setting of all the attributes to be set included in the barrage entity object, the preset system animation execution method is called to display the barrage to be displayed in the target trajectory of the video playback interface after the start display time arrives according to the motion trajectory and the barrage type. The present application scheme realizes the display of barrages with different barrage effects, thereby increasing user stickiness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video playback technology, and in particular to a bullet screen display method and device, a storage medium and an electronic device. Background Art

[0002] Many existing video playback platforms are equipped with a bullet screen function. When watching multimedia information, users can express their opinions by posting bullet screens, communicate with other users, and increase the interactivity of multimedia resources. With the development of network technology, users have put forward higher requirements for the diversity of bullet screens.

[0003] Therefore, how to provide a technical solution for barrages that can display different barrage effects is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention

[0004] The present application provides a bullet screen display method and device, a storage medium and an electronic device, the purpose of which is to realize bullet screens with different bullet screen effects.

[0005] In order to achieve the above objectives, this application provides the following technical solutions:

[0006] A bullet screen display method, comprising:

[0007] Obtaining the bullet screen to be displayed, and obtaining the bullet screen type selected by the user for the bullet screen to be displayed through the bullet screen type selection box on the video playback interface; wherein different bullet screen types correspond to different bullet screen effects;

[0008] Determine in turn whether there is a trajectory that allows adding barrage in each trajectory;

[0009] If it is determined that there is a trajectory that allows adding barrage, then the trajectory that allows adding barrage is used as the target trajectory;

[0010] Based on the barrage type, a barrage entity object is generated that inherits the target barrage effect implementation method in the preset barrage component; the target barrage effect implementation method is the barrage effect implementation method corresponding to the barrage type in each barrage effect implementation method included in the barrage component, and the barrage entity object includes multiple attributes to be set, and the multiple attributes to be set at least include the start display time and the running track;

[0011] Based on the bullet screen to be displayed and the trajectory information of the target trajectory, each attribute to be set is set;

[0012] After completing the setting of all the properties to be set included in the barrage entity object, call the preset system animation execution method to display the barrage to be displayed in the target trajectory of the video playback interface according to the motion trajectory and the barrage type after the start display time arrives.

[0013] In the above method, optionally, the step of sequentially determining whether there is a trajectory in each trajectory that allows adding barrage includes:

[0014] Determine in turn whether the adding permission of each trajectory is enabled;

[0015] If it is determined that the permission to add bullets is enabled, it is determined that there is a bullet that allows adding bullet comments;

[0016] If it is determined that the permissions for adding bullet comments are all in a closed state, it is determined that there is no bullet comment that allows adding bullet comments.

[0017] The above method may optionally further include:

[0018] If it is determined that there is no trajectory that allows adding barrage, the barrage to be displayed and the barrage type are discarded.

[0019] In the above method, optionally, generating a bullet screen entity object that inherits the target bullet screen effect implementation method in the preset bullet screen component based on the bullet screen type includes:

[0020] Based on the barrage type, determining the barrage effect implementation method corresponding to the barrage type among the barrage effect implementation methods included in the preset barrage component as the target barrage effect implementation method;

[0021] Generate a barrage entity object that inherits the target barrage effect implementation method in the barrage component.

[0022] In the above method, optionally, the step of setting each attribute to be set based on the bullet screen to be displayed and the trajectory information of the target trajectory includes:

[0023] Obtaining the length of the previous bullet screen of the bullet screen to be displayed in the target trajectory;

[0024] Calculating a delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen, and the length of the bullet screen to be displayed;

[0025] Determine the starting coordinates and the ending coordinates of the barrage to be displayed based on the length of the barrage to be displayed and the trajectory information of the target trajectory;

[0026] Based on the delayed display time, the starting coordinates and the ending coordinates, each attribute to be set is set.

[0027] In the above method, optionally, the calculating of the delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous barrage and the length of the barrage to be displayed includes:

[0028] Determine the running speed of the previous barrage and the remaining running distance in the target trajectory based on the trajectory length in the trajectory information of the target trajectory, the barrage length of the previous barrage, a preset distance threshold, and a preset barrage running time;

[0029] Determining the remaining running time of the previous barrage based on the running speed of the previous barrage and the remaining running distance;

[0030] Determining a running speed of the barrage to be displayed based on the barrage length of the barrage to be displayed, the trajectory length, and the running time of the barrage;

[0031] The delayed display time is calculated based on the running speed of the bullet screen to be displayed, the remaining running time and the remaining running distance.

[0032] The above method may optionally further include, after the target trajectory of the client displays the bullet screen to be displayed:

[0033] In response to a touch event, determining whether a touch point corresponding to the touch event is in a current view; the current view is a current video playback interface;

[0034] When it is determined that the touch point is in the current view, traverse each trajectory in the current view in sequence to find the trajectory to which the touch point belongs;

[0035] When the trajectory to which the touch point belongs is found, the touch event is transferred to the trajectory to which the touch point belongs, so that the trajectory processes the touch event.

[0036] A bullet screen display device, comprising:

[0037] An acquisition unit, used to acquire the bullet screen to be displayed, and to acquire the bullet screen type selected by the user for the bullet screen to be displayed through the bullet screen type selection box of the video playback interface; wherein different bullet screen types correspond to different bullet screen effects;

[0038] A judging unit, used to judge in turn whether there is a trajectory in each trajectory to which a bullet screen is allowed to be added;

[0039] a determination unit, configured to, if it is determined that there is a trajectory to which a barrage is allowed to be added, use the trajectory to which a barrage is allowed to be added as a target trajectory;

[0040] A generating unit, configured to generate a barrage entity object that inherits a target barrage effect implementation method in a preset barrage component based on the barrage type; the target barrage effect implementation method is a barrage effect implementation method corresponding to the barrage type in each barrage effect implementation method included in the barrage component, and the barrage entity object includes a plurality of attributes to be set, and the plurality of attributes to be set include at least a start display time and a running track;

[0041] A setting unit, configured to set each attribute to be set based on the bullet screen to be displayed and the trajectory information of the target trajectory;

[0042] A display unit is used to call a preset system animation execution method after completing the setting of all the properties to be set included in the barrage entity object, so as to display the barrage to be displayed in the target trajectory of the video playback interface according to the motion trajectory and the barrage type after the start display time arrives.

[0043] A storage medium storing an instruction set, wherein the instruction set, when executed by a processor, implements the above-mentioned bullet screen display method.

[0044] An electronic device, comprising:

[0045] A memory for storing at least one set of instructions;

[0046] The processor is used to execute the instruction set stored in the memory, and implement the above-mentioned barrage display method by executing the instruction set.

[0047] Compared with the prior art, this application has the following advantages:

[0048] The present application provides a method and device for displaying bullet screens, a storage medium and an electronic device. The method first obtains the bullet screen to be displayed, and obtains the bullet screen type selected for the bullet screen to be displayed in the bullet screen type selection box of the user video playback interface, wherein different bullet screen types correspond to different bullet screen effects, and then determines in turn whether there is a trajectory that allows the addition of bullet screens in each trajectory. If it is determined that there is a trajectory that allows the addition of bullet screens, the trajectory that allows the addition of bullet screens is used as the target trajectory, and then based on the bullet screen type, a bullet screen entity object that inherits the target bullet screen effect implementation method in the preset bullet screen component is generated, and each attribute to be set is set based on the trajectory information of the bullet screen to be displayed and the target trajectory. Finally, after completing the setting of all the attributes to be set included in the bullet screen entity object, the preset system animation execution method is called to display the bullet screen to be displayed in the target trajectory of the video playback interface according to the motion trajectory and the bullet screen type after the start display time arrives. It can be seen that the present application scheme realizes the display of bullet screens with different bullet screen effects, thereby increasing user stickiness. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0050] Figure 1 A method flow chart of a bullet screen display method provided in this application;

[0051] Figure 2 An example diagram of a bullet screen display method provided in this application;

[0052] Figure 3 A method flow chart of another method of a bullet screen display method provided by the present application;

[0053] Figure 4 A method flow chart of another method of a bullet screen display method provided by the present application;

[0054] Figure 5 A method flow chart of another method of a bullet screen display method provided by the present application;

[0055] Figure 6 A method flow chart of another method of a bullet screen display method provided by the present application;

[0056] Figure 7 Another example diagram of a bullet screen display method provided by the present application;

[0057] Figure 8A schematic diagram of the structure of a bullet screen display device provided in this application;

[0058] Fig. 9 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0060] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0061] It should be noted that the concepts such as "first" and "second" mentioned in the present application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0062] It should be noted that the modifications of "one" and "plurality" mentioned in the disclosure of this application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0063] The embodiment of the present application provides a bullet screen display method, which can be applied to a variety of system platforms, and its execution subject can be a computer terminal or a processor of various mobile devices. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:

[0064] S101, obtaining the bullet screen to be displayed, and obtaining the bullet screen type selected by the user through the bullet screen type selection box on the video playback interface for the bullet screen to be displayed.

[0065] In this embodiment, a barrage input box and a barrage type selection box are pre-set in the video playback interface of the video software, so that the user can input the barrage to be displayed through the barrage input box of the playback interface, and select the barrage type to be displayed for the barrage to be displayed through the barrage type selection box.

[0066] Among them, the types of barrage include but are not limited to ordinary barrage, celebrity barrage, and voice barrage.

[0067] It should be noted that different types of barrage correspond to different display effects.

[0068] In this embodiment, the bullet screen to be displayed input by the user in the video playback interface is obtained, and the bullet screen type selected by the user for the bullet screen to be displayed through the bullet screen type selection box in the video playback interface is obtained.

[0069] S102, determine in turn whether there is a trajectory in each trajectory that allows adding barrage, if not, execute S103, if so, execute S104.

[0070] In this embodiment, a bullet screen display area is preset in the video playback interface, and multiple bullet tracks are preset in the bullet screen display area. It should be noted that the bullet screen display area is smaller than the video playback interface, and the bullet screen display area is located at the upper part of the video playback interface. For example, Figure 2 , the interface layout of the video playback interface is as follows Figure 2 As shown, the interface window (i.e., the video playback interface) includes a bullet screen display area, and the bullet screen display area includes multiple bullet tracks.

[0071] In this embodiment, it is determined in sequence whether there is a trajectory that allows barrage to be added in each trajectory. Specifically, it is determined in sequence whether there is a trajectory that allows barrage in each trajectory in a preset order. Preferably, the preset order is from top to bottom, and optionally, the preset order can also be from bottom to top, or other orders.

[0072] See also Figure 3 , the process of determining in turn whether there is a trajectory that allows adding barrage in each trajectory specifically includes the following steps:

[0073] S301, determining in turn whether the adding permission of each trajectory is in an enabled state.

[0074] In this embodiment, the adding permission is pre-set for each ballistic. If the adding permission of the ballistic is turned on, it means that the ballistic allows the addition of barrages. If it is turned off, it means that the ballistic does not allow the addition of barrages.

[0075] In this embodiment, it is determined in turn whether the permission to add each trajectory is in an enabled state. Specifically, it is determined in turn whether the permission to add each trajectory is in an enabled state in a preset order. Preferably, the preset order is from top to bottom. Optionally, the preset order can also be from bottom to top, or other orders.

[0076] S302: If it is determined that the permission to add bullet comments is enabled, it is determined that there is a bullet comment that allows adding bullet comments.

[0077] In this embodiment, for the currently judged trajectory, if the adding permission of the trajectory is in the enabled state, it means that the trajectory allows adding barrages, and it is determined that there is a trajectory for adding barrages, thereby terminating the current judgment process.

[0078] S303: If it is determined that the permission to add bullet comments is in a closed state, it is determined that there is no bullet comment that allows adding bullet comments.

[0079] In this embodiment, if it is determined that the permission to add bullet screens is in a closed state, it is determined that there is no bullet screen that allows adding bullet screens.

[0080] For example, the above-mentioned process of sequentially judging whether there is a trajectory that allows adding barrage in each trajectory is described as follows:

[0081] Assuming that there are 3 ballistics in the barrage display area, from top to bottom, first determine whether the first ballistic is allowed to add barrage. If allowed, determine that there is a ballistic that allows adding barrage, and end the judgment process. If not allowed, continue to determine whether the second ballistic is allowed to add barrage. If allowed, determine that there is a ballistic that allows adding barrage, and end the process. If not allowed, continue to determine whether the third ballistic is allowed to add barrage. If allowed, determine that there is a ballistic that allows adding barrage, and end the process. If not allowed, determine that there is no ballistic that allows adding barrage, and end the process.

[0082] In the method provided in the embodiment of the present application, by limiting the barrage display area to be smaller than the video playback interface, the video subtitles will not be blocked even when there are many barrages, thereby improving the user viewing experience.

[0083] S103: discard the bullet comments and bullet comment types to be displayed.

[0084] In this embodiment, after completing the judgment of all ballistics, there is no ballistic that allows the addition of barrage, that is, it is determined that there is no ballistic that allows the addition of barrage in each ballistic, which means that each ballistic is in a busy state, that is, the current number of barrages is too large, and the barrage and barrage type to be displayed will be discarded.

[0085] In the method provided in the embodiment of the present application, by discarding the barrage and barrage type to be displayed when it is determined that there is no trajectory that allows the addition of barrage, the smoothness of video playback is ensured.

[0086] S104. The trajectory that allows adding barrage is used as the target trajectory.

[0087] In this embodiment, if it is determined that there is a trajectory that allows the addition of barrage, the trajectory that allows the addition of barrage will be used as the target trajectory. That is, in the process of judging in turn whether each trajectory allows the addition of barrage, if it is determined that there is a trajectory that allows the addition of barrage, the trajectory will be used as the target trajectory.

[0088] S105. Based on the barrage type, generate a barrage entity object that inherits the target barrage effect implementation method in the preset barrage component.

[0089] In this embodiment, the barrage component is preset, that is, the root class BarrageSprite barrage is pre-constructed, and then the root class BarrageSprite barrage is encapsulated to obtain the barrage component.

[0090] In this embodiment, the root class BarrageSprite uses the core animation CALaye to perform scrolling animation. Specifically, an entity object basicAnimation is created in the basic animation class CABasicAnimation, and the scrolling of the barrage is processed through the position attribute in the entity object basicAnimation. The position attribute includes multiple attributes, including speed, totalTime, fromValue, toValue, and removedOnCompletion. Among them, speed is the speed, totalTime is the running time of the barrage, romValue is outside the right screen, and the vertical center position is processed in the trajectory, toValue is the position on the left screen and exceeds the length of the barrage, and the vertical center position is processed in the trajectory, and removedOnCompletion is set to NO to prevent the barrage from jumping back after the animation is completed, because CALayer adds animation instead of actually changing the display position of the barrage on the screen.

[0091] In this embodiment, the CAAnimationDelegate proxy method is fully utilized because it is necessary to monitor the animationDidStop method of the animation stop. When the animation of the barrage ends, the barrage must be removed to prevent the barrage from increasing infinitely and causing a surge in memory, which will eventually kill the app.

[0092] In this embodiment, the hovering animation is processed by the houvering_position attribute in the entity object basicAnimation. After hovering is added during the animation process, new animations should be added in the animationDidStop method callback to make the stopped bullet screen scroll out of the screen, which is considered a complete scrolling animation.

[0093] For example, the specific implementation steps of the root class BarrageSprite are as follows:

[0094] Among them, spriteLength = bullet screen length, superViewWidth = screen length.

[0095] Step 1: Since the length of the bullet screen may be inconsistent, in order to ensure that the speeds of bullet screens of different lengths are different, the total running time totalTime is kept unchanged. First, the appropriate complete running time totalTime is obtained. Preferably, t can be 7 seconds.

[0096] Step 2: Get the total length of the bullet screen running: totalLength = spriteLength + superViewWidth. It should be noted that the bullet screen head runs from the rightmost edge of the screen to the tail of the bullet screen running to the leftmost edge of the screen, which is a complete running process.

[0097] Step 3: Based on totalTime and totalLength, create a CALayer core animation for the bullet screen. Each UIView has a layer (layout) property. The layer defaults to the CALayer type. The properties in the layer include: bounds (the value of the CGRects (i.e. rectangle) of the layer), position (the position of the top layer (relative to the parent layer)), and transform (the geometric transformation of the top layer). These properties are animatable, which means that animation can be achieved by changing these properties.

[0098] Step 4: This example creates a basic animation class CABasicAnimation to change the properties of the layer and achieve animation effects. First, create a CABasicAnimation entity basicAnimation. Given totalLength, you can set the following properties of basicAnamation:

[0099] fromValue = (totalLength + 50, self.center.y) the starting coordinates of the barrage (x-axis: the position of the barrage head 50dp away from the rightmost side of the screen, y-axis: because it is a translation animation, the barrage is centered (since the position of the trajectory is fixed, the y-axis coordinate of the barrage is determined based on the y-axis coordinate of the trajectory)).

[0100] speed=1 default value.

[0101] removedOncompletion = NO prevents rebound problems after animation is completed.

[0102] Start display time beginTime = current time + delayed display time delateTime.

[0103] toValue = (-50, self.center.y) the end coordinates of the bullet screen (x-axis: the position of the tail of the bullet screen -50dp away from the leftmost side of the screen, y-axis: the center of the bullet screen because it is a translation animation).

[0104] Finally, set the layer of the bullet screen and add animation to the layer: [self.layer addAnimation:basicAnim forKey:@”posintion”]; after the layer is set, it will be triggered according to the beginTime time to perform the translation animation.

[0105] At this point, a complete bullet screen translation animation has been realized. If you want to achieve other effects, you can modify the above attribute values ​​to achieve different effects.

[0106] In this embodiment, the barrage component includes multiple barrage effect implementation methods, and each barrage effect implementation method is used to achieve a display effect corresponding to a barrage type.

[0107] In this embodiment, based on the barrage type, a barrage entity object is generated that inherits the target barrage effect implementation method in the barrage component. That is to say, based on the barrage type, a barrage entity object is generated, and the barrage entity object inherits the target barrage effect implementation method in the barrage component. The target barrage effect implementation method is the barrage effect implementation method corresponding to the barrage type in each barrage effect implementation method included in the barrage component.

[0108] In this embodiment, the bullet screen entity object includes multiple attributes to be set, and the multiple attributes to be set include at least the start display time and the running track.

[0109] The process of generating a barrage entity object that inherits the target barrage effect implementation method in the barrage component based on the barrage type specifically includes the following steps:

[0110] Based on the barrage type, determining the barrage effect implementation method corresponding to the barrage type among the barrage effect implementation methods included in the preset barrage component as the target barrage effect implementation method;

[0111] Generates a barrage entity object that inherits the target barrage effect implementation method in the barrage component.

[0112] In this embodiment, the barrage effect implementation method corresponding to the barrage type is determined from the various barrage effect implementation methods included in the preset barrage component, and the barrage effect implementation method corresponding to the determined barrage type is used as the target barrage effect implementation method, thereby generating a barrage entity object that inherits the target barrage effect implementation method in the barrage component based on the target barrage effect implementation method.

[0113] S106. Based on the bullet screen to be displayed and the trajectory information of the target trajectory, various attributes to be set are set.

[0114] In this embodiment, the trajectory information of the target trajectory is obtained, and each attribute to be set is set based on the bullet screen to be displayed and the trajectory information of the target trajectory, wherein the trajectory information of the target trajectory includes the trajectory length, trajectory position and size.

[0115] For details, see Figure 4 , including the following steps:

[0116] S401, obtaining the barrage length of the previous barrage to be displayed in the target trajectory.

[0117] In this embodiment, the length of the bullet screen before the bullet screen to be displayed in the target trajectory is obtained. It should be noted that the length of the bullet screen is related to the content of the bullet screen.

[0118] S402, calculating the delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen and the length of the bullet screen to be displayed.

[0119] In this embodiment, the delayed display time is calculated based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen and the length of the bullet screen to be displayed.

[0120] The delayed display time is the time to delay entering the target trajectory. It should be noted that since the running time of each bullet screen in the trajectory is the same (ie, the running time of the bullet screen is the same), bullet screens of different lengths run at different speeds, so the delayed display time of each bullet screen is different.

[0121] See also Figure 5 The process of calculating the delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen and the length of the bullet screen to be displayed specifically includes the following steps:

[0122] S501, based on the trajectory length in the trajectory information of the target trajectory, the length of the previous barrage, the preset distance threshold and the preset barrage running time, determine the running speed of the previous barrage and the remaining running distance in the target trajectory.

[0123] In this embodiment, based on the trajectory length in the target trajectory information, the barrage length of the previous barrage, the preset distance threshold and the preset barrage running time, the running speed of the previous barrage and the remaining running distance of the previous barrage in the target trajectory are determined.

[0124] Specifically, based on the ballistic length in the ballistic information of the target ballistics and the barrage length of the previous barrage, the total running length of the previous barrage is determined. Preferably, the total running length of the barrage is equal to the ballistic length plus the barrage length of the previous barrage.

[0125] Based on the total length of the barrage running and the preset barrage running time, the running speed of the previous barrage is calculated, that is, the running speed of the previous barrage is equal to the total length of the barrage running divided by the barrage running time.

[0126] Based on the target trajectory length, the previous bullet screen length and the preset distance threshold, the remaining running distance of the previous bullet screen is determined. Specifically, the remaining running distance is equal to the target trajectory length minus the previous bullet screen length minus the preset distance threshold. Preferably, the preset distance threshold is 50.

[0127] S502: Determine the remaining running time of the previous barrage based on the running speed and remaining running distance of the previous barrage.

[0128] In this embodiment, the remaining running time of the previous barrage is determined based on the running speed and the remaining running distance of the previous barrage. Specifically, the remaining running time of the previous barrage is equal to the remaining running distance of the previous barrage divided by the running speed.

[0129] S503: Determine the running speed of the barrage to be displayed based on the barrage length, trajectory length and running time of the barrage to be displayed.

[0130] In this embodiment, the running speed of the barrage to be displayed is determined based on the barrage length, trajectory length and running time of the barrage to be displayed. Specifically, based on the barrage length and trajectory length of the barrage to be displayed, the total running length of the barrage to be displayed is calculated. Specifically, the total running length of the barrage to be displayed is equal to the barrage length of the barrage to be displayed plus the trajectory length.

[0131] The running speed of the barrage to be displayed is obtained by dividing the total running length of the barrage to be displayed by the running length of the barrage.

[0132] S504: Calculate the delayed display time based on the running speed, remaining running time and remaining running distance of the bullet screen to be displayed.

[0133] In this embodiment, the delayed display time is calculated based on the running speed, remaining running time and remaining running distance of the bullet screen to be displayed.

[0134] Specifically, based on the running speed of the barrage to be displayed, the remaining running time and the remaining running distance of the previous barrage, the distance difference between the barrage to be displayed and the previous barrage is calculated. Specifically, the distance difference between the barrage to be displayed and the previous barrage is equal to the product of the running speed of the barrage to be displayed and the remaining running time of the previous barrage, minus the remaining running distance of the previous barrage.

[0135] Based on the distance difference between the barrage to be displayed and the previous barrage and the running speed of the barrage to be displayed, the delayed display time is calculated. The delayed display time is the distance difference between the barrage to be displayed and the previous barrage divided by the running speed of the barrage to be displayed.

[0136] Exemplarily, the process of calculating the delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen, and the length of the bullet screen to be displayed is described as follows:

[0137] Trajectory length w = self.bounds.size.width (the length of the trajectory);

[0138] The barrage length s1 of barrage 1 (i.e., the previous barrage), the remaining running distance of barrage 1 d1 = w-s1-barrageSpace; where barrageSpace is the preset distance threshold;

[0139] Bullet screen 1 running speed v1 = (w + s1) / totalTime;

[0140] The remaining running time of barrage 1 is t1 = d1 / v1;

[0141] The length of barrage 2 (i.e. the barrage to be displayed) is s2, and the total running length of barrage 2 is d2=w+s2;

[0142] The running speed of bullet screen 2 v2 = d2 / totalTime;

[0143] In the time it takes for barrage 1 to complete the remaining running distance, the difference in distance between barrage 2 and barrage 1 is dd=v2*t1-d1;

[0144] If the dd value is greater than 0, it means that the bullet comments will overlap, so the bullet comment 2 needs to be added with a delay, and the delay time tt=dd / v2.

[0145] In the method provided in the embodiment of the present application, the delayed display time is calculated to delay the display of the bullet screen to be displayed, thereby avoiding the overlap of the bullet screens.

[0146] S403: Determine the starting coordinates and the ending coordinates of the barrage to be displayed based on the length of the barrage to be displayed and the trajectory information of the target trajectory.

[0147] In this embodiment, the starting coordinates and the ending coordinates of the barrage to be displayed are determined based on the length of the barrage to be displayed and the trajectory information of the target trajectory. Specifically, based on the length of the barrage to be displayed and the trajectory length in the trajectory information of the target trajectory, the total length of the barrage to be displayed is determined, and based on the barrage to be displayed, the preset distance threshold and the position information in the trajectory information, the starting coordinates and the ending coordinates of the barrage to be displayed are determined. Specifically, the starting coordinate fromValue = (totalLength + 50, self.center.y), the ending coordinate toValue = (-50, self.center.y) wherein totalLength is the total length of the barrage to be displayed, and self.center.y is obtained based on the position information in the trajectory information, for example, the upper y-axis coordinate of the trajectory is y1, and the lower y-axis coordinate is y2, thereby obtaining the y-axis coordinate of the starting coordinate of the barrage to be displayed, self.center.y = (y1 + y2) / 2.

[0148] S404: Set each attribute to be set based on the delayed display time, the starting coordinates and the ending coordinates.

[0149] In this embodiment, each attribute to be set is set based on the delayed display time, the starting coordinates and the end coordinates. Specifically, the delayed display time, the starting coordinates and the end coordinates are assigned to each attribute to be set, so as to achieve the setting of each attribute to be set. For example, the start display time is set based on the delayed display time, and the running track is set based on the starting coordinates and the end coordinates.

[0150] In this embodiment, continue to refer to Figure 2 , the starting position of a bullet screen is at a preset distance threshold from the right side of the interface window. Preferably, the preset distance threshold is 50dp. There is a bullet screen spacing between bullet screens to avoid bullet screen overlap. That is, the bullet screen spacing is the interval between the real-time position of a bullet screen movement and the starting position of a bullet screen. In this embodiment, the end position of a bullet screen is also at a preset distance threshold from the left side of the interface window.

[0151] S107. After completing the setting of all the properties to be set included in the bullet screen entity object, call the preset system animation execution method to display the bullet screen to be displayed in the target trajectory of the video playback interface according to the motion trajectory and bullet screen type after the start display time arrives.

[0152] In this embodiment, after setting all the properties to be set included in the bullet screen entity object, the preset system animation execution method is called, so that after the start display time arrives, the bullet screen to be displayed is displayed in the target trajectory of the video playback interface according to the running trajectory and bullet screen type. Exemplarily, the system animation execution method can be the [self.layer addAnimation:basicAnim forKey:@”posintion”] method.

[0153] In this embodiment, after calling the preset system animation execution method, after the start display time arrives, control is performed to display the bullet screen to be displayed in the target trajectory.

[0154] It should be noted that for video applications, a popular variety show may have hundreds or thousands of bullet screens per minute. In order to ensure the smoothness of the application, the embodiment of the present application controls the number of bullet screens that can be displayed. Specifically, it includes: (1) limiting the total number of bullet screens; (2) limiting the random abandonment of bullet screens at the same time point; (3) adding a waiting strategy, which requires a waiting time before the bullet screen is displayed. The length of time is the movement time from the previous bullet screen to the complete display and leaving enough space; (4) After the bullet screen is displayed, it is cleared immediately. The above four steps ensure that the memory consumption of the bullet screen is within a certain range, and there will be no lag even if there are many bullet screens.

[0155] The barrage display method provided in the embodiment of the present application first obtains the barrage to be displayed, and obtains the barrage type selected for the barrage to be displayed in the barrage type selection box of the user video playback interface, wherein different barrage types correspond to different barrage effects, and then judges in turn whether there is a trajectory that allows the addition of barrage in each trajectory, and if it is determined that there is a trajectory that allows the addition of barrage, the trajectory that allows the addition of barrage is used as the target trajectory, and then based on the barrage type, a barrage entity object that inherits the target barrage effect implementation method in the preset barrage component is generated, and based on the ballistic information of the barrage to be displayed and the target trajectory, each attribute to be set is set, and finally, after completing the setting of all the attributes to be set included in the barrage entity object, the preset system animation execution method is called to display the barrage to be displayed in the target trajectory of the video playback interface according to the motion trajectory and the barrage type after the start display time arrives. It can be seen that the present application scheme realizes the display of barrages with different barrage effects, thereby increasing user stickiness.

[0156] See also Figure 6 The bullet screen display method provided in the above embodiment of the present application may further include the following steps after step S107:

[0157] S601, responding to a touch event, determining whether the touch point corresponding to the touch event is in a current view; the current view is a current video playback interface.

[0158] In this embodiment, in response to a touch event, it is determined whether the touch point corresponding to the touch event is in the current view, where the current view is the current video playback interface.

[0159] The touch event is an event triggered by the user clicking on the displayed bullet screen in the current video playback interface when there is an operation requirement. For example, the operation requirement includes but is not limited to a like.

[0160] In this embodiment, the process of determining whether the touch point corresponding to the touch event is in the current view specifically includes: mobilizing the touch point determination method of the current view to determine whether the touch point corresponding to the touch event is in the current view, wherein if the touch point is in the current view, the touch point determination method returns YES; if the touch point is not in the current view, the touch point returns nill.

[0161] Exemplarily, the touch point determination method is pointInside:withEvent:.

[0162] In this embodiment, if the touch point determination method returns YES, it is determined that the touch point is in the current view; if the touch point determination method returns nill, it is determined that the touch point is not in the current view.

[0163] S602: When it is determined that the touch point is in the current view, traverse each trajectory in the current view in sequence to find the trajectory to which the touch point belongs.

[0164] In this embodiment, when it is determined that the touch point is in the current view, each trajectory in the current view is traversed in turn to find the trajectory to which the touch point belongs. Specifically, the subview traversal method (hitTest:withEvent:) is called to traverse each trajectory in turn according to the preset traversal order until the subview traversal method returns a non-empty object or all traversals are traversed. Preferably, the preset traversal order is from top to bottom.

[0165] It should be noted that the subview traversal method returns a non-empty object, that is, the subview traversal method returns the trajectory information of the trajectory to which the touch point belongs. Exemplarily, the subview traversal method is hitTest:withEvent:.

[0166] It should be noted that if a subview traversal method returns a non-null object for the first time, the traversal process for each trajectory is terminated.

[0167] S603: When the trajectory to which the touch point belongs is found, the touch event is transmitted to the trajectory to which the touch point belongs, so that the trajectory processes the touch event.

[0168] In this embodiment, if the sub-view traversal method returns a non-empty object, it is determined that the trajectory to which the touch point belongs is found, that is, the trajectory described by the touch point is found. Therefore, when the trajectory to which the touch point belongs is found, the touch event is passed to the trajectory to which the touch point belongs, so that the trajectory to which the touch point belongs can handle the touch event.

[0169] In this embodiment, a response to a touch event is added to the UI interface, and a tapGesture click gesture is added to the UI interface.

[0170] For example, see Figure 7 The specific implementation process of responding to touch events is illustrated as follows:

[0171] A. First, the main interface (i.e., the video playback interface) receives touch events, i.e., receives hitTest events, and calls the pointInside:withEvent: method of the current view to determine whether the touch point is within the current view. If the pointInside:withEvent: method returns NO, indicating that the touch point is not within the current view, the hitTest:withEvent: method of the current view returns nil.

[0172] B. If the pointInside:withEvent: method returns YES, indicating that the touch point is within the current view, all subviews of the current view are traversed, and the hitTest:withEvent: method of the subview is called to repeat the previous steps. The subviews are traversed from top to bottom, that is, from the end of the subviews array forward, until the hitTest:withEvent: method of a subview returns a non-empty object or all subviews are traversed.

[0173] C. If the hitTest:withEvent: method of a subview returns a non-null object for the first time, the hitTest:withEvent: method of the current view returns this object and the process ends.

[0174] D. If the hitTest:withEvent: methods of all subviews return nil, the hitTest:withEvent: method of the current view returns the current view itself (self).

[0175] E. Finally, the touch event is handed over to the view object returned by the hitTest:withEvent: method of the main window for processing.

[0176] After the barrage receives the touch event, it can handle things in the touch callback event, such as prompts, likes, and other operations.

[0177] The method provided in the embodiment of the present application responds to a touch event to determine whether the touch point corresponding to the touch event is in the current view, where the current view is the current video playback interface; when it is determined that the touch point is in the current view, each trajectory in the current view is traversed in turn to find the trajectory to which the touch point belongs; when the trajectory to which the touch point belongs is found, the touch event is passed to the trajectory to which the touch point belongs, so that the trajectory processes the touch event and responds to the touch event, so that the user can operate the barrage that has been displayed in the video playback.

[0178] It should be noted that although the instructions are depicted in a particular order, this should not be understood as requiring that the instructions be executed in the particular order shown or in a sequential order. In certain circumstances, multitasking and parallel processing may be advantageous.

[0179] It should be understood that the various steps described in the method embodiments disclosed in the present application can be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0180] and Figure 1 Corresponding to the method described above, the embodiment of the present application also provides a bullet screen display device for Figure 1 The specific implementation of the method is shown in the following diagram: Figure 8 As shown, specifically including:

[0181] The acquisition unit 801 is used to acquire the bullet screen to be displayed, and acquire the bullet screen type selected by the user for the bullet screen to be displayed through the bullet screen type selection box of the video playback interface; wherein different bullet screen types correspond to different bullet screen effects;

[0182] A judging unit 802 is used to judge in turn whether there is a trajectory in each trajectory to which a bullet screen is allowed to be added;

[0183] The determining unit 803 is configured to use the trajectory to which the barrage is allowed to be added as the target trajectory if it is determined that there is a trajectory to which the barrage is allowed to be added;

[0184] A generating unit 804 is used to generate a barrage entity object that inherits a target barrage effect implementation method in a preset barrage component based on the barrage type; the target barrage effect implementation method is a barrage effect implementation method corresponding to the barrage type in each barrage effect implementation method included in the barrage component, and the barrage entity object includes a plurality of attributes to be set, and the plurality of attributes to be set include at least a start display time and a running track;

[0185] A setting unit 805, configured to set each attribute to be set based on the bullet screen to be displayed and the trajectory information of the target trajectory;

[0186] The display unit 806 is used to call a preset system animation execution method after completing the setting of all the properties to be set included in the barrage entity object, so as to display the barrage to be displayed in the target trajectory of the video playback interface according to the motion trajectory and the barrage type after the start display time arrives.

[0187] The barrage display device provided in the embodiment of the present application realizes the display of barrages with different barrage effects, thereby increasing user stickiness.

[0188] In one embodiment of the present application, based on the above solution, the judging unit 802 is specifically configured to:

[0189] Determine in turn whether the adding permission of each trajectory is enabled;

[0190] If it is determined that the permission to add bullets is enabled, it is determined that there is a bullet that allows adding bullet comments;

[0191] If it is determined that the permission to add a trajectory is in a closed state, then return to the step of determining whether the permission to add each trajectory is in an open state in turn, and if the permission to add all trajectory is in a closed state, it is determined that there is no trajectory that allows adding barrage.

[0192] In one embodiment of the present application, based on the above solution, it can also be configured as follows:

[0193] The discarding unit is used to discard the barrage to be displayed and the barrage type if it is determined that there is no trajectory that allows adding barrage.

[0194] In one embodiment of the present application, based on the above solution, the generating unit 804 is specifically configured to:

[0195] Based on the barrage type, determining the barrage effect implementation method corresponding to the barrage type among the barrage effect implementation methods included in the preset barrage component as the target barrage effect implementation method;

[0196] Generate a barrage entity object that inherits the target barrage effect implementation method in the barrage component.

[0197] In one embodiment of the present application, based on the above solution, the setting unit 805 is specifically used to:

[0198] Obtaining the length of the previous bullet screen of the bullet screen to be displayed in the target trajectory;

[0199] Calculating a delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen, and the length of the bullet screen to be displayed;

[0200] Determine the starting coordinates and the ending coordinates of the barrage to be displayed based on the length of the barrage to be displayed and the trajectory information of the target trajectory;

[0201] Based on the delayed display time, the starting coordinates and the ending coordinates, each attribute to be set is set.

[0202] In one embodiment of the present application, based on the above-mentioned scheme, the setting unit 805 is specifically used to calculate the delayed display time based on the trajectory length in the trajectory information of the target trajectory, the barrage length of the previous barrage, and the barrage length of the barrage to be displayed:

[0203] Determine the running speed of the previous barrage and the remaining running distance in the target trajectory based on the trajectory length in the trajectory information of the target trajectory, the barrage length of the previous barrage, a preset distance threshold, and a preset barrage running time;

[0204] Determining the remaining running time of the previous barrage based on the running speed of the previous barrage and the remaining running distance;

[0205] Determining a running speed of the barrage to be displayed based on the barrage length of the barrage to be displayed, the trajectory length, and the running time of the barrage;

[0206] The delayed display time is calculated based on the running speed of the bullet screen to be displayed, the remaining running time and the remaining running distance.

[0207] In one embodiment of the present application, based on the above solution, it can also be configured as follows:

[0208] A judgment unit, used to respond to a touch event and judge whether the touch point corresponding to the touch event is in a current view; the current view is a current video playback interface;

[0209] A searching unit, configured to, when it is determined that the touch point is in the current view, sequentially traverse each trajectory in the current view to search for the trajectory to which the touch point belongs;

[0210] The transmitting unit is used for transmitting the touch event to the trajectory to which the touch point belongs when the trajectory to which the touch point belongs is found, so that the trajectory processes the touch event.

[0211] An embodiment of the present application also provides a storage medium, which stores an instruction set, wherein when the instruction set is executed, the barrage display method disclosed in any of the above embodiments is executed.

[0212] The present application also provides an electronic device, whose structural diagram is as follows: Fig. 9 As shown, it specifically includes a memory 901 for storing at least one set of instruction sets; a processor 902 for executing the instruction sets stored in the memory by executing the barrage display method disclosed in any of the above embodiments.

[0213] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0214] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope disclosed in the present application. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

[0215] The above description is only a preferred embodiment disclosed in this application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the disclosure of this application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the disclosure of this application (but not limited to) to form a technical solution.

Claims

1. A bullet screen display method, characterized in that: include: Obtain the barrage to be displayed, and obtain the barrage type selected by the user for the barrage to be displayed through the barrage type selection box in the video playback interface; wherein different barrage types correspond to different barrage effects; Determine in turn whether there is a trajectory that allows adding barrage in each trajectory; If it is determined that there is a trajectory that allows adding barrage, then the trajectory that allows adding barrage is used as the target trajectory; Based on the barrage type, a barrage entity object is generated that inherits the target barrage effect implementation method in the preset barrage component; the target barrage effect implementation method is the barrage effect implementation method corresponding to the barrage type in each barrage effect implementation method included in the barrage component, and the barrage entity object includes multiple attributes to be set, and the multiple attributes to be set at least include the start display time and the running track; Based on the bullet screen to be displayed and the trajectory information of the target trajectory, each attribute to be set is set; After completing the setting of all the properties to be set included in the barrage entity object, call the preset system animation execution method to display the barrage to be displayed in the target trajectory of the video playback interface according to the running trajectory and the barrage type after the start display time arrives.

2. The method according to claim 1, characterized in that The step of sequentially judging whether there is a trajectory in each trajectory to which a bullet screen is allowed to be added comprises: Determine in turn whether the adding permission of each trajectory is enabled; If it is determined that the permission to add bullets is enabled, it is determined that there is a bullet that allows adding bullet comments; If it is determined that the permissions for adding bullet comments are all in a closed state, it is determined that there is no bullet comment that allows adding bullet comments.

3. The method according to claim 1 or 2, characterized in that: Also includes: If it is determined that there is no trajectory that allows adding barrage, the barrage to be displayed and the barrage type are discarded.

4. The method according to claim 1, characterized in that: The generating, based on the barrage type, a barrage entity object that inherits a target barrage effect implementation method in a preset barrage component comprises: Based on the barrage type, determining the barrage effect implementation method corresponding to the barrage type among the barrage effect implementation methods included in the preset barrage component as the target barrage effect implementation method; Generate a barrage entity object that inherits the target barrage effect implementation method in the barrage component.

5. The method according to claim 1 or 4, characterized in that: The setting of each attribute to be set based on the bullet screen to be displayed and the trajectory information of the target trajectory includes: Obtaining the length of the previous bullet screen of the bullet screen to be displayed in the target trajectory; Calculating a delayed display time based on the trajectory length in the trajectory information of the target trajectory, the length of the previous bullet screen, and the length of the bullet screen to be displayed; Determine the starting coordinates and the ending coordinates of the barrage to be displayed based on the length of the barrage to be displayed and the trajectory information of the target trajectory; Based on the delayed display time, the starting coordinates and the ending coordinates, each attribute to be set is set.

6. The method according to claim 5, characterized in that The calculating the delayed display time based on the trajectory length in the trajectory information of the target trajectory, the bullet screen length of the previous bullet screen, and the bullet screen length of the bullet screen to be displayed includes: Determine the running speed of the previous barrage and the remaining running distance in the target trajectory based on the trajectory length in the trajectory information of the target trajectory, the barrage length of the previous barrage, a preset distance threshold, and a preset barrage running time; Determining the remaining running time of the previous barrage based on the running speed of the previous barrage and the remaining running distance; Determining a running speed of the barrage to be displayed based on the barrage length of the barrage to be displayed, the trajectory length, and the running time of the barrage; The delayed display time is calculated based on the running speed of the bullet screen to be displayed, the remaining running time and the remaining running distance.

7. The method according to claim 1, characterized in that After displaying the bullet screen to be displayed in the target trajectory of the video playback interface, the method further includes: In response to a touch event, determining whether a touch point corresponding to the touch event is in a current view; the current view is a current video playback interface; When it is determined that the touch point is in the current view, traverse each trajectory in the current view in sequence to find the trajectory to which the touch point belongs; When the trajectory to which the touch point belongs is found, the touch event is transferred to the trajectory to which the touch point belongs, so that the trajectory processes the touch event.

8. A bullet screen display device, characterized in that: include: An acquisition unit, used to acquire the bullet screen to be displayed, and to acquire the bullet screen type selected by the user for the bullet screen to be displayed through the bullet screen type selection box in the video playback interface; wherein different bullet screen types correspond to different bullet screen effects; A judging unit, used to judge in turn whether there is a trajectory in each trajectory to which a bullet screen is allowed to be added; a determination unit, configured to, if it is determined that there is a trajectory to which a barrage is allowed to be added, use the trajectory to which a barrage is allowed to be added as a target trajectory; A generating unit, configured to generate a barrage entity object that inherits a target barrage effect implementation method in a preset barrage component based on the barrage type; the target barrage effect implementation method is a barrage effect implementation method corresponding to the barrage type in each barrage effect implementation method included in the barrage component, and the barrage entity object includes a plurality of attributes to be set, and the plurality of attributes to be set include at least a start display time and a running track; A setting unit, configured to set each attribute to be set based on the bullet screen to be displayed and the trajectory information of the target trajectory; A display unit is used to call a preset system animation execution method after completing the setting of all the properties to be set included in the barrage entity object, so as to display the barrage to be displayed in the target trajectory of the video playback interface according to the running trajectory and the barrage type after the start display time arrives.

9. A storage medium, characterized in that: The storage medium stores an instruction set, wherein the instruction set, when executed by the processor, implements the bullet screen display method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A memory for storing at least one set of instructions; A processor is used to execute an instruction set stored in the memory, and implement the barrage display method as described in any one of claims 1 to 7 by executing the instruction set.