A kind of method and apparatus of video playback
Technical field
The present invention relates to consumer electronics field, more particularly to a kind of method and apparatus of video playback.
Background technology
It is current carry out the Online Video based on HTTP Live Streaming (HLS) agreement it is live when, because live regards
According to being got in real time from server, local playback equipment does not store live content frequency, but is regarded what is received
Frequency is according to directly being played.
Existing technical scheme can cause when part live content is missed, and local playback equipment can not be by storage
Video data carry out timi requirement to realize look back function, that is, the function of being reviewed live video data be present and lack
Lose.
The content of the invention
Embodiments of the invention provide a kind of method and apparatus of video playback, can realize and live video is reviewed
Function, make up and the afunction reviewed realized to live video.
To reach above-mentioned purpose, embodiments of the invention adopt the following technical scheme that:
First aspect, there is provided a kind of method of video playback, methods described include:
Pause instruction is received, according to the pause instruction, in the video that the pause of the first moment is currently played, and simultaneously
The video data from first moment is downloaded from server, by the video data storage of download in the buffer;
Play instruction is received, according to the play instruction, the video data in reading the caching at the second moment, and broadcast
Put the video data.
With reference to the content of first aspect, in the first possible implementation of first aspect, the regarding download
Frequency includes in the buffer according to storage:
The video data of download is stored in the caching of playback equipment, and record storage is in playback equipment caching
The time span of video data.
In second of possible implementation of first aspect, with reference in a first aspect, the video by the download
Also include in the caching of data storage:
When the caching in playback equipment described in the 3rd moment has been filled with, and is not received by the play instruction, from
The server downloads the playlist of the 3rd moment rear video content, and the playlist is stored in internal memory.
In the third possible implementation of first aspect, with reference to second of possible realization side of first aspect
Formula, methods described also include:
The playlist includes the initial time of the 3rd moment rear video, termination time, and the playback equipment exists
After playing the video data being stored in the playback equipment caching, according to the playlist, institute is downloaded from the server
State the video data of video in playlist.
In the 4th kind of possible implementation of first aspect, with reference to the first possible realization side of first aspect
Formula, methods described also include:
Reception progress jump instruction, obtain the time location redirected in the progress jump instruction, and is redirected described
Time location is contrasted with the time span of video information in playback equipment caching and the playlist;
When the time location redirected is less than the time span of the video information of playback equipment caching, then from institute
State the time location redirected and commence play out the video data cached;Or
When the time location redirected is more than the time span of the video information of playback equipment caching but less than described
The time span of video in the playlist of download, then redirect the time described in the specifying information determination in the playlist
Corresponding video initial time, downloads and plays from the server and described redirect video data corresponding to the time;Or
The time span of video in the time location redirected is beyond the playlist, then from the server
Receive and play newest video data.
Second aspect, there is provided a kind of equipment of video playback, the equipment include:
Download unit, for receiving pause instruction, according to the pause instruction, at the first moment, pause is currently played
Video, and download video data from first moment from server simultaneously, the video data of download be stored in slow
In depositing;
Broadcast unit, for receiving play instruction, according to the play instruction, read at the second moment in the caching
Video data, and play the video data.
In the first possible implementation of second aspect, with reference to second aspect, the download unit includes:
Time computation subunit, for the video data of download to be stored in the caching of playback equipment, and record storage
The time span of video data in playback equipment caching.
In second of possible implementation of second aspect, with reference to second aspect, the download unit also includes:
Subelements under list, for being filled with when the caching in playback equipment described in the 3rd moment, and do not receive
During to the play instruction, then the playlist of the 3rd moment rear video content is downloaded from the server, is broadcast described
Table is emplaced to be stored in internal memory.
In the third possible implementation of second aspect, with reference to second of possible realization side of second aspect
Formula, the playlist that subelements are downloaded under the list are used for:
The initial time comprising the 3rd moment rear video, the specifying information of termination time, make in the playlist
The playback equipment after the video data being stored in playback equipment caching is played, always according to the playlist,
The video data of video in the playlist is downloaded from the server.
In the 4th kind of possible implementation of second aspect, with reference to second of possible realization side of second aspect
Formula, the equipment also include:
Jump-transfer unit, for receiving progress jump instruction, the time location redirected in the progress jump instruction is obtained, and
The time span of video information in the time location redirected and playback equipment caching and the playlist are carried out
Contrast;
When the time location redirected is less than the time span of the video information of playback equipment caching, then from institute
State the time location redirected and commence play out the video data cached;Or
When the time location redirected is more than the time span of the video information of playback equipment caching but less than described
The time span of video in the playlist of download, then redirect the time described in the specifying information determination in the playlist
Corresponding video initial time, downloads and plays from the server and described redirect video data corresponding to the time;Or
The time span of video in the time location redirected is beyond the playlist, then from the server
Receive and play newest video data.
A kind of method and apparatus of video playback provided in an embodiment of the present invention, playback equipment receive pause instruction, ought
The preceding video pause played, and from this moment of pause, start to receive live video data from server, together
When the video data received is stored in the caching of playback equipment;When receiving play instruction, playback equipment plays slow
The video data downloaded in depositing;During video is played, if also receiving progress jump instruction, playback equipment is also
It can obtain the time specified in progress jump instruction, and by foradownloaded video data in specified time and playback equipment caching
Time span contrasts, if the time specified in progress jump instruction is less than in playback equipment caching foradownloaded video data
During time span, then determine in the latter and play video data corresponding to the former specified time, and when the former is less than the latter,
Playback equipment directly plays the live video data downloaded from server, that is, recovers live.
The step of passing through the above, playback equipment are stored live video data, and are jumped according to play instruction or progress
Turn instruction review broadcasting, progress redirects or recover live operation, so as to compensate for can not regarding to live in the prior art
The defects of frequency carries out reviewing operation.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of flow chart of the method for video playback provided in an embodiment of the present invention;
Fig. 2 is a kind of flow chart of the method detailed of video playback provided in an embodiment of the present invention;
Fig. 3 is the time shaft schematic diagram at three moment provided in an embodiment of the present invention;
Fig. 4 is the first situation schematic diagram of three moment provided in an embodiment of the present invention on a timeline;
Fig. 5 is the flow chart of the first situation provided in an embodiment of the present invention according to three moment on a timeline;
Fig. 6 is the second situation schematic diagram of three moment provided in an embodiment of the present invention on a timeline;
Fig. 7 is the flow chart of the second situation provided in an embodiment of the present invention according to three moment on a timeline;
Fig. 8 is the schematic flow sheet that video time progress provided in an embodiment of the present invention redirects;
Fig. 9 is the idiographic flow schematic diagram that video time progress provided in an embodiment of the present invention redirects;
Figure 10 is a kind of structural representation of the equipment of video playback provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
Embodiment one
The embodiment of the present invention provides a kind of method of video playback, as shown in figure 1, this method specifically includes:
101st, playback equipment receives pause instruction, according to pause instruction, is regarded what the pause of the first moment was currently played
Frequently, the video data from first moment and simultaneously is downloaded from server, by the video data storage of download in the buffer.
102nd, play instruction is received, according to play instruction, the video data in reading caching at the second moment, and play and regard
Frequency evidence.
When playback equipment detects and received the pause instruction that user sends, as shown in Fig. 2 carrying out following operate:
1011st, it was designated as the first moment at the time of playback equipment will receive instruction, and the video being currently played is entered
Row pause is handled.
1012nd, video data of the playback equipment from server download from the first moment, the video data of download is stored
In playback equipment caching.
Wherein, can also broadcasting video data while playback equipment stores the video data downloaded from server
Put the time stores in the lump.
Further, in addition to:
1013rd, when the 3rd moment, when the video data that the caching of playback equipment is downloaded takes, while the playback equipment
When being not received by the instruction of broadcasting, playback equipment can download played column corresponding to the 3rd moment rear video data from server
Table, and the content of playlist is stored in local memory.
The caching of playback equipment in itself is limited by operating system or hardware memory space, and often capacity is little, is only capable of
The video data of certain time is enough stored, after playback equipment is filled with, in order to keep that live video is continued to store, meeting
Using the form continued from server foradownloaded video playlist.
The video data that so-called playlist stores in being cached previously in playback equipment is different, before in playback equipment
Caching is in specific in complete live video information, including the attribute information, in addition to video such as video length, video size
The video data of appearance, but only include video initial time in playlist, terminate time, video storage address in the server
Video data easily can be obtained from server Deng attribute information, and according to playlist, playback equipment, therefore, played
List is far smaller than the video data stored in playback equipment caching, therefore playlist is carried out into storage pair in local memory
Very little is influenceed in other equipment, according to representative value, the space shared by the playlist of 10 hour contents is stored and is not more than
1MB, there is very strong operability playlist is locally stored.
It can be seen from the related content of HTTP Live Streaming (HLS) agreement, in the transmission of current HLS protocol
Appearance includes two aspects, and M3U describes file and TS media files, and wherein M3U describes file and is made up of a series of label Tag files
Text, and TS media files then be comprising timestamp prescribed level audio-video document, further, HLS assist
Also include playlist Playlist in view.
Playlist in HLS protocol is a text being made up of multiple independent rows, is a URL sky per a line
White row or the character string started with " # ", often different elements are separated with space in a line, and a URL represents a media segment
An or " Variant Playlist File ".
In M3U files in HLS protocol, include the information such as time span of segmenting video corresponding to the M3U files,
That is, being directed to each video segmentation file, the time length that a M3U file describes the video segmentation file is respectively provided with
Degree.
Understood with reference to the content of step 1023 and the partial content of above-mentioned HLS protocol, when playback equipment is cached by video
After data take, when being still not received by the play instruction of user's transmission, playback equipment can download broadcasting from server and set
For the playlist information that the video after video data has been stored in caching, and these information are stored in local computer
In depositing.
Preserved in playlist be the 3rd moment rear video initial time, terminate the time specifying information so that
Playback equipment is after the video data being stored in playback equipment caching is played, additionally it is possible to according to playlist, under server
Carry the video data of video in playlist.
Exemplary, as shown in figure 3, in figure 3, a time shaft be present, it is to the right positive direction to define the time shaft, is pressed
Three moment are respectively defined according to time order and function order, according to foregoing description in the present embodiment, it is known that the first moment was to broadcast
The pause instruction that equipment receives user's transmission is put, at the time of video is currently played in pause, the second moment was playback equipment
At the time of receiving the play instruction of user's transmission, and recover video playback, and the 3rd moment was downloaded for playback equipment caching
Video data at the time of take.According to the explanation of above-mentioned steps in the present embodiment, sequentially in time, three moment it is front and rear
Order has following three kinds of situations:
First situation:First moment, the second moment, the 3rd moment;
Second situation:First moment, the 3rd moment, the second moment.
Next, it is illustrated respectively for both the above situation.
When for the first situation when, arrangement on time shaft as shown in figure 4, according to distribution situation at the time of time shaft in figure,
It can be clearly seen that, the second moment occurred before the 3rd moment, and corresponding scene is:Playback equipment is in own cache quilt
Before played data takes, the play instruction of user's transmission has been received by, it is therefore, specific such as Fig. 5 the step of generation under this situation
It is shown:
201st, playback equipment receives pause instruction, according to pause instruction, is currently played in the pause of the first moment
Video, and playback equipment continues the video data from server downloaded for the first moment simultaneously, and the video data of download is deposited
Storage is in the caching of playback equipment itself.
202nd, playback equipment receives play instruction, and from the second moment device, playback equipment reads the download in own cache
Good video data, the video being suspended is played out from the first moment of pause.
Under this situation, the caching of playback equipment itself is not occupied full, when the information of corresponding time shaft is exactly the 3rd
It is later than the appearance of the second moment quarter.
In a second situation, the arrangement on time shaft is as shown in fig. 6, according to distribution situation at the time of time shaft, Ke Yiqing
Chu finds out, the second moment occurred after the 3rd moment, and corresponding scene is:Playback equipment is receiving broadcasting for user equipment
Before putting instruction, the caching of itself has been occupied full, and just receives the play instruction of user's transmission afterwards, therefore, this scene issues
Raw step is specifically as shown in Figure 7:
301st, playback equipment receives pause instruction, in the video that the pause of the first moment is currently played, plays simultaneously
Equipment continues the video data from server downloaded for the first moment, and the video data of download is stored in playback equipment itself
Caching in.
302nd, playback equipment takes the caching of playback equipment itself at the 3rd moment from the video data that server is downloaded.
303rd, playback equipment from server downloaded for the 3rd moment after video corresponding to playlist, and by the broadcasting of download
The content of list is stored in the internal memory of local computer.Here playlist be in HLS protocol M3U describe file composition
Playlist.
304th, after playback equipment receives the play instruction of user's transmission, read from playback equipment own cache first
Video data through having downloaded, the video being suspended is played out from the first moment of pause.
305th, when playback equipment commences play out the video data in caching, playback equipment can also be according to being stored in local meter
Playlist in calculation machine internal memory, download video data corresponding with playlist from server so that playback equipment is playing
After video data in complete own cache, the broadcasting of video still can continue to.
The embodiment of the present invention provides a kind of method of video playback, and playback equipment receives pause instruction, and pause is currently playing
Video, from server foradownloaded video data and store caching in, when receiving play instruction, by read cache in
Video data, so as to can continue to play the video of pause, it is even more important that accounted for when playback equipment caches by video data
Completely, when but not receiving play instruction yet, playback equipment can also obtain the playlist content of video from server, so as to
In playback equipment after the video data in own cache is played, it can also continue to obtain from server according to playlist
New video data, can so make user by the live video pause of line for a period of time after, can also be from the position of pause
Put and continue to watch video, can so make user to spend the replay of time viewing video again, can realize and be regarded to live
The function that frequency is reviewed, make up and the afunction reviewed is realized to live video.
Embodiment two
On the basis of a upper embodiment is realized and realizes that suspending/resuming plays to the live video based on HLS protocol, this reality
Apply example and also further provide and can carry out video progress in buffered live video data and redirect and recover live
Method, specific step is as shown in Figure 8:
401st, after playback equipment receives pause instruction, in the video that the pause of the first moment is currently played, broadcast simultaneously
Video data of the equipment from server downloaded for the first moment is put, and the video data of download is stored in the buffer.
402nd, playback equipment is in the second reception to play instruction, the M3U files in HLS protocol, it is determined that from
One moment to the second moment playback equipment buffered video data length and file size.
403rd, playback equipment receives progress jump instruction, obtains the time location redirected in progress jump instruction, and will jump
The time location turned and the time span and playlist of video information in playback equipment caching are contrasted.
Further, it is as shown in figure 9, different according to the position of the time location of determination, following three kinds of situations are also divided into, are had
Body, step 403 includes:
4031st, it is when the time location redirected is less than the time span of the video information of playback equipment caching, then true from
The time location that fixed time location redirects commences play out the video data cached;Or
4032nd, when the time location redirected is more than the time span of the video information of playback equipment caching but less than download
Playlist in video time span, then specifying information in playlist determine that redirecting video corresponding to the time rises
Begin the time, download and play from server and redirect video data corresponding to the time;Or
4033rd, in the time location redirected is beyond playlist video time span, then from server receive simultaneously
Play newest video data.
The embodiment of the present invention provides a kind of method of video playback, and playback equipment is by detecting in user's progress jump instruction
The file size specified, the M3U file contents according to corresponding to buffered video, the video time position that user specifies is determined, so as to
Make playback equipment be played out from fixed time location, the progress progress jump in buffered video data can be realized
Turn, after time span of the time location that user specifies beyond playlist, playback equipment directly obtains most from server
New video data plays out, that is, recovers live, so enables to user missing the net cast of a period of time
Afterwards, quickly can be browsed in the video missed, and can also be after browsing, in newest live of direct viewing
Hold, the function of being reviewed to live video can not only be realized, and reviewed according to play instruction or progress jump instruction
Broadcasting, progress redirect or recovered live operation, so as to compensate for live video can not being carried out reviewing operation in the prior art
The defects of.
Embodiment three
The embodiment of the present invention provides a kind of equipment 1 of video playback, and as shown in Figure 10, the equipment includes:
Download unit 11, for receiving pause instruction, according to the pause instruction, at the first moment, pause is currently being broadcast
The video put, and the video data from first moment is downloaded from server simultaneously, the video data of download is stored in
In caching;
Broadcast unit 12, for receiving play instruction, according to the play instruction, read at the second moment in the caching
Video data, and play the video data.
Wherein, download unit 11 includes:
Time computation subunit 111, for the video data of the download to be stored in the caching of playback equipment, and remember
The time span of address book stored video data in playback equipment caching.
Subelements under list, for being filled with when the caching in playback equipment described in the 3rd moment, and do not receive
During to the play instruction, then the playlist of the 3rd moment rear video content is downloaded from the server, is broadcast described
Table is emplaced to be stored in internal memory.
The playlist that subelements are downloaded under list is used for:
Preserved in the playlist be the 3rd moment rear video initial time, terminate the time specific letter
Breath so that the playback equipment is after the video data being stored in the playback equipment caching is played, always according to the broadcasting
List, the video data of video in the playlist is downloaded from the server.
Further, equipment 1 also includes:
Jump-transfer unit 13, for receiving progress jump instruction, the time location redirected in the progress jump instruction is obtained,
And the time location redirected and the time span of video information in playback equipment caching and the playlist are entered
Row contrast;
When the time location redirected is less than the time span of the video information of playback equipment caching, then from
The time location redirected described in the time location of determination commences play out the video data cached;Or
When the time location redirected is more than the time span of the video information of playback equipment caching but less than described
The time span of the playlist of download, then specifying information in the playlist determine described in redirect the time corresponding to
Video initial time, downloads and plays from the server and described redirect video data corresponding to the time;Or
When the time location redirected is beyond the time span in the playlist, then received from the server
And play newest video data.
The embodiment of the present invention provides a kind of equipment of video playback, and when receiving pause instruction, pause is currently being broadcast
The video put, the video data from being suspended the moment is downloaded from server, and the video data of download is preserved in the buffer;
When receiving play instruction, the video data in caching is read;Further, moreover it is possible in the play instruction sent according to user
Time location, compared with the video data in caching, the progress to be played back redirects and recovered live operation, with showing
There is technology to compare, can be carried out reviewing broadcasting, progress redirects or recovering live behaviour according to play instruction or progress jump instruction
Make, the defects of so as to compensate in the prior art live video can not being carried out reviewing operation..
In several embodiments provided herein, it should be understood that disclosed method, device, and system, can be with
Realize by another way.For example, device embodiment described above is only schematical, for example, the unit
Division, only a kind of division of logic function, can there is other dividing mode, such as multiple units or component when actually realizing
Another system can be combined or be desirably integrated into, or some features can be ignored, or do not perform.It is another, it is shown or
The mutual coupling discussed or direct-coupling or communication connection can be the indirect couplings by some interfaces, device or unit
Close or communicate to connect, can be electrical, mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit
The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also
That the independent physics of unit includes, can also two or more units it is integrated in a unit.Above-mentioned integrated list
Member can both be realized in the form of hardware, can also be realized in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit realized in the form of SFU software functional unit, can be stored in one and computer-readable deposit
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are causing a computer
Equipment (can be personal computer, server, or network equipment etc.) performs the portion of each embodiment methods described of the present invention
Step by step.And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (Read-Only Memory, abbreviation
ROM), random access memory (Random Access Memory, abbreviation RAM), magnetic disc or CD etc. are various to store
The medium of program code.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.