Invention content
The technical problem to be solved in the present invention is, in view of the deficiencies of the prior art, provides a kind of video that is played simultaneously
Method and system, to solve the problems, such as that existing multiple terminal devices play poor synchronization existing for same video file simultaneously.
In order to solve the above-mentioned technical problem, the technical solution adopted in the present invention is as follows:
A kind of method that video is played simultaneously, including:
When main playback equipment receives play instruction, the of the current video frame of file to be played is generated according to the play instruction
One render request;
Synchronization request is generated, and send the synchronization request at least one from playback equipment according to first render request,
In, synchronization request carries the file identification of file to be played;
Respectively the synchronization request is verified from playback equipment, and verification result is fed back into main playback equipment;
Main playback equipment renders to video window, and generate when receiving the feedback information being proved to be successful, by current video frame
Second render request of next video frame is with each video frame of circulation synchronous file to be played.
The method that video is played simultaneously, wherein, when the main playback equipment receives play instruction, broadcast according to described
Include before putting the render request for the current video frame that instruction generates file to be played:
Main playback equipment receives the play instruction of server transmission with respectively distinguishing Connection Service device from playback equipment, wherein, it broadcasts
Put the file identification that instruction carries file to be played.
The method that video is played simultaneously, wherein, when the main playback equipment receives play instruction, broadcast according to described
The first render request for putting the current video frame that instruction generates file to be played specifically includes:
Main playback equipment receives the play instruction, reads the file identification that the play instruction carries;
The current video frame of file to be played is obtained according to the file identification, and the first wash with watercolours is generated according to the current video frame
Dye request.
The method that video is played simultaneously, wherein, it is described that respectively the synchronization request is verified from playback equipment, and
Verification result is fed back to main playback equipment to specifically include:
The synchronization request respectively is received from playback equipment, and extracts the synchronization request and carries file identification;
The file to be played is judged whether according to the file identification, to be verified to the synchronization request;
When there are the feedback information being proved to be successful during the file to be played, is sent to main playback equipment, and wait to broadcast described in rendering
Put the video frame to be rendered of file;
When not there are during the file to be played, the feedback information of authentication failed is sent to main playback equipment.
The method that video is played simultaneously, wherein, it is described when there are during the file to be played, being sent out to main playback equipment
The feedback information being proved to be successful is sent, and the video frame to be rendered for rendering the file to be played specifically includes:
When there are the feedback informations during file to be played, being proved to be successful to the transmission of main playback equipment;
Obtain the first frame number of video frame to be rendered, and by first frame number and main playback equipment it is to be rendered work as forward sight
Second frame number of frequency frame is compared;
If the first frame number is identical with the second frame number, video frame to be rendered is rendered;
If the first frame number is differed with the second frame number, corresponding video frame is searched, and render and look into according to the second frame number
Find video frame.
The method that video is played simultaneously, wherein, the main playback equipment is receiving the feedback information that is proved to be successful
When, current video frame is rendered into video window, and the second render request for generating next video frame is to be played with circulation synchronous
Each video frame of file specifically includes:
Main playback equipment receives the feedback information respectively sent from playback equipment, and reads the verification result that each feedback information carries;
When being to be proved to be successful there are verification result, current video frame is rendered into video window, and generate next video frame
Second render request is with each video frame of circulation synchronous file to be played.
The method that video is played simultaneously, wherein, the main playback equipment is receiving the feedback information that is proved to be successful
When, current video frame is rendered into video window, and the second render request for generating next video frame is to be played with circulation synchronous
Each video frame of file further includes:
When being to be proved to be successful not there are verification result, the corresponding synchronization request of current video frame is sent after being spaced preset time
To respectively from playback equipment.
A kind of system that video is played simultaneously, including a main playback equipment and at least one from playback equipment, the master
Playback equipment is connect respectively with respectively from playback equipment, and the main playback equipment receives play instruction, is given birth to according to the play instruction
It is sent to respectively from playback equipment into the first render request and synchronization request, and by the synchronization request;Respectively connect from playback equipment
The synchronization request is received, the synchronization request is verified and verification result is fed back into main playback equipment;Main playback equipment
The feedback information respectively sent from playback equipment is received, and when receiving the feedback information being proved to be successful, by current video frame wash with watercolours
It contaminates to video window and the second render request of the next video frame of generation with each video frame of circulation synchronous file to be played.
The system that video is played simultaneously, further includes server, the server respectively with main playback equipment and each
It is connected from playback equipment, and file to be played is sent with play instruction respectively to main playback equipment and respectively from playback equipment.
The system that video is played simultaneously, further includes router;The server by router respectively with main broadcaster
Put equipment and be respectively connected from playback equipment, the main playback equipment with it is respectively direct-connected by network interface from playback equipment.
Advantageous effect:Compared with prior art, it is described the present invention provides a kind of method and system that video is played simultaneously
Method includes:When main playback equipment receives play instruction, the current video of file to be played is generated according to the play instruction
First render request of frame;Synchronization request is generated, and send institute at least one from playback equipment according to first render request
State synchronization request;Respectively the synchronization request is verified from playback equipment, and verification result is fed back into main playback equipment;It is main
Playback equipment renders to video window when receiving the feedback information being proved to be successful, by current video frame, and generates next regard
Second render request of frequency frame is with each video frame of circulation synchronous file to be played.The present invention is controlled by main playback equipment from broadcasting
It puts equipment and synchronizes the same video frame of rendering, ensure the consistent of the same video that different playback equipment synchronizations play, improve
The synchronism of video playing.
Specific embodiment
The present invention provides a kind of method and system that video is played simultaneously, to make the purpose of the present invention, technical solution and effect
Fruit is clearer, clear and definite, and the present invention is described in more detail for the embodiment that develops simultaneously referring to the drawings.It should be appreciated that this place
The specific embodiment of description only to explain the present invention, is not intended to limit the present invention.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singulative " one " used herein, " one
It is a ", " described " and "the" may also comprise plural form.It is to be further understood that is used in the specification of the present invention arranges
Diction " comprising " refers to there are the feature, integer, step, operation, element and/or component, but it is not excluded that presence or addition
Other one or more features, integer, step, operation, element, component and/or their group.It should be understood that when we claim member
Part is " connected " or during " coupled " to another element, it can be directly connected or coupled to other elements or there may also be
Intermediary element.In addition, " connection " used herein or " coupling " can include wireless connection or wireless coupling.It is used herein to arrange
Take leave whole or any cell and all combination of the "and/or" including one or more associated list items.
Those skilled in the art of the present technique are appreciated that unless otherwise defined all terms used herein are (including technology art
Language and scientific terminology), there is the meaning identical with the general understanding of the those of ordinary skill in fields of the present invention.Should also
Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art
The consistent meaning of meaning, and unless by specific definitions as here, the meaning of idealization or too formal otherwise will not be used
To explain.
Below in conjunction with the accompanying drawings, by the description of the embodiment, being described further to invention content.
As depicted in figs. 1 and 2, the present invention provides a kind of method that video is played simultaneously, including:
When S10, main playback equipment receive play instruction, the current video frame of file to be played is generated according to the play instruction
The first render request.
Specifically, the file to be played indicates that the broadcasting that the main playback equipment plays out is literary for the play instruction
Part.The main playback equipment can obtain the file to be played, while can also obtain the text to be played from playback equipment
Part.The play instruction can be that server is sent to main playback equipment, while described can also be synchronized from playback equipment receives
The play instruction.That is, the main playback equipment passes through the clothes with connecting same server simultaneously from playback equipment
Business device sends play instruction to principal and subordinate's playback equipment and provides video file to be played for principal and subordinate's playback equipment.Correspondingly, institute
When stating main playback equipment and receiving play instruction, the rendering of the current video frame of file to be played is generated according to the play instruction
Include before request:
Main playback equipment receives the play instruction of server transmission with respectively distinguishing Connection Service device from playback equipment, wherein, it broadcasts
Put the file identification that instruction carries file to be played.
Specifically, the server is respectively with the main playback equipment and respectively from playback equipment by network connection, and to
Main playback equipment and respectively play instruction, and main playback equipment and respectively can be from server from playback equipment are sent from playback equipment
Get file to be played.In addition, in order to ensure that main playback equipment is identical with the file to be played respectively got from playback equipment,
The play instruction can carry the file identification of file to be played, wait to broadcast according to can determining the file identification in this way
File is put, and ensures that main playback equipment is identical with the file to be played respectively obtained from playback equipment.
In the present embodiment simultaneously, after main playback equipment receives play instruction, can obtain file to be played currently needs
The video frame of broadcasting, is denoted as current video frame;And the render request of current video frame is generated, with by performing the render request
The current video frame is rendered into video window, to play the current video frame.Correspondingly, the main playback equipment connects
When receiving play instruction, the first render request that the current video frame of file to be played is generated according to the play instruction specifically wraps
It includes:
Main playback equipment receives the play instruction, reads the file identification that the play instruction carries;
The current video frame of file to be played is obtained according to the file identification, and the first wash with watercolours is generated according to the current video frame
Dye request.
S20, synchronization request is generated according to first render request, and the synchronization is sent at least one from playback equipment
Request, wherein, synchronization request carries the file identification of file to be played.
Specifically, the synchronization request is the main playback equipment generation, and will be sent to respectively from playback equipment to ask
Current video frame respectively is played simultaneously from terminal device.The synchronization request carries file identification, in order to be determined from playback equipment
Whether it has the corresponding video file of the file identification to need to render, that is to say, that according to the file identification to determine
It states and whether be used to the file to be played be played simultaneously from playback equipment.Wherein, the main playback equipment from broadcasting with respectively setting
Standby to be directly connected to using network interface, synchronization request is sent to respectively from playback equipment by main playback equipment by the way that network interface is direct-connected.
S30, respectively the synchronization request is verified from playback equipment, and verification result is fed back into main playback equipment.
Specifically, it is described that verification, which refers to respectively whether judging it from playback equipment, respectively to be carried out to synchronization request from playback equipment
There is the corresponding file to be played of the file identification, and verification result is generated according to judging result.The verification result includes
It is proved to be successful and authentication failed, it is described to be proved to be successful to be stored from playback equipment or the file to be played be got,
Authentication failed is not store and cannot get the file to be played from playback equipment.It is correspondingly, described respectively from broadcasting
Equipment verifies the synchronization request, and verification result is fed back to main playback equipment and is specifically included:
The synchronization request respectively is received from playback equipment, and extracts the synchronization request and carries file identification;
The file to be played is judged whether according to the file identification, to be verified to the synchronization request;
When there are the feedback information being proved to be successful during the file to be played, is sent to main playback equipment, and wait to broadcast described in rendering
Put the video frame to be rendered of file;
When not there are during the file to be played, the feedback information of authentication failed is sent to main playback equipment.
Specifically, the video frame to be rendered for rendering the file to be played refers to the video to currently needing to render
Frame is rendered.The video frame to be rendered needs identical with the current video frame of main playback equipment, that is to say, that described to treat wash with watercolours
The frame number needs for contaminating video frame are identical with the frame number of the current video frame of main playback equipment.Wherein, the main playback equipment
Current video frame frame number can be main equipment to slave device send synchronization request when carry, i.e., synchronization request carry use
It is each in this way in the first frame number of the current video frame for the file identification and main playback equipment for verifying file consistence to be played
Slave device can get first frame number, and to its own video frame to be rendered on the basis of the first frame serial number
Frame number is verified.It is correspondingly, described when there are during the file to be played, being proved to be successful to the transmission of main playback equipment anti-
Feedforward information, and the video frame to be rendered for rendering the file to be played specifically includes:
When there are the feedback informations during file to be played, being proved to be successful to the transmission of main playback equipment;
Obtain the first frame number of video frame to be rendered, and by first frame number and main playback equipment it is to be rendered work as forward sight
Second frame number of frequency frame is compared;
If the first frame number is identical with the second frame number, video frame to be rendered is rendered;
If the first frame number is differed with the second frame number, corresponding video frame is searched, and render and look into according to the second frame number
Find video frame.
Specifically, first frame number and the second frame number difference illustrate the current video frame of main playback equipment with from broadcasting
The video frame to be rendered for putting equipment is the different video frame of the corresponding played file of the file identification.And in order to enable video is same
Step, based on the playing progress rate of the main playback equipment, pair from main broadcaster put device plays progress it is different from playback equipment into
Row adjustment, so that being respectively the current video frame of main playback equipment from the video frame to be rendered of playback equipment.
Current video frame is rendered to video window by S40, main playback equipment when receiving the feedback information being proved to be successful
Mouthful, and the second render request of next video frame is generated with each video frame of circulation synchronous file to be played.
Specifically, the main playback equipment receives the feedback information being proved to be successful and refers to existing from playback equipment to master
The feedback information that playback equipment transmission is proved to be successful.Main playback equipment is when receiving the feedback information being proved to be successful, Ke Yizhi
It connects and current video frame is rendered into video window.In addition, the main playback equipment, which can also be pre-configured with, renders strategy, and according to
The strategy that renders renders current video frame.Certainly, the main playback equipment also can be by the rendering policy synchronization value respectively from broadcasting
Equipment is put, so that respectively rendering tactful all same used by playback equipment and the main playback equipment.
It is described play render strategy can be main player to respectively sent from playback equipment and main playback equipment render it is true
Recognize instruction, respectively rendered really according to described when receiving the rendering confirmation instruction from playback equipment and main playback equipment
Recognize instruction to be rendered.Wherein, it is the slave playback equipment being proved to be successful that the rendering, which confirms that instruction is only sent to verification result,.This
Outside, the rendering strategy can be that delay preset time performs Rendering operations, to avoid main playback equipment with being passed from playback equipment
The defeated time difference and caused by play nonsynchronous problem.Wherein, the preset time can be pre-set, e.g., 0.01s etc..
In the present embodiment simultaneously, the verification result that all feedback information carrying can be sent from playback equipment is verification
Success, can also the verification result that carries of the feedback information that is sent from playback equipment of part to be proved to be successful, can also not from
Playback equipment send feedback information carry verification result be verification into.Correspondingly, the main playback equipment is tested receiving
When demonstrate,proving successful feedback information, current video frame is rendered into video window, and generates the second render request of next video frame
It is specifically included with each video frame of circulation synchronous file to be played:
Main playback equipment receives the feedback information respectively sent from playback equipment, and reads the verification result that each feedback information carries;
When being to be proved to be successful there are verification result, current video frame is rendered into video window, and generate next video frame
Second render request is with each video frame of circulation synchronous file to be played;
When being to be proved to be successful not there are verification result, the corresponding synchronization request of current video frame is sent after being spaced preset time
To respectively from playback equipment.
Specifically, when not existing, when being proved to be successful to be proved to be successful, main broadcaster repeats to send after putting equipment interval preset time
The synchronization request is to respectively from playback equipment, and monitoring is respectively from the verification result of playback equipment.If continuous preset times do not receive
To being the feedback information that is proved to be successful there are verification result, then prompt user that failure is played simultaneously in more equipment.In addition, it ought partly test
Card result is when being proved to be successful, the number of its continuous synchronization failure and synchronous mistake is recorded for the slave playback equipment of authentication failed
The total degree lost when the number of continuous synchronization failure reaches the first predetermined threshold value, prompts to synchronize from playback equipment described in user
Play failure;When the total degree of synchronization failure reaches the second predetermined threshold value, from playback equipment, there are failures described in prompting user.
Preset times described here, the first predetermined threshold value and the second predetermined threshold value are default setting, and three can be identical, such as three
It is 3.Certainly, the three can also be different, and if preset times are 3, the first predetermined threshold value is 4, and the second predetermined threshold value is 5
Deng.
Based on the above-mentioned method that video is played simultaneously, as shown in Figure 3 and Figure 4, the present invention also provides one kind to be played simultaneously
The system of video, including a main playback equipment 100 and at least one from playback equipment 200, the main playback equipment 100 is distinguished
With respectively being connect from playback equipment 200, the main playback equipment 100 receives play instruction, and first is generated according to the play instruction
Render request and synchronization request, and the synchronization request is sent to respectively from playback equipment 200;Respectively connect from playback equipment 200
The synchronization request is received, the synchronization request is verified and verification result is fed back into main playback equipment 100;Main broadcaster, which is put, to be set
Standby 100 receive the feedback information respectively sent from playback equipment, and when receiving the feedback information being proved to be successful, by current video
Frame renders to the second render request of video window and the next video frame of generation with each video of circulation synchronous file to be played
Frame.
The system that video is played simultaneously further includes server 300, and the server 300 is put respectively with main broadcaster to be set
It respectively connects for 100 and from playback equipment 200, and to main playback equipment 100 and respectively send text to be played from playback equipment 200 respectively
Part is with play instruction.
The system that video is played simultaneously, further includes router 400;The server 300 is divided by router 400
Not with main playback equipment 100 and being respectively connected from playback equipment 200, the main playback equipment 100 with it is respectively logical from playback equipment 200
It is direct-connected to cross network interface.
In addition, the specific work process of each component part has been described in detail in the above-mentioned methods in above system, at this
In just no longer state one by one.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
The present invention is described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that:It still may be used
To modify to the technical solution recorded in foregoing embodiments or carry out equivalent replacement to which part technical characteristic;
And these modification or replace, various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution spirit and
Range.