Data Processing Method, Apparatus, Computer Device, and Storage Medium
By obtaining page data and pre-binding the player object to pull the video data, the problem of slow video playback speed is solved, and the effect of direct video playback is achieved.
Patent Information
- Application Number
- CN202110317705.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-25
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2041-03-25
AI Technical Summary
The feed streaming video needs loading time to play after sliding, resulting in slow video playback.
Get page data, determine the currently displayed video based on the terminal screen size and video stream page parameters, create a corresponding number of player objects, bind the player object for each video, and pull the video data in advance, and call the player object to play the video when the playback conditions are met.
This enables direct playback of video without loading, which improves the video start speed.
Smart Images

Figure CN115134651B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a data processing method, apparatus, computer device, and storage medium. Background Art
[0002] Currently, video applications on terminal devices often display content in the form of a feed stream. A feed combines several message sources actively subscribed by users to form a content aggregator, which helps users continuously obtain the latest subscribed source content. A feed stream is an information stream that continuously updates and presents content to users.
[0003] Feed stream videos are generally short videos, with a large quantity and fast update rate. When users watch feed stream videos, they slide the screen frequently. However, currently, the videos displayed on the screen after sliding need to be loaded for a certain period of time before playing, resulting in a slow video start-up speed. Summary of the Invention
[0004] Based on this, in view of the above technical problems, it is necessary to provide a data processing method, apparatus, computer device, and storage medium that can improve the video start-up speed.
[0005] A data processing method, the method comprising:
[0006] Obtaining page data, where the page data includes video stream page parameters, as well as the display order and play address of each video to be displayed;
[0007] Determining a currently displayed video from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each display order;
[0008] Creating a corresponding number of player objects based on the number of the currently displayed videos, binding a player object to each of the currently displayed videos, and pulling video data based on the play address of each of the currently displayed videos;
[0009] When the video playing condition is satisfied, calling the corresponding player object to play the video data.
[0010] A data processing apparatus, the apparatus comprising:
[0011] An obtaining module, configured to obtain page data, where the page data includes video stream page parameters, as well as the display order and play address of each video to be displayed;
[0012] A determining module, configured to determine a currently displayed video from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each display order;
[0013] A pulling module, configured to create a corresponding number of player objects based on the number of the currently displayed videos, bind a player object to each of the currently displayed videos, and pull video data based on the play addresses of the currently displayed videos;
[0014] A playing module, configured to call the corresponding player object to play the video data when the video playing condition is met.
[0015] A computer device, comprising a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0016] Obtain page data, where the page data includes video stream page parameters, and the display order and play addresses of each video to be displayed;
[0017] Determine the currently displayed videos from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each display order;
[0018] Create a corresponding number of player objects based on the number of the currently displayed videos, bind a player object to each of the currently displayed videos, and pull video data based on the play addresses of the currently displayed videos;
[0019] When the video playing condition is met, call the corresponding player object to play the video data.
[0020] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0021] Obtain page data, where the page data includes video stream page parameters, and the display order and play addresses of each video to be displayed;
[0022] Determine the currently displayed videos from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each display order;
[0023] Create a corresponding number of player objects based on the number of the currently displayed videos, bind a player object to each of the currently displayed videos, and pull video data based on the play addresses of the currently displayed videos;
[0024] When the video playing condition is met, call the corresponding player object to play the video data.
[0025] The above data processing method, device, computer equipment and storage medium obtain page data, determine the currently displayed video according to the page data, create multiple player objects according to the currently displayed video, pre-bind player objects to each currently displayed video, and pre-pull video data based on the playback address of the currently displayed video, so that the video can be directly played when it starts broadcasting without a loading state, thereby improving the video start-up speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is an application environment diagram of the data processing method in an embodiment;
[0027] Figure 2 It is a flowchart of the data processing method in an embodiment;
[0028] Figure 3 It is a structural diagram of page data in an embodiment;
[0029] Figure 4 It is a flowchart of the step of determining the currently displayed video from the videos to be displayed according to the terminal screen size, video stream page parameters and each display order in an embodiment;
[0030] Figure 5 It is a schematic diagram of a video stream page in an embodiment;
[0031] Figure 6 It is a flowchart after entering the video stream page in an embodiment;
[0032] Figure 7 It is a structural block diagram of the data processing device in an embodiment;
[0033] Figure 8 It is an internal structure diagram of the computer equipment in an embodiment;
[0034] Figure 9 It is an internal structure diagram of the computer equipment in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0036] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing. Cloud technology is the general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, be used on demand, and is flexible and convenient. Cloud computing technology will become an important support. The back-end services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the back-end system for logical processing. Data at different levels will be processed separately, and various industry data requires a powerful system back-end support, which can be achieved through cloud computing.
[0037] The data processing method provided by this application can be applied to an application environment such as Figure 1 shown. Among them, the terminal 102 communicates with the server 104 through the network. The user can access the platform that provides the feed stream video service (such as the client of a video application) through the terminal 102, and the server 104 can be the server corresponding to this platform. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms. The terminal 102 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal 102 and the server 104 can be directly or indirectly connected through wired or wireless communication methods, and this application does not make any restrictions here.
[0038] In one embodiment, as Figure 2 shown, a data processing method is provided. Taking the terminal in Figure 1 as an example for illustration, it includes the following steps S202 to step S208.
[0039] S202, obtain page data, where the page data includes video stream page parameters, as well as the display order and play address of each video to be displayed.
[0040] Specifically, when starting the client, the terminal can send a data request to the server to request data for the video stream page; the server responds to the data request and returns the corresponding page data to the terminal; the terminal obtains the page data returned by the server. In one embodiment, the home page, such as the news page, is displayed after the client starts. The data request can be sent through multiple threads to obtain the video stream page data. Specifically, the terminal can create a preloading module (preloadCenter) to handle interaction events such as video stream page data, play, pause, and slide.
[0041] The page data includes: video stream page parameters, as well as the display order and play address of each video to be displayed. Among them, the video stream page parameters are used to describe the position of the video stream page on the screen when it is displayed. For example, it can include the distance between the page edge and the screen edge. The video to be displayed refers to the video object included in the page data. The page data can include multiple videos to be displayed. The display order refers to the order in which the videos enter the screen for display. It can be understood that when the user normally slides the video stream page, the video with a higher display order enters the screen earlier than the video with a lower display order. The play address refers to the video source address, and the video data can be pre-loaded through the play address.
[0042] As Figure 3 shown, a schematic structural diagram of the page data in an embodiment is provided. Among them, "responseObject" represents the data object returned by the server; under the "data" node, it includes the relevant data of each video to be displayed. The relevant data can include but are not limited to data such as copywriting, pictures, and play addresses; "10elements" indicates that there are 10 videos to be displayed in this page data; under the "infoVideoVO" node is the data of one video; the "playUrl" field represents the play address of the video.
[0043] S204, determine the currently displayed video from the videos to be displayed according to the terminal screen size, video stream page parameters, and each display order.
[0044] The terminal screen refers to the screen of the terminal used to watch the video stream. The currently displayed video refers to the video that can enter the screen for display when the video stream page is first loaded. It should be noted that the screen sizes of different terminals (such as mobile phones) may be different. Therefore, the number of videos that can be accommodated and displayed on the screens of different terminals may also be different. As a result, the currently displayed videos determined according to the screen sizes of different terminals may also be different.
[0045] S206, create a corresponding number of player objects based on the number of currently displayed videos, bind a player object to each currently displayed video, and pull video data based on the play addresses of each currently displayed video.
[0046] When the terminal receives a trigger operation to enter the video stream page, it renders the video stream page through the main thread and creates multiple players for the videos displayed on the page, that is, creates multiple player objects. Create a corresponding number of player objects based on the number of currently displayed videos. The corresponding number can be the same as the number of currently displayed videos or more than the number of currently displayed videos. For example, it can be one more than the number of currently displayed videos. Bind a player object to each currently displayed video, so that each currently displayed video corresponds to a player object. For each currently displayed video, pull video data in advance based on its playback address. For example, the first few seconds of video data can be pulled in advance.
[0047] S208. When the video playback condition is met, call the corresponding player object to play the video data.
[0048] After entering the video stream page, if the terminal is in a wireless (WiFi) network or free flow situation, it is considered that the video playback condition is met, and the terminal automatically plays the video. For example, call the player object corresponding to the first video in the currently displayed videos to automatically play the video data of the first video. If the terminal is not in a wireless (WiFi) network and not in a free flow situation, when a video playback instruction is received, it is considered that the video playback condition is met, and the terminal plays the corresponding video based on the video playback instruction. For example, when the user clicks the playback control of any video in the currently displayed videos, the terminal calls the player object corresponding to the clicked video to play the video data of the clicked video.
[0049] In the above data processing method, by obtaining page data, determining the currently displayed videos according to the page data, creating multiple player objects according to the currently displayed videos, pre-binding player objects to each currently displayed video, and pre-pulling video data based on the playback addresses of the currently displayed videos, the video can be directly played when it starts broadcasting without a loading state, thus improving the video start-up speed.
[0050] In one embodiment, as Figure 4 shown, the steps of determining the currently displayed videos from the videos to be displayed according to the terminal screen size, video stream page parameters, and each display order may specifically include the following steps S402 to S406.
[0051] S402. Obtain the video display window size and the size of a single video according to the terminal screen size and video stream page parameters.
[0052] The video display window refers to the window on the terminal screen used to display videos. The video stream page can be slid and displayed within the range of this window. The video display window size includes the height of the video display window. The size of a single video includes the height of a single video, and the height of a single video refers to the height of the picture of a single video. AsFigure 5 As shown, a schematic diagram of a video stream page in an embodiment is provided, where H represents the height of the video display window and h represents the height of a single video.
[0053] In one embodiment, the terminal screen size includes: the terminal screen height and the terminal screen width; the video stream page parameters include: the top margin, bottom margin, left margin, right margin of the video display window, and the aspect ratio of the video picture. The video stream page can be set using a table view, and the top margin, bottom margin, left margin, and right margin of the table view are obtained as the top margin, bottom margin, left margin, and right margin of the video display window respectively. The aspect ratio of the video picture is a preset fixed value.
[0054] As Figure 5 shown, the terminal screen height and the terminal screen width are represented by H0 and W0 respectively, and the top margin, bottom margin, left margin, and right margin of the video display window are represented by U, D, L, and R respectively. Specifically, subtracting the top margin and the bottom margin from the terminal screen height gives the height of the video display window, i.e., H = H0 - U - D. Subtracting the left margin and the right margin from the terminal screen width gives the width of a single video (represented by w), and based on the width of a single video and the aspect ratio (represented by n), the height of a single video is obtained, i.e., w = W0 - L - R, h = w / n.
[0055] S404. Determine the position data of each video to be displayed according to the size of a single video and each display order.
[0056] In one embodiment, the step of determining the position data of each video to be displayed according to the size of a single video and each display order may specifically include: setting the position data of the video to be displayed ranked first in the display order as a fixed value; starting from the video to be displayed ranked second in the display order, the position data of each video to be displayed is determined according to the position data of the video to be displayed in the previous order and the height of a single video.
[0057] A coordinate system can be established based on the terminal screen, and the position data of the video to be displayed represents the position of the picture of the video to be displayed in this coordinate system. For example, taking the left vertex of the video display window as the coordinate origin, with the rightward direction as the positive X-axis direction and the downward direction as the positive Y-axis direction, a coordinate system is established, and the position data of the video to be displayed is specifically the Y-axis coordinate where the top edge of the picture of the video to be displayed is located. It should be noted that the coordinate origin is not limited to the left vertex of the video display window. For example, it can also be the left vertex of the entire terminal screen, and no limitation is made in this regard.
[0058] Set the position data of the video to be displayed in the first display order (referred to as the first video) as a fixed value (denoted by y1). The position data of the video to be displayed in the second display order (referred to as the second video) (denoted by y2) can be calculated in the following way: y2 = y1 + h + h1. Here, h represents the height of the first video. In this embodiment, the height of each video is the same and is the height of a single video calculated in the previous embodiment. h1 represents the height of the additional content of the first video. The additional content may include, but is not limited to, the video title, the name of the video publisher, etc. h1 can be a preset fixed value or can be dynamically calculated based on the font, font size, text height, etc., and is not limited here. Similarly, the position data of the video to be displayed in the third display order (referred to as the third video) (denoted by y3) can be calculated in the following way: y3 = y2 + h + h2. That is, starting from the second video, the position data of each video can be calculated in the following way: y i = y i-1 + h + h i-1 , where y i represents the position data of the i-th video, h represents the height of a single video, and h i-1 represents the height of the additional content of the (i - 1)-th video, and i ≥ 2.
[0059] S406. Determine the currently displayed video from the videos to be displayed according to the video display window size and the position data of each video to be displayed.
[0060] In one embodiment, the step of determining the currently displayed video from the videos to be displayed according to the video display window size and the position data of each video to be displayed may specifically be to determine the video to be displayed whose position data is less than the height of the video display window as the currently displayed video.
[0061] The position data of the video to be displayed being less than the height of the video display window means that the video to be displayed has entered the video display window, that is, it is already displayed on the screen. For example, if the height of the video display window is 600 and the number of videos to be displayed is 10, and the position data y j = 100 + (j - 1) × 200 for the j-th (1 ≤ j ≤ 10) video to be displayed, then when j ≤ 3, y j < 600, that is, the position data of the first 3 videos to be displayed is less than the height of the video display window. Therefore, the currently displayed videos determined in this case are the first 3 videos to be displayed.
[0062] In the above embodiment, the videos displayed on the current screen can be dynamically calculated based on the terminal screen size, the video stream page parameters, and the display order of each video to be displayed, which is beneficial to pre-bind the player objects and pull the video data for each video displayed on the current screen, avoiding loading time consumption, and thus improving the video start-up speed.
[0063] In one embodiment, as Figure 6 shown, after entering the video stream page, the following steps S602 to S608 may further be included.
[0064] S602, when a screen slide is detected, obtain the offset at the end of the slide.
[0065] The video stream page is offset as the screen slides. Each time the slide stops, the terminal obtains the offset of the tableview as the currently accumulated offset. It can be understood that as the screen slides, the videos originally displayed on the current screen may slide out of the screen, and the videos that have not entered the screen may enter the screen for display.
[0066] S604, based on the offset and the height of the video display window, obtain reference position data.
[0067] The reference position data is used to describe the range of the position data of the videos displayed on the current screen. When the position data of the video to be displayed is within the range defined by the reference position data, it indicates that the video to be displayed is currently being displayed on the current screen. When the position data of the video to be displayed is not within the range defined by the reference position data, it indicates that the video to be displayed has slid out of the screen or has not yet entered the screen.
[0068] In one embodiment, the step of obtaining reference position data based on the offset and the height of the video display window may specifically include: obtaining the minimum position data based on the offset, and obtaining the maximum position data based on the sum of the offset and the height of the video display window.
[0069] The minimum position data is used to indicate that when the position data of the video to be displayed is less than the minimum position data, the video to be displayed has slid out of the screen. The maximum position data is used to indicate that when the position data of the video to be displayed is greater than the maximum position data, the video to be displayed has not yet entered the screen.
[0070] S606, when it is determined according to the reference position data that a video has slid out of the screen, release the player object bound to the video that has slid out of the screen.
[0071] In one embodiment, when the currently displayed videos include a video with position data less than the minimum position data, it is determined that a video has slid out of the screen. All currently displayed videos are pre-bound with player objects. When a video slides out of the screen, the player object bound to the video that has slid out of the screen is released. The released player object can be saved through a temporary variable and can be assigned to a newly entered video for reuse later to extend the lifecycle of the player object.
[0072] S608. When it is determined that a new video has entered the screen according to the reference position data, bind the released player object to the video that has newly entered the screen, and pull the video data based on the playback address of the video that has newly entered the screen.
[0073] In one embodiment, a video whose position data is between the minimum position data and the maximum position data is determined as the new current display video. When the new current display video includes a video that does not exist in the current display video, it is determined that a new video has entered the screen.
[0074] When the screen sliding amplitude is small, the video displayed on the current screen may not change. For example, if the videos displayed on the current screen were originally the 1st - 3rd videos, after sliding, the videos displayed on the current screen may still be the 1st - 3rd videos. When the screen sliding amplitude is large, the video displayed on the current screen is very likely to change. For example, if the videos displayed on the current screen were originally the 1st - 3rd videos, after sliding, the videos displayed on the current screen may become the 2nd - 4th videos. In this case, the 1st video is the video that has slid out of the screen, and the 4th video is the video that has newly entered the screen. Release the player object bound to the 1st video, then re - bind it to the 4th video, and based on the playback address of the 4th video, pre - pull the video data of the 4th video.
[0075] In the above - mentioned embodiment, by monitoring the offset during the screen sliding process and dynamically calculating the videos displayed on the current screen after the sliding stops, it is beneficial to pre - bind the player object and pull the video data for each video that subsequently enters the current screen, avoiding loading time consumption, and thus improving the video start - up speed.
[0076] In one embodiment, after entering the video stream page, the following steps may further be included: determine the target quantity according to a preset ratio of the total number of videos to be displayed; when the video to be displayed ranked at the target quantity enters the screen, obtain the data of the next page.
[0077] Among them, the preset ratio is within the range of (0, 1), and the specific value can be set according to actual needs and is not limited here. The target quantity can be rounded up to an integer. For example, if the total number of videos to be displayed is 10 and the preset ratio is set to 2 / 3, then the target quantity is determined to be 7, that is, when the 7th video to be displayed enters the screen, obtain the data of the next page. Accordingly, the data of the next page can be pre - loaded, which is beneficial to improving the video start - up speed. In addition, when loading the data of the next page, the request parameters of the data of the page after the next page can further be placed in the data request header for pull - up loading, facilitating the loading of the expected data when the user pulls up to refresh.
[0078] In one embodiment, after obtaining the data of the next page, the data of the next page is integrated with the previous page data. The display order of the videos to be displayed in the next page data is arranged sequentially after the display order of the previously displayed videos. Correspondingly, the position data of each video to be displayed in the next page data can also be calculated. For example, if the total number of previously displayed videos is 10 and the total number of videos to be displayed in the next page data is also 10, then the total number of videos to be displayed in the entire page data is 20. If the preset ratio is set to 2 / 3, the next target number is determined to be 14, that is, when the 14th video to be displayed enters the screen, the data of the next page is obtained, and so on. Accordingly, the preloading of the next page data is ensured, and the time-consuming data loading in the case of fast sliding is avoided.
[0079] It should be understood that although the steps in the various flowcharts involved in the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least some of the steps in the various flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least some of the steps or stages in other steps or other steps.
[0080] In one embodiment, as Figure 7 shown, a data processing apparatus 700 is provided, including: an acquisition module 710, a determination module 720, a pull module 730, and a playback module 740, where:
[0081] The acquisition module 710 is configured to acquire page data, where the page data includes video stream page parameters, as well as the display order and playback address of each video to be displayed.
[0082] The determination module 720 is configured to determine the currently displayed video from the videos to be displayed according to the terminal screen size, video stream page parameters, and each display order.
[0083] The pull module 730 is configured to create a corresponding number of player objects based on the number of currently displayed videos, bind a player object to each currently displayed video, and pull video data based on the playback addresses of each currently displayed video.
[0084] The playback module 740 is configured to call the corresponding player object to play the video data when the video playback condition is satisfied.
[0085] In one embodiment, when determining the currently displayed video from the videos to be displayed according to the terminal screen size, video stream page parameters, and each display order, the determining module 720 is specifically configured to: obtain the video display window size and the size of a single video according to the terminal screen size and the video stream page parameters; determine the position data of each video to be displayed according to the size of a single video and each display order; and determine the currently displayed video from the videos to be displayed according to the video display window size and the position data of each video to be displayed.
[0086] In one embodiment, the terminal screen size includes: the terminal screen height and the terminal screen width; the video stream page parameters include: the top margin, bottom margin, left margin, right margin of the video display window, and the aspect ratio of the video picture. When obtaining the video display window size and the size of a single video according to the terminal screen size and the video stream page parameters, the determining module 720 is specifically configured to: subtract the top margin and the bottom margin from the terminal screen height to obtain the video display window height, and the video display window size includes the video display window height; subtract the left margin and the right margin from the terminal screen width to obtain the width of a single video, and obtain the height of a single video according to the width of a single video and the aspect ratio, and the size of a single video includes the height of a single video.
[0087] In one embodiment, when determining the position data of each video to be displayed according to the size of a single video and each display order, the determining module 720 is specifically configured to: set the position data of the video to be displayed ranked first in the display order as a fixed value; starting from the video to be displayed ranked second in the display order, the position data of each video to be displayed is determined according to the position data of the video to be displayed in the previous order and the height of a single video.
[0088] In one embodiment, when determining the currently displayed video from the videos to be displayed according to the video display window size and the position data of each video to be displayed, the determining module 720 is specifically configured to: determine the video to be displayed with position data less than the video display window height as the currently displayed video.
[0089] In one embodiment, the apparatus further includes a processing module, configured to: when detecting a screen slide, obtain the offset at the stop of the slide; obtain reference position data based on the offset and the video display window height. The pulling module 730 is further configured to: when determining that a video slides out of the screen according to the reference position data, release the player object bound to the video that slides out of the screen; when determining that a new video enters the screen according to the reference position data, bind the released player object to the new video that enters the screen, and pull video data based on the play address of the new video that enters the screen.
[0090] In one embodiment, the reference position data includes: minimum position data and maximum position data. When obtaining the reference position data based on the offset and the height of the video display window, the processing module is specifically configured to: obtain the minimum position data based on the offset, and obtain the maximum position data based on the sum of the offset and the height of the video display window. The apparatus further includes a determination module, configured to: when the current displayed video includes a video whose position data is less than the minimum position data, determine that a video has slipped out of the screen; determine the video whose position data is between the minimum position data and the maximum position data as the new current displayed video, and when the new current displayed video includes a video that does not exist in the current displayed video, determine that a video has newly entered the screen.
[0091] In one embodiment, the processing module is further configured to: determine a target quantity according to a preset ratio of the total quantity of videos to be displayed. The obtaining module is further configured to: when the video to be displayed ranked at the target quantity enters the screen, obtain the next page of data.
[0092] For the specific limitations on the data processing apparatus, reference may be made to the limitations on the data processing method in the foregoing text, which will not be elaborated herein. Each module in the above data processing apparatus may be implemented in whole or in part by software, hardware, and their combination. The above modules may be embedded in the processor in the computer device in the form of hardware or be independent of the processor, or may be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0093] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 8 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a data processing method.
[0094] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as Figure 9As shown in the figure. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be implemented through WIFI, carrier network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a data processing method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball, or touchpad set on the computer device housing, or an external keyboard, touchpad, or mouse, etc.
[0095] Those skilled in the art can understand that Figure 8 or Figure 9 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0096] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps in the above method embodiments are implemented.
[0097] In one embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.
[0098] In one embodiment, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in the above method embodiments.
[0099] It should be understood that the terms "first", "second", etc. in the above embodiments are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. For the description of a numerical range, the term "plurality" is understood to be equal to or greater than two.
[0100] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0101] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0102] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A data processing method, characterized in that, The method includes: Obtaining page data, where the page data includes video stream page parameters, as well as the display order and play addresses of each video to be displayed; the video stream page parameters at least include the distances between the page edges and the screen edges, and the video stream page parameters are used to describe the position of the video stream page on the screen when it is displayed; the display order refers to the order in which the videos to be displayed enter the terminal screen for display, and the play address is used to preload video data; Determining the currently displayed video from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each display order; the currently displayed video refers to the video that enters the terminal screen for display when the video stream page is first loaded, and the number of currently displayed videos is related to the terminal screen size; Rendering the video stream page through the main thread, and at the same time creating a corresponding number of player objects based on the number of currently displayed videos, binding a player object to each currently displayed video, and pre-pulling video data based on the play addresses of each currently displayed video; the number of player objects is greater than the number of currently displayed videos; When the video playback condition is met, calling the corresponding player object to play the video data; When it is detected that the screen slides, obtaining the accumulated offset when the sliding stops; based on the offset and the video display window height, obtaining reference position data, where the reference position data is used to describe the range of the position data of the video displayed on the current screen; when it is determined according to the reference position data that a video slides out of the screen, releasing the player object bound to the video that slides out of the screen, and saving the released player object through a temporary variable for reuse when assigned to a newly entered video on the screen; when it is determined according to the reference position data that a video newly enters the screen, binding the released player object to the newly entered video on the screen, and pulling video data based on the play address of the newly entered video on the screen.
2. The method according to claim 1, characterized in that, Determining the currently displayed video from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each display order includes: Obtaining the video display window size and the size of a single video according to the terminal screen size and the video stream page parameters; Determining the position data of each video to be displayed according to the size of a single video and each display order; Determining the currently displayed video from the videos to be displayed according to the video display window size and the position data of each video to be displayed.
3. The method according to claim 2, wherein The terminal screen size includes the terminal screen height and the terminal screen width; the video stream page parameters include the top margin, bottom margin, left margin, right margin of the video display window, and the aspect ratio of the video picture; Obtaining the video display window size and the size of a single video according to the terminal screen size and the video stream page parameters includes: Subtracting the top margin and the bottom margin from the terminal screen height to obtain the video display window height, and the video display window size includes the video display window height; Subtract the left margin and the right margin from the width of the terminal screen to obtain the width of a single video. Based on the width of the single video and the aspect ratio, obtain the height of the single video. The size of the single video includes the height of the single video.
4. The method according to claim 3, wherein Based on the size of the single video and each display order, determine the position data of each video to be displayed, including: Set the position data of the video to be displayed with the first display order as a fixed value; Starting from the video to be displayed with the second display order, the position data of each video to be displayed is determined based on the position data of the video to be displayed in the previous order and the height of the single video.
5. The method according to claim 3, wherein Based on the size of the video display window and the position data of each video to be displayed, determine the currently displayed video from the videos to be displayed, including: Determine the video to be displayed with position data less than the height of the video display window as the currently displayed video.
6. The method according to claim 1, characterized in that The reference position data includes the minimum position data and the maximum position data; based on the offset and the height of the video display window, obtain the reference position data, including: Obtain the minimum position data based on the offset, and obtain the maximum position data based on the sum of the offset and the height of the video display window; When there is a video in the currently displayed video with position data less than the minimum position data, it is determined that a video has slipped out of the screen; Determine the video with position data between the minimum position data and the maximum position data as the new currently displayed video. When there is a video in the new currently displayed video that does not exist in the currently displayed video, it is determined that a video has newly entered the screen.
7. A data processing device, characterized in that, The device includes: An acquisition module for acquiring page data, where the page data includes video stream page parameters, the display order and the play address of each video to be displayed; the video stream page parameters at least include the distance between the page edge and the screen edge, and the video stream page parameters are used to describe the position of the video stream page in the screen when it is displayed; the display order refers to the order in which the videos to be displayed enter the terminal screen for display, and the play address is used to pre-load video data; A determination module for determining the currently displayed video from the videos to be displayed according to the terminal screen size, the video stream page parameters and each display order; the currently displayed video refers to the video that enters the terminal screen for display when the video stream page is first loaded, and the number of currently displayed videos is related to the terminal screen size; A pulling module for rendering the video stream page through the main thread, and at the same time creating a corresponding number of player objects based on the number of currently displayed videos, binding a player object to each currently displayed video, and pre-pulling video data based on the play address of each currently displayed video; the number of player objects is greater than the number of currently displayed videos; A playing module for calling the corresponding player object to play the video data when the video playing condition is met; A processing module is configured to, when detecting a screen swipe, obtain the accumulated offset when the swipe stops; based on the offset and the height of the video display window, obtain reference position data, where the reference position data is used to describe the range of the position data of the video displayed on the current screen; when determining that a video has swiped out of the screen according to the reference position data, release the player object bound to the swiped-out video, and save the released player object through a temporary variable for reuse by a newly entered video on the screen; when determining that a new video has entered the screen according to the reference position data, bind the released player object to the newly entered video on the screen, and pull video data based on the playback address of the newly entered video on the screen.
8. The device according to claim 7, characterized in that, When the determination module determines the currently displayed video from the videos to be displayed according to the terminal screen size, the video stream page parameters, and each of the display orders, it is specifically configured to: obtain the video display window size and the size of a single video according to the terminal screen size and the video stream page parameters; determine the position data of each of the videos to be displayed according to the size of a single video and each of the display orders; and determine the currently displayed video from the videos to be displayed according to the video display window size and the position data of each of the videos to be displayed.
9. The device according to claim 8, wherein The terminal screen size includes the terminal screen height and the terminal screen width; the video stream page parameters include the top margin, bottom margin, left margin, right margin of the video display window, and the aspect ratio of the video frame. When the determination module obtains the video display window size and the size of a single video according to the terminal screen size and the video stream page parameters, it is specifically configured to: subtract the top margin and the bottom margin from the terminal screen height to obtain the video display window height, where the video display window size includes the video display window height; subtract the left margin and the right margin from the terminal screen width to obtain the width of a single video, and obtain the height of a single video according to the width of a single video and the aspect ratio, where the size of a single video includes the height of a single video.
10. The device according to claim 9, characterized in that When the determination module determines the position data of each of the videos to be displayed according to the size of a single video and each of the display orders, it is specifically configured to: set the position data of the video to be displayed ranked first in the display order as a fixed value; starting from the video to be displayed ranked second in the display order, the position data of each video to be displayed is determined according to the position data of the video to be displayed in the previous order and the height of a single video.
11. The device according to claim 9, characterized in that, When the determination module determines the currently displayed video from the videos to be displayed according to the video display window size and the position data of each of the videos to be displayed, it is specifically configured to: determine the video to be displayed with position data less than the video display window height as the currently displayed video.
12. The device according to claim 7, characterized in that, The reference position data includes the minimum position data and the maximum position data. When obtaining the reference position data based on the offset and the height of the video display window, the processing module is specifically configured to: obtain the minimum position data based on the offset, and obtain the maximum position data based on the sum of the offset and the height of the video display window; when the current displayed video includes a video with position data smaller than the minimum position data, it is determined that a video slides out of the screen; the video with position data between the minimum position data and the maximum position data is determined as the new current displayed video, and when the new current displayed video includes a video that does not exist in the current displayed video, it is determined that a video newly enters the screen.
13. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Video playing method and device
CN105681912A
Multi-video playing method, storage medium and computer equipment
CN109688473A
Video playing method and device for realizing same-screen multi-display and double-screen different-display
CN111083548A