A video preloading method and device, electronic equipment and storage medium
By identifying and preloading the first segment of the target video in real time during the video list scrolling operation, the problem of slow video start-up speed is solved, improving the user's viewing experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2024-08-06
- Publication Date
- 2026-07-14
AI Technical Summary
Slow video playback speed increases user waiting time and affects the viewing experience.
By identifying relevant information about the currently displayed video in real time during the video list swiping operation, determining the target video and preloading it, and obtaining its first segment, we can ensure fast playback startup.
This reduces the playback wait time for target videos, improving the user's viewing experience.
Smart Images

Figure CN119094820B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to the field of video playback technology, and more particularly to a video preloading method, apparatus, electronic device and storage medium. Background Technology
[0002] Video loading speed is a key factor affecting user viewing experience. When users swipe through the video list in the display area to select a video, they often have to wait for the video to load completely before they can start watching. This increases user waiting time and directly impacts the viewing experience. Therefore, improving video loading speed becomes a problem that needs to be solved. Summary of the Invention
[0003] This disclosure provides a video preloading method, apparatus, electronic device, and storage medium.
[0004] According to a first aspect of this disclosure, a video preloading method is provided, comprising:
[0005] When a swipe operation is started on the video list and no swipe operation to end the video list is detected at the current moment, identify relevant information about one or more current videos in the currently displayed video list;
[0006] If, based on relevant information from one or more current videos, it is determined that a target video exists within one or more current videos, a target preloading task for the target video is determined.
[0007] If the target video preloading task is successfully executed, the first segment of the target video is obtained.
[0008] According to a second aspect of this disclosure, a video preloading apparatus is provided, comprising:
[0009] The recognition module is used to identify relevant information of one or more videos in the currently displayed video list when a swipe operation is started on the video list and no swipe operation to end the video list is detected at the current moment.
[0010] The task determination module is used to determine the target preloading task of the target video when it is determined that the target video exists in one or more current videos based on relevant information of one or more current videos.
[0011] The task execution module is used to obtain the first segment of the target video if the target preloading task is successfully executed.
[0012] According to a third aspect of this disclosure, an electronic device is provided, comprising:
[0013] At least one processor; and
[0014] The memory is communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the methods of any embodiment of the present disclosure.
[0016] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform a method according to any embodiment of this disclosure.
[0017] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the aforementioned method.
[0018] By adopting the above scheme, during the scrolling operation of the video list, relevant information of one or more currently displayed videos can be identified in real time. If a target video exists among the current videos, a target preloading task for that video is determined. If the target preloading task is successfully executed, the first segment of the target video is obtained. In this way, by combining the scrolling operation of the video list with the real-time identification and loading of the first segment of the target video, it is ensured that the first segment of the target video can be quickly started when it is needed for subsequent playback, reducing the waiting time for playing the target video and greatly improving the user's viewing experience.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0020] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0021] Figure 1 This is a schematic flowchart of a video preloading method according to an embodiment of the present disclosure;
[0022] Figure 2 This is another flowchart illustrating a video preloading method according to an embodiment of the present disclosure;
[0023] Figure 3 This is a schematic diagram of the composition structure of a video preloading device according to an embodiment of the present disclosure;
[0024] Figure 4This is a block diagram of an electronic device used to implement the video preloading method of the embodiments of this disclosure. Detailed Implementation
[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0026] The first aspect of this disclosure provides a video preloading method, such as... Figure 1 As shown, it includes:
[0027] S101: When a swipe operation is started on the video list and no swipe operation is detected to end on the video list at the current moment, identify relevant information of one or more current videos in the video list currently displayed at the current moment;
[0028] S102: If it is determined that a target video exists in one or more current videos based on the relevant information of the one or more current videos, determine the target preloading task of the target video;
[0029] S103: If the target preloading task of the target video is successfully executed, the first segment of the target video is obtained.
[0030] The video preloading method provided in this embodiment can be applied to electronic devices, specifically terminals. For example, the terminal may possess at least one of the following: playback capability, network connectivity, and processing capability. For instance, the terminal may be any one of a laptop, smartphone, personal computer, smart TV, etc. This description does not limit or exhaustively list all possible types of terminals.
[0031] By adopting the above scheme, during the scrolling operation of the video list, relevant information of one or more currently displayed videos can be identified in real time. If a target video exists among the current videos, a target preloading task for that video is determined. If the target preloading task is successfully executed, the first segment of the target video is obtained. In this way, by combining the scrolling operation of the video list with the real-time identification and loading of the first segment of the target video, it is ensured that the first segment of the target video can be quickly started when it is needed for subsequent playback, reducing the waiting time for playing the target video and greatly improving the user's viewing experience.
[0032] In some implementations, identifying information related to one or more current videos in the video list displayed at the current moment when a swipe operation begins on the video list and no swipe operation to end the video list is detected at the current moment can refer to: starting from the first moment when a swipe operation to begin on the video list is detected, determining in real time whether a swipe operation to end the video list is detected at the current moment; and if it is determined that no swipe operation to end the video list is detected at the current moment, identifying information related to one or more current videos in the video list displayed at the current moment.
[0033] The method to determine whether to start the sliding operation on the video list can be as follows: determine whether the video list is displayed in the display area; if the video list is displayed in the display area, then detect whether the first event is detected in real time; if the first event is detected, then determine whether to start the sliding operation on the video list.
[0034] The first event can refer to the invocation of the first statement or method, which can be configured according to the actual situation. For example, the first statement can be the "WillBeginDragging" method or statement, and the first event can refer to listening for the invocation of "WillBeginDragging". "WillBeginDragging" can be invoked when the user starts dragging the "UIScrollView". Therefore, by listening for the presence of the first event that invokes the first statement, it can be determined whether to start performing a scrolling operation on the video list.
[0035] The display area can refer to the area within the terminal's screen used for display, that is, the area where users can directly observe or see multimedia information through the terminal's screen. The type of multimedia information can include: text, images, videos, etc., without limitation here.
[0036] Additionally, it may include: if the video list is not displayed in the display area, or if the first event is not detected, then it is determined that the swiping operation on the video list has not started.
[0037] Starting from the moment when a swipe operation on the video list is detected to begin, it is determined in real time whether a swipe operation to end the video list is detected at the current moment. This can mean: starting from the moment a swipe operation on the video list is detected to begin, it is determined in real time whether a second event is detected at the current moment; if no second event is detected, it is determined that no swipe operation to end the video list is detected at the current moment.
[0038] The current moment is different from the first moment, and the current moment is later than the first moment.
[0039] The second event may refer to the invocation of a second statement or a second method, which can be configured according to the actual situation. For example, the second statement or second method may include at least one of the following: WillEndDragging (the dragging is about to end), DidEndDragging (the dragging ends), and DidEndDecelerating (the deceleration ends).
[0040] Additionally, it may include: if a second event is detected, determining that the current moment has detected the end of the sliding operation on the video list, and ending the processing.
[0041] Identifying the relevant information of one or more current videos in the video list displayed at the current moment can be: identifying the relevant information of each current video in the video list displayed in the display area at the current moment.
[0042] It should be understood that a video list may include information about each of the multiple videos, but at any given moment, the display area may only show information about a portion of the videos included in the video list. Therefore, it is necessary to identify the information about each of the one or more current videos currently displayed in the display area at the current moment.
[0043] The relevant information of any video in the video list may include at least one of the following: video name, video title, video thumbnail, video description, video unique identifier, etc. It should be understood that this is only an exemplary description of the relevant information of the video. In actual processing, the relevant information of the video may include other content, but this embodiment does not limit or exhaustively list them.
[0044] In this way, by detecting in real time whether to start the sliding operation on the video list and whether to start the sliding operation on the video list, the timing of pre-fetching the target video and loading the first segment of the target video can be controlled during the execution of the sliding operation. This avoids problems such as excessive storage and processing resources caused by excessive video preloading, and also ensures that the finally loaded video is more in line with the user's requirements, thereby improving the hit rate of video preloading.
[0045] In one implementation, determining the target preloading task of the target video when it is determined that a target video exists in the one or more current videos based on relevant information of the one or more current videos includes: determining the candidate video as the target video when it is determined that a candidate video different from the one or more historical videos exists in the one or more current videos based on relevant information of one or more historical videos in the video list displayed at the previous moment and relevant information of the one or more current videos, and determining the target preloading task of the target video in the preloading task queue.
[0046] The previous moment can be the first moment or a moment later than the first moment. The time interval between two adjacent moments can be configured according to the actual situation. For example, the time interval can be 10ms, 100ms, 200ms, longer or shorter. There is no limitation on all possible values of the time interval.
[0047] The relevant information of one or more historical videos in the video list displayed at the previous moment can be: the relevant information of each historical video in the video list displayed at the previous moment within the display area.
[0048] Based on the relevant information of one or more historical videos in the video list displayed at the previous moment and the relevant information of one or more current videos, the method for determining whether there are candidate videos different from the one or more historical videos in the one or more current videos can include: determining whether the relevant information of the i-th current video is the same as the relevant information of each historical video in the one or more historical videos in the video list displayed at the previous moment; if the relevant information of the i-th current video is the same as the relevant information of any one of the one or more historical videos in the video list displayed at the previous moment, then the i-th current video is determined not to be a candidate video; if the relevant information of the i-th current video is different from the relevant information of each one or more historical videos in the video list displayed at the previous moment, then the i-th current video is determined to be a candidate video different from the one or more historical videos, where i is an integer greater than or equal to 1, and the i-th current video is any one of the one or more current videos. Since the processing for each current video in the one or more current videos is the same as for the i-th current video, it will not be described in detail.
[0049] It should be understood that when the time interval between two adjacent moments is sufficiently small, there may be one and only one candidate video that is different from the one or more historical videos among the current videos. Therefore, this candidate video can be directly identified as the target video, and the target preloading task for the target video can be determined in the preloading task queue. The target video determined in this way specifically refers to the target video at the current moment, that is, the video (or video file) that is most recently seen by the user at the current moment.
[0050] For example, suppose the information of the three current videos in the video list displayed at the current moment is the name of video A, the name of video B, and the name of video C; and the information of the three historical videos in the video list displayed at the previous moment is the name of video B, the name of video C, and the name of video D. By comparing the information of one or more historical videos in the video list displayed at the previous moment with the information of one or more current videos, it can be determined that video A is different from all three historical videos. At this time, video A can be determined as a candidate video, and then video A can be determined as the target video at the current moment, that is, the video that has just appeared in the user's field of vision.
[0051] In some other possible examples, where the time interval between two adjacent moments is not small enough, there may be multiple candidate videos in the one or more current videos that are different from the one or more historical videos. In this case, the multiple candidate videos can be used as multiple target videos at the current moment. Furthermore, the subsequent processing for each target video at the current moment should be similar to the subsequent processing for a single target video at the current moment. Therefore, the following mainly describes the subsequent related processing for determining a single target video at the current moment, and will not elaborate on the subsequent related processing for each of the multiple target videos at the current moment.
[0052] In this way, by comparing relevant information between the current video and historical videos, videos that differ from historical videos can be accurately identified. This ensures that the preloading task is applied to the video most recently displayed in the display area based on the swipe operation, thereby improving the accuracy and effectiveness of video preloading.
[0053] In one embodiment, determining the target preloading task of the target video in the preloading task queue includes: creating the target preloading task of the target video if the target preloading task queue does not contain the target preloading task of the target video, adding the target preloading task of the target video to the preloading task queue, and setting the target preloading task of the target video to the highest priority in the preloading task queue.
[0054] The maximum queue length of the preloaded task queue can be set according to the actual situation. The maximum queue length is an integer greater than or equal to 1, such as 4, 10, or more or less. Here, we do not limit or exhaust all possible values of the maximum queue length.
[0055] The number of preloaded video preloaded tasks included in the preloaded task queue can be less than or equal to the maximum queue length of the preloaded task queue.
[0056] In this embodiment, the target video refers to the target video at the current moment.
[0057] Specifically, the preloading task queue may include a preloading task for each preloading video in one or more preloading videos, and a priority for each preloading task. Additionally, each preloading video in the preloading task queue can be identified by its unique identifier. For example, the unique identifier of each preloading video in the preloading task queue may correspond to or be associated with its preloading task, and / or the unique identifier of each preloading video may correspond to or be associated with the priority of its preloading task.
[0058] The method for determining whether the preloaded task queue contains a target preloaded task for the target video may include: determining whether the unique identifier of each preloaded video in the preloaded task queue is the same as the unique identifier of the target video; if the unique identifier of each preloaded video in the preloaded task queue is different from the unique identifier of the target video, then it is determined that the preloaded task queue does not contain a target preloaded task for the target video; if the unique identifier of any preloaded video in the preloaded task queue is the same as the unique identifier of the target video, then it is determined that the preloaded task queue contains a target preloaded task for the target video.
[0059] The process of adding a target preloading task for the target video to the preloading task queue and setting the target preloading task for the target video to the highest priority in the preloading task queue may include: determining whether the number of preloading tasks in the preloading task queue has reached the maximum queue length of the preloading task queue; if the maximum queue length has not been reached, then adding a target preloading task for the target video to the preloading task queue, setting the target preloading task for the target video to the highest priority in the preloading task queue, and lowering the priority of the preloading tasks for other preloading videos in the preloading task queue; if the maximum queue length has been reached, then adding a target preloading task for the target video to the preloading task queue, setting the target preloading task for the target video to the highest priority in the preloading task queue, removing the lowest priority preloading task in the preloading task queue, and lowering the priority of the remaining preloading tasks for other preloading videos in the preloading task queue. Here, lowering the priority can refer to lowering the priority by one or more levels, which is not limited in this embodiment.
[0060] Adding a target preload task for the target video to the preload task queue may include: adding the target preload task for the target video to the preload task queue, and associating the target preload task for the target video with a unique identifier of the target video in the preload task queue. It should be understood that after the target preload task for the target video is added to the preload task queue, the target video may also be referred to as or used as a preload video in the preload task queue.
[0061] In the preloading task queue, the priority of any preloading task for a preloading video determines the execution order of the preloading tasks. Setting the target preloading task for the target video as the highest priority in the preloading task queue means that the target preloading task for the target video will be executed first, or before any other unexecuted preloading video in the queue. Furthermore, setting the target preloading task for the target video as the highest priority in the preloading task queue means that one or more preloading tasks with the highest priority will be placed at the front of the queue. If there are currently executing preloading tasks, the highest priority preloading task in the queue (i.e., the highest priority unexecuted preloading task) will immediately begin execution after the currently executing preloading task is completed.
[0062] For example, by comparing the unique identifiers of historical videos with the unique identifiers of the current video, video A is identified as the target video in the current video. The unique identifier of video A is then compared with the unique identifiers of the videos corresponding to each of the one or more preloaded tasks in the preloaded task queue. It is found that video A is different from the videos corresponding to each of the one or more preloaded tasks in the preloaded task queue, meaning that there is no target preloaded task for video A in the preloaded task queue. At this point, a target preloaded task for video A is created, the target preloaded task for video A is added to the preloaded task queue, the unique identifier of video A is associated with the target preloaded task for video A, and the priority of the target preloaded task for video A is set to the highest priority.
[0063] By adopting the above solution, when the preloading task queue does not contain a preloading task for the target video, a target preloading task for the target video can be created in a timely manner and added to the preloading task queue. The priority of the target preloading task for the target video is set to the highest priority, which ensures that newly appearing but not preloaded videos in the display area are loaded first. This improves the response speed to subsequent playback requests for the target video, reduces the waiting time for users before watching the target video, and enhances the smoothness and experience of watching.
[0064] In one embodiment, the aforementioned determination of the target preloading task of the target video in the preloading task queue includes: if the preloading task queue contains the target preloading task of the target video and the priority of the target preloading task of the target video is not the highest priority, adjusting the priority of the target preloading task of the target video in the preloading task queue to the highest priority.
[0065] In this embodiment, the target video also refers to the target video at the current time. Specifically, the process of determining the target preloading task of the target video in the preloading task queue may include: determining whether the preloading task queue contains a target preloading task of the target video; if the preloading task queue does not contain a target preloading task of the target video, creating a target preloading task of the target video, adding the target preloading task of the target video to the preloading task queue, and setting the target preloading task of the target video to the highest priority in the preloading task queue; if the preloading task queue contains a target preloading task of the target video, determining whether the priority of the target preloading task of the target video in the preloading task queue is the highest priority; if the priority of the target preloading task of the target video is not the highest priority, setting the target preloading task of the target video to the highest priority in the preloading task queue.
[0066] Additionally, it may include: if the target preloading task of the target video has the highest priority, no processing is performed; and / or, if the target preloading task of the target video has already entered the download process or is being loaded, the target preloading task of downloading or loading the target video is maintained.
[0067] The relevant descriptions of the preloaded task queue, and the method for determining whether the preloaded task queue contains the target preloaded task of the target video, are the same as those in the previous embodiments, and will not be repeated.
[0068] In this embodiment, setting the target preloading task of the target video to the highest priority in the preloading task queue may include: determining one or more preloading tasks to be adjusted that have an initial priority higher than the priority of the target preloading task of the target video in the preloading task queue; setting the priority of the target preloading task of the target video to the highest priority in the preloading task queue; and reducing the priority of the one or more preloading tasks to be adjusted in the preloading task queue.
[0069] For example, by comparing the unique identifier of historical videos with the unique identifier of the current video, video A is identified as the target video in the current video. The unique identifier of video A is then compared with the unique identifier of the video corresponding to each of the one or more preloaded tasks in the preloaded task queue. It is then identified that the video corresponding to one of the one or more preloaded tasks in the preloaded task queue is the same as video A. In other words, the preloaded task queue contains the target preloaded task for video A. At this point, if the priority of the target preloaded task for video A is not the highest priority, the priority of the target preloaded task for video A in the preloaded task queue is adjusted to the highest priority.
[0070] The presence of a target preload task in the preload task queue indicates that the target video is being repeatedly displayed in the display area based on swipe gestures, suggesting it may be a video the user is interested in. If the target preload task for this video is not at its highest priority, adjusting its priority to the highest in the preload task queue ensures that videos the user is interested in are loaded first, aligning the execution of preload tasks in the queue with the user's actual playback needs.
[0071] Furthermore, by employing a priority queue (a preload task queue with set task priorities) to manage each preload task, the preload task (target preload task) of the most recently seen video file in the user's field of vision, i.e., the target video at the current moment, can be prioritized for downloading. The highest priority preload task is dynamically adjusted in real-time as the user scrolls through the list. This means that in the preload task queue, the target preload task of the target video at the current moment always has the highest priority during the user's scrolling process. This maximizes the chances of completing the download of video data within the user's field of vision, improving the video preload hit rate.
[0072] In addition, the above scheme also includes an elimination strategy. By setting the maximum queue length of the preloaded task queue, it ensures that when the number of preloaded tasks entering the preloaded task queue exceeds the maximum queue length limit, the lowest priority preloaded task will be eliminated and the latest target video preloaded task at the current moment will be added.
[0073] Furthermore, the direction of the user's swipe operation is uncontrollable. During a single swipe operation, the target video may be determined at multiple moments, triggering the execution logic of the target preloading task for the target video at each moment multiple times. This could result in the same preloading task for the same video existing at different moments. By checking whether the preloading task queue contains the target preloading task for the target video at the current moment, a filtering mechanism can be added to prevent the phenomenon of adding the same preloading task for the same video multiple times from appearing in the preloading task queue, thereby improving data prefetching efficiency.
[0074] After determining the target preloading task of the target video in the preloading task queue, the method further includes: executing the target preloading task of the target video if the target preloading task of the target video has the highest priority in the preloading task queue and no other preloading tasks are being executed.
[0075] Because after the sliding operation on the video list begins, it continuously checks at the current moment whether the sliding operation on the video list has ended, and determines whether a target video exists among the one or more current videos based on relevant information of the current videos, and so on, until the sliding operation on the video list ends, a corresponding target video will exist at multiple current moments. At each current moment where a target video exists, a target preloading task for the target video at that moment will be determined in the preloading task queue, and the target preloading task for the target video at that moment will be set to the highest priority. It should be understood that there is a relative order between different current moments. Suppose that target video A is determined at moment A, and target preloading task A for target video A at moment A is determined in the preloading task queue and set to the highest priority; and at moment B, which is later than moment A, a new target video B is determined. At this time, target preloading task B for target video B at moment B will be determined in the preloading task queue and set to the highest priority, while the priority of target preloading task A will be reduced, and so on.
[0076] In this embodiment, the statement that the target preloading task of the target video in the preloading task queue has the highest priority can mean that the target preloading task of the target video at the current moment has the highest priority in the preloading task queue. Specifically, when the target preloading task of the target video in the preloading task queue has the highest priority and no other preloading tasks are being executed, executing the target preloading task of the target video can be achieved by: determining whether there are other preloading tasks being executed at the current moment; if there are no other preloading tasks being executed at the current moment, retrieving the highest priority preloading task at the current moment from the preloading task queue and executing that highest priority preloading task at the current moment, where the highest priority preloading task at the current moment is the target preloading task of the target video at the current moment.
[0077] For example, by comparing the unique identifiers of historical videos with the unique identifier of the current video, video A is identified within the current video. The unique identifier of video A is then compared with the unique identifiers of the videos corresponding to each of the one or more preloaded tasks in the preloaded task queue. If video A is found to be different from the videos corresponding to any of the one or more preloaded tasks in the preloaded task queue (meaning there is no target preloaded task for video A in the preloaded task queue), a target preloaded task for video A is created in the preloaded task queue, and its priority is set to the highest priority. If no other preloaded tasks are currently executing in the preloaded task queue, the highest priority target preloaded task for video A is executed.
[0078] In addition, after determining the target preloading task of the target video in the preloading task queue, the method further includes: if other preloading tasks are being executed at the current time, detecting whether the other preloading tasks have been completed; at the second time when it is determined whether the execution of other preloading tasks was successful or failed, extracting the highest priority preloading task at the second time from the preloading task queue and executing the highest priority preloading task at the second time.
[0079] By adopting the above scheme, the highest priority target preloading task is executed first in the preloading task queue. This ensures that newly added videos in the display area that have not been preloaded are downloaded first. This can more effectively preload videos that users may watch in the current display area, achieving a rapid response to users' potential playback needs and making video preloading more in line with users' actual needs.
[0080] In one embodiment, the method may further include one of the following: if the execution of the target preloading task of the target video fails and the execution count of the target preloading task of the target video has not reached the maximum number of times, reducing the priority of the target preloading task of the target video in the preloading task queue; if the execution of the target preloading task of the target video fails and the execution count of the target preloading task of the target video has reached the maximum number of times, removing the target preloading task of the target video from the preloading task queue.
[0081] The failure of the above target preloading task (or prefetching failure) may be due to reasons other than data non-existence, such as network issues. This embodiment does not limit the specific reasons.
[0082] The maximum number of times can be pre-configured based on actual circumstances or needs. For example, the maximum number of times can be 1 time, 2 times, or more or less. We do not limit or exhaust all possible values for the maximum number of times.
[0083] In cases where the execution of the target preloading task for the target video fails and the execution count of the target preloading task for the target video has not reached the maximum number of times, the priority of the target preloading task for the target video in the preloading task queue is reduced. This can be achieved by: based on the degradation rules, reducing the priority of the target preloading task for the target video in the preloading task queue and recording the execution count of the target preloading task.
[0084] The degradation rules can be pre-configured and may include: lowering the priority of failed preloading tasks to the lowest level and placing them at the end of the preloading task queue; or, downgrading the failed preloading task according to a fixed level. For example, if the target preloading task was originally the highest priority (level 1), and its execution failed before the maximum number of executions was reached, its priority can be lowered to level 2, level 3, or the lowest level.
[0085] For example, the maximum number of attempts can be preconfigured to 3, and the degradation rule can be preconfigured to lower the priority of failed target preloading tasks to the lowest level. When a target preloading task fails, the number of failures is recorded. It is then determined whether the number of failures equals 3. If the number of failures is less than 3, the target preloading task's priority is lowered to the lowest level, but it is kept in the queue for later reloading. At this point, the next highest-priority preloading task in the preloading task queue is executed. If the number of failures reaches 3, the target preloading task is completely removed from the preloading task queue, and related resources are released.
[0086] It should be noted that the handling of failures when executing other preloaded tasks in the preloaded task queue is the same as the handling of failures when executing the target preloaded task, and will not be repeated here.
[0087] In this way, by adjusting the priority of failed target preloading tasks in a timely manner, we can reduce their consumption of system resources while retaining them, making way for other preloading tasks in the preloading task queue. By removing target preloading tasks that have reached their maximum execution count from the preloading task queue, we can prevent resources from being continuously occupied by invalid or inefficient target preloading tasks, thereby improving the overall system resource utilization efficiency.
[0088] In some embodiments, obtaining the first segment of the target video when the target preloading task of the target video is successfully executed may include: obtaining the first segment of the target video when the target preloading task of the target video is successfully executed, and saving the first segment of the target video at the target cache location.
[0089] The target cache location can be configured according to actual conditions. Preferably, the target cache location can be the relevant cache directory used by the playback SDK (Software Development Kit). That is, the location of the first segment of the target video is cached, and the relevant cache directory is reused with the playback SDK used to play the target video.
[0090] Here, the playback SDK used to play the target video refers to the playback SDK used by the video application or video software. The video application or video software is the video application or video software that runs or is installed on the terminal side. Furthermore, this video application or video software can be a video application or video software that displays a list of videos to the user.
[0091] Additionally, storing the first segment of the target video at the target cache location can be achieved by: storing the first segment of the target video at the target cache location and establishing a mapping relationship between the first segment of the target video and related information of the target video. This related information can not only be used to identify the first segment of the target video, but also to establish a mapping relationship between the first segment of the target video and the online target video. Therefore, when a user selects or clicks to play a target video on the terminal through a video application or video software, if the first segment of the target video is already stored locally using the related information, the first segment can be played directly, while the remaining content of the target video is downloaded online. This achieves a near-instantaneous playback effect for the target video.
[0092] By placing the first segment of the target video in the same relevant cache directory of the playback SDK used by the video application or video software, the problem of reduced retrieval efficiency caused by the video application or video software repeatedly fetching the first segment of the target video through the playback SDK when playing the target video can be avoided. Furthermore, this can also establish a mapping relationship between the first segment of the locally pre-acquired video and the online video.
[0093] The following is combined with Figure 2 The solution provided in this embodiment is illustrated by example:
[0094] S201: When a swipe operation is started on the video list and no swipe operation is detected to end on the video list at the current moment, identify relevant information of one or more current videos in the video list currently displayed at the current moment.
[0095] S202: Based on the relevant information of the one or more current videos, determine whether there is a target video among the one or more current videos. If there is a target video, proceed to S203; if there is no target video, return to S201.
[0096] S203: Determine whether the preloading task queue contains a target preloading task for the target video. If the preloading task queue contains a target preloading task for the target video, then execute S204; if the preloading task queue does not contain a target preloading task for the target video, then execute S205.
[0097] Additionally, it may include: if the target preloading task for the target video in the preloading task queue has already entered the download process, then continue executing the target preloading task for downloading the target video. In this case, it may return to execute S201.
[0098] S204: Determine whether the priority of the target preloading task of the target video is the highest priority. If the priority of the target preloading task of the target video is the highest priority, then execute S207; if the priority of the target preloading task of the target video is not the highest priority, then execute S206.
[0099] S205: Create a target preload task for the target video in the preload queue, set the priority of the target preload task for the target video to the highest priority, and then execute S207.
[0100] Here, the processing in S205 may specifically include: determining whether the number of preloaded tasks in the preloaded task queue has reached the maximum queue length of the preloaded task queue; if the maximum queue length of the preloaded task queue has not been reached, then a target preloaded task for the target video is created in the preloaded queue, the priority of the target preloaded task for the target video is set to the highest priority, the priority of the preloaded tasks for the remaining preloaded videos in the preloaded task queue (excluding the target preloaded task for the target video) is reduced, and then S207 is executed; if the maximum queue length of the preloaded task queue has been reached, then a target preloaded task for the target video is created in the preloaded queue, the priority of the target preloaded task for the target video is set to the highest priority, the lowest priority preloaded task in the preloaded task queue is removed, the priority of the remaining preloaded tasks for the remaining preloaded videos in the preloaded task queue (excluding the target preloaded task for the target video) is reduced, and then S207 is executed.
[0101] S206: Adjust the priority of the target video preloading task to the highest priority.
[0102] The above processes S201 to S206 are repeated at each current moment, and will not be explained again here.
[0103] Furthermore, at each current moment, for the preloaded task queue, the following processes S207 to S211 are repeatedly executed, specifically including:
[0104] S207: Execute the highest priority preload task in the preload task queue.
[0105] S208: Determine whether the preloading task was executed successfully. If the preloading task was executed successfully, return to execute S207; if the preloading task failed, execute S209.
[0106] S209: Determine whether the number of times the preloaded task that failed to execute has reached the maximum number of times. If the number of times the preloaded task that failed to execute has reached the maximum number of times, then execute S210; if the number of times the preloaded task that failed to execute has not reached the maximum number of times, then execute S211.
[0107] S210: Remove the failed preloaded task from the preloaded task queue and return to execute S207.
[0108] S211: Degrade the failed preloading task and return to execution of S207.
[0109] This disclosure also provides a video preloading device, such as... Figure 3 As shown, it includes:
[0110] The recognition module 301 is used to recognize relevant information of one or more current videos in the video list currently displayed when a sliding operation is started on the video list and no sliding operation to end the video list is detected at the current moment.
[0111] The task determination module 302 is used to determine the target preloading task of the target video when it is determined that there is a target video in one or more current videos based on relevant information of one or more current videos.
[0112] The task execution module 303 is used to obtain the first segment of the target video if the target preloading task of the target video is successfully executed.
[0113] In one implementation, the task determination module 302 is used to determine the candidate video as the target video when, based on the relevant information of one or more historical videos in the video list displayed at the previous moment and the relevant information of one or more current videos, there is a candidate video in one or more current videos that is different from one or more historical videos, and to determine the target preloading task of the target video in the preloading task queue.
[0114] In one implementation, the task determination module 302 is used to create a target preload task for the target video when there is no target preload task for the target video in the preload task queue, add the target preload task for the target video to the preload task queue, and set the target preload task for the target video to the highest priority in the preload task queue.
[0115] In one embodiment, the task determination module 302 is used to set the target preloading task of the target video to the highest priority in the preloading task queue when the target preloading task of the target video is included in the preloading task queue and the priority of the target preloading task of the target video is not the highest priority.
[0116] In one implementation, the task execution module 303 is used to execute the target preloading task of the target video when the target preloading task of the target video has the highest priority in the preloading task queue and no other preloading tasks are being executed.
[0117] In one embodiment, the task execution module 303 is further configured to: reduce the priority of the target preloading task of the target video in the preloading task queue if the execution of the target preloading task of the target video fails and the execution count of the target preloading task of the target video has not reached the maximum number of times; or remove the target preloading task of the target video from the preloading task queue if the execution of the target preloading task of the target video fails and the execution count of the target preloading task of the target video has reached the maximum number of times.
[0118] By adopting the above scheme, during the scrolling operation of the video list, relevant information of one or more currently displayed videos can be identified in real time. If a target video exists among the current videos, a target preloading task for that video is determined. If the target preloading task is successfully executed, the first segment of the target video is obtained. In this way, by combining the scrolling operation of the video list with the real-time identification and loading of the first segment of the target video, it is ensured that the first segment of the target video can be quickly started when it is needed for subsequent playback, reducing the waiting time for playing the target video and greatly improving the user's viewing experience.
[0119] The specific functions and examples of each module and submodule of the apparatus in this disclosure can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.
[0120] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0121] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0122] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0123] like Figure 4 As shown, device 400 includes a computing unit 401, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 402 or a computer program loaded from storage unit 408 into random access memory (RAM) 403. RAM 403 may also store various programs and data required for the operation of device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0124] Multiple components in device 400 are connected to I / O interface 405, including: input unit 406, such as keyboard, mouse, etc.; output unit 407, such as various types of monitors, speakers, etc.; storage unit 408, such as disk, optical disk, etc.; and communication unit 409, such as network card, modem, wireless transceiver, etc. Communication unit 409 allows device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0125] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the video preloading method. For example, in some embodiments, the video preloading method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the video preloading method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the video preloading method by any other suitable means (e.g., by means of firmware).
[0126] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0127] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0128] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0129] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0130] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0131] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0132] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0133] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A video preloading method, comprising: Real-time detection is used to determine whether the first event is detected and whether to start the swipe operation on the video list. If the first event is detected, a swiping operation is started on the video list, and no swiping operation is detected to end on the video list at the current moment, then relevant information of one or more current videos in the video list currently displayed at the current moment is identified; If, based on relevant information of the one or more current videos, a target video is determined to exist in the one or more current videos, a target preloading task for the target video is determined, including: if, based on relevant information of one or more historical videos in the video list displayed at the previous moment and relevant information of the one or more current videos, a candidate video different from the one or more historical videos is determined in the one or more current videos, the candidate video is determined to be the target video, and the target preloading task for the target video is determined in the preloading task queue; If the target preloading task of the target video is successfully executed, the first segment of the target video is obtained.
2. The method according to claim 1, wherein, The step of determining the target preloading task for the target video in the preloading task queue includes: If the target preload task for the target video is not present in the preload task queue, a target preload task for the target video is created, the target preload task for the target video is added to the preload task queue, and the target preload task for the target video is set to the highest priority in the preload task queue.
3. The method according to claim 1, wherein, The step of determining the target preloading task for the target video in the preloading task queue further includes: If the target preloading task of the target video is included in the preloading task queue and the priority of the target preloading task of the target video is not the highest priority, then the target preloading task of the target video is set to the highest priority in the preloading task queue.
4. The method according to claim 2 or 3, wherein, After determining the target preloading task for the target video in the preloading task queue, the method further includes: If the target preloading task of the target video has the highest priority in the preloading task queue and no other preloading tasks are being executed, then the target preloading task of the target video is executed.
5. The method according to any one of claims 1-3, further comprising one of the following: If the target preloading task of the target video fails to be executed, and the number of times the target preloading task of the target video has been executed has not reached the maximum number of times, the priority of the target preloading task of the target video in the preloading task queue shall be reduced. If the target preloading task of the target video fails to be executed, and the number of times the target preloading task of the target video is executed reaches the maximum number, the target preloading task of the target video is removed from the preloading task queue.
6. A video preloading device, comprising: The detection module is used to detect in real time whether the first event has been detected in order to determine whether to start the sliding operation on the video list; The identification module is used to identify relevant information of one or more current videos in the video list currently displayed at the current moment when the first event is detected and the sliding operation of the video list is started, and the sliding operation of the video list is not detected to end at the current moment. The task determination module is used to determine the target preloading task of the target video when it is determined that there is a target video in the one or more current videos based on the relevant information of the one or more current videos. The task determination module is used to determine the target preloading task of the target video in the preloading task queue when it is determined that there is a candidate video in the one or more current videos that is different from the one or more historical videos based on the relevant information of one or more historical videos in the video list displayed at the previous time and the relevant information of the one or more current videos. The task execution module is used to obtain the first segment of the target video if the target preloading task of the target video is successfully executed.
7. The apparatus according to claim 6, wherein, The task determination module is used to create a target preloading task for the target video if the target preloading task queue does not contain a target preloading task for the target video, add the target preloading task for the target video to the preloading task queue, and set the target preloading task for the target video to the highest priority in the preloading task queue.
8. The apparatus according to claim 6, wherein, The task determination module is configured to set the target preloading task of the target video to the highest priority in the preloading task queue when the target preloading task queue contains the target preloading task of the target video and the priority of the target preloading task of the target video is not the highest priority.
9. The apparatus according to claim 7 or 8, wherein, The task execution module is used to execute the target preloading task of the target video when the target preloading task of the target video has the highest priority in the preloading task queue and no other preloading tasks are being executed.
10. The apparatus according to any one of claims 6-8, wherein, The task execution module is used to execute one of the following: If the target preloading task of the target video fails to be executed, and the number of times the target preloading task of the target video has been executed has not reached the maximum number of times, the priority of the target preloading task of the target video in the preloading task queue shall be reduced. If the target preloading task of the target video fails to be executed, and the number of times the target preloading task of the target video is executed reaches the maximum number, the target preloading task of the target video is removed from the preloading task queue.
11. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5.
13. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-5.