Summary of the invention
The object of the embodiment of the present invention is the player method and the device that provide a kind of Streaming Media, plays the problem of card in order to solve the streaming media video when unstable networks.
For achieving the above object, the embodiment of the invention discloses a kind of player method of Streaming Media, being applied to terminal, described method comprises step:
Obtain the buffer data size of current displaying video, judge whether this buffer data size is less than default lower threshold D1;
If so, the downloading rate of current displaying video is obtained;
Judge whether the downloading rate of current displaying video is less than the original code check of this video;
If so, the playback rate of current displaying video is reduced.
Preferably, the playback rate of the current displaying video of described reduction comprises:
The frame per second original according to the original code check of the downloading rate of current displaying video, this video, this video, determines the playback rate of the current displaying video after reducing.
Preferably, before the playback rate of the current displaying video of described reduction, also comprise:
Judge whether buffer memory completes current displaying video;
When current displaying video buffer memory completes, keep the playback rate of current displaying video constant.
Preferably, described method also comprises:
Obtain the buffer data size of current displaying video, judge whether this buffer data size is greater than default upper limit threshold D2;
If so, then the playback rate of current displaying video is improved.
Preferably, described method also comprises:
Judge whether the downloading rate of current displaying video is less than the original code check of this video;
If not, then the playback rate of current displaying video is improved.
The embodiment of the invention also discloses a kind of playing device of Streaming Media, be applied to terminal, described device comprises:
First obtains judge module, for obtaining the buffer data size of current displaying video, judges whether this buffer data size is less than default lower threshold D1;
Second obtains judge module, for when first obtains judge module judged result for being, obtains the downloading rate of current displaying video; Judge whether the downloading rate of current displaying video is less than the original code check of this video;
Adjusting module, for when second obtains judge module judged result for being, reduces the playback rate of current displaying video.
Preferably, described adjusting module, specifically for the frame per second that the original code check of the downloading rate according to current displaying video, this video, this video are original, determines the playback rate of the current displaying video after reducing.
Preferably, described device also comprises:
Buffer memory completes Executive Module, for judging whether buffer memory completes current displaying video;
Described adjusting module, also for complete when described buffer memory Executive Module judge that current displaying video buffer memory completes time, keep the playback rate of current displaying video constant.
Preferably, described first obtains judge module, also for obtaining the buffer data size of current displaying video, judges whether this buffer data size is greater than default upper limit threshold D2;
Described adjusting module, also for when described first acquisition judge module judges that buffer data size is greater than default upper limit threshold D2, improves the playback rate of current displaying video.
Preferably, described second obtains judge module, also for judging whether the downloading rate of current displaying video is less than the original code check of this video;
Described adjusting module, also for when described second obtain judge module judge that the downloading rate of current displaying video is not less than this video original code check time, improve the playback rate of current displaying video.
Embodiments provide a kind of player method and device of Streaming Media, in the method, terminal obtains the buffer data size of current displaying video, judge whether this buffer data size is less than default lower threshold D1, if be less than this lower threshold, then obtain the downloading rate of current displaying video, and judge whether the downloading rate of current displaying video is less than the original video code stream rate of this video, if so, reduce the playback rate of current displaying video.Owing to obtaining the buffer data size of this current displaying video in the embodiment of the present invention for current displaying video, and be less than default lower threshold at this buffer data size, and the downloading rate of this current displaying video is when being less than the original code check of this video, reduce the playback rate of this current displaying video, thus the buffer memory of this video can be increased to a certain extent, avoid buffer memory to occur exhausted, ensure the continuity of video playback.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, 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, belong to the scope of protection of the invention.
Embodiments provide a kind of player method and device of Streaming Media, in the method, terminal obtains the buffer data size of current displaying video, judge whether this buffer data size is less than default lower threshold D1, if be less than this lower threshold, then obtain the downloading rate of current displaying video, and judge whether the downloading rate of current displaying video is less than the original video code stream rate of this video, if so, reduce the playback rate of current displaying video.Owing to obtaining the buffer data size of this current displaying video in the embodiment of the present invention for current displaying video, and be less than default lower threshold at this buffer data size, and the downloading rate of this current displaying video is when being less than the original code check of this video, reduce the playback rate of this current displaying video, thus the buffer memory of this video can be increased to a certain extent, avoid buffer memory to occur exhausted, ensure the continuity of video playback.
Below by specific embodiment, the present invention is described in detail.
The schematic flow sheet of the player method of a kind of Streaming Media that Fig. 1 provides for the embodiment of the present invention one, the method is applied to terminal, comprises the steps:
S101: the buffer data size obtaining current displaying video.
According to the time interval every one section of setting, the buffer data size of a current video can be obtained; If the time interval of this setting is shorter, at the end of the buffer data size that also can be understood as terminal Real-time Obtaining current video or the flow process provided whenever the embodiment of the present invention one, obtain the buffer data size of a current video.
This terminal can be the electronic equipments such as smart mobile phone, panel computer, notebook/desktop computer in embodiments of the present invention.
S102: judge whether the buffer data size of current displaying video is less than default lower threshold D1, if so, performs S103, if not, then keeps the playback rate of current displaying video constant.
This lower threshold can be in the terminal pre-configured, and lower threshold that can be different for dissimilar video configuration, when carrying out streaming media playing, the lower threshold that terminal can be corresponding according to the type selecting of video.
Terminal also can provide a D1 value to arrange interface, makes user arrange D1 value voluntarily according to the use habit of oneself.Arranging interface can provide data input frame to input D1 numerical value for user, and data selection hurdle also can be provided to provide selectable D1 value to user.
Or terminal also can obtain this lower threshold preset from server.Identical lower threshold can be set for dissimilar video in server, or different lower thresholds.When terminal carries out streaming media playing, obtain lower threshold corresponding to this Streaming Media from server; The lower threshold arranged for dissimilar video also can be sent to terminal by server, so that terminal is when carrying out streaming media playing, can judge accordingly according to the lower threshold preset received from server.
Such as, no matter can arrange different D1 values for different video type in terminal or server, video type can be distinguished with video format.Such as, for the video of MP4 form, determine that the lower threshold that it is preset is 1MB; For the video of MKV form, determine that the lower threshold that it is preset is 10MB.
Can different D1 values be set for different terminal resources.Such as, when video download is carried out in terminal to server request, the bandwidth information of oneself institute's access network is also sent to server; After server receives the bandwidth information of this terminal, the predetermined lower threshold value D1 corresponding with this bandwidth information is sent to this terminal, to do the judgement of this terminal follow-up; Or, when there being terminal to server request video to download, server is before its transmission of video resource, the look-up table of the network bandwidth first terminal local of default latest edition preserved and the corresponding relation of corresponding lower threshold sends to terminal, after terminal obtains this look-up table, corresponding lower threshold is searched, as the use of follow-up judgement voluntarily according to the accessed network bandwidth.Such as, the D1 value that the 100MB broadband network that server is arranged in this look-up table is corresponding can be less than D1 value corresponding to 20MB broadband network, to save the memory space of data cached shared terminal.
S103: the downloading rate obtaining current displaying video.
S104: judge whether the downloading rate of current displaying video is less than the original code check of this video; If so, perform S105, if not, then keep the playback rate of current displaying video constant.
When the original code check of video refers to that video normal frame rate is play, the video bits number of transmission per second.Such as, for MPEG1 format video, original code check is 1150kbps, namely during normal play one section of MPEG1 format video, and the data volume of consumption 1150kb per second.
S105: the playback rate reducing current displaying video.
The playback rate reducing current displaying video can be the frame per second reducing current displaying video, namely reduces the frame number of exploded view picture per second, extends the displaying time of every two field picture.
In embodiments of the present invention when reducing the playback rate of this current displaying video, this playback rate can be reduced to the arbitrary value low compared with current playing rate.
The playback rate reducing current displaying video comprises: the frame per second original according to the original code check of the downloading rate of current displaying video, this video, this video, determines the frame per second of the current displaying video after reducing.The frame per second that wherein video is original refers to frame per second during this video normal play.
Such as, the original code check of certain video is V1, the original frame per second of video is F, if the downloading rate recording current displaying video is V2 and V2<V1, current video play frame rate can be defined as (V2/V1) * F, at this moment can ensure that the buffer memory total amount of current displaying video does not occur negative growth.Such as, for MPEG1 format video, original code check is 1150kbps, the original frame per second of video is 25fps, if the downloading rate recording current displaying video is 920kbps, current video play frame rate can be defined as (920kbps/1150kbps) * 25fps=20fps, at this moment can ensure that the buffer memory total amount of current displaying video does not occur negative growth.
The method reducing the frame per second of current displaying video also comprises: the frame per second original according to the original code check of the downloading rate of current displaying video, the data volume of current cache data field, default lower threshold D1, this video, this video, determines the frame per second of the current displaying video after reducing.
Such as, the original code check of certain video is V1, the original frame per second of video is F, if the downloading rate recording current displaying video is V2 and V2<V1, current cache data volume is D0 and D0<D1, default lower threshold are D1, current video play frame rate can be defined as (V2/V1) * (D0/D1) * F, then be less than in the time period of D1 at D0, data cached total amount can be made to be increase state.Such as, for MPEG1 format video, original code check is 1150kbps, the original frame per second of video is 25fps, if the downloading rate recording current displaying video is 920kbps, current cache data volume is 4MB, default buffer memory lower threshold is 5MB, then current video play frame rate can be defined as (920kbps*/1150kbps) * (4MB/5MB) * 25fps=16fps, and data cached total amount at this moment can be made to be increase state.
Owing to obtaining the buffer data size of this video in the embodiment of the present invention for current displaying video, and this buffer data size is less than default lower threshold, and the downloading rate of this current displaying video is when being less than the original video code stream rate of this video, reduce the frame per second of this video, thus the buffer data size of this video can be increased to a certain extent, ensure the continuity of video playback.
In the process of streaming media playing, when this Streaming Media buffer memory complete, due to the broadcasting of this Streaming Media, its buffer data size also can constantly reduce, when this buffer data size is less than default lower threshold, because current cache completes, the downloading rate of this video is 0, also meet and be less than the original code check of this video, even if now do not reduce the playback rate of current displaying video, also there will not be the problem that card pauses.Therefore in embodiments of the present invention in order to when video cache completes, reduce the frequent operation of the playback rate reducing displaying video, before the playback rate of the current displaying video of described reduction, also comprise:
Judge whether buffer memory completes current displaying video;
When current displaying video buffer memory completes, keep the playback rate of current displaying video constant.
Judge that the current displaying video step whether buffer memory completes belongs to prior art, Ke Yiwei: whether its interface receiving described current displaying video of terminal judges sends the complete information of download to it, if so, then judges that current displaying video buffer memory completes.Wherein, these data can be returned after the data of the current displaying video that this interface sends to server, when the data that this interface returns are 0, can judge that current displaying video buffer memory completes.Concrete, speed in order to avoid the transfer of data caused due to other reason is 0 erroneous judgement causing becoming that terminal completes buffer memory, described terminal also according to the data volume of the total amount of data of current displaying video and the described current displaying video downloaded, can judge whether buffer memory completes.In embodiments of the present invention concrete implementation is not repeated.
The schematic flow sheet of the player method of a kind of Streaming Media that Fig. 2 provides for the embodiment of the present invention two, comprises the steps:
S201: the buffer data size obtaining current displaying video.
S202: judge that whether buffer memory completes current displaying video, if so, performs S204, if not, performs S203.
S203: judge whether the buffer data size of current displaying video is less than default lower threshold D1, if so, performs S205, if not, then performs S204.
S204: keep the playback rate of current displaying video constant.
The frame per second of current displaying video is judged, if be the original frame per second of video, does not then adjust; If be less than the frame per second that video is original, then the frame per second of current displaying video is adjusted to the original frame per second of video.No longer perform other institutes in the embodiment of the present invention afterwards in steps.
S205: the downloading rate obtaining current displaying video.
S206: judge whether the downloading rate of current displaying video is less than the original code check of this video; If so, perform S207, if not, then perform S204.
S207: the playback rate reducing current displaying video.
Wherein step S202 can perform any position between step S201 and step S207, as long as can ensure to realize the video judgement whether buffer memory completes before the playback rate reducing current displaying video.
The buffer data size of video can be increased to a certain extent by the above-mentioned execution mode of the embodiment of the present invention.Obtain the buffer data size of current displaying video, if this buffer data size acquires a certain degree, even if the playback rate improving current video is described, this video also there will not be buffer data size exhaustion to occur the problem that card pauses, and therefore described method also comprises in embodiments of the present invention:
Obtain the buffer data size of current displaying video, judge whether this buffer data size is greater than default upper limit threshold D2;
If so, the playback rate of current displaying video is improved.
Improve the playback rate of current displaying video, can be that the playback rate of this video is risen to the high any number of more current playback rate, preferably, can be that the playback rate of this video is risen to its original playback rate, namely play with original code check.
This upper limit threshold can be in the terminal pre-configured, and upper limit threshold that can be different for dissimilar video configuration, when carrying out streaming media playing, the upper limit threshold that terminal can be corresponding according to the type selecting of video.
Terminal also can provide a D2 value to arrange interface, makes user can arrange D2 value voluntarily according to the use habit of oneself.Arranging interface can provide data input frame to input D2 numerical value for user, and data selection hurdle also can be provided to provide selectable D2 value to user.
Or terminal also can obtain this upper limit threshold preset from server.Identical upper limit threshold can be set for dissimilar video in server, or different upper limit thresholds.When terminal carries out streaming media playing, obtain upper limit threshold corresponding to this Streaming Media from server; The upper limit threshold arranged for dissimilar video also can be sent to terminal by server, so that terminal is when carrying out streaming media playing, can judge accordingly according to the upper limit threshold preset received from server.
Such as, no matter can arrange different D2 values for different video format type in terminal or server, video type can be distinguished with video format.Such as, for the video of MP4 form, determine that the upper limit threshold that it is preset is 10MB; For the video of MKV form, determine that the upper limit threshold that it is preset is 100MB.
Can different D2 values be set for different terminal resources.Such as, when video download is carried out in terminal to server request, the bandwidth information of oneself institute's access network is also sent to server; After server receives the bandwidth information of this terminal, the predetermined upper threshold value D2 corresponding with this bandwidth information is sent to this terminal, to do the judgement of this terminal follow-up; Or, when there being terminal to server request video to download, server is before its transmission of video resource, the look-up table of the network bandwidth first terminal local of default latest edition preserved and the corresponding relation of corresponding upper limit threshold sends to terminal, after terminal obtains this look-up table, corresponding upper limit threshold is searched, as the use of follow-up judgement voluntarily according to the accessed network bandwidth.Such as, the D2 value that the 100MB broadband network that server is arranged in this look-up table is corresponding can be less than D2 value corresponding to 20MB broadband network, to save the memory space of data cached shared terminal.
The schematic flow sheet of the player method of a kind of Streaming Media that Fig. 3 provides for the embodiment of the present invention three, comprises the steps:
S301: the buffer data size obtaining current displaying video.
S302: judge whether the buffer data size of current displaying video is less than default lower threshold D1, if so, performs S303, if not, then keeps the playback rate of current displaying video constant.
S303: the downloading rate obtaining current displaying video.
S304: judge whether the downloading rate of current displaying video is less than the original code check of this video, if so, performs S305, if not, then keeps the playback rate of current displaying video constant.
S305: the playback rate reducing current displaying video.
S306: judge whether the buffer data size of current displaying video is greater than default upper limit threshold D2, if so, performs S307, if not, then keeps the playback rate of current displaying video constant.
S307: the playback rate improving current displaying video.
The buffer data size of video can be increased to a certain extent by the above-mentioned execution mode of the embodiment of the present invention three.
If the downloading rate of current displaying video increases, and be increased to the original code check being not less than video, even if the playback rate improving current video is described, this video also there will not be buffer data size exhaustion to occur the problem that card pauses, and therefore described method also comprises in embodiments of the present invention: judge whether the downloading rate of current displaying video is less than the original video code stream rate of this video;
If not, the playback rate of current displaying video is improved.
Improve the playback rate of current displaying video, can be that the playback rate of this video is risen to the high any number of more current playback rate, preferably, can be that the playback rate of this video is risen to its original playback rate, namely play with original code check.
The schematic flow sheet of the player method of a kind of Streaming Media that Fig. 4 provides for the embodiment of the present invention four, comprises the steps:
S401: the buffer data size obtaining current displaying video.
S402: judge whether the buffer data size of current displaying video is less than default lower threshold D1, if so, performs S403, if not, then keeps the playback rate of current displaying video constant.
S403: the downloading rate obtaining current displaying video.
S404: judge whether the downloading rate of current displaying video is less than the original code check of this video, if so, performs S405, if not, then keeps the playback rate of current displaying video constant.
S405: the playback rate reducing current displaying video.
S406: judge whether the downloading rate of current displaying video is less than the original code check of this video, as no, perform S407, if so, then keeps the playback rate of current displaying video constant.
S407: the playback rate improving current displaying video.
Due in the embodiment of the present invention when reduce current displaying video playback rate after, in order to the viewing improving user is experienced, the buffer data size downloading rate of this video is obtained for current displaying video, and the lower threshold being less than the original code check of this video and presetting is greater than at this buffer data size of downloading rate, and the downloading rate of this current displaying video is when being less than the original video code stream rate of this video, reduce the playback rate frame per second improving this current displaying video, thus the buffer memory of this video can be increased to a certain extent, ensure that the continuity of video playback improves Consumer's Experience.
The structural representation of the playing device of a kind of Streaming Media that Fig. 5 provides for the embodiment of the present invention, comprises the first acquisition judge module 501, second and obtains judge module 502, adjusting module 504.
Wherein, first obtains judge module 501, for obtaining the buffer data size of current displaying video, judges whether this buffer data size is less than default lower threshold D1;
Second obtains judge module 502, for when first obtains judge module judged result for being, obtains the downloading rate of current displaying video; Judge whether the downloading rate of current displaying video is less than the original code check of this video;
Adjusting module 504, for when second obtains judge module judged result for being, reduces the playback rate of current displaying video.
Further, described adjusting module 504, specifically for the frame per second that the original code check of the downloading rate according to current displaying video, this video, this video are original, determines the playback rate of the current displaying video after reducing.
Described device also comprises:
Buffer memory completes Executive Module 503, for judging whether buffer memory completes current displaying video;
Described adjusting module 504, also for complete when described buffer memory Executive Module judge that current displaying video buffer memory completes time, keep the playback rate of current displaying video constant.
Described first obtains judge module 501, also for obtaining the buffer data size of current displaying video, judges whether this buffer data size is greater than default upper limit threshold D2;
Described adjusting module 504, also for when described first acquisition judge module judges that buffer data size is greater than default upper limit threshold D2, improves the playback rate of current displaying video.
Described second obtains judge module 502, also for judging whether the downloading rate of current displaying video is less than the original code check of this video;
Described adjusting module 504, also for when described second obtain judge module judge that the downloading rate of current displaying video is not less than this video original code check time, improve the playback rate of current displaying video.
Embodiments provide a kind of player method and device of Streaming Media, in the method, terminal obtains the buffer data size of current displaying video, judge whether this buffer data size is less than default lower threshold D1, if be less than this lower threshold, then obtain the downloading rate of current displaying video, and judge whether the downloading rate of current displaying video is less than the original video code stream rate of this video, if so, reduce the playback rate of current displaying video.Owing to obtaining the buffer data size of this current displaying video in the embodiment of the present invention for current displaying video, and be less than default lower threshold at this buffer data size, and the downloading rate of this current displaying video is when being less than the original code check of this video, reduce the playback rate of this current displaying video, thus the buffer memory of this video can be increased to a certain extent, avoid buffer memory to occur exhausted, ensure the continuity of video playback.
For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or mobile device and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or mobile device.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the mobile device comprising described key element and also there is other identical element.
One of ordinary skill in the art will appreciate that all or part of step realized in said method execution mode is that the hardware that can carry out instruction relevant by program has come, described program can be stored in computer read/write memory medium, here the alleged storage medium obtained, as: ROM/RAM, magnetic disc, CD etc.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.All any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., be all included in protection scope of the present invention.