Summary of the invention
The embodiment of the present application, by providing a kind of program broadcasting method based on HLS protocol and device, solves
Being the demand meeting different user in prior art, server is required for same multimedia file and disposes
Many set section FileVersions and index file version, this programme makes server can enter according to the identity of user
The broadcasting of row differentiation, when playing same video flowing, provides different indexes according to the difference of client identity
File makes last broadcasting content different.
First aspect, the embodiment of the present application provides a kind of program broadcasting method based on HLS protocol, should
For terminal, described method includes:
Based on target program, send the first playing request download server to server and broadcast based on described first
The first broadcasting index file that the request of putting generates, described first plays index file for providing and described target
The URL address of the basic class section file that program is relevant;
If described first broadcasting index file comprising default increment class section file identification information, then to clothes
Business device sends the second playing request based on HLS protocol, at least carries in described second playing request
The right identification information of described terminal;
The second broadcasting index file that download server right identification information based on described terminal generates, described
Second plays index file for providing the URL address of increment class section file;
Index is play in the basic class section file URL address and second that playing index file according to first provides
The URL address of the increment class section file that file provides is downloaded the section file of described target program and plays.
Second aspect, the embodiment of the present application provides a kind of program broadcasting method based on HLS protocol, should
For server, described method includes:
Receive the first playing request that terminal sends, target program is cut into slices;
If the section file of described file destination comprises the section file of preset content type, then cut described
Sheet file is classified, and generates basic class section file and at least one increment corresponding with preset content type
Class section file;
Generating the first broadcasting index file according to default broadcast strategy, described first plays index file is used for
The URL address that basic class section file is provided and the identification information of the increment class section file preset;
Receive the second playing request that described terminal sends after downloading described first broadcasting index file, described
Second playing request carries described terminal authorization identification information;
According to described right identification information, determine the increment class section file relevant to right identification information;
Playing index file based on described increment class section file generated second, described second plays index file
For providing the URL address of described increment class section file.
The third aspect, the embodiment of the present application provides a kind of program broadcasting apparatus based on HLS protocol, should
For terminal, described device includes:
First plays index download module, for based on target program, sends the first playing request to server
And the first broadcasting index file that download server generates based on described first playing request, described first plays
The URL address that index file cuts into slices file for providing the basic class relevant to described target program;
Index file analyzes module, cuts if comprising default increment class in described first broadcasting index file
Sheet file identification information, then send based on HLS protocol the second playing request to server, and described the
Two playing request at least carry the right identification information of described terminal;
Second plays index download module, and download server right identification information based on described terminal generates
Second plays index file, and described second plays index file for providing the URL of increment class section file
Address;
Section file download module, for playing, according to first, the basic class section file that index file provides
URL address and second is play the URL address of the increment class section file that index file provides and is downloaded described mesh
Mark the section file of program and play.
Fourth aspect, the embodiment of the present application additionally provides a kind of program broadcasting apparatus based on HLS protocol,
Being applied to server, described device includes:
Section file generating module, for receiving the first playing request that terminal sends, is carried out target program
Section;
Section document classification module, if comprise preset content type in the section file of described file destination
Section file, then described section file is classified, generates basic class section file and and preset content
Type at least one increment class corresponding section file;
First plays index file generation module, for generating the first broadcasting index according to default broadcast strategy
File, described first play index file for provide basic class section file URL address and preset
The identification information of increment class section file;
Second playing request receiver module, is used for receiving described terminal and is downloading described first broadcasting index file
Second playing request of rear transmission, carries described terminal authorization identification information in described second playing request;
Increment section file matching module, for according to described right identification information, determines and believes with capability identification
The increment class section file that manner of breathing closes;
Second plays index file generation module, for playing based on described increment class section file generated second
Index file, described second plays index file for providing the URL address of described increment class section file.
The application, for terminal, first sends the first playing request for target program to server,
Then downloading the first broadcasting index file, wherein, first plays index file provides basic class section file
URL address, if also comprising the identification information of increment class section file in the first broadcasting index file, that
Terminal second time sends the second playing request to server, the authority of carried terminal in the second playing request
Identification information, after server receives, generates the second broadcasting index file according to right identification information, this
Two play in index file, comprise the URL address of increment class section file, finally, based on two broadcastings
Index file, user can get the section file of target program and play out, for server, clothes
File destination is cut into slices after receiving the first playing request by business device, if it find that comprise pre-in section file
If the section file of content type, just section file is classified, be divided into basic class section file and increment
Class section file, first provides only terminal and comprises basic class section file URL address and the section of increment class
First broadcasting index file of the identification information of file, receives terminal with right identification information in second time
The second playing request after, then determine relevant increment class section file, Jin Ersheng based on right identification information
Becoming the second broadcasting index file to download for user, compared to existing technology, server end is only disposed a set of for mesh
Mark the section file of program, and content type based on section file is classified, for the authority of terminal
Information is different, it is provided that different increment section files, and terminal is based on downloading the index file obtained not
With, different section file contents can be obtained, and then the different editions realizing same video flowing plays content,
Effectively avoiding prior art for meeting the needs of different users, server is required for same multimedia literary composition
Part disposes many set section FileVersions and index file version so that server can enter according to the identity of user
The broadcasting of row differentiation, when playing same video flowing, provides different indexes according to the difference of client identity
File makes last broadcasting content different.
Detailed description of the invention
In order to be better understood from technique scheme, below in conjunction with Figure of description and concrete embodiment party
Technique scheme is described in detail by formula.
The embodiment of the present application provides a kind of program broadcasting method based on HLS protocol, is applied to terminal, as
Shown in Fig. 1, described method includes:
Step S101: based on target program, to server send the first playing request download server based on
The first broadcasting index file that described first playing request generates, described first plays index file is used for providing
The URL address of the basic class section file relevant to described target program;
HLS (HTTP Live Streaming) is that Apple is for iPhone, iPod, iTouch and iPad
The streaming media solutions based on http protocol developed etc. mobile device.Web in HLS technology
Server provides close to real-time audio/video flow to client.But it is the standard used during using
Http protocol, so at this moment, as long as using the technology of HLS, just can answering at common HTTP
Use and program request and live is directly provided.This technology ultimate principle is that video file or video flowing are cut into small pieces
And set up index file (m3u8) (ts).H.264 the video flowing supported is encoded to, and audio stream is encoded to AAC.
The partition strategy of HLS, substantially recommending is 10 seconds bursts, and certainly, the concrete time also wants root
Can freely adjust according to the actual duration of the burst after dividing well.
In simple terms, terminal provides only the URL of basic class section file in getting the first broadcasting index file
Address, and server end target program is except basic class section file, it is possible to there is also the section of other classes
File, certain target program is likely to only comprise basic class section file.
Step S102: if comprising default increment class section file identification letter in described first broadcasting index file
Breath, then send the second playing request based on HLS protocol to server, in described second playing request
At least carry the right identification information of described terminal;
Server end provide first broadcasting index file in comprise basic class section file URL address with
And a default identification information may be there are, this identification information is used for identifying target program and also includes
Increment class section file.
If terminal finds the mark of increment class section file in the first broadcasting index file, can be to server
Send the second playing request of the right identification information carrying self.
Such as, terminal is by searching #EXTINF-ADDITIONAL:<GID>this field may determine that and is
No continuation sends the second playing request.
Step S103: the second broadcasting index that download server right identification information based on described terminal generates
File, described second plays index file for providing the URL address of increment class section file;
After server receives the playing request that terminal second time sends, can be according to the terminal carried in request
Right identification information generates the second broadcasting index file, and terminal can obtain based on this second broadcasting index file
Know the URL address of increment class section file.
Step S104: play the basic class section file URL address and that index file provides according to first
The section of described target program is downloaded in the two URL addresses playing the increment class section file that index file provides
File is also play.
The application, for terminal, first sends the first playing request for target program to server,
Then downloading the first broadcasting index file, wherein, first plays index file provides basic class section file
URL address, if also comprising the identification information of increment class section file in the first broadcasting index file, that
Terminal second time sends the second playing request to server, the authority of carried terminal in the second playing request
Identification information, after server receives, generates the second broadcasting index file according to right identification information, this
Two play in index file, comprise the URL address of increment class section file, finally, based on two broadcastings
Index file, user can get the section file of target program and play out, compared to existing technology, eventually
End is by twice playing request, and reports the right identification information of self in second time playing request so that
Server provides the URL address of increment class section file according to right identification information, is finally based on basic class
The address of section file and the URL address of increment class section file, it is achieved the video content of full release is broadcast
Playing function, effectively avoids prior art for meeting the needs of different users, and server is required for same
Multimedia file disposes many set section FileVersions and index file version so that server and terminal can roots
Identity according to user carries out the broadcasting of differentiation, when playing same video flowing, according to the difference of client identity
Different index files is provided to make last broadcasting content different.
Optionally, the method for the present embodiment also includes, if not comprising pre-in described first broadcasting index file
If increment class section file identification information, then according to first play index file provide basic class section
File URL address is downloaded the section file of described target program and plays.
Optionally, the second broadcasting index generated at download server right identification information based on described terminal
After the step of file, also include:
Obtain described first and play the time of each section file in index file and the second broadcasting index file
Information;
Based on described temporal information, play index file to described first and the second broadcasting index file closes
And, generate and merge index file.
Example, a corresponding complete video file, the reproduction time that its basic class section file is corresponding is
The section file 1 of common plot from the section file 2 of 00:00:00-00:45:00 and common plot from
01:25:01-02:00:00, and wherein may comprise increment class section file, such as, one section of region sensitivity feelings
The section file of joint, its reproduction time is 00:45:01-01:00:00, the section file of one section of violence plot,
Its reproduction time is 01:00:01-01:25:00, if the authority of terminal is relatively big, then server may will increase
The information of the section file of amount class is all handed down to terminal,
After terminal receives, again two parts of index files can be ranked up, by increment according to the order of time
The information that class section file is corresponding is inserted in basic class section file, after then generating a complete merging
Index file.
Optionally, the second broadcasting index file has carried out cryptographic operation at server end, then corresponding,
Download server right identification information based on described terminal generate second broadcasting index file step it
After, also include:
The decoding request of the second broadcasting index file after server sends based on encryption;
The decryption information issued according to server, obtains the increment class section literary composition that the second broadcasting index file provides
The URL address of part.
First plays index file can issue with form in plain text, and second plays index file owing to relating to
The privacy informations such as the authority to user, server can be play index file to second and be encrypted, i.e. by close
The form of literary composition issues, to ensure the safety of terminal.
On the other hand, present invention also provides a kind of program broadcasting method based on HLS protocol, be applied to
Server, as in figure 2 it is shown, described method includes:
Step S201: receive the first playing request that terminal sends, target program is cut into slices;
Original media file is carried out cutting into slices and obtain cutting into slices file and former by server end according to HLS protocol
Beginning concordance list.
Such as: raw media file playing duration 02:35:00, basic section file playing duration 5 seconds, altogether
Generating section file 1860, index is 0~1859.0 corresponding first section file, 1859 is corresponding
Last file of cutting into slices.
Step S202: if comprising the section file of preset content type in the section file of described file destination,
Then described section file is classified, generate basic class section file and corresponding with preset content type extremely
Few a kind of increment class section file;
By analyzing the content of each section file, wherein section file may comprise the feelings that region is sensitive
Joint, the plot of violence, religion sensitivity plot, plot etc. unsuitable for children.These can serve as comprising pre-
If the section file of content type, therefore, play to realize differentiation, preferably give each type of section
File is plus a mark content or the label of plot.
Example, as shown in table 1 below:
Content plot segment mark label |
Reproduction time |
Section file index scope |
Common plot section 1 |
00:00:00–00:45:00 |
0-539 |
Region sensitivity plot section |
00:45:01–01:00:00 |
540-719 |
Violence plot section |
01:00:01–01:25:00 |
720-1019 |
Common plot section 2 |
01:25:01–02:00:00 |
1020-1439 |
Religion sensitivity plot section |
02:00:01–02:15:00 |
1440–1619 |
Lengthen plot section |
02:15:01–02:35:00 |
1620-1859 |
Wherein every kind of plot or content type may corresponding multiple section files, such as section file sequence number
0~539 is all the section file of common content.
As common plot section 1 and common plot section 2 broadly fall into basic class section file, and region sensitivity plot
Section, the plot section of violence, religion sensitivity plot section and lengthening plot section broadly fall into increment class section file.
Step S203: generating the first broadcasting index file according to default broadcast strategy, described first plays rope
Quotation part is for providing URL address and the mark of default increment class section file of basic class section file
Information;
At server end by analyzing the content type of section file, can be first raw according to the broadcast strategy given tacit consent to
Become the first broadcasting index file.Mean that user currently can only watch common plot section 1 and common plot section 2
Corresponding content, but play in index file first and this target program of user can be pointed out also to include increment class
The mark of section file, if authority is enough, can apply for watching the program fragment of increment class.
In reality, generate according to acquiescence broadcast strategy and play concordance list, the same M3U8 of its form in plain text, and increase
Lower field:
#EXTINF-GLOBAL:<GID>, GID is 128 bit digital.The most uniquely identify this to broadcast
Put program.
If this program there is also other increments and plays content, then include at broadcasting concordance list in plain text with subscript
Know:
#EXTINF-ADDITIONAL:<GID>, GID is 128 bit digital.The most uniquely identify this
Play program.
Step S204: receive the second broadcasting that described terminal sends after downloading described first broadcasting index file
Request, carries described terminal authorization identification information in described second playing request;
Step S205: according to described right identification information, determines that the increment class relevant to right identification information is cut
Sheet file;
Example, as shown in table 2 below:
The right identification information of terminal can be corresponding be divided into anonymous client, the most not client with charge, common state
Interior client with charge and external client with charge, can search what every kind of client can watch in data base accordingly
Section content type, such as the secondary series in table 2.
If current terminal authorization mark shows that user is common domestic client with charge, then such client can
To watch basic class section file (common plot section 1 and common plot section 2) and the section of Partial Incremental class
File (lengthens plot section)
Step S206: playing index file based on described increment class section file generated second, described second broadcasts
Put index file for providing the URL address of described increment class section file.
The increment class section file content can watched based on the user matched in step S205, will lengthen
Content corresponding to plot section sequence number of i.e. cutting into slices generates the second broadcasting index literary composition from the URL address of 1,620 1859
Part, obtains for user's subsequent download.
Example again, can as it is shown on figure 3, server end be according to different corresponding the broadcasting of terminal authorization information
Put strategy, generate the video-frequency playing content of different editions.
To those skilled in the art, when realizing this programme, it is also possible to send a pin to server
Playing request to target program, carries the right identification information of user in this playing request, and server is received
After request, based on playing request, generate the first broadcasting rope of corresponding basic class section file URL address
Quotation part, and generate corresponding increment class section file URL address according to the right identification information of user
Second plays index file, and terminal connects download and receives two and play after index files, merges, or clothes
Two broadcasting index files are merged and are downloaded by terminal by business device section.The program also should belong to this Shen
Please be in technical scope to be protected.
The application is for server, and file destination is cut after receiving the first playing request by server
Sheet, if it find that comprise the section file of preset content type in section file, is just carried out file of cutting into slices point
Class, is divided into basic class section file and increment class section file, first provides only terminal and comprise basic class and cut
First broadcasting index file of the identification information of sheet file URL address and increment class section file, second
Secondary receive the terminal the second playing request with right identification information after, then determine based on right identification information
The increment class section file being correlated with, and then generation the second broadcasting index file is for user's download, compares existing skill
Art, server end only disposes a set of section file for target program, and content based on section file
Type is classified, and the authority information for terminal is different, it is provided that different increment section files, and
Terminal is different based on downloading the index file obtained, and can obtain different section file contents, and then realize
The different editions of same video flowing plays content, effectively avoids prior art for meeting different user need
Asking, server is required for same multimedia file and disposes many set section FileVersions and index file version
This so that server can carry out the broadcasting of differentiation according to the identity of user, when playing same video flowing,
Difference according to client identity provides different index files to make last broadcasting content different.
Optionally, described described section file is classified, generate basic class section file and with preset in
Hold the step of type at least one increment class corresponding section file, particularly as follows:
Described section file is divided according to default content type;
Section file corresponding for non-default content type is defined as basic class section file, will meet default
Section file corresponding to content type
The increment that different demarcation is at least one type section file according to program content type;
According to default matching strategy, for the terminal authorization mark that each type of increment section file coupling is corresponding
Knowledge information.
Optionally, described according to described right identification information, determine the increment class relevant to right identification information
Section file, particularly as follows:
After the right identification information getting described terminal, from default each type of increment section file
With lookup target type increment section file in the corresponding relation of terminal authorization identification information;
The increment section file meeting terminal authorization identification information corresponding is defined as target delta section file.
Optionally, described based on described increment class section file generated second play index file step it
After, also include:
Second broadcasting index file of described generation is encrypted;
The terminal downloads second that receives waiting plays the decoding request sent after index file, by correspondence second broadcasting
The decryption information of index file is handed down to described terminal.
Optionally, the present embodiment also includes:
If relevant increment class section file cannot be determined according to the right identification information of terminal, then generate increment
Class section file identification information deletes instruction;
Described deletion instruction is handed down to terminal, to indicate terminal to play the increasing in index file to described first
The identification information of amount class section file is deleted.
Based on same inventive concept, the embodiment of the present application additionally provides a kind of program based on HLS protocol
Playing device, is applied to terminal, and as shown in Figure 4, described device includes:
First plays index download module 401, for based on target program, sending the first broadcasting to server
The first broadcasting index file that request download server generate based on described first playing request, described first
Play the URL address that index file cuts into slices file for providing the basic class relevant to described target program;
Index file analyzes module 402, comprises default increment if playing in index file for described first
Class section file identification information, then send the second playing request based on HLS protocol, institute to server
State the right identification information at least carrying described terminal in the second playing request;
Second plays index download module 403, and download server right identification information based on described terminal is raw
The the second broadcasting index file become, described second plays index file for providing increment class section file
URL address;
Section file download module 404, for playing, according to first, the basic class section literary composition that index file provides
Part URL address and second is play the URL address of the increment class section file that index file provides and is downloaded described
The section file of target program is also play.
The application, for terminal, first sends the first playing request for target program to server,
Then downloading the first broadcasting index file, wherein, first plays index file provides basic class section file
URL address, if also comprising the identification information of increment class section file in the first broadcasting index file, that
Terminal second time sends the second playing request to server, the authority of carried terminal in the second playing request
Identification information, after server receives, generates the second broadcasting index file according to right identification information, this
Two play in index file, comprise the URL address of increment class section file, finally, based on two broadcastings
Index file, user can get the section file of target program and play out, compared to existing technology, eventually
End is by twice playing request, and reports the right identification information of self in second time playing request so that
Server provides the URL address of increment class section file according to right identification information, is finally based on basic class
The address of section file and the URL address of increment class section file, it is achieved the video content of full release is broadcast
Playing function, effectively avoids prior art for meeting the needs of different users, and server is required for same
Multimedia file disposes many set section FileVersions and index file version so that server and terminal can roots
Identity according to user carries out the broadcasting of differentiation, when playing same video flowing, according to the difference of client identity
Different index files is provided to make last broadcasting content different.
Based on same inventive concept, the embodiment of the present application also provides for a kind of program based on HLS protocol and broadcasts
Put device, be applied to server, as it is shown in figure 5, described device includes:
Section file generating module 501, for receiving the first playing request that terminal sends, to target program
Cut into slices;
Section document classification module 502, if comprise preset content in the section file of described file destination
The section file of type, then classify to described section file, generates basic class section file and with default
Content type at least one increment class corresponding section file;
First plays index file generation module 503, for generating the first broadcasting according to default broadcast strategy
Index file, described first plays index file for providing the URL address of basic class section file with pre-
If increment class section file identification information;
Second playing request receiver module 504, is used for receiving described terminal and is downloading described first broadcasting index
The second playing request sent after file, carries described terminal authorization mark letter in described second playing request
Breath;
Increment section file matching module 505, for according to described right identification information, determines and authority mark
The increment class section file that knowledge information is relevant;
Second plays index file generation module 506, for based on described increment class section file generated second
Playing index file, described second plays index file for providing the URL of described increment class section file
Address.
Based on the functions of modules in above-mentioned terminal and server, in reality, the block diagram such as Fig. 6 can be built.
At server end, on the one hand raw media file carries out slicing treatment, on the one hand pin by section module
The content of section file is classified by section time period analysis module, to the section literary composition of each type
Part increases section file label, identity type, and section time series, corresponding corresponding broadcast strategy,
By slice of data management module, each section file is divided, be divided into basic class section file and some
The increment class section file of type, meanwhile, index file generation module has configured the broadcasting index literary composition of acquiescence
Part i.e. base clusters indexing file, and client-based request, generate the increment broadcasting index file of ciphertext,
The broadcasting index file of encryption needs to interact with user profile authentication module, divides for different user rights
Join different increment class section files.
For terminal or client, add the analysis mould of index file on the basis of existing technology
Whether block, include increment section in the basic class section index file that Analysis server section issues first
The mark of file, if it is, second time sends playing request, and sends out the right identification information of client
Give server, by the broadcasting index file of the encryption that download module download server generates, it is thus achieved that increment
The URL address of class section file, is then based on downloading for the first time the URL of the basic class section file of acquisition
Address and second time download the section of the URL address download target program of the increment class section file obtained
File, is played out by playing module.
The application is for server, and file destination is cut after receiving the first playing request by server
Sheet, if it find that comprise the section file of preset content type in section file, is just carried out file of cutting into slices point
Class, is divided into basic class section file and increment class section file, first provides only terminal and comprise basic class and cut
First broadcasting index file of the identification information of sheet file URL address and increment class section file, second
Secondary receive the terminal the second playing request with right identification information after, then determine based on right identification information
The increment class section file being correlated with, and then generation the second broadcasting index file is for user's download, compares existing skill
Art, server end only disposes a set of section file for target program, and content based on section file
Type is classified, and the authority information for terminal is different, it is provided that different increment section files, and
Terminal is different based on downloading the index file obtained, and can obtain different section file contents, and then realize
The different editions of same video flowing plays content, effectively avoids prior art for meeting different user need
Asking, server is required for same multimedia file and disposes many set section FileVersions and index file version
This so that server can carry out the broadcasting of differentiation according to the identity of user, when playing same video flowing,
Difference according to client identity provides different index files to make last broadcasting content different.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or meter
Calculation machine program product.Therefore, the present invention can use complete hardware embodiment, complete software implementation or knot
The form of the embodiment in terms of conjunction software and hardware.And, the present invention can use and wherein wrap one or more
Computer-usable storage medium containing computer usable program code (include but not limited to disk memory,
CD-ROM, optical memory etc.) form of the upper computer program implemented.
The present invention is with reference to method, equipment (system) and computer program product according to embodiments of the present invention
The flow chart of product and/or block diagram describe.It should be understood that can by computer program instructions flowchart and
/ or block diagram in each flow process and/or flow process in square frame and flow chart and/or block diagram and/
Or the combination of square frame.These computer program instructions can be provided to general purpose computer, special-purpose computer, embedding
The processor of formula datatron or other programmable data processing device is to produce a machine so that by calculating
The instruction that the processor of machine or other programmable data processing device performs produces for realizing at flow chart one
The device of the function specified in individual flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and computer or the process of other programmable datas can be guided to set
In the standby computer-readable memory worked in a specific way so that be stored in this computer-readable memory
Instruction produce and include the manufacture of command device, this command device realizes in one flow process or multiple of flow chart
The function specified in flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, makes
Sequence of operations step must be performed to produce computer implemented place on computer or other programmable devices
Reason, thus the instruction performed on computer or other programmable devices provides for realizing flow chart one
The step of the function specified in flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know base
This creativeness concept, then can make other change and amendment to these embodiments.So, appended right is wanted
Ask and be intended to be construed to include preferred embodiment and fall into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification without deviating from this to the present invention
Bright spirit and scope.So, if the present invention these amendment and modification belong to the claims in the present invention and
Within the scope of its equivalent technologies, then the present invention is also intended to comprise these change and modification.