File loading method and device

By dynamically adjusting the buffer area and delayed loading technology, the problems of resource waste and delay during file loading are solved, the file loading speed and user experience are improved, and system overhead and bandwidth consumption are reduced.

CN118672686BActive Publication Date: 2024-11-05WUHAN LAZYMAO WEIFU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411153030.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-11-05
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

In the prior art, when files are loaded, they cannot be loaded dynamically according to the user view range, resulting in waste of resources and delayed loading, affecting user experience, and lack of an effective load interruption mechanism, which increases system overhead.

Method used

By dynamically adjusting the buffer area size under interactive instructions, increasing the size of the upper buffer area or lower buffer area, adjusting the buffer area according to the sliding speed, optimizing file loading, delaying the loading of the file until it enters the visual area, and using virtual list technology to render only Files within the current view scope, providing an interrupt loading mechanism.

Benefits of technology

Reduces system resource consumption, improves file loading speed and user experience, reduces bandwidth consumption and server pressure, ensures files load when needed, and optimizes resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672686B_ABST
    Figure CN118672686B_ABST
Patent Text Reader

Abstract

The present invention provides a file loading method and device, and relates to the field of file loading. The method comprises: receiving a preview instruction from a user, the preview instruction is used to indicate previewing files in a target document; using a virtual list to display all files in a visible area in a preview interface; receiving an interactive instruction from a user, the interactive instruction is used to indicate previewing files in an upper area or a lower area of ​​the visible area; when the interactive instruction is to preview files in an upper area of ​​the visible area, increasing the area size of an upper buffer area and reducing the area size of a lower buffer area; when the interactive instruction is to preview files in a lower area of ​​the visible area, increasing the area size of a lower buffer area and reducing the area size of an upper buffer area. The present invention can dynamically adjust the upper and lower buffers according to the sliding direction for early loading, freeing up space and increasing speed, and files in the sliding direction will obtain more resources, thereby reducing bandwidth consumption and server pressure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of file loading, and in particular to a file loading method and device. Background Art

[0002] In existing network applications and mobile applications, file loading is an important factor affecting user experience. Especially in pages with a large number of file resources, loading all files at the same time will cause the page loading time to be too long, consume a lot of traffic, increase the server burden, and affect the user experience. In the prior art, the method of gradually loading files is usually adopted, but the following problems still exist: First, there is no dynamic loading based on the user's view range, resulting in a waste of resources for loading a large number of invisible files; second, when the user scrolls the page, the delay in file loading will affect the user experience; third, for files that are no longer visible, there is no effective loading interruption mechanism, and continued loading leads to increased system overhead.

[0003] Chinese invention patent CN 112364279 B discloses a method and device for loading pictures, including: obtaining a target page element; obtaining the motion state of the target page element; if the motion state of the target page element is a scrolling state, obtaining the to-be-loaded picture carried by the target page element, and adding the to-be-loaded picture to a queue to be loaded, wherein the queue to be loaded is used to monitor the to-be-loaded picture according to the change of the motion state of the target page element, and add the to-be-loaded picture to the loading queue for downloading when the motion state of the target page element changes to a non-scrolling state. Thus, it is possible to choose whether to load according to the scrolling state of the picture. If it is in a scrolling state, it is not directly downloaded, but added to the queue to be downloaded. However, after adding the to-be-loaded picture to the queue to be downloaded, this solution reduces the loading speed due to increased system resource consumption.

[0004] However, there is currently no technical solution that can solve the above technical problems, and there is no file loading method and device. Summary of the invention

[0005] The present invention provides a file loading method and device, which can increase the area size of an upper buffer area and reduce the area size of a lower buffer area when an interactive instruction is a file in an upper area of ​​a preview visible area; and increase the area size of a lower buffer area and reduce the area size of an upper buffer area when an interactive instruction is a file in a lower area of ​​a preview visible area, so that more files in a user's browsing direction are loaded, which not only reduces the consumption of system resources, but also makes the loading of files in a sliding preview process smoother.

[0006] In a first aspect, the present invention provides a file loading method, comprising:

[0007] Receiving a preview instruction from a user, wherein the preview instruction is used to instruct to preview a file in a target document;

[0008] In response to the preview instruction, displaying all files in the visible area in the preview interface using a virtual list, the virtual list including an upper buffer area, the visible area and a lower buffer area, and the file including at least one of a picture, a video and an audio;

[0009] Receiving a user's interactive instruction, wherein the interactive instruction is used to instruct to preview the upper area file or the lower area file of the visible area, and the interactive instruction is generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control;

[0010] In response to the interaction instruction, when the interaction instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased and the area size of the lower buffer area is reduced; when the interaction instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased and the area size of the upper buffer area is reduced.

[0011] According to the file loading method provided by the present invention, the interactive instruction includes a first instruction and a second instruction that are executed continuously;

[0012] Before responding to the interactive instruction, the method further includes:

[0013] Determine a first calibrated position of any monitoring point in the visible area when the first instruction is executed, and determine a second calibrated position of the monitoring point when the second instruction is executed;

[0014] Determining a distance difference according to the first calibrated position and the second calibrated position;

[0015] Determining a time difference according to the execution time of the first instruction and the execution time of the second instruction;

[0016] The sliding speed of the file is determined according to the distance difference and the time difference.

[0017] According to the file loading method provided by the present invention, when the sliding speed of the file is greater than or equal to the preset speed, after responding to the interaction instruction, the method further includes:

[0018] When the interactive instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is adjusted to the maximum and the lower buffer area is deleted; when the interactive instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is adjusted to the maximum and the upper buffer area is deleted.

[0019] According to the file loading method provided by the present invention, when the sliding speed of the file is less than a preset speed, increasing the area size of the upper buffer area and reducing the area size of the lower buffer area comprises:

[0020]

[0021] in, To increase the size of the upper back buffer area, To increase the size of the front upper buffer area, is the first preset coefficient, To reduce the size of the rear lower buffer area, To reduce the size of the front lower buffer area, is the second preset coefficient, The sliding speed of the file.

[0022] According to the file loading method provided by the present invention, when the sliding speed of the file is less than a preset speed, increasing the area size of the lower buffer area and reducing the area size of the upper buffer area comprises:

[0023]

[0024] in, To reduce the size of the upper back buffer area, To reduce the size of the front upper buffer area, is the third preset coefficient, To increase the size of the lower back buffer area, To increase the size of the front lower buffer area, is the fourth preset coefficient, The sliding speed of the file.

[0025] According to the file loading method provided by the present invention, the target document includes all initial images. After receiving a preview instruction from a user and before responding to the preview instruction, the method further includes:

[0026] Using a preset image processing library to compress and convert the formats of all the initial images in the target document to obtain all processed images;

[0027] For each processed image, determining that a processed image whose size is larger than a preset size is an image to be cropped, and cropping the image to be cropped to obtain all cropped images;

[0028] Determine that all cropped images and all processed images that have not been cropped are files in the target document.

[0029] According to the file loading method provided by the present invention, the method of displaying all files in the visible area in the preview interface using a virtual list includes:

[0030] Determine all file contents in the visible area according to the size of the visible area and the target view size of each file;

[0031] Displaying all the files in a preview interface using a virtual list;

[0032] The target view size is determined by adjusting the preset view size according to the user's display requirements.

[0033] According to the file loading method provided by the present invention, after responding to the interactive instruction, the method further includes:

[0034] After the file enters the visible area, the file is loaded after a preset delay;

[0035] The preset time length is 40ms to 60ms.

[0036] According to the file loading method provided by the present invention, before loading the file, the method further includes:

[0037] Create an AbortController instance. When initiating a Fetch request, pass the Signal property of AbortController as the Signal option to the Fetch request to establish a signal chain. When any file enters the visible area but has not been loaded and has slid out of the visible area, call abort() of AbortController to terminate the loading of the file.

[0038] In a second aspect, a file loading device is provided, comprising:

[0039] A first receiving unit, the first receiving unit is used to receive a preview instruction from a user, the preview instruction is used to instruct to preview a file in a target document;

[0040] a first response unit, the first response unit being used to respond to the preview instruction and display all files in the visible area in the preview interface using a virtual list, the virtual list including an upper buffer area, the visible area and a lower buffer area, and the files including at least one of pictures, videos and audios;

[0041] a second receiving unit, the second receiving unit being used to receive an interaction instruction from a user, the interaction instruction being used to instruct to preview an upper area file or a lower area file of the visible area, the interaction instruction being generated after the user controls the mouse wheel to scroll or clicks an up or down button of a control;

[0042] A second response unit, the second response unit is used to respond to the interaction instruction, and when the interaction instruction is to preview the upper area file of the visible area, increase the area size of the upper buffer area and reduce the area size of the lower buffer area; when the interaction instruction is to preview the lower area file of the visible area, increase the area size of the lower buffer area and reduce the area size of the upper buffer area.

[0043] The present invention utilizes a virtual list in the preview interface to display all files in the visible area. The virtual list includes an upper buffer area, a visible area, and a lower buffer area. When controlling the mouse wheel to scroll or clicking the up and down buttons of the control to preview the upper area files or the lower area files of the visible area, when the interactive instruction is to preview the upper area files of the visible area, the area size of the upper buffer area is increased, and the area size of the lower buffer area is reduced; when the interactive instruction is to preview the lower area files of the visible area, the area size of the lower buffer area is increased, and the area size of the upper buffer area is reduced. The present invention only displays the files in the user's current view, and can dynamically adjust the upper and lower buffers according to the sliding direction for pre-loading, further optimizing the rapid display of files, further freeing up space and increasing speed, and the files in the sliding direction will obtain more resources and load faster, thereby reducing bandwidth consumption and server pressure;

[0044] The present invention also adjusts the size of the buffer area according to the file sliding speed, dynamically adjusts the size of the buffer area to adapt to the file loading requirements, improves the file loading efficiency, optimizes the image loading speed and display effect by preprocessing and cropping the image, reduces the network burden and improves the user experience; loads the file after a certain delay after the file enters the visible area, avoids loading all files at once, and ensures that the file is loaded only when it is really needed, thereby further optimizing resource usage. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 It is a flowchart of the file loading method provided by the present invention;

[0047] Figure 2 It is a block diagram of the virtual list technology provided by the present invention;

[0048] Figure 3 It is a structural schematic diagram of the file loading device provided by the present invention;

[0049] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] Figure 1 : is a flowchart of a file loading method provided by the present invention, wherein the file loading method is characterized by comprising:

[0052] Step 101: receiving a preview instruction from a user, wherein the preview instruction is used to instruct to preview a file in a target document;

[0053] Step 102: In response to the preview instruction, display all files in the visible area in a preview interface using a virtual list, wherein the virtual list includes an upper buffer area, the visible area, and a lower buffer area, and the file includes at least one of a picture, a video, and an audio;

[0054] Step 103: receiving an interactive instruction from a user, wherein the interactive instruction is used to instruct to preview the upper area file or the lower area file of the visible area, and the interactive instruction is generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control;

[0055] Step 104, in response to the interaction instruction, when the interaction instruction is to preview the upper area file of the visible area, increase the area size of the upper buffer area and reduce the area size of the lower buffer area; when the interaction instruction is to preview the lower area file of the visible area, increase the area size of the lower buffer area and reduce the area size of the upper buffer area.

[0056] In step 101, the present invention uses mouse clicks or control clicks in the client to open the target document and generate a user preview instruction to instruct previewing the files in the target document. The target document can be a folder, and all files that can be previewed exist in the folder.

[0057] In step 102, the present invention responds to the preview instruction and displays all files in the visible area in the preview interface using a virtual list. The virtual list is a technology for optimizing the rendering of large amounts of data and is generally used in user interfaces that need to display large amounts of data. The virtual list technology reduces the number of rendering and updating times and improves performance and response speed by rendering only the list items within the current view range and a certain number of list items within and near the view range (i.e., the list items in the buffer). The role of the buffer is to load and render the list items that are about to enter the view range in advance when the user scrolls the view, so as to ensure a smooth scrolling experience and avoid white screen or freeze caused by data loading delays.

[0058] Specifically, the virtual list includes an upper buffer area, the visible area and a lower buffer area. Figure 2 is a block diagram of the virtual list technology provided by the present invention, such as Figure 2 As shown, the gray block is the element that is scrolled away, and the virtual list includes an upper buffer area (green frame), a visible area (red frame) and a lower buffer area (yellow frame). The file in the present invention can be at least one of a picture, a video, and an audio. If the file is a picture, all pictures in the visible area are displayed in the preview interface using a virtual list, that is, all pictures are displayed in the red frame. The present invention uses virtual list technology to only display pictures in the user's current view, and can adjust the upper and lower buffers for pre-loading, further optimizing the rapid display of pictures.

[0059] In step 103, when the user uses the mouse wheel to scroll or clicks the up and down buttons of the control in the document preview interface, the system will capture these interactive events. The control can be a remote control. According to the captured mouse wheel scrolling direction or clicking the up and down buttons of the control, the system determines whether the user wants to view the file above the visible area or the file below the visible area.

[0060] In step 104, if the user wants to view the upper file, the system will increase the size of the upper buffer area and reduce the size of the lower buffer area to ensure that the upper file is preloaded; if the user wants to view the lower file, the system will increase the size of the lower buffer area and reduce the size of the upper buffer area to ensure that the lower file is preloaded. The present invention dynamically adjusts the size of the buffer area according to the user's operation, can more efficiently preload the file that the user wants to view, and improves the speed and fluency of file loading.

[0061] In an optional embodiment, the buffer size of the virtual list is unchanged, and only a certain number of pictures before and after are loaded. The buffer area and size are dynamically adjusted according to the direction of the user's scrolling. For example, when the user scrolls down, there is only the buffer below the view, and the pictures above will be destroyed and recycled, further freeing up space to increase the speed, and the pictures below will get more resources and load faster, thereby reducing bandwidth consumption and server pressure.

[0062] Optionally, the interactive instruction includes a first instruction and a second instruction that are executed continuously;

[0063] Before responding to the interactive instruction, the method further includes:

[0064] Determine a first calibrated position of any monitoring point in the visible area when the first instruction is executed, and determine a second calibrated position of the monitoring point when the second instruction is executed;

[0065] Determining a distance difference according to the first calibrated position and the second calibrated position;

[0066] Determining a time difference according to the execution time of the first instruction and the execution time of the second instruction;

[0067] The sliding speed of the file is determined according to the distance difference and the time difference.

[0068] Optionally, the present invention continuously executes the first instruction and the second instruction, for example, the user continuously executes the mouse wheel scrolling downward corresponding to the first instruction, and scrolling downward again corresponding to the second instruction, and then determines the first calibrated position of the monitoring point in the visible area when executing the first instruction, determines the second calibrated position of the monitoring point when executing the second instruction, and then calculates the distance difference between them according to the first calibrated position and the second calibrated position. While determining the distance difference, the present invention determines the time interval of the user operation according to the time difference between the execution moments of the first instruction and the second instruction. After determining the distance difference and the time difference, the present invention can determine the file sliding speed corresponding to the user operation through the distance difference and the time difference. This speed information can be used to adjust the order and speed of preloaded files to ensure the smoothness and immediacy of user operations, and provide data support for subsequent buffer area size adjustment.

[0069] Optionally, when the sliding speed of the file is greater than or equal to a preset speed, after responding to the interaction instruction, the method further includes:

[0070] When the interactive instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is adjusted to the maximum and the lower buffer area is deleted; when the interactive instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is adjusted to the maximum and the upper buffer area is deleted.

[0071] When the system detects that the file sliding speed is greater than or equal to the preset speed during user operation, that is, when the user slides the file quickly, for example, sliding downward, it is necessary to adjust the area size of the lower buffer area to the maximum, so that more files can be loaded, thereby improving the response speed and smoothness of the file preview. Since the user's quick sliding is a continuous action, the user will not preview the files in the upper buffer area, and then delete the upper buffer area.

[0072] The present invention provides a method for adjusting the size of a buffer area and deleting unnecessary buffer areas when a file sliding speed is greater than or equal to a preset speed. The present invention can dynamically adjust the file preloading strategy according to the speed and direction of the user operation, thereby improving the file preview efficiency and user experience.

[0073] Optionally, when the sliding speed of the file is less than a preset speed, increasing the size of the upper buffer area and reducing the size of the lower buffer area includes:

[0074] (1)

[0075] in, To increase the size of the upper back buffer area, To increase the size of the front upper buffer area, is the first preset coefficient, To reduce the size of the rear lower buffer area, To reduce the size of the front lower buffer area, is the second preset coefficient, The sliding speed of the file.

[0076] Optionally, according to , when the sliding speed is slower, the area of ​​the upper buffer area increases less, and when the sliding speed is faster, the area of ​​the upper buffer area increases more; similarly, according to When the sliding speed is slower, the area of ​​the lower buffer area is reduced less, and when the sliding speed is faster, the area of ​​the lower buffer area is reduced more. Through this strategy of adaptively adjusting the buffer size, the present invention can effectively improve the performance of the file sliding buffer. When the sliding speed is slow, the upper buffer area can be increased while the lower buffer area can be better taken into account. When the sliding speed is fast, the lower buffer area can be reduced to free up more space for the upper buffer area, thereby improving the overall buffering performance.

[0077] Optionally, when the sliding speed of the file is less than a preset speed, increasing the area size of the lower buffer area and reducing the area size of the upper buffer area includes:

[0078] (2)

[0079] in, To reduce the size of the upper back buffer area, To reduce the size of the front upper buffer area, is the third preset coefficient, To increase the size of the lower back buffer area, To increase the size of the front lower buffer area, is the fourth preset coefficient, The sliding speed of the file.

[0080] Optionally, according to , when the sliding speed is slower, the area of ​​the upper buffer area decreases more slowly, and when the sliding speed is faster, the area of ​​the upper buffer area decreases more; similarly, according to , when the sliding speed is slower, the area of ​​the lower buffer area increases less, and when the sliding speed is faster, the area of ​​the lower buffer area increases more. Similarly, through this strategy of adaptively adjusting the buffer size, the present invention can effectively improve the performance of the file sliding buffer. When the sliding speed is slow, the upper buffer area can be better taken into account while increasing the lower buffer area. When the sliding speed is fast, the upper buffer area can be reduced as much as possible to free up more space for the lower buffer area, thereby improving the overall buffering performance.

[0081] Optionally, the target document includes all initial images, and after receiving a preview instruction from a user and before responding to the preview instruction, the method further includes:

[0082] Using a preset image processing library to compress and convert the formats of all the initial images in the target document to obtain all processed images;

[0083] For each processed image, determining that a processed image whose size is larger than a preset size is an image to be cropped, and cropping the image to be cropped to obtain all cropped images;

[0084] Determine that all cropped images and all processed images that have not been cropped are files in the target document.

[0085] Optionally, after the user issues a preview instruction, the present invention processes all initial images in the target document before responding to the preview instruction, and uses a preset image processing library to compress and convert the format of all initial images in the target document to improve the file loading speed and reduce the file size. For each processed image, it is determined whether its size is larger than a preset size. If larger, it is marked as a picture to be cropped, and a cropping operation is performed on all images marked as to be cropped to ensure that they meet the preset size requirements, and all cropped images and uncropped images are determined as all files in the target document.

[0086] Optionally, displaying all files in the visible area using a virtual list in the preview interface includes:

[0087] Determine all file contents in the visible area according to the size of the visible area and the target view size of each file;

[0088] Displaying all the files in a preview interface using a virtual list;

[0089] The target view size is determined by adjusting the preset view size according to the user's display requirements.

[0090] Optionally, the present invention first obtains the size of the visible area of ​​the current preview interface, such as width and height, and the user can dynamically adjust the preset view size according to the preview requirements and historical habits to determine the target view size, and then record the files in the visible area according to the target view size of each file to form a file list. Using virtual list technology, only the file content in the visible area is rendered, and files beyond the visible area are preloaded but not rendered. The possibility of scrolling operation for sliding preview is provided, and when the scroll position changes, the file content in the virtual list is dynamically updated. The present invention can greatly improve the preview performance and achieve smooth display even when there are a large number of files. At the same time, it supports users to customize the file view size to improve the user experience.

[0091] Optionally, after responding to the interaction instruction, the method further includes:

[0092] After the file enters the visible area, the file is loaded after a preset delay;

[0093] The preset time length is 40ms to 60ms.

[0094] Optionally, when a file enters the visible area, the content of the file is not loaded immediately, but rather waits for a preset period of time before loading, which can usually be set between 40 milliseconds and 60 milliseconds and adjusted according to system performance and user experience. The present invention can reduce the pressure on the system to load a large number of files in real time, improve system operating efficiency, and prevent users from being stuck when scrolling the preview interface due to the sudden loading of a large number of files. When the file is a picture, the loading will be delayed by 50ms after the picture enters the view range to ensure that the picture really needs to be loaded. Through lazy loading technology, the present invention can further optimize resource usage to ensure that only pictures that users need to view are loaded.

[0095] Optionally, before loading the file, the method further includes:

[0096] Create an AbortController instance. When initiating a Fetch request, pass the Signal property of AbortController as the Signal option to the Fetch request to establish a signal chain. When any file enters the visible area but has not been loaded and has slid out of the visible area, call abort() of AbortController to terminate the loading of the file.

[0097] Optionally, the user of the present invention utilizes the scrolling preview interface, and when a file is about to enter the visible area, the system creates an AbortController instance and binds it to the Fetch request corresponding to the file. If the file has not been loaded or has slid out of the visible area, the abort() method of AbortController is called to terminate the loading operation. The present invention uses an interrupt mechanism to stop loading, release system resources, improve the utilization efficiency of system resources, and avoid unnecessary file loading operations.

[0098] Figure 3 It is a structural schematic diagram of the file loading device provided by the present invention, and the file loading device includes a first receiving unit 1, and the first receiving unit is used to receive a user's preview instruction, and the preview instruction is used to instruct to preview the file in the target document. The working principle of the first receiving unit 1 can refer to the aforementioned step 101 and will not be repeated here.

[0099] The file loading device also includes a first response unit 2, which is used to respond to the preview instruction and display all files in the visible area in the preview interface using a virtual list. The virtual list includes an upper buffer area, the visible area and a lower buffer area. The file includes at least one of a picture, a video and an audio. The working principle of the first response unit 2 can refer to the aforementioned step 102 and will not be repeated here.

[0100] The file loading device also includes a second receiving unit 3, which is used to receive user interaction instructions, and the interaction instructions are used to instruct previewing the upper area file or the lower area file of the visible area. The interaction instructions are generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control. The working principle of the second receiving unit 3 can refer to the aforementioned step 103 and will not be repeated here.

[0101] The file loading device also includes a second response unit 4, which is used to respond to the interactive instruction. When the interactive instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased and the area size of the lower buffer area is reduced; when the interactive instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased and the area size of the upper buffer area is reduced. The working principle of the second response unit 4 can refer to the aforementioned step 104 and will not be repeated here.

[0102] The present invention uses a virtual list to display all files in a visible area in a preview interface, and the virtual list includes an upper buffer area, a visible area, and a lower buffer area. When controlling the mouse wheel to scroll or clicking the up and down buttons of the control to preview the upper area file or the lower area file of the visible area, when the interactive instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased, and the area size of the lower buffer area is reduced; when the interactive instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased, and the area size of the upper buffer area is reduced. The present invention only displays the files in the user's current view, and can dynamically adjust the upper and lower buffers according to the sliding direction for pre-loading, further optimize the rapid display of files, further release space and improve speed, and the files in the sliding direction will obtain more resources and load faster, thereby reducing bandwidth consumption and server pressure.

[0103] Figure 4 Schematic diagram of the structure of the electronic device provided by the present invention. Figure 4As shown, the electronic device may include: a processor (processor) 410 , a communication interface (CommunicationsInterface) 420 , a memory (memory) 430 and a communication bus 440 , wherein the processor 410 , the communication interface 420 , and the memory 430 communicate with each other through the communication bus 440 . The processor 410 can call the logic instructions in the memory 430 to execute the file loading method, which includes: receiving a preview instruction from a user, wherein the preview instruction is used to instruct to preview the files in the target document; in response to the preview instruction, displaying all files in the visible area in a preview interface using a virtual list, wherein the virtual list includes an upper buffer area, the visible area, and a lower buffer area, and the files include at least one of pictures, videos, and audios; receiving an interaction instruction from a user, wherein the interaction instruction is used to instruct to preview the upper area file or the lower area file of the visible area, wherein the interaction instruction is generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control; in response to the interaction instruction, when the interaction instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased, and the area size of the lower buffer area is reduced; when the interaction instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased, and the area size of the upper buffer area is reduced.

[0104] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0105] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a file loading method provided by the above methods, the method including: receiving a preview instruction from a user, the preview instruction is used to instruct to preview the files in the target document; in response to the preview instruction, using a virtual list to display all files in the visible area in the preview interface, the virtual list includes an upper buffer area, the visible area and a lower buffer area, and the file includes at least one of a picture, a video, and an audio; receiving an interaction instruction from a user, the interaction instruction is used to instruct to preview the upper area file or the lower area file of the visible area, and the interaction instruction is generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control; in response to the interaction instruction, when the interaction instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased, and the area size of the lower buffer area is reduced; when the interaction instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased, and the area size of the upper buffer area is reduced.

[0106] On the other hand, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to execute the file loading method provided by the above methods, the method comprising: receiving a preview instruction from a user, the preview instruction is used to instruct to preview the files in the target document; in response to the preview instruction, using a virtual list to display all files in the visible area in the preview interface, the virtual list includes an upper buffer area, the visible area and a lower buffer area, and the files include at least one of pictures, videos, and audios; receiving an interaction instruction from a user, the interaction instruction is used to instruct to preview the upper area file or the lower area file of the visible area, and the interaction instruction is generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control; in response to the interaction instruction, when the interaction instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased, and the area size of the lower buffer area is reduced; when the interaction instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased, and the area size of the upper buffer area is reduced.

[0107] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A file loading method, characterized in that: include: Receiving a preview instruction from a user, wherein the preview instruction is used to instruct to preview a file in a target document; In response to the preview instruction, displaying all files in the visible area in the preview interface using a virtual list, the virtual list including an upper buffer area, the visible area and a lower buffer area, and the file including at least one of a picture, a video and an audio; Receiving a user's interactive instruction, wherein the interactive instruction is used to instruct to preview the upper area file or the lower area file of the visible area, and the interactive instruction is generated after the user controls the mouse wheel to scroll or clicks the up and down buttons of the control; In response to the interaction instruction, when the interaction instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is increased and the area size of the lower buffer area is reduced; when the interaction instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is increased and the area size of the upper buffer area is reduced.

2. The file loading method according to claim 1, characterized in that: The interactive instruction includes a first instruction and a second instruction that are executed continuously; the first instruction is generated according to the mouse wheel scrolling downward, and the second instruction is generated according to the mouse wheel scrolling downward again; Before responding to the interactive instruction, the method further includes: Determine a first calibrated position of any monitoring point in the visible area when the first instruction is executed, and determine a second calibrated position of the monitoring point when the second instruction is executed; Determining a distance difference according to the first calibrated position and the second calibrated position; Determining a time difference according to the execution time of the first instruction and the execution time of the second instruction; The sliding speed of the file is determined according to the distance difference and the time difference.

3. The file loading method according to claim 2, characterized in that: When the sliding speed of the file is greater than or equal to a preset speed, after responding to the interaction instruction, the method further includes: When the interactive instruction is to preview the upper area file of the visible area, the area size of the upper buffer area is adjusted to the maximum and the lower buffer area is deleted; when the interactive instruction is to preview the lower area file of the visible area, the area size of the lower buffer area is adjusted to the maximum and the upper buffer area is deleted.

4. The file loading method according to claim 2, characterized in that: When the sliding speed of the file is less than a preset speed, increasing the size of the upper buffer area and reducing the size of the lower buffer area includes: ; in, To increase the size of the upper back buffer area, To increase the size of the front upper buffer area, is the first preset coefficient, To reduce the size of the rear lower buffer area, To reduce the size of the front lower buffer area, is the second preset coefficient, The sliding speed of the file.

5. The file loading method according to claim 2, characterized in that: When the sliding speed of the file is less than a preset speed, increasing the area size of the lower buffer area and reducing the area size of the upper buffer area includes: ; in, To reduce the size of the upper back buffer area, To reduce the size of the front upper buffer area, is the third preset coefficient, To increase the size of the lower back buffer area, To increase the size of the front lower buffer area, is the fourth preset coefficient, The sliding speed of the file.

6. The file loading method according to claim 1, characterized in that: The target document includes all initial images. After receiving a preview instruction from a user and before responding to the preview instruction, the method further includes: Using a preset image processing library to compress and convert the formats of all the initial images in the target document to obtain all processed images; For each processed image, determining that a processed image whose size is larger than a preset size is an image to be cropped, and cropping the image to be cropped to obtain all cropped images; Determine that all cropped images and all processed images that have not been cropped are files in the target document.

7. The file loading method according to claim 1, characterized in that: The virtual list is used to display all files in the visible area in the preview interface, including: Determine all file contents in the visible area according to the size of the visible area and the target view size of each file; Displaying all the files in a preview interface using a virtual list; The target view size is determined by adjusting the preset view size according to the user's display requirements.

8. The file loading method according to claim 1, characterized in that: After responding to the interaction instruction, the method further includes: After the file enters the visible area, the file is loaded after a preset delay; The preset time length is 40ms to 60ms.

9. The file loading method according to claim 8, characterized in that: Before loading the file, the method further includes: Create an AbortController instance. When initiating a Fetch request, pass the Signal property of AbortController as the Signal option to the Fetch request to establish a signal chain. When any file enters the visible area but has not been loaded and has slid out of the visible area, call abort() of AbortController to terminate the loading of the file.

10. A file loading device, characterized in that: include: A first receiving unit, the first receiving unit is used to receive a preview instruction from a user, the preview instruction is used to instruct to preview a file in a target document; a first response unit, the first response unit being used to respond to the preview instruction and display all files in the visible area in the preview interface using a virtual list, the virtual list including an upper buffer area, the visible area and a lower buffer area, and the files including at least one of pictures, videos and audios; a second receiving unit, the second receiving unit being used to receive an interaction instruction from a user, the interaction instruction being used to instruct to preview an upper area file or a lower area file of the visible area, the interaction instruction being generated after the user controls the mouse wheel to scroll or clicks an up or down button of a control; A second response unit, the second response unit is used to respond to the interaction instruction, and when the interaction instruction is to preview the upper area file of the visible area, increase the area size of the upper buffer area and reduce the area size of the lower buffer area; when the interaction instruction is to preview the lower area file of the visible area, increase the area size of the lower buffer area and reduce the area size of the upper buffer area.