File request method and device
Technical field
The present invention relates to software application field, in particular to a kind of file request method and device.
Background technology
A lot of cellphone subscriber likes listening audio frequency online with mobile phone at present, but such problem may be there is, sometimes network speed is comparatively slow, and such as user listens to song under 2G network, audio frequency that is that possible user listens to or high-quality, because the audio file of high-quality is very large, so need to receive for a long time under 2G network, user will inevitably be affected like this and listen to song, on the contrary, sometimes may under WIFI network environment, possible user's uppick be the audio frequency of standard quality on the contrary.
For above-mentioned problem, at present effective solution is not yet proposed.
Summary of the invention
Embodiments provide a kind of file request method and device, with the unmatched technical problem of size and network speed at least solving file to be obtained.
According to an aspect of the embodiment of the present invention, provide a kind of file request method, comprising: in terminal, obtain the first indication information being used to indicate the first file to be obtained; Obtain the network speed of the current network that terminal is connected to; According to network speed and the first indication information spanned file solicited message, wherein, first file of file request information for mating to server request file size with network speed; File request information is sent from terminal to server.
As the optional scheme of one, comprise according to network speed and the first indication information spanned file solicited message: judge whether network speed is greater than the first network speed threshold value; If judge, network speed is greater than the first network speed threshold value, spanned file solicited message in terminal, and wherein, the first file that file size is mated with network speed is: file size is greater than the first file of the first file size threshold value; If judge, network speed is less than or equal to the first network speed threshold value, spanned file solicited message in terminal, and wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the first file size threshold value.
As the optional scheme of one, if judge, network speed is less than or equal to the first network speed threshold value, in terminal, spanned file solicited message comprises: if judge, network speed is less than or equal to the first network speed threshold value but is greater than the second network speed threshold value, then spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file size threshold value and is greater than the first file of the second file size threshold value; If judge, network speed is less than or equal to the second network speed threshold value, then spanned file solicited message in terminal, and wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the second file size threshold value; Wherein, the first network speed threshold value is greater than the second network speed threshold value, and the first file size threshold value is greater than the second file size threshold value.
As the optional scheme of one, after sending file request information from terminal to server, also comprise: if network speed is greater than the first network speed threshold value, in terminal, then receive the first file that server sends, wherein, the file size of the first file is greater than or less than and equals the first file size threshold value; If network speed is less than or equal to the first network speed threshold value and be greater than the second network speed threshold value, in terminal, then receive the first file that server sends, wherein, the file size of the first file is less than or equal to the first file size threshold value and is greater than the second file size threshold value, or, be less than or equal to the second file size threshold value; If network speed is less than or equal to the second network speed threshold value, then in terminal, receive the first file that server sends, wherein, the file size of the first file is less than or equal to the second file size threshold value.
As the optional scheme of one, after sending file request information from terminal to server, also comprise: the first file that the file size receiving server transmission in terminal is mated with network speed, or, receive being used to indicate of server transmission and obtain failed response message.
As the optional scheme of one, before the network speed obtaining the current network that terminal is connected to, also comprise: judge whether to get in terminal the second indication information being used to indicate adaptive network reception file; If after getting the second indication information, then notify to perform following steps in terminal: the network speed obtaining the current network that terminal is connected to; According to network speed and the first indication information spanned file solicited message; File request information is sent from terminal to server.
As the optional scheme of one, the first file comprise following one of at least: picture file, audio file and video file.
According to the another aspect of the embodiment of the present invention, additionally provide a kind of File requesting device, comprising: the first acquiring unit, for obtaining the first indication information indicating the first file to be obtained in terminal; Second acquisition unit, for obtaining the network speed of the current network that terminal is connected to; Generation unit, for according to network speed and the first indication information spanned file solicited message, wherein, file request information is used for the first file mated with network speed to server request file size; Transmitting element, for sending file request information from terminal to server.
As the optional scheme of one, generation unit comprises: judge module, for judging whether network speed is greater than the first network speed threshold value; First generation module, during for judging that network speed is greater than the first network speed threshold value at judge module, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is greater than the first file of the first file size threshold value; Second generation module, during for judging that network speed is less than or equal to the first network speed threshold value at judge module, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the first file size threshold value.
As the optional scheme of one, the second generation module comprises: judge submodule, during for judging that network speed is less than or equal to the first network speed threshold value at judge module, judges whether network speed is greater than the second network speed threshold value; First generates submodule, for when judging that submodule judges that network speed is less than or equal to the first network speed threshold value but is greater than the second network speed threshold value, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file size threshold value and is greater than the first file of the second file size threshold value; Second generates submodule, for when judging that submodule judges that network speed is less than or equal to the second network speed threshold value, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the second file size threshold value; Wherein, the first network speed threshold value is greater than the second network speed threshold value, and the first file size threshold value is greater than the second file size threshold value.
As the optional scheme of one, this device also comprises: the first receiving element, during for being greater than the first network speed threshold value when network speed, at transmitting element from after terminal to server sends file request information, if network speed is greater than the first network speed threshold value, for receiving the first file that server sends in terminal, wherein, the file size of the first file is greater than or less than and equals the first file size threshold value; Second receiving element, during for being less than or equal to the first network speed threshold value when network speed and being greater than the second network speed threshold value, at transmitting element from after terminal to server sends file request information, terminal receives the first file that server sends, wherein, the file size of the first file is less than or equal to the first file size threshold value and is greater than the second file size threshold value, or, be less than or equal to the second file size threshold value; 3rd receiving element, during for being less than or equal to the second network speed threshold value when network speed, at transmitting element from after terminal to server sends file request information, terminal receives the first file that server sends, wherein, the file size of the first file is less than or equal to the second file size threshold value.
As the optional scheme of one, this device also comprises: the 4th receiving element, for after sending file request information from terminal to server, the first file that the file size that terminal receives server transmission is mated with network speed, or the 5th receiving element, for after sending file request information from terminal to server, receive being used to indicate of server transmission and obtain failed response message.
As the optional scheme of one, this device also comprises: judging unit, for before the network speed obtaining the current network that terminal is connected to, judges whether to get in terminal the second indication information being used to indicate adaptive network reception file; Notification unit, during for judging to get the second indication information at judging unit, notice second acquisition unit performs the step of the network speed obtaining the current network that terminal is connected to, notice generation unit performs the step according to network speed and the first indication information spanned file solicited message, and notice sends the step of file request information from terminal to server.
As the optional scheme of one, the first file comprise following one of at least: picture file, audio file and video file.
In embodiments of the present invention, by obtaining the network speed of current network, with the file matched to server acquisition file size and network speed, thus solve size and the unmatched technical problem of network speed of file to be obtained, like this, when network speed is slow, can the inferior file of acquisition request (such as, the picture that normal video, resolution are low or lo-fi audio frequency), to improve file acquisition speed, minimizing file acquisition time; When network speed is fast, can the file (such as, the audio frequency of the picture that HD video, resolution are high or high-fidelity) of acquisition request high-quality, to improve the quality of the file got.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, and form a application's part, schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the flow chart of a kind of optional file request method according to the embodiment of the present invention;
Fig. 2 is the flow chart according to the optional file request method of the another kind of the embodiment of the present invention;
Fig. 3 is the flow chart of another the optional file request method according to the embodiment of the present invention;
Fig. 4 is the flow chart of another the optional file request method according to the embodiment of the present invention;
Fig. 5 is the schematic diagram at a kind of optional file request interface according to the embodiment of the present invention;
Fig. 6 is the schematic diagram of a kind of optional File requesting device according to the embodiment of the present invention;
Fig. 7 is the schematic diagram according to the optional File requesting device of the another kind of the embodiment of the present invention; And
Fig. 8 is the schematic diagram of another the optional File requesting device according to the embodiment of the present invention.
Embodiment
First, the part noun occurred in the process be described the embodiment of the present invention or term are applicable to description below:
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
It should be noted that, term " first ", " second " etc. in specification of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged in the appropriate case, so as embodiments of the invention described herein can with except here diagram or describe those except order implement.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
Embodiment 1
According to the embodiment of the present invention, provide a kind of method of file request, as shown in Figure 1, the method comprises:
S102, terminal obtains the first indication information being used to indicate the first file to be obtained;
Alternatively, in the present embodiment the first file include but not limited to following one of at least: picture file, audio file and video file.Alternatively, above-mentioned terminal include but not limited to following one of at least: mobile phone, notebook computer, panel computer.
Such as, to obtain audio file by mobile phone, on mobile phone by touch screen or key-press input for obtaining first indication information (such as, audio file title " Music ") of required audio file.
S104, obtains the network speed of the current network that terminal is connected to;
Alternatively, current network includes but not limited in the present embodiment: 2G network, 3G network, WIFI network.
Such as, when the network that terminal connects is 2G, network speed is 25kb/s; When the network that terminal connects is 3G, network speed is 500kb/s; When the network that terminal connects is WIFI, network speed is 2mb/s.
S106, according to network speed and the first indication information spanned file solicited message;
Alternatively, file request information is used for the first file from network speed to server request file size that mate with in the present embodiment.
Such as, to obtain audio file by mobile phone, suppose that the current connected network of mobile phone is WIFI, its network speed is 2mb/s, first indication information is audio file title " Music ", then generate corresponding file request information according to above-mentioned network speed and the first indication information, audio file name for mating to server request file size with network speed is called the audio file of " Music ", such as, to server request high-quality (such as, high-fidelity, or, harmless) audio file name be called the audio file of " Music ".
Again such as, suppose that the current connected network of mobile phone is 2G, its network speed is 25kb/s, first indication information is audio file title " Music ", then generate corresponding file request information according to above-mentioned network speed and the first indication information, be called the audio file of " Music " for the audio file name mated with network speed to server request file size, such as, audio file name to server request low-quality (such as, Lo-Fi) is called the audio file of " Music ".
S108, sends file request information from terminal to server.
Alternatively, the first file of the different file size that prestores in server in the present embodiment, to send to terminal the first file that file size mates with network speed according to the request carrying out self terminal under different network speeds.
Such as, can the prestore audio file name of different quality of server is called the audio file of " Music ", and be called the audio file of " Music " as housed three audio file names, wherein, the file size of three audio files is respectively: 8M, 3M, and 1M.
In embodiments of the present invention, by obtaining the network speed of current network, with the file matched to server acquisition file size and network speed, thus solve size and the unmatched technical problem of network speed of file to be obtained, like this, when network speed is slow, can the inferior file of acquisition request (such as, the picture that normal video, resolution are low or lo-fi audio frequency), to improve file acquisition speed, minimizing file acquisition time; When network speed is fast, can the file (such as, the audio frequency of the picture that HD video, resolution are high or high-fidelity) of acquisition request high-quality, to improve the quality of the file got.
As the optional scheme of one, as shown in Figure 2, comprise according to network speed and the first indication information spanned file solicited message:
S202, judges whether network speed is greater than the first network speed threshold value;
Such as, set the first network speed threshold value be A(such as, 600kb/s), judge current network speed whether be greater than the first network speed threshold value be A(such as, 600kb/s), judgement is, then perform S204; If not, then perform S206.
S204, if judge, network speed is greater than the first network speed threshold value, spanned file solicited message in terminal, and wherein, the first file that file size is mated with network speed is: file size is greater than the first file of the first file size threshold value.
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is WIFI network, its network speed is 2mb/s, and the first network speed threshold value is 600kb/s, judges to learn that current network speed 2mb/s is greater than the first network speed threshold value 600kb/s, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request high-quality (such as, high-fidelity).Wherein, the size (such as, file size is 8M) with the first file of current network speeds match, is greater than the first file size threshold value (such as, this threshold value is 5M).
S206, if judge, network speed is less than or equal to the first network speed threshold value, spanned file solicited message in terminal, and wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the first file size threshold value.
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, and the first network speed threshold value is 600kb/s, judges to learn that current network speed 500kb/s is less than the first network speed threshold value 600kb/s, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request ordinary quality (such as, medium fidelity).Wherein, the size (such as, file size is 3M) with the first file of current network speeds match, is less than the first file size threshold value (such as, this threshold value is 5M).
Shown in composition graphs 3, further illustrate, to obtain audio file by mobile phone, mobile phone judges that current network (such as, connected network is 3G network) network environment situation, obtain current network speed (such as, for 500kb/s), then current network speed is pulled (such as to server, 500kb/s), the audio frequency of corresponding quality (such as, file size is 3M), server to the first file of stored different sizes (such as, the name that file size is different is called the audio file of " Music ") search, after finding corresponding audio file, corresponding audio-frequency information is returned to mobile phone.
By the embodiment that the application provides, by judging the network speed of current network, obtain the file of the file size matched with it, when network speed is slow, can the inferior file of acquisition request (such as, the picture that normal video, resolution are low or lo-fi audio frequency), to improve file acquisition speed, minimizing file acquisition time; When network speed is fast, can the file (such as, the audio frequency of the picture that HD video, resolution are high or high-fidelity) of acquisition request high-quality, to improve the quality of the file got, achieve and automatically download according to the speed of network speed the file adapted.
As the optional scheme of one, as shown in Figure 4, if judge, network speed is less than or equal to the first network speed threshold value, and in terminal, spanned file solicited message comprises:
S402, judges that network speed is less than or equal to the first network speed threshold value, but whether is greater than the second network speed threshold value, wherein, the first network speed threshold value is greater than the second network speed threshold value, and the first file size threshold value is also greater than the second file size threshold value;
Such as, set the first network speed threshold value be A(such as, 600kb/s), the second network speed threshold value be B(such as, 100kb/s), wherein, first network speed threshold value 600kb/s is greater than the second network speed threshold value 100kb/s, and the first file size threshold value corresponding with the first network speed threshold value 600kb/s is 5M, and the second file size threshold value corresponding with the second network speed threshold value 100kb/s is 2M, wherein, the first file size threshold value 5M is greater than the second file size threshold value 2M.Judge that current network speed is when being less than or equal to the first network speed threshold value A (such as, 600kb/s), with the second network speed threshold value B(such as, 100kb/s) magnitude relationship.
S404, if judge, network speed is less than or equal to the first network speed threshold value but is greater than the second network speed threshold value, then spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file size threshold value and is greater than the first file of the second file size threshold value;
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, judge to learn that current network speed 500kb/s is less than the first network speed threshold value 600kb/s, but be greater than the second network speed threshold value 100kb/s, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request ordinary quality (such as, medium fidelity).Wherein, the size (such as, file size is 3M) with the first file of current network speeds match, is less than or equal to the first file size threshold value (such as, this threshold value is 5M), and is greater than the second file size threshold value (such as, this threshold value is 2M).
S406, if judge, network speed is less than or equal to the second network speed threshold value, then spanned file solicited message in terminal, and wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the second file size threshold value;
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone becomes 2G network, its network speed is 25kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, judge to learn that current network speed 25kb/s is less than the first network speed threshold value 600kb/s, also the second network speed threshold value 100kb/s is less than, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request low-quality (such as, Lo-Fi).Wherein, the size (such as, file size is 1M) with the first file of current network speeds match, is less than or equal to the first file size threshold value (such as, this threshold value is 5M), is also less than the second file size threshold value (such as, this threshold value is 2M).
By the embodiment of the application, when network speed is less than or equal to the first network speed threshold value, judge the magnitude relationship of current network speed and the second network speed threshold value, and then network environment is distinguished further, when network speed is slow, can the inferior file of acquisition request, to improve file acquisition speed, reduce the file acquisition time.
As the optional scheme of one, after sending file request information from terminal to server, the first file that terminal receives server transmission comprises three kinds of Alternate embodiments:
As the optional execution mode of one, if network speed is greater than the first network speed threshold value, then in terminal, receive the first file that server sends, wherein, the file size of the first file is greater than or less than and equals the first file size threshold value;
Such as, shown in composition graphs 3, to obtain audio file by mobile phone, the current connected network of mobile phone is WIFI network, its network speed is 2mb/s, first network speed threshold value is 600kb/s, namely current network speed is greater than the first network speed threshold value, then server is by the file size matched with this network speed (such as, the first file 8M) (such as, name is called the audio file of " Music ") search, the audio file adapted if find, then return the audio-frequency information matched, such as, file size is the audio file that the name of 8M is called " Music ", if do not find the audio file adapted, then return the audio-frequency information of next quality (such as, network speed equals the first network speed threshold value 600kb/s), such as, file size is the audio file that the name of 5M is called " Music ".
As the optional execution mode of another kind, if network speed is less than or equal to the first network speed threshold value and be greater than the second network speed threshold value, in terminal, then receive the first file that server sends, wherein, the file size of the first file is less than or equal to the first file size threshold value and is greater than the second file size threshold value, or, be less than or equal to the second file size threshold value;
Such as, shown in composition graphs 3, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, namely current network speed is less than the first network speed threshold value, and be greater than the second network speed threshold value, then server is by the file size matched with this network speed (such as, the first file 3M) (such as, name is called the audio file of " Music ") search, the audio file adapted if find, then return the audio-frequency information matched, such as, file size is the audio file that the name of 3M is called " Music ", if do not find the audio file adapted, then return the audio-frequency information of next quality (such as, network speed equals the second network speed threshold value 100kb/s), such as, file size is the audio file that the name of 2M is called " Music ".
As another optional execution mode, if network speed is less than or equal to the second network speed threshold value, then in terminal, receive the first file that server sends, wherein, the file size of the first file is less than or equal to the second file size threshold value.
Such as, shown in composition graphs 3, to obtain audio file by mobile phone, the current connected network of mobile phone becomes 2G network, its network speed is 25kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, namely current network speed is less than the first network speed threshold value, also the second network speed threshold value is less than, then server is by the file size matched with this network speed (such as, the first file 1M) (such as, name is called the audio file of " Music ") search, the audio file adapted if find, then return the audio-frequency information matched, such as, file size is the audio file that the name of 1M is called " Music ".
By the embodiment that the application provides, according to current network conditions, obtain the file of different file size to server, exist if server finds the file matched, then return the file adapted, if do not exist, then reduce the quality of file, return the file lower than request condition.
As the optional scheme of one, after sending file request information from terminal to server, also comprise: the first file that the file size receiving server transmission in terminal is mated with network speed, or, receive being used to indicate of server transmission and obtain failed response message.
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, after sending file request information from mobile phone to server, if whois lookup obtains the first file of matching with current network speed (such as, name is called the audio file of " Music "), then return the audio-frequency information matched to mobile phone, such as, file size is the audio file that the name of 3M is called " Music "; If server does not find the first file matched with current network speed, the audio file that such as, name is called " Music ", does not find the file of next quality yet, then mobile phone obtains failed response message by receiving server.
By the embodiment that the application provides, if server finds the file matched with current network speed, then return the fileinfo adapted, but, if do not find the file matched, obtaining failed response by making, achieving and providing according to user's request the online service adapted.
As the optional scheme of one, before the network speed obtaining the current network that terminal is connected to, also comprise:
S1, judges whether to get in terminal the second indication information being used to indicate adaptive network reception file;
Alternatively, in Webpage, increase the function of an adaptive network, by arranging the second indication information of opening and closing, indicating whether the function using adaptive network, judging whether terminal (such as, mobile phone) gets the second indication information.
S2, if after getting the second indication information, then notifies to perform following steps in terminal: the network speed obtaining the current network that terminal is connected to; According to network speed and the first indication information spanned file solicited message; File request information is sent from terminal to server.
Such as, shown in composition graphs 5, if when selecting adaptive network function to open, then notify that mobile phone can obtain the file of corresponding quality according to network condition self adaptation, concrete execution following steps: the current network that acquisition mobile phone is connected to (such as, WIFI network) network speed (such as, 2mb/s); According to network speed (such as, 2mb/s) and the first indication information (such as, name is called the audio file of " Music ") spanned file solicited message; Send file request information by mobile phone to server, such as, the audio file name to server request high-quality (such as, high-fidelity) is called the audio file of " Music ".
By the embodiment that the application provides, by arranging adaptive network function, whether can obtain according to current network speed the file adapted by real-time selection, making user obtain better Consumer's Experience.
It should be noted that, for aforesaid each embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not by the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in specification all belongs to preferred embodiment, and involved action and module might not be that the present invention is necessary.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that can add required general hardware platform by software according to the method for above-described embodiment and realize, hardware can certainly be passed through, but in a lot of situation, the former is better execution mode.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product is stored in a storage medium (as ROM/RAM, magnetic disc, CD), comprising some instructions in order to make a station terminal equipment (can be mobile phone, computer, server, or the network equipment etc.) perform the method for each embodiment of the present invention.
Embodiment 2
According to the embodiment of the present invention, additionally provide a kind of device for implementing above-mentioned file request, as shown in Figure 6, this device comprises:
1) the first acquiring unit 602, for obtaining the first indication information indicating the first file to be obtained in terminal;
Alternatively, in the present embodiment the first file include but not limited to following one of at least: picture file, audio file and video file.Alternatively, above-mentioned terminal include but not limited to following one of at least: mobile phone, notebook computer, panel computer.
Such as, to obtain audio file by mobile phone, on mobile phone by touch screen or key-press input for obtaining first indication information (such as, audio file title " Music ") of required audio file.
2) second acquisition unit 604, for obtaining the network speed of the current network that terminal is connected to;
Alternatively, current network includes but not limited in the present embodiment: 2G network, 3G network, WIFI network.
Such as, when the network that terminal connects is 2G, network speed is 25kb/s; When the network that terminal connects is 3G, network speed is 500kb/s; When the network that terminal connects is WIFI, network speed is 2mb/s.
3) generation unit 606, for according to network speed and the first indication information spanned file solicited message, wherein, file request information is used for the first file mated with network speed to server request file size;
Alternatively, file request information is used for the first file from network speed to server request file size that mate with in the present embodiment.
Such as, to obtain audio file by mobile phone, suppose that the current connected network of mobile phone is WIFI, its network speed is 2mb/s, first indication information is audio file title " Music ", then generate corresponding file request information according to above-mentioned network speed and the first indication information, audio file name for mating to server request file size with network speed is called the audio file of " Music ", such as, to server request high-quality (such as, high-fidelity, or, harmless) audio file name be called the audio file of " Music ".
Again such as, suppose that the current connected network of mobile phone is 2G, its network speed is 25kb/s, first indication information is audio file title " Music ", then generate corresponding file request information according to above-mentioned network speed and the first indication information, be called the audio file of " Music " for the audio file name mated with network speed to server request file size, such as, audio file name to server request low-quality (such as, Lo-Fi) is called the audio file of " Music ".
4) transmitting element 608, for sending file request information from terminal to server.
Alternatively, the first file of the different file size that prestores in server in the present embodiment, to send to terminal the first file that file size mates with network speed according to the request carrying out self terminal under different network speeds.
Such as, can the prestore audio file name of different quality of server is called the audio file of " Music ", and be called the audio file of " Music " as housed three audio file names, wherein, the file size of three audio files is respectively: 8M, 3M, and 1M.
In embodiments of the present invention, by obtaining the network speed of current network, with the file matched to server acquisition file size and network speed, thus solve size and the unmatched technical problem of network speed of file to be obtained, like this, when network speed is slow, can the inferior file of acquisition request (such as, the picture that normal video, resolution are low or lo-fi audio frequency), to improve file acquisition speed, minimizing file acquisition time; When network speed is fast, can the file (such as, the audio frequency of the picture that HD video, resolution are high or high-fidelity) of acquisition request high-quality, to improve the quality of the file got.
As the optional scheme of one, as shown in Figure 7, generation unit 606 comprises:
1) judge module 702, for judging whether network speed is greater than the first network speed threshold value;
Such as, set the first network speed threshold value be A(such as, 600kb/s), judge current network speed whether be greater than the first network speed threshold value be A(such as, 600kb/s).
2) the first generation module 704, during for judging that network speed is greater than the first network speed threshold value at judge module, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is greater than the first file of the first file size threshold value;
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is WIFI network, its network speed is 2mb/s, and the first network speed threshold value is 600kb/s, judges to learn that current network speed 2mb/s is greater than the first network speed threshold value 600kb/s, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request high-quality (such as, high-fidelity).Wherein, the size (such as, file size is 8M) with the first file of current network speeds match, is greater than the first file size threshold value (such as, this threshold value is 5M).
3) the second generation module 706, during for judging that network speed is less than or equal to the first network speed threshold value at judge module, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the first file size threshold value.
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, and the first network speed threshold value is 600kb/s, judges to learn that current network speed 500kb/s is less than the first network speed threshold value 600kb/s, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request ordinary quality (such as, medium fidelity).Wherein, the size (such as, file size is 3M) with the first file of current network speeds match, is less than the first file size threshold value (such as, this threshold value is 5M).
Shown in composition graphs 3, further illustrate, to obtain audio file by mobile phone, mobile phone judges that current network (such as, connected network is 3G network) network environment situation, obtain current network speed (such as, for 500kb/s), then current network speed is pulled (such as to server, 500kb/s), the audio frequency of corresponding quality (such as, file size is 3M), server to the first file of stored different sizes (such as, the name that file size is different is called the audio file of " Music ") search, after finding corresponding audio file, corresponding audio-frequency information is returned to mobile phone.
By the embodiment that the application provides, by judging the network speed of current network, obtain the file of the file size matched with it, when network speed is slow, can the inferior file of acquisition request (such as, the picture that normal video, resolution are low or lo-fi audio frequency), to improve file acquisition speed, minimizing file acquisition time; When network speed is fast, can the file (such as, the audio frequency of the picture that HD video, resolution are high or high-fidelity) of acquisition request high-quality, to improve the quality of the file got, achieve and automatically download according to the speed of network speed the file adapted.
As the optional scheme of one, as shown in Figure 8, the second generation module 706 comprises:
1) judging submodule 802, during for judging that network speed is less than or equal to the first network speed threshold value at judge module, judging whether network speed is greater than the second network speed threshold value;
Alternatively, the first network speed threshold value is greater than the second network speed threshold value in the present embodiment, and the first file size threshold value is greater than the second file size threshold value.
Such as, set the first network speed threshold value be A(such as, 600kb/s), the second network speed threshold value be B(such as, 100kb/s), wherein, first network speed threshold value 600kb/s is greater than the second network speed threshold value 100kb/s, and the first file size threshold value corresponding with the first network speed threshold value 600kb/s is 5M, and the second file size threshold value corresponding with the second network speed threshold value 100kb/s is 2M, wherein, the first file size threshold value 5M is greater than the second file size threshold value 2M.Judge that current network speed is when being less than or equal to the first network speed threshold value A (such as, 600kb/s), with the second network speed threshold value B(such as, 100kb/s) magnitude relationship.
2) first submodule 804 is generated, for when judging that submodule judges that network speed is less than or equal to the first network speed threshold value but is greater than the second network speed threshold value, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file size threshold value and is greater than the first file of the second file size threshold value;
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, judge to learn that current network speed 500kb/s is less than the first network speed threshold value 600kb/s, but be greater than the second network speed threshold value 100kb/s, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request ordinary quality (such as, medium fidelity).Wherein, the size (such as, file size is 3M) with the first file of current network speeds match, is less than or equal to the first file size threshold value (such as, this threshold value is 5M), and is greater than the second file size threshold value (such as, this threshold value is 2M).
3) second submodule 806 is generated, for when judging that submodule judges that network speed is less than or equal to the second network speed threshold value, spanned file solicited message in terminal, wherein, the first file that file size is mated with network speed is: file size is less than or equal to the first file of the second file size threshold value.
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone becomes 2G network, its network speed is 25kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, judge to learn that current network speed 25kb/s is less than the first network speed threshold value 600kb/s, also the second network speed threshold value 100kb/s is less than, on mobile phone, then generate corresponding audio file solicited message, such as, the audio file of " Music " is called to the audio file name of server request low-quality (such as, Lo-Fi).Wherein, the size (such as, file size is 1M) with the first file of current network speeds match, is less than or equal to the first file size threshold value (such as, this threshold value is 5M), is also less than the second file size threshold value (such as, this threshold value is 2M).
By the embodiment of the application, when network speed is less than or equal to the first network speed threshold value, judge the magnitude relationship of current network speed and the second network speed threshold value, and then network environment is distinguished further, when network speed is slow, can the inferior file of acquisition request, to improve file acquisition speed, reduce the file acquisition time.
As the optional scheme of one, this device also comprises:
1) the first receiving element, during for being greater than the first network speed threshold value when network speed, at transmitting element from after terminal to server sends file request information, terminal receives the first file that server sends, wherein, the file size of the first file is greater than or less than and equals the first file size threshold value;
Such as, shown in composition graphs 3, to obtain audio file by mobile phone, the current connected network of mobile phone is WIFI network, its network speed is 2mb/s, first network speed threshold value is 600kb/s, namely current network speed is greater than the first network speed threshold value, then server is by the file size matched with this network speed (such as, the first file 8M) (such as, name is called the audio file of " Music ") search, the audio file adapted if find, then return the audio-frequency information matched, such as, file size is the audio file that the name of 8M is called " Music ", if do not find the audio file adapted, then return the audio-frequency information of next quality (such as, network speed equals the first network speed threshold value 600kb/s), such as, file size is the audio file that the name of 5M is called " Music ".
2) the second receiving element, during for being less than or equal to the first network speed threshold value when network speed and being greater than the second network speed threshold value, at transmitting element from after terminal to server sends file request information, terminal receives the first file that server sends, wherein, the file size of the first file is less than or equal to the first file size threshold value and is greater than the second file size threshold value, or, be less than or equal to the second file size threshold value;
Such as, shown in composition graphs 3, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, namely current network speed is less than the first network speed threshold value, and be greater than the second network speed threshold value, then server is by the file size matched with this network speed (such as, the first file 3M) (such as, name is called the audio file of " Music ") search, the audio file adapted if find, then return the audio-frequency information matched, such as, file size is the audio file that the name of 3M is called " Music ", if do not find the audio file adapted, then return the audio-frequency information of next quality (such as, network speed equals the second network speed threshold value 100kb/s), such as, file size is the audio file that the name of 2M is called " Music ".
3) the 3rd receiving element, during for being less than or equal to the second network speed threshold value when network speed, at transmitting element from after terminal to server sends file request information, terminal receives the first file that server sends, wherein, the file size of the first file is less than or equal to the second file size threshold value.
Such as, shown in composition graphs 3, to obtain audio file by mobile phone, the current connected network of mobile phone becomes 2G network, its network speed is 25kb/s, first network speed threshold value is 600kb/s, second network speed threshold value is 100kb/s, namely current network speed is less than the first network speed threshold value, also the second network speed threshold value is less than, then server is by the file size matched with this network speed (such as, the first file 1M) (such as, name is called the audio file of " Music ") search, the audio file adapted if find, then return the audio-frequency information matched, such as, file size is the audio file that the name of 1M is called " Music ".
By the embodiment that the application provides, according to current network conditions, obtain the file of different file size to server, exist if server finds the file matched, then return the file adapted, if do not exist, then reduce the quality of file, return the file lower than request condition.
As the optional scheme of one, this device also comprises:
1) the 4th receiving element, for after sending file request information from terminal to server, the first file that the file size that terminal receives server transmission is mated with network speed, or
2) the 5th receiving element, for after sending file request information from terminal to server, receives being used to indicate of server transmission and obtains failed response message.
Such as, to obtain audio file by mobile phone, the current connected network of mobile phone is 3G network, its network speed is 500kb/s, after sending file request information from mobile phone to server, if whois lookup obtains the first file of matching with current network speed (such as, name is called the audio file of " Music "), then return the audio-frequency information matched to mobile phone, such as, file size is the audio file that the name of 3M is called " Music "; If server does not find the first file matched with current network speed, the audio file that such as, name is called " Music ", does not find the file of next quality yet, then mobile phone obtains failed response message by receiving server.
By the embodiment that the application provides, if server finds the file matched with current network speed, then return the fileinfo adapted, but, if do not find the file matched, obtaining failed response by making, achieving and providing according to user's request the online service adapted.
As the optional scheme of one, this device also comprises:
1) judging unit, for before the network speed obtaining the current network that terminal is connected to, judges whether to get in terminal the second indication information being used to indicate adaptive network reception file;
Alternatively, in Webpage, increase the function of an adaptive network, by arranging the second indication information of opening and closing, indicating whether the function using adaptive network, judging whether terminal (such as, mobile phone) gets the second indication information.
2) notification unit, during for judging to get the second indication information at judging unit, notice second acquisition unit performs the step of the network speed obtaining the current network that terminal is connected to, notice generation unit performs the step according to network speed and the first indication information spanned file solicited message, and notice sends the step of file request information from terminal to server.
Such as, shown in composition graphs 5, if when selecting adaptive network function to open, then notify that mobile phone can obtain the file of corresponding quality according to network condition self adaptation, concrete execution following steps: the current network that acquisition mobile phone is connected to (such as, WIFI network) network speed (such as, 2mb/s); According to network speed (such as, 2mb/s) and the first indication information (such as, name is called the audio file of " Music ") spanned file solicited message; Send file request information by mobile phone to server, such as, the audio file name to server request high-quality (such as, high-fidelity) is called the audio file of " Music ".
By the embodiment that the application provides, by arranging adaptive network function, whether can obtain according to current network speed the file adapted by real-time selection, making user obtain better Consumer's Experience.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
In the above embodiment of the present invention, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
In several embodiments that the application provides, should be understood that, disclosed client, the mode by other realizes.Wherein, device embodiment described above is only schematic, the division of such as unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of unit or module or communication connection can be electrical or other form.
The unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
If integrated unit using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprises all or part of step of some instructions in order to make a computer equipment (can be personal computer, server or the network equipment etc.) perform each embodiment method of the present invention.And aforesaid storage medium comprises: USB flash disk, read-only memory (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), portable hard drive, magnetic disc or CD etc. various can be program code stored medium.
Below be only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.