Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a picture loading method provided in an embodiment of the present disclosure, where an execution subject of the method may be a terminal device, and as shown in fig. 1, the method may include:
step S101, when a picture loading triggering operation is acquired, whether the network quality at the current moment meets a preset condition is judged based on the loading duration of the historical picture, wherein the picture loading triggering operation is used for triggering the loading of a first sampling picture corresponding to the acquired target picture, and the preset condition is used for judging that the network quality is better than a set standard.
The image loading triggering operation may be understood as an instruction for loading an image, and may be a click or other touch operation of a user on a specific interface of an application program, or specific voice information or text information input by the user on the specific interface of the application program.
Specifically, when the terminal receives a picture loading instruction, in order to determine which picture to subsequently load, the network quality at the current time is evaluated, and whether the network quality at the current time meets a preset condition is judged. The preset condition is a set standard for measuring the network quality, and if the preset condition is met, the network quality is superior to the set standard.
Step S102, if the network quality at the current moment meets a preset condition, a loading request is sent to a server, wherein the loading request is used for requesting to load a second sampling picture corresponding to a target picture, and the sampling rate of the second sampling picture is greater than that of the first sampling picture.
Step S103, receiving a storage address corresponding to the second sampling picture returned by the server in response to the loading request, and loading the second sampling picture based on the storage address.
And for the same picture loading triggering operation, the corresponding first sampling picture and the second sampling picture are both from the same original picture, but the picture quality of the second sampling picture is high, namely the first sampling picture. Specifically, the first sample picture is compressed from the original picture, the storage space required in the transmission process is small, and the first sample picture can be loaded at a picture loading speed under various network speed conditions, and the second sample picture can also be compressed from the original picture or is the original picture. The picture compression generally includes two processing procedures, one is to sample an original picture according to a certain sampling rate, so that the compressed picture contains fewer pixels in a unit size to reduce the storage space of the picture, and the lower the sampling rate is, the fewer pixels in the unit size (i.e. the lower the resolution is); and secondly, the high-frequency filtering is carried out on the original picture, and partial high-frequency details in the original picture are filtered to reduce the storage space of the picture, and the processing processes in the two aspects can reduce the storage space of the picture, but can also cause the picture quality to be reduced. Since high-frequency filtering is always present and the effect remains stable when the same picture is compressed in various degrees, the picture quality of the compressed picture obtained after compression is mainly determined by sampling compression, in other words, for the same original picture, the picture quality of the compressed picture can be measured by the size of the sampling rate in the process of obtaining each compressed picture. In summary, the reason why the picture quality of the second sampled picture is higher than that of the first sampled picture is that the sampling rate corresponding to the replacement picture is higher than that corresponding to the preset picture in the compression process, or the second sampled picture is not compressed, that is, the second sampled picture is the original picture. Further, it can be understood that, for a compressed picture of the same original picture, the resolution of the compressed picture corresponding to the high sampling rate is higher than that of the compressed picture corresponding to the low sampling rate during the compression process, that is, the resolution of the second sampled picture is considered to be higher than that of the first sampled picture.
It should be noted that the second sampled picture may include an original picture and a plurality of compressed pictures with different resolutions, and when the second sampled picture is specifically loaded, the second sampled picture may be selected to be loaded according to actual requirements or preset rules.
Specifically, if the network quality at the current moment meets the preset condition, it is indicated that the network quality at the current moment can meet the requirement of loading a picture with a larger storage space (or higher resolution), and in this case, in order to improve the display effect of the picture corresponding to the picture loading trigger operation, the terminal selects to load a second sampling picture with better picture quality (better display effect).
For example, a user uses a news APP to obtain news information through a mobile phone, the user clicks a news title under the APP interface, the APP displays news content corresponding to the title, the news content includes a picture, the mobile phone can directly load a preset picture corresponding to the picture in the prior art, and in the scheme disclosed by the disclosure, when the user clicks the news title, the mobile phone can evaluate the network quality at the current moment, judge whether the network quality at the current moment meets the preset condition, if so, a first sampling picture corresponding to the picture can not be loaded, but a second sampling picture corresponding to the picture is loaded, because the display effect of the second sampling picture is better, the use experience of the user is improved. Meanwhile, due to the fact that the network quality is good, even if the storage space of the second sampling picture is larger than the preset picture, the picture loading speed cannot be influenced.
According to the scheme provided by the disclosure, when the picture loading triggering operation is acquired, the network quality at the current moment is evaluated, and if the network quality at the current moment is better, the picture loading quality is higher than the replacement picture of the preset picture corresponding to the picture loading triggering operation, so that the picture loading speed is not influenced, the picture display effect is improved, and the use experience of a user is improved.
In an optional embodiment of the present disclosure, the determining whether the network quality at the current time meets a preset condition based on the loading duration of the historical picture includes:
acquiring historical loading durations corresponding to a preset number of historical pictures before the current moment, and determining an average value of the historical loading durations;
when the maximum time length in the loading time lengths of the preset number of historical pictures is smaller than a first preset threshold value and the average value is smaller than a second preset threshold value, determining that the network quality at the current moment meets a preset condition, otherwise, determining that the network quality at the current moment does not meet the preset condition, wherein the first preset threshold value is larger than the second preset threshold value.
The method for evaluating the network quality has various methods, and the picture loading time is used as an evaluation factor in the method.
Specifically, historical data before the current time is obtained, starting time and ending time of loading a plurality of pictures are obtained from the historical data, a plurality of historical loading durations are obtained, whether the maximum historical loading duration in the plurality of historical loading durations is not greater than a first preset threshold value or not is evaluated, if the maximum historical loading duration is greater than the first preset threshold value, the evaluation is ended, and the network quality at the current time does not meet preset conditions; if the maximum historical loading duration is not greater than a first preset threshold, calculating an average value of the multiple historical loading durations, if the average value is not greater than a second preset threshold, the network quality at the current moment meets a preset condition, otherwise, the network quality at the current moment does not meet the preset condition. The first preset threshold is greater than the second preset threshold, for example, the first preset threshold may be twice the second preset threshold.
In an optional embodiment of the present disclosure, before sending the load request to the server, the method may further include:
and sending the display parameters of the terminal equipment to the server so that the server obtains the sampling rate of the second sampling picture based on the display parameters, obtains the first sampling picture and the second sampling picture based on the sampling rate of the second sampling picture, and stores the second sampling picture according to the network storage address.
For example, for a mobile phone with a display resolution of 1080P, the resolution of the preset picture set by the server is generally 720P, and the resolution of the corresponding replacement picture can be 1080P or the resolution of the original picture (i.e., no compression processing is performed).
Specifically, after setting various types of pictures, the server stores the pictures in corresponding network storage addresses, and sends the network storage addresses to the terminal device, and the terminal device determines which type of picture is loaded, and then loads the corresponding picture in the corresponding network address.
It should be noted that the server may also set a fixed network storage address generation rule, and after determining what type of picture is loaded, the terminal device may generate a corresponding network storage address according to the rule and access the network storage address to load the corresponding picture. For example, the specific form of the network storage address may be: 720p picture- > domain name/img/uri +720, 1080p picture- > domain name/img/uri +1080, original picture- > domain name/origin/uri, and the like.
In an optional embodiment of the disclosure, the method may further comprise:
when the picture loading triggering operation is obtained, the number of the picture loading tasks at the current moment is obtained;
if at least two picture loading tasks exist at the current moment, determining the priority level of each picture loading task;
determining the execution sequence of the corresponding picture loading tasks from front to back based on the sequence of the priority levels of the picture loading tasks from high to low;
loading a second sample picture based on the storage address, comprising:
determining an execution sequence of the picture loading tasks corresponding to the picture loading trigger operation based on the execution sequence of each picture loading task;
and loading the second sampling picture based on the execution sequence and the storage address of the picture loading task corresponding to the picture loading trigger operation.
Each picture loading trigger operation corresponds to a picture loading task to be executed, a plurality of picture loading tasks often exist at the same time when an application program runs, in order to enable the picture loading tasks to be completed orderly and provide the best experience for a user, the priority level of each picture loading task needs to be determined, and each picture loading task is executed according to the priority level from high to low.
Specifically, when a new picture loading triggering operation is acquired, one or more new picture loading tasks are acquired, the number of the current picture loading tasks waiting to be executed is counted, if the number of the current picture loading tasks is not less than two, the priority level of each picture loading task needs to be determined, and after the priority levels are determined, each picture loading task is executed in sequence from high to low according to the priority level of each picture loading task.
In an optional embodiment of the present disclosure, determining a priority level of each picture loading task includes:
acquiring the operation type and the acquisition time of the picture loading trigger operation corresponding to each picture loading task;
and determining the priority level of each picture loading task based on the operation type and the acquisition time corresponding to each picture loading task.
Specifically, different operation types and sending times (corresponding to the acquisition times of the terminals) of the image loading triggering operation sent by the user reflect different intentions of the user, and according to the operation types and the sending times, which images the user wants to see first can be judged, so that the priority levels of the images should be higher, in other words, the priority levels of each image loading task can be determined according to the operation types and the sending times of the image loading triggering operation.
In an alternative embodiment of the disclosure, the operation types include: the method comprises the following steps of performing content viewing operation and content refreshing operation, and determining the priority level of each picture loading task based on the operation type and the acquisition time corresponding to each picture loading task, wherein the steps comprise:
determining the picture loading task with the operation type corresponding to the content viewing operation in all the picture loading tasks as the highest priority level;
aiming at picture loading tasks corresponding to each image loading triggering operation with the operation type of content refreshing operation, correspondingly determining the priority level of each picture loading task from high to low according to the sequence from near to far of the acquisition time;
and aiming at the picture loading tasks corresponding to the same image loading triggering operation with the operation type of content refreshing operation, the priority level of each picture loading task is correspondingly determined from high to low according to the display sequence of the corresponding pictures from first to last.
The picture loading triggering operation with the operation type of the content viewing operation is generally a clicking operation of a user on a specific content, which indicates that the user wants to view the content immediately, i.e., view a picture in the content. The picture loading triggering operation with the operation type of the content refreshing operation is generally an operation of refreshing a current page by a user, and indicates that the user wants an application program to update more contents for subsequent viewing, that is, the user wants to subsequently view pictures corresponding to the updated contents, and when the user receives the refreshing operation, the terminal preloads the pictures in the updated contents to be provided, so that the pictures can be directly displayed when the user subsequently views the pictures. According to the above description, the picture loading triggering operation whose operation type is the content viewing operation generates one picture loading task, and the picture loading task is relatively urgent and has a higher priority level, while the picture loading triggering operation whose operation type is the content refreshing operation generates a plurality of picture recording tasks, and the plurality of picture loading tasks are not urgent as the picture loading tasks corresponding to the content viewing operation, and their priority levels should be lower than the picture loading tasks corresponding to the content viewing operation.
Specifically, the picture loading task corresponding to the picture loading trigger operation whose operation type is the content viewing operation among all the queued picture loading tasks at the current time is determined to be the highest priority level, and when the picture loading task is generated, the execution sequence of the picture loading task is ranked at the top, or when the picture loading task is generated, other picture loading tasks being executed can be interrupted to execute the picture loading task in a limited manner.
When a plurality of image loading tasks corresponding to content refreshing operations are carried out at the current moment (each batch of image loading tasks corresponds to the same content refreshing operation), the priority level is determined according to the acquisition time corresponding to the content refreshing operation, and it can be understood that the image loading tasks corresponding to the content refreshing operations with the closer acquisition time are more likely to be completed by a user, and then the image loading tasks corresponding to the image loading triggering operations with the operation types of the content refreshing operations are correspondingly determined according to the sequence of the acquisition time from near to far, wherein the sequence of the priority levels of the image loading tasks is from high to low.
In addition, in the picture loading tasks corresponding to the same content refreshing operation, the picture loading tasks corresponding to the pictures in the content displayed to the user earlier are more urgent, so that the picture loading tasks corresponding to the same image loading triggering operation with the operation type of the content refreshing operation are determined according to the display sequence of the corresponding pictures from first to last, wherein the priority level of each picture loading task is from high to low.
It should be noted that, another type of priority level is a designated priority level, that is, the priority level of some designated picture loading tasks is pre-designated. For example, a picture loading task corresponding to a picture of advertising content in an application may be specified to have a higher priority than all other picture loading tasks.
In an optional embodiment of the present disclosure, acquiring the number of picture loading tasks at the current time includes:
and at the current moment, if the same second sampling picture respectively corresponds to the picture loading task corresponding to the content viewing operation and the picture loading task corresponding to the content refreshing operation, deleting the picture loading task corresponding to the content refreshing operation.
Specifically, the same picture loading task may belong to both a content refresh operation and a content view operation, for example, if a user needs to view a newly displayed content, and the preloading of a picture corresponding to the content is not yet completed, that is, the picture corresponds to both the content refresh operation and the content view operation, at this time, only the picture recording task corresponding to the content view operation needs to be executed, and the picture loading task of the content refresh operation corresponding to the picture waiting to be executed in the queue is terminated, so as to avoid redundant computation.
Fig. 2 is a block diagram of a picture loading apparatus according to an embodiment of the disclosure, and as shown in fig. 2, the apparatus 200 may include: a network judgment module 201, a loading request sending module 202 and a picture loading module 203, wherein:
the network judging module 201 is configured to judge whether the network quality at the current time meets a preset condition based on a loading duration of a historical picture when a picture loading triggering operation is obtained, where the picture loading triggering operation is used to trigger the loading of a first sampling picture corresponding to an obtained target picture, and the preset condition is used to judge that the network quality is better than a set standard;
the loading request sending module 202 is configured to send a loading request to the server if the network quality at the current time meets a preset condition, where the loading request is used to request loading of a second sampling picture corresponding to the target picture, and a sampling rate of the second sampling picture is greater than a sampling rate of the first sampling picture;
the picture loading module 203 is configured to receive a storage address corresponding to a second sampling picture returned by the server in response to the loading request, and load the second sampling picture based on the storage address.
According to the scheme provided by the disclosure, when the picture loading triggering operation is acquired, the network quality at the current moment is evaluated, and if the network quality at the current moment is better, the picture loading quality is higher than the replacement picture of the preset picture corresponding to the picture loading triggering operation, so that the picture loading speed is not influenced, the picture display effect is improved, and the use experience of a user is improved.
In an optional embodiment of the present disclosure, the network determining module is specifically configured to:
acquiring historical loading durations corresponding to a preset number of historical pictures before the current moment, and determining an average value of the historical loading durations;
when the maximum time length in the loading time lengths of the preset number of historical pictures is smaller than a first preset threshold value and the average value is smaller than a second preset threshold value, determining that the network quality at the current moment meets a preset condition, otherwise, determining that the network quality at the current moment does not meet the preset condition, wherein the first preset threshold value is larger than the second preset threshold value.
In an optional embodiment of the present disclosure, the apparatus may further include a network storage address receiving module, configured to:
before sending a loading request to the server, sending display parameters of the terminal device to the server, so that the server obtains the sampling rate of the second sampling picture based on the display parameters, obtains the first sampling picture and the second sampling picture based on the sampling rate of the second sampling picture, and stores the second sampling picture according to a network storage address.
In an optional embodiment of the present disclosure, the apparatus may further include a priority determining module configured to:
when the picture loading triggering operation is obtained, the number of the picture loading tasks at the current moment is obtained;
if at least two picture loading tasks exist at the current moment, determining the priority level of each picture loading task;
determining the execution sequence of the corresponding picture loading tasks from front to back based on the sequence of the priority levels of the picture loading tasks from high to low;
correspondingly, the picture loading module is specifically configured to:
determining an execution sequence of the picture loading tasks corresponding to the picture loading trigger operation based on the execution sequence of each picture loading task;
and loading the second sampling picture based on the execution sequence and the storage address of the picture loading task corresponding to the picture loading trigger operation.
In an optional embodiment of the present disclosure, the priority determining module is specifically configured to:
acquiring the operation type and the acquisition time of the picture loading trigger operation corresponding to each picture loading task;
and determining the priority level of each picture loading task based on the operation type and the acquisition time corresponding to each picture loading task.
In an alternative embodiment of the disclosure, the operation types include: the priority determining module is specifically configured to:
determining the picture loading task with the operation type corresponding to the content viewing operation in all the picture loading tasks as the highest priority level;
aiming at picture loading tasks corresponding to each image loading triggering operation with the operation type of content refreshing operation, correspondingly determining the priority level of each picture loading task from high to low according to the sequence from near to far of the acquisition time;
and aiming at the picture loading tasks corresponding to the same image loading triggering operation with the operation type of content refreshing operation, the priority level of each picture loading task is correspondingly determined from high to low according to the display sequence of the corresponding pictures from first to last.
In an optional embodiment of the disclosure, the priority determination module is further configured to:
and at the current moment, if the same second sampling picture respectively corresponds to the picture loading task corresponding to the content viewing operation and the picture loading task corresponding to the content refreshing operation, deleting the picture loading task corresponding to the content refreshing operation.
Referring now to fig. 3, shown is a schematic diagram of an electronic device (e.g., a terminal device or server that performs the method shown in fig. 1) 300 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device includes: a memory and a processor, wherein the processor may be referred to as a processing device 301 described below, and the memory may include at least one of a Read Only Memory (ROM)302, a Random Access Memory (RAM)303, and a storage device 308, which are described below:
as shown in fig. 3, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM303, various programs and data necessary for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM302, and the RAM303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 300 to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable storage medium of the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
when a picture loading triggering operation is acquired, judging whether the network quality at the current moment meets a preset condition or not based on the loading duration of a historical picture, wherein the picture loading triggering operation is used for triggering the loading of a first sampling picture corresponding to an acquired target picture, and the preset condition is used for judging that the network quality is superior to a set standard; if the network quality at the current moment meets a preset condition, sending a loading request to a server, wherein the loading request is used for requesting to load a second sampling picture corresponding to the target picture, and the sampling rate of the second sampling picture is greater than that of the first sampling picture; and receiving a storage address corresponding to the second sampling picture returned by the server in response to the loading request, and loading the second sampling picture based on the storage address.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. The name of a module or a unit does not in some cases constitute a limitation of the unit itself, and for example, the network judgment module may also be described as a "module for judging a network".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, the present disclosure provides a picture loading method including:
when a picture loading triggering operation is acquired, judging whether the network quality at the current moment meets a preset condition or not based on the loading duration of a historical picture, wherein the picture loading triggering operation is used for triggering the loading of a first sampling picture corresponding to an acquired target picture, and the preset condition is used for judging that the network quality is superior to a set standard;
if the network quality at the current moment meets a preset condition, sending a loading request to a server, wherein the loading request is used for requesting to load a second sampling picture corresponding to the target picture, and the sampling rate of the second sampling picture is greater than that of the first sampling picture;
and receiving a storage address corresponding to the second sampling picture returned by the server in response to the loading request, and loading the second sampling picture based on the storage address.
According to one or more embodiments of the present disclosure, determining whether the network quality at the current time meets a preset condition based on the loading duration of the historical picture includes:
acquiring historical loading durations corresponding to a preset number of historical pictures before the current moment, and determining an average value of the historical loading durations;
when the maximum time length in the loading time lengths of the preset number of historical pictures is smaller than a first preset threshold value and the average value is smaller than a second preset threshold value, determining that the network quality at the current moment meets a preset condition, otherwise, determining that the network quality at the current moment does not meet the preset condition, wherein the first preset threshold value is larger than the second preset threshold value.
According to one or more embodiments of the present disclosure, before sending the load request to the server, the method further includes:
and sending the display parameters of the terminal equipment to the server so that the server obtains the sampling rate of the second sampling picture based on the display parameters, obtains the first sampling picture and the second sampling picture based on the sampling rate of the second sampling picture, and stores the second sampling picture according to the network storage address.
In accordance with one or more embodiments of the present disclosure, the method further comprises:
when the picture loading triggering operation is obtained, the number of the picture loading tasks at the current moment is obtained;
if at least two picture loading tasks exist at the current moment, determining the priority level of each picture loading task;
determining the execution sequence of the corresponding picture loading tasks from front to back based on the sequence of the priority levels of the picture loading tasks from high to low;
loading a second sample picture based on the storage address, comprising:
determining an execution sequence of the picture loading tasks corresponding to the picture loading trigger operation based on the execution sequence of each picture loading task;
and loading the second sampling picture based on the execution sequence and the storage address of the picture loading task corresponding to the picture loading trigger operation.
According to one or more embodiments of the present disclosure, determining a priority level of each picture loading task includes:
acquiring the operation type and the acquisition time of the picture loading trigger operation corresponding to each picture loading task;
and determining the priority level of each picture loading task based on the operation type and the acquisition time corresponding to each picture loading task.
According to one or more embodiments of the present disclosure, the operation types include: the method comprises the following steps of performing content viewing operation and content refreshing operation, and determining the priority level of each picture loading task based on the operation type and the acquisition time corresponding to each picture loading task, wherein the steps comprise:
determining the picture loading task with the operation type corresponding to the content viewing operation in all the picture loading tasks as the highest priority level;
aiming at picture loading tasks corresponding to each image loading triggering operation with the operation type of content refreshing operation, correspondingly determining the priority level of each picture loading task from high to low according to the sequence from near to far of the acquisition time;
and aiming at the picture loading tasks corresponding to the same image loading triggering operation with the operation type of content refreshing operation, the priority level of each picture loading task is correspondingly determined from high to low according to the display sequence of the corresponding pictures from first to last.
According to one or more embodiments of the present disclosure, acquiring the number of picture loading tasks at the current time includes:
and at the current moment, if the same second sampling picture respectively corresponds to the picture loading task corresponding to the content viewing operation and the picture loading task corresponding to the content refreshing operation, deleting the picture loading task corresponding to the content refreshing operation.
According to one or more embodiments of the present disclosure, there is provided a picture loading apparatus including:
the network judgment module is used for judging whether the network quality at the current moment meets a preset condition or not based on the loading duration of the historical picture when the picture loading trigger operation is obtained, wherein the picture loading trigger operation is used for triggering the loading of the first sampling picture corresponding to the obtained target picture, and the preset condition is used for judging that the network quality is superior to a set standard;
the loading request sending module is used for sending a loading request to the server if the network quality at the current moment meets a preset condition, wherein the loading request is used for requesting to load a second sampling picture corresponding to the target picture, and the sampling rate of the second sampling picture is greater than that of the first sampling picture;
and the picture loading module is used for receiving a storage address corresponding to the second sampling picture returned by the server in response to the loading request and loading the second sampling picture based on the storage address.
According to one or more embodiments of the present disclosure, the network determining module is specifically configured to:
acquiring historical loading durations corresponding to a preset number of historical pictures before the current moment, and determining an average value of the historical loading durations;
when the maximum time length in the loading time lengths of the preset number of historical pictures is smaller than a first preset threshold value and the average value is smaller than a second preset threshold value, determining that the network quality at the current moment meets a preset condition, otherwise, determining that the network quality at the current moment does not meet the preset condition, wherein the first preset threshold value is larger than the second preset threshold value.
According to one or more embodiments of the present disclosure, the apparatus may further include a network storage address receiving module configured to:
before sending a loading request to the server, sending display parameters of the terminal device to the server, so that the server obtains the sampling rate of the second sampling picture based on the display parameters, obtains the first sampling picture and the second sampling picture based on the sampling rate of the second sampling picture, and stores the second sampling picture according to a network storage address.
According to one or more embodiments of the present disclosure, the apparatus may further include a priority determination module to:
when the picture loading triggering operation is obtained, the number of the picture loading tasks at the current moment is obtained;
if at least two picture loading tasks exist at the current moment, determining the priority level of each picture loading task;
determining the execution sequence of the corresponding picture loading tasks from front to back based on the sequence of the priority levels of the picture loading tasks from high to low;
correspondingly, the picture loading module is specifically configured to:
determining an execution sequence of the picture loading tasks corresponding to the picture loading trigger operation based on the execution sequence of each picture loading task;
and loading the second sampling picture based on the execution sequence and the storage address of the picture loading task corresponding to the picture loading trigger operation.
According to one or more embodiments of the present disclosure, the priority determining module is specifically configured to:
acquiring the operation type and the acquisition time of the picture loading trigger operation corresponding to each picture loading task;
and determining the priority level of each picture loading task based on the operation type and the acquisition time corresponding to each picture loading task.
According to one or more embodiments of the present disclosure, the operation types include: the priority determining module is specifically configured to:
determining the picture loading task with the operation type corresponding to the content viewing operation in all the picture loading tasks as the highest priority level;
aiming at picture loading tasks corresponding to each image loading triggering operation with the operation type of content refreshing operation, correspondingly determining the priority level of each picture loading task from high to low according to the sequence from near to far of the acquisition time;
and aiming at the picture loading tasks corresponding to the same image loading triggering operation with the operation type of content refreshing operation, the priority level of each picture loading task is correspondingly determined from high to low according to the display sequence of the corresponding pictures from first to last.
According to one or more embodiments of the present disclosure, the priority determination module is further configured to:
and at the current moment, if the same second sampling picture respectively corresponds to the picture loading task corresponding to the content viewing operation and the picture loading task corresponding to the content refreshing operation, deleting the picture loading task corresponding to the content refreshing operation.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.