A kind of multi-screen video sharing method and terminal, server
Technical field:
Communication technical field of the present invention, more particularly to a kind of multi-screen video sharing method and terminal, server.
Background technology:
The progress of Internet technology and the diversified development of terminal electronic device, the work life of great convenience people
It is living.Such as in our Working Life, it is sometimes desirable to which the video frequency program played in an equipment is pushed directly to
Played on miscellaneous equipment, the video frequency program for sometimes needing play on miscellaneous equipment again, which is moved to return in this equipment, to be broadcast
Put.In the prior art, to realize the mutual push-and-pull of video frequency program between multiple this equipment, the end in various forms is generally required
The client software specified is installed on end, then carries out the operation of multi-screen interactive.Such as in DLNA(DIGITAL LIVING
NETWORK ALLIANCE)In technology, if realizing the video push-and-pull between mobile phone and TV by multi-screen interactive accessory WiPlug,
Need to download WiPlug clients on mobile phone, projected the screen of mobile phone on TV by WiPlug clients, and control
The video playback of TV.
But due to the operating system of terminal(Operating System, OS), hardware etc. it is widely different, client software
Developer often develops the client software of variform, client of the user plane to variform for the application needs of adaptation terminal
Hold software often at a loss as to what to do, be able to can not also be installed because client software is more complicated, and then can not realize between each equipment
Video share.
The content of the invention:
The invention provides a kind of multi-screen video sharing method and terminal, server, to improve the video between each equipment
Sharing efficiency.
In a first aspect, the invention provides a kind of one embodiment of multi-screen video sharing method.
In the first possible implementation, methods described includes:First terminal establishes webpage socket with server
Agreement websocket data transmission channels, and obtain at least one second end established websocket with the server and be connected
The address information at end;
The first terminal receives at least one second terminal warp by the websocket data transmission channels
The video address information sent by the server;The video address information is used to indicate that at least one second terminal is worked as
Position of the video of preceding broadcasting on the server;
The first terminal obtains the video according to the video address information from the server.
The first possible implementation with reference to first aspect, in second of possible implementation, described first eventually
End establishes websocket data transmission channels with server and is specially:
First terminal sends websocket handshake requests to server;
The first terminal receives the handshake response that the server is sent;The handshake response is the server to institute
State the response to the websocket handshake requests of first terminal transmission;The handshake response is included and built with the server
The address information of at least one second terminal of vertical websocket connections.
With reference to first aspect the first or second of possible implementation, in the third possible implementation,
It is described before the first terminal receives the video address information that at least one second terminal is sent via the server
Method also includes:
The first terminal is according to the address information, by the websocket data transmission channels, via the clothes
Device be engaged in the request of second terminal transmission first, to ask the second terminal to send out the address information of currently playing video
It is sent to the first terminal;
The first terminal receives the agreement described first that at least one second terminal is sent via the server
The response message of request.
With reference to first aspect the first or second or the third possible implementation, the 4th kind of possible realization side
In formula, the video address information that the first terminal receives is URL(Uniform Resource Locator,
URL);According to the video address information, obtain the video from the server is specially the first terminal:
The first terminal establishes video link according to the URL and the server, receives what the server was sent
The video flowing of the video.
With reference to first aspect the first or second or the third or the 4th kind of possible implementation, in the 5th kind of possibility
Implementation in, after the broadcasting that the first terminal completes the video, methods described also includes:
The first terminal closes the websocket data transmission channels established with the server.
Second aspect, the invention provides a kind of one embodiment of multi-screen video sharing method.
In the first possible implementation, methods described includes:First terminal establishes websocket numbers with server
According to transmission channel, and obtain the address information that at least one second terminal that websocket is connected is established with the server;
The first terminal is by the websocket data transmission channels, via the server to described at least one
Individual second terminal sends video address information;The video address information is used to indicate the currently playing video of the first terminal
In the position of the server.
The first possible implementation with reference to second aspect, in second of possible implementation, described first eventually
End establishes websocket data transmission channels with server and is specially:
First terminal sends websocket handshake requests to server;
The first terminal receives the handshake response that the server is sent;The handshake response is the server to institute
State the response to the websocket handshake requests of first terminal transmission;The handshake response includes to be connected with the server
The address information of at least one second terminal connect.
With reference to second aspect the first or second of possible implementation, in the third possible implementation,
The first terminal is whole to described at least one second via the server by the websocket data transmission channels
Before end sends video address information, methods described also includes:
The first terminal is according to the address information, by the websocket data transmission channels, via the clothes
Device of being engaged in sends the second request at least one second terminal, with request by the first terminal by currently playing video
Address information is sent at least one second terminal;
The first terminal receives the response message for agreement second request that at least one second terminal is sent.
With reference to second aspect the first or second or the third possible implementation, the 4th kind of possible realization side
In formula, after the transmission that the first terminal completes the video address information, methods described also includes:
The first terminal closes the websocket data transmission channels established with the server.
The third aspect, the invention provides a kind of one embodiment of multi-screen video sharing method.
In the first possible implementation, methods described includes:Server establishes websocket numbers with first terminal
According to transmission channel, and at least one second end established websocket with the server and be connected is sent to the first terminal
The address information at end;
The server receives the video address information that at least one second terminal is sent, and to the first terminal
Send video address information;The video address information is used to indicate that the currently playing video of at least one second terminal exists
The position of the server;
The server receives request of the first terminal according to the video address acquisition of information video, to described the
One terminal sends the video.
The first possible implementation with reference to the third aspect, in second of possible implementation, the server
Websocket data transmission channels are established with first terminal, and sends to the first terminal and is established with the server
The address information of at least one second terminal of websocket connections is specially:
The server receives the websocket handshake requests that the first terminal is sent;
The server sends handshake response to the first terminal;The handshake response is the server to described the
The response to the websocket handshake requests that one terminal is sent;The handshake response includes to be established with the server
The address information of at least one second terminal of websocket connections.
With reference to the third aspect the first or second of possible implementation, in the third possible implementation,
Before the server receives the video address information that at least one second terminal is sent, methods described also includes:
The server receives the 3rd that the first terminal is sent by the websocket data transmission channels please
Ask, and the 3rd request is sent at least one second terminal;Described 3rd ask be used for ask it is described at least one
The address information of currently playing video is sent to the first terminal by second terminal;
The server receives the response message for agreement the 3rd request that at least one second terminal is sent, and
The response message is sent to the first terminal.
With reference to the third aspect the first or second or the third possible implementation, the 4th kind of possible realization side
In formula,
The video address information is URL;The server receives the first terminal according to the video address information
The request of video is obtained, sending the video to the first terminal is specially:
The server receives request of the first terminal according to the video address acquisition of information video, with described the
One terminal establishes video link corresponding with the URL, and the video flowing of the video is sent to the first terminal.
Fourth aspect, the invention provides a kind of one embodiment of multi-screen video sharing method.
In the first possible implementation, methods described includes:Server establishes websocket numbers with first terminal
According to transmission channel, and at least one second end established websocket with the server and be connected is sent to the first terminal
The address information at end;
The server receives the video address information that the first terminal is sent, and at least one second terminal
Send the video address information;The video address information is used to indicate the currently playing video of the first terminal described
The position of server;
The server receives request of at least one second terminal according to the video address acquisition of information video,
The video is sent at least one second terminal.
The first possible implementation with reference to fourth aspect, in second of possible implementation, the server
Websocket data transmission channels are established with first terminal, and sends to the first terminal and is established with the server
The address information of at least one second terminal of websocket connections is specially:
The server receives the websocket handshake requests that the first terminal is sent;
The server sends handshake response to the first terminal;The handshake response is the server to described the
The response to the websocket handshake requests that one terminal is sent;The handshake response includes to be established with the server
The address information of at least one second terminal of websocket connections.
With reference to fourth aspect the first or second of possible implementation, in the third possible implementation,
Before the server receives the video address information that the first terminal is sent, methods described also includes:
The server receives the 4th that the first terminal is sent by the websocket data transmission channels please
Ask, and the 4th request is sent at least one second terminal;Described 4th asks to be used to ask described the
The address information of the currently playing video of one terminal is sent at least one second terminal;
The server receives the response message for agreement the 4th request that at least one second terminal is sent, and
The response message is sent to the first terminal.
With reference to fourth aspect the first or second or the third possible implementation, the 4th kind of possible realization side
In formula, the video address information is URL;The server receives at least one second terminal according to the video address
The request of acquisition of information video, sending the video at least one second terminal is specially:
The server receives request of at least one second terminal according to the video address acquisition of information video,
Video link corresponding with the URL is established with least one second terminal, is sent at least one second terminal
The video flowing of the video.
5th aspect, the invention provides a kind of one embodiment of terminal.
In the first possible implementation, the terminal includes:Connection unit, for being established with server
Websocket data transmission channels;
Acquiring unit, the ground at least one second terminal that websocket is connected is established with the server for obtaining
Location information;According to video address information, video is obtained from the server;
Receiving unit, for by the websocket data transmission channels, receiving at least one second terminal warp
The video address information sent by the server;The video address information is used to indicate that at least one second terminal is worked as
Position of the video of preceding broadcasting on the server.
With reference to the 5th aspect the first possible implementation, in second of possible implementation, the terminal is also
Including:
Transmitting element, for before the receiving unit receives video address information, according to the address information, passing through
The websocket data transmission channels, the 5th request is sent to the second terminal via the server, with described in request
The address information of currently playing video is sent to the first terminal by second terminal;
The receiving unit is additionally operable to, and receives the sound for agreement the 5th request that at least one second terminal is sent
Answer message.
With reference to the 5th aspect the first or second of possible implementation, in the third possible implementation, institute
The video address information for stating receiving unit reception is URL;
The connection unit is additionally operable to, and video link is established according to the URL and the server;
According to video address information, obtain video from the server is specially the acquiring unit:
The acquiring unit obtains the video flowing for the video that the server is sent according to the video link.
With reference to the 5th aspect the first or second or the third possible implementation, the 4th kind of possible realization side
In formula, the connection unit is additionally operable to, and after the acquiring unit obtains video, closes what is established with the server
Websocket data transmission channels.
6th aspect, the invention provides a kind of one embodiment of terminal.
In the first possible implementation, the terminal includes:Connection unit, is used for and server
Establish websocket data transmission channels;
Acquiring unit, the ground at least one second terminal that websocket is connected is established with the server for obtaining
Location information;
Transmitting element, for by the websocket data transmission channels, via the server to described at least one
Individual second terminal sends video address information;The video address information is used to indicate the currently playing video of the first terminal
In the position of the server
With reference to the 6th aspect the first possible implementation, in second of possible implementation, it is described send it is single
Member is additionally operable to, and before video address information is sent, according to the address information, is led to by the websocket data transfers
Road, the 6th request is sent to the second terminal via the server, will be currently playing by the first terminal with request
The address information of video is sent at least one second terminal;
The terminal also includes:
Receiving unit, the response of agreement the 6th request sent for receiving at least one second terminal disappear
Breath.
With reference to the 6th aspect the first possible implementation, in the third possible implementation, the connection is single
Member is additionally operable to, and after the transmission that the transmitting element completes the video address information, is closed and the server
Websocket data transmission channels.
7th aspect, the invention provides a kind of one embodiment of server.
In the first possible implementation, the server includes:Connection unit, for first
Terminal establishes websocket data transmission channels;
Acquiring unit, the ground at least one second terminal that websocket is connected is established with the server for obtaining
Location information;
Transmitting element, for sending establish that websocket is connected with server at least one the to the first terminal
The address information of two terminals;The video address information is sent to the first terminal;The video address information is used to indicate
The currently playing video of at least one second terminal is in the position of the server;Video is sent to the first terminal;
Receiving unit, receive the video address information that at least one second terminal is sent;Receive the first terminal
According to the request of the video address acquisition of information video.
With reference to the 7th aspect the first possible implementation, in second of possible implementation, it is described receive it is single
Member is additionally operable to, receive the first terminal by the websocket data transmission channels send the 7th request, the described 7th
Ask for asking at least one second terminal that the address information of currently playing video is sent into the first terminal;
Receive the response message for agreement the 7th request that at least one second terminal is sent;
The transmitting element is additionally operable to, and the 7th request is sent at least one second terminal;To described first
Terminal sends the response message.
With reference to the 7th aspect the first or second of possible implementation, in the third possible implementation, institute
The video address information for stating transmitting element transmission is URL;
The connection unit is additionally operable to, and video link corresponding with the URL is established with the first terminal;
The transmitting element sends the video to the first terminal:
The transmitting element is by the video link, to the video flowing of the first terminal transmission video.
Eighth aspect, the invention provides a kind of one embodiment of server.
In the first possible implementation, the server includes:Connection unit, for being established with first terminal
Websocket data transmission channels;
Acquiring unit, the ground at least one second terminal that websocket is connected is established with the server for obtaining
Location information;
Transmitting element, for the first terminal send it is described websocket is established with server and is connected at least one
The address information of individual second terminal;The video address information is sent at least one second terminal;The video address
Information is used to indicate the currently playing video of the first terminal in the position of the server;To described at least one second eventually
End sends the video.
Receiving unit, receive the video address information that the first terminal is sent;Receive at least one second terminal
According to the request of the video address acquisition of information video.
The first possible implementation with reference to eighth aspect, it is described to receive list in second of possible implementation
Member is additionally operable to, before the video address information that the first terminal is sent is received, receive the first terminal pass through it is described
The 8th request that websocket data transmission channels are sent, the described 8th asks to be used to ask to work as the first terminal
The address information of the video of preceding broadcasting is sent at least one second terminal;At least one second terminal is received to send
Agreement it is described 4th request response message;
The transmitting element is additionally operable to, and the 8th request is sent at least one second terminal;To described first
Terminal sends the response message.
With reference to eighth aspect the first or second of possible implementation, in the third possible implementation, institute
The video address information for stating transmitting element transmission is URL;
The connection unit is additionally operable to, and video link corresponding with the URL is established with least one second terminal;
The transmitting element sends the video at least one second terminal:
The transmitting element is by the video link, to the video of at least one second terminal transmission video
Stream.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.
Brief description of the drawings:
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be in embodiment or description of the prior art
The required accompanying drawing used is briefly described, it should be apparent that, drawings in the following description are only some realities of the present invention
Example is applied, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to these accompanying drawings
Obtain other accompanying drawings.
Fig. 1 is a kind of schematic flow sheet of multi-screen video sharing method one embodiment provided by the invention;
Fig. 2 is a kind of schematic flow sheet of multi-screen video sharing method one embodiment provided by the invention;
Fig. 3 is a kind of schematic flow sheet of multi-screen video sharing method one embodiment provided by the invention;
Fig. 4 is a kind of schematic flow sheet of multi-screen video sharing method one embodiment provided by the invention;
Fig. 5 is a kind of structural representation of the embodiment of terminal provided by the invention;
Fig. 6 is a kind of structural representation of the embodiment of terminal provided by the invention;
Fig. 7 is a kind of structural representation of the embodiment of server provided by the invention;
Fig. 8 is a kind of structural representation of the embodiment of server provided by the invention.
Embodiment:
Embodiment one
The embodiments of the invention provide a kind of multi-screen video sharing method, as shown in figure 1, methods described includes:
S101, first terminal and server establish webpage socket protocol websocket data transmission channels, and obtain with
The server establishes the address information of at least one second terminal of websocket connections;
The first terminal runs browser, and the browser is supports HTML5 browser, such as chrome browsers
Deng.The first terminal is established websocket with server by browser and is connected, and establishes websocket data transmission channels.
The first terminal is obtained at least by the websocket data transmission channels established with server at the server
The address information of one second terminal.At least one second terminal is equally established websocket with the server and is connected,
Establish websocket data transmission channels.The address information of at least one second terminal can be described at least one the
The IP address of two terminals, host name etc..The server obtains the information such as the IP address of the first terminal, host name.
S102, the first terminal receive described at least one second eventually by the websocket data transmission channels
The video address information that end is sent via the server;The video address information is used to indicate described at least one second eventually
Hold position of the currently playing video on the server;
Specifically, at least one second terminal obtains the address information of the first terminal.Described at least one
Address information of the currently playing video on the server is sent to described first eventually by two terminals via the server
End.At least one second terminal and the server establish websocket data transmission channels, and described at least one second
Terminal can be sent the video information to server by the websocket data transmission channels established with server, by taking
Business device by the websocket data transmission channels that the server and the first terminal are established by the video information send to
First terminal.The video address information can be that the unified resource of at least one second terminal current live video positions
Symbol(Uniform Resource Locator, URL)Or channel number information;Or the video information can also be described
At least one second terminal is by the URL of current order video;The parameters such as the reproduction time of current video can also be included.
S103, the first terminal obtain the video according to the video address information from the server.
After the first terminal obtains the video address information, the data of the video are obtained from the server,
And play the video.The video data can transmit according to http protocol.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the first terminal establishes websocket data with server
Transmission channel sends handshake request by first terminal and responds the handshake request realization with server.Specifically, described first
Terminal sends websocket handshake requests by browser to the server, and the websocket handshake requests can include
The IP address of the first terminal, host name etc..The websocket that the server reception first terminal is sent shakes hands please
Ask, obtain IP address, host name of the first terminal etc..The server parses the websocket handshake requests and produced
Raw handshake response.The server sends the handshake response to the first terminal, realizes successful handshake, establishes
Websocket data transmission channels.The handshake response that the server is sent can include server acquisition and the service
The address information of at least one second terminal of device connection, such as IP address, host name.At least one second terminal and institute
State server and establish websocket data transmission channels.Specifically, first terminal sends handshake request to server end, described
Handshake request can be format.The data format can be according to " protocol header, field one, field seperator, field
2nd, the form arrangement of field seperator ... ".The protocol header, field, field seperator are the ascii character that can be shown.
The protocol header is used to distinguish each different pieces of information bag.The field is made up of two parts of field keys and data.It is described
The protocol header of the data format of handshake request can be " start " or " begin ", for showing that notebook data form is
Handshake request.Field in the embodiment of the present invention can have two kinds of forms:One is the device name " name " of first terminal, if
The terminal device does not have title, then without this field.Secondly be device type " device ", such as " PC ", " Pad ",
" Phone ", " IPClient " " MediaServer " etc..The field of the data format of the handshake request is added with field seperator
To distinguish.The first terminal sends the handshake request comprising the protocol header and the field to server, request and clothes
Business device establishes websocket connections.The server receives the handshake request of the first terminal, parses the handshake request
After data format, the response message for the handshake request is sent to the terminal.The response message is specific data lattice
Formula, the data format can arrange according to the form of " protocol header, field one, field seperator, field two, field seperator ... "
Row.The protocol header of the response message data format can be " list ", indicate all devices title for signing in server end
List.The protocol header of the response message data format can be " NtDm ", indicate sign in server end all devices name,
IP、hostname." list " or " NtDm " protocol header is used to represent that the message of notebook data form to be to the first terminal
The response message of handshake request.The response message that the first terminal the reception server is sent, established with the server
Websocket connections.Related data is transmitted by the websocket data transmission channels, has saved Internet resources.
In a kind of implementation of the embodiment of the present invention, at least one second terminal is received in the first terminal
Before the video address information sent via the server, the first terminal can be according at least one second terminal
Address information, by the websocket data transmission channels, sending first to the second terminal via the server please
Ask, to ask the second terminal that the address information of currently playing video is sent into the first terminal;Described first eventually
End receives the response message for agreement first request that at least one second terminal is sent via the server.
Specifically, the first terminal is by the websocket data transmission channels established with the server, via institute
State server at least one second terminal send by the currently playing video push of at least one second terminal to
The request of the first terminal, i.e., described first terminal pull described at least one second eventually at least one second terminal
Hold the request of currently playing video.Described first request is first passed through websocket data transmission channels hair by the first terminal
Server is delivered to, the websocket data transfers established by server by the server with least one second terminal
Passage sends the first request at least one second terminal.The protocol header of the data format of the request can be " push ",
The first request for showing notebook data form is that request at least one second terminal arrives currently playing video push
The first terminal.The field of first request can include four parts, first, field " dest ", represents target device name
Claim, i.e. first terminal;Second, field " data ", for representing video information, such as the URL of video flowing id or video;Its
Three, field " type ", for representing that the video is live or recorded broadcast;Fourth, field " device ", for representing equipment class
Type, such as " device ", such as " PC ", " Pad ", " Phone ", " IP Client " " MediaServer " etc..Specifically, it is described extremely
The protocol header of the data format receiveed the response for the first request that a second terminal is sent to the first terminal can be less
" recv ", the message for representing notebook data form are the responses to the described first request.The data format receiveed the response
Field may include two parts, first, field " data ", for representing the id of the video flowing or URL of the video;Second,
Field " type ", for representing that the video is live or recorded broadcast.
After at least one second terminal receives first request, sent out via the server to the first terminal
Send the response message for agreeing to first request.
In a kind of implementation of the embodiment of the present invention, the video address information that the first terminal receives provides to be unified
Source finger URL(Uniform Resource Locator, URL), the first terminal builds according to the URL and the server
Vertical video link, receive the video flowing for the video that the server is sent.Specifically, described in the first terminal obtains
After URL, video data request is sent to the server according to the URL.The first terminal establishes video link with server
The video stream of video corresponding to the URL to the first terminal, the first terminal are received institute by road, the server
State the video flowing of the video of server transmission.The video flowing can be transport stream(Transport Stream, TS).Institute
Stating video flowing can be sent by http protocol.After the first terminal receives the video flowing, it is corresponding to play the video flowing
Video.
In the above-mentioned implementation of the embodiment of the present invention, after the broadcasting that the first terminal completes the video, institute
Stating method also includes:The first terminal closes the websocket data transmission channels with the server.
Embodiment two
The embodiments of the invention provide a kind of multi-screen video sharing method, as shown in Fig. 2 methods described includes:
S201, first terminal establish websocket data transmission channels by browser and server, obtain and the clothes
Business device establishes the address information of at least one second terminal of websocket connections;
S202, the first terminal by the websocket data transmission channels, via the server to it is described extremely
A few second terminal sends video address information;The video address information is used to indicate that the first terminal is currently playing
Video is in the position of the server.
Specifically, the first terminal obtains the address information of at least one second terminal.The first terminal can
The video address information is sent to server by the websocket data transmission channels established with server, by servicing
Device is by the server and the websocket data transmission channels that at least one second terminal is established by the video information
Send at least one second terminal.The video address information can be at least one second terminal current live video
URL or channel number information;Or the video information can also be that at least one second terminal regards current program request
The URL of frequency;The parameters such as the reproduction time of current video can also be included.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the first terminal establishes websocket data with server
Transmission channel sends handshake request by first terminal and responds the handshake request realization with server.Specifically, described first
Terminal sends websocket handshake requests by browser to the server, and the websocket handshake requests can include
The IP address of the first terminal, host name etc..The websocket that the server reception first terminal is sent shakes hands please
Ask, obtain IP address, host name of the first terminal etc..The server parses the websocket handshake requests and produced
Raw handshake response.The server sends the handshake response to the first terminal, realizes successful handshake, establishes
Websocket data transmission channels.The handshake response that the server is sent can include server acquisition and the service
The address information of at least one second terminal of device connection, such as IP address, host name.At least one second terminal and institute
State server and establish websocket data transmission channels.
In a kind of implementation of the embodiment of the present invention, passed in the first terminal by the websocket data
Defeated passage, before sending video address information at least one second terminal via the server, the first terminal
According to the address information of at least one second terminal, by the websocket data transmission channels, via the service
Device sends the second request at least one second terminal, with request by the first terminal by the ground of currently playing video
Location information is sent at least one second terminal;The first terminal receives the same of at least one second terminal transmission
Anticipate it is described second request response message.Specifically, the first terminal passes through the websocket numbers established with the server
According to transmission channel, send at least one second terminal via the server and regard the first terminal is currently playing
Frequency is pushed to the request of at least one second terminal, i.e., described first terminal pushes institute at least one second terminal
State the request of the currently playing video of first terminal.The first terminal is by websocket data transmission channels by the request
Send to server, the websocket data established by server by the server with least one second terminal pass
Defeated passage sends the request described at least one second terminal.The protocol header of the data format of the request can be
" pull ", the first request for showing notebook data form are that request arrives currently playing video push the first terminal
At least one second terminal.The video draws the field of request to include two parts:First, field " souce ", is represented
First terminal title;Second, field " device ", for representing device type, such as " device ", such as " PC ", " Pad ",
" Phone ", " IP Client " " MediaServer " etc..Response of at least one second terminal to the described first request disappears
The protocol header of the data format of breath can be " send ", and the message for representing notebook data form is the sound to the described first request
Answer message.The data of the response message include two parts every the field of form, first, field " souce ", represents source device name
Claim, i.e., the relevant information of described first terminal;Second, field " device ", for representing device type, such as " device ",
Such as " PC ", " Pad ", " Phone ", " IP Client " " MediaServer ".
In the above-mentioned implementation of the embodiment of the present invention, the transmission of the video information is completed in the first terminal
Afterwards, methods described also includes:The first terminal closes the websocket data transmission channels established with the server.
Embodiment three
The embodiments of the invention provide a kind of multi-screen video sharing method, as shown in figure 3, methods described includes:
S301, server and first terminal establish websocket data transmission channels, and to the first terminal send with
The server establishes the address information of at least one second terminal of websocket connections;
Specifically, the server is established websocket with the first terminal and is connected, and establishes websocket data biography
Defeated passage.The server is established websocket with least one second terminal and is connected, and establishes websocket data biography
Defeated passage.The server establishes the address information of at least one second terminal by described and first terminal
Websocket data transmission channels are sent to the first terminal.The address information of at least one second terminal can be
The IP address of at least one second terminal, host name etc..
S302, the server receive the video address information that at least one second terminal is sent, and to described the
One terminal sends video address information;The video address information is used to indicate that at least one second terminal is currently playing
Video is in the position of the server;
Specifically, the server receives at least one second terminal and led to by the websocket data transfers
The video address information that road is sent, and the video address information is established by the server and the first terminal
Websocket data transmission channels are sent to the first terminal.The first terminal obtains the video address information.It is described
Video address information can be the URL or channel number information of at least one second terminal current live video;Or institute
It can also be at least one second terminal by the URL of current order video to state video information;Current video can also be included
The parameter such as reproduction time.
S303, the server receive request of the first terminal according to the video address acquisition of information video, to
The first terminal sends the video.
After the first terminal obtains the video address information, number is sent to server according to the video address information
According to request, video data corresponding to video address information described in acquisition request., can be to institute after the server receives the request
State first terminal and send data flow.The video flowing can be transport stream.The video flowing can be sent by http protocol.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the server establishes websocket with the first terminal
Data transmission channel sends handshake request by first terminal and responds the handshake request realization with server.The server connects
Receive the websocket handshake requests that the first terminal is sent;The server sends handshake response to the first terminal;Institute
It is the response to the websocket handshake requests that the server is sent to the first terminal to state handshake response.It is described
First terminal receives the handshake response, realizes successful handshake, establishes websocket data transmission channels.
In a kind of implementation of the embodiment of the present invention, at least one second terminal hair is received in the server
Before the video address information sent, the server receives the first terminal and passes through the websocket data transmission channels
The 3rd request sent, and send the 3rd request at least one second terminal;Described 3rd asks to be used to ask
The address information of currently playing video is sent to the first terminal by least one second terminal;The server connects
The response message for agreement the 3rd request that at least one second terminal is sent is received, and institute is sent to the first terminal
State response message.Specifically, the first terminal obtains the address letter at least one second terminal being connected with the server
After breath, the first terminal by the websocket data transmission channels established with the server, via the server to
At least one second terminal sends the currently playing video push of the first terminal is whole to described at least one second
The request at end, i.e., described first terminal push asking for the currently playing video of first terminal at least one second terminal
Ask.The server receives the websocket data transmission channels that the first terminal is established by first terminal and server
The request of transmission, and the websocket data that the request is established by least one second terminal and server pass
Defeated passage is sent at least one second terminal.After at least one second terminal obtains the request, to described the
One terminal sends the response message to the request.The server receive at least one second terminal by the terminal with
The response message that the websocket data transmission channels that server is established are sent, and the response message is passed through described first
The websocket data transmission channels that terminal is established with server are sent to the first terminal.
In a kind of implementation of the embodiment of the present invention, the video address information is URL(URL);
The server receives the first terminal according to the request of the video address acquisition of information video, is built with the first terminal
Video link corresponding with the URL is found, the video flowing of the video is sent to the first terminal.
Example IV
The embodiments of the invention provide a kind of multi-screen video sharing method, as shown in figure 4, methods described includes:
S401, server and first terminal establish websocket data transmission channels, and to the first terminal send with
The server establishes the address information of at least one second terminal of websocket connections;
S402, the server receive the video address information that the first terminal is sent, and to described at least one the
Two terminals send the video address information;The video address information is used to indicate the currently playing video of the first terminal
In the position of the server;
Specifically, the server receives what the first terminal was sent by the websocket data transmission channels
Video address information, and the video address information is established by the server with least one second terminal
Websocket data transmission channels are sent at least one second terminal.Described at least one second terminal obtains
Video address information.The video address information can be the URL or channel number letter of the first terminal current live video
Breath;Or the video information can also be the first terminal by the URL of current order video;It can also include working as forward sight
The parameters such as the reproduction time of frequency.
S403, the server receive at least one second terminal according to the video address acquisition of information video
Request, the video is sent at least one second terminal.
After at least one second terminal obtains the video address information, according to the video address information to service
Device sends request of data, video data corresponding to video address information described in acquisition request.The server receives the request
Afterwards, data flow can be sent at least one second terminal.The video flowing can be transport stream.The video flowing can lead to
Cross http protocol transmission.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the server establishes websocket with the first terminal
Data transmission channel sends handshake request by first terminal and responds the handshake request realization with server.The server connects
Receive the websocket handshake requests that the first terminal is sent;The server sends handshake response to the first terminal;Institute
It is the response to the websocket handshake requests that the server is sent to the first terminal to state handshake response.It is described
First terminal receives the handshake response, realizes successful handshake, establishes websocket data transmission channels.
In a kind of implementation of the embodiment of the present invention, the video of the first terminal transmission is received in the server
Before address information, the server receives that the first terminal is sent by the websocket data transmission channels
Four requests, and send the 4th request at least one second terminal;Described 4th asks to be used to ask the institute
The address information for stating the currently playing video of first terminal is sent at least one second terminal;The server receives institute
The response message for agreement the 4th request that at least one second terminal is sent is stated, and the sound is sent to the first terminal
Answer message.Specifically, after the first terminal obtains the address information at least one second terminal being connected with the server,
The first terminal is by the websocket data transmission channels established with the server, via the server to described
At least one second terminal is sent the currently playing video push of at least one second terminal to the first terminal
Request, i.e., described first terminal pull the currently playing video of at least one second terminal at least one second terminal
Request.The server receives the websocket data transfers that the first terminal is established by first terminal and server
The first request that passage is sent, and the described first request is established by least one second terminal and server
Websocket data transmission channels are sent at least one second terminal.Described at least one second terminal obtains
After request, the response message to the request is sent to the first terminal.The server receives described at least one second
The response message that the websocket data transmission channels that terminal is established by the terminal and server are sent, and by the response
The websocket data transmission channels that message is established by the first terminal and server are sent to the first terminal.
In a kind of implementation of the embodiment of the present invention, the video address information is URL(URL);
The server receives request of at least one second terminal according to the video address acquisition of information video, with it is described extremely
A few second terminal establishes video link corresponding with the URL, and the video is sent at least one second terminal
Video flowing.
Embodiment five
As shown in figure 5, the embodiments of the invention provide a kind of terminal, the terminal includes:
Connection unit 502, for establishing websocket data transmission channels with server;The connection unit passes through clear
Device of looking at is established websocket with server and is connected, and establishes websocket data transmission channels.
Acquiring unit 503, at least one second terminal that websocket is connected is established with the server for obtaining
Address information;According to video address information, video is obtained from the server;
After the connection unit and the server establish websocket data transmission channels, the acquiring unit is led to
Cross the websocket data transmission channels, from the server obtain with the server establish that websocket is connected to
The address information of a few second terminal.At least one second terminal is established websocket with the server and is connected.Institute
The address information for stating at least one second terminal can be IP address, host name of at least one second terminal etc..
Receiving unit 505, for by the websocket data transmission channels, receiving described at least one second eventually
The video address information that end is sent via the server;The video address information is used to indicate described at least one second eventually
Hold position of the currently playing video on the server.The first terminal is obtained at least one second terminal
After address information, at least one second terminal is by the video address information of currently playing video via the server push
The first terminal is given, the receiving unit receives at least one second terminal via described in the server push
Video address information.At least one second terminal can be led to by the websocket data transfers established with the server
Road, the information of the video is pushed to the first terminal via the server.
After the receiving unit 505 receives the video address information, the acquiring unit 503 is additionally operable to, according to regarding
Frequency address information, video is obtained from the server.
The terminal also includes communication bus 501, for connecting the connection unit 502, information acquisition unit 503, connecing
Receive unit 505.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the terminal also includes transmitting element 504, for being connect described
Before receiving unit reception video address information, according to the address information, pass through the websocket data transmission channels, warp
The 5th request is sent from the server to the second terminal, to ask the second terminal by the ground of currently playing video
Location information is sent to the first terminal;The receiving unit 505 is additionally operable to, and receives what at least one second terminal was sent
Agree to the response message of the 5th request.At least one second end being connected with the server is obtained in the acquiring unit
After the address information at end, the transmitting element is by the websocket data transmission channels established with the server, via institute
Server is stated to pull the currently playing video of at least one second terminal at least one second terminal transmission
The request of the first terminal., can be by being established with the server after at least one second terminal receives the request
Websocket data transmission channels sent via the server to the first terminal and agree to that the response of the request disappears
Breath.
In a kind of implementation of the embodiment of the present invention, the video address information that the receiving unit receives is URL;Institute
State connection unit to be additionally operable to, video link is established according to the URL and the server;The acquiring unit is according to video address
Information, obtaining video from the server is specially:The acquiring unit obtains the server hair according to the video link
The video flowing of the video sent.The video flowing can be transport stream(Transport Stream, TS).The video flowing can
To be sent by http protocol.After the receiving unit receives the video flowing, the first terminal plays the video flowing pair
The video answered.
In a kind of implementation of the embodiment of the present invention, the connection unit is additionally operable to, and is obtained in the acquiring unit
After video, the websocket data transmission channels established with the server are closed.
Embodiment six
As shown in fig. 6, the embodiments of the invention provide a kind of terminal, the terminal includes:
Connection unit 602, for establishing websocket data transmission channels with server;
Acquiring unit 603, at least one second terminal that websocket is connected is established with the server for obtaining
Address information;
Transmitting element 604, for by the websocket data transmission channels, via the server to it is described extremely
A few second terminal sends video address information;The video address information is used to indicate that the first terminal is currently playing
Position of the video on the server.
It is described after the address information that the acquiring unit obtains at least one second terminal being connected with the server
Transmitting element by the websocket data transmission channels established with the server, via the server to it is described at least
One second terminal sends the video address information of the currently playing video of the first terminal.
The terminal also includes communication bus 601, for connecting the connection unit 602, information acquisition unit 603, hair
Send unit 604.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the transmitting element is additionally operable to, and is sending video address information
Before, according to the address information, by the websocket data transmission channels, via the server to described second
Terminal sends the 6th request, with request by the first terminal by the address information of currently playing video be sent to it is described at least
One second terminal;The terminal also includes receiving unit, the agreement institute sent for receiving at least one second terminal
State the response message of the 6th request.
Connection unit is additionally operable to described in a kind of implementation of the embodiment of the present invention, and institute is completed in the transmitting element
After the transmission for stating video information, the websocket data transmission channels with the server are closed.
Embodiment seven
As shown in fig. 7, the embodiments of the invention provide a kind of server, the server includes:
Connection unit 702, for establishing websocket data transmission channels with first terminal;The connection unit and institute
State first terminal and establish websocket connections, establish websocket data transmission channels.
Acquiring unit 703, at least one second terminal that websocket is connected is established with the server for obtaining
Address information.At least one second terminal is established websocket with the server and is connected, and described at least one second eventually
The address information at end can be IP address, host name of at least one second terminal etc..
Transmitting element 704, for the first terminal send with server establish websocket be connected it is at least one
The address information of second terminal;
After the address information that the acquiring unit obtains at least one second terminal, the transmitting element is by described in
The address information of at least one second terminal is sent to the first terminal.
Receiving unit 705, receive the video address information that at least one second terminal is sent;The video address letter
Cease for indicating the currently playing video of at least one second terminal in the position of the server;
The transmitting element 704 is additionally operable to, after the receiving unit 705 receives the video address information, to described
First terminal sends the video address information.
The receiving unit 705 is additionally operable to, after transmitting element sends the video address information to the first terminal,
Receive request of the first terminal according to the video address acquisition of information video.
The transmitting element 704 is additionally operable to, and video corresponding with the video address information is sent to the first terminal.
The server also includes communication bus 701, for connecting the connection unit 702, acquiring unit 703, sending
Unit 704 and receiving unit 705.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the receiving unit is additionally operable to, and is received the first terminal and is led to
Cross the 7th request that the websocket data transmission channels are sent, the described 7th asks to be used for ask described at least one the
The address information of currently playing video is sent to the first terminal by two terminals;The transmitting element is additionally operable to, described
After receiving unit receives the 7th request, the 7th request is sent at least one second terminal;It is described to receive list
Member is additionally operable to, and receives the response message for agreement the 7th request that at least one second terminal is sent;It is described to send list
Member is additionally operable to, and the response message is sent to the first terminal after the receiving unit receives the response message.
In a kind of implementation of the embodiment of the present invention, the video address information that the transmitting element is sent provides to be unified
Source finger URL(URL);The connection unit is additionally operable to, and video link corresponding with the URL is established with the first terminal;Institute
State transmitting element is specially to the first terminal transmission video:The transmitting element is by the video link, to institute
State the video flowing that first terminal sends the video.
Embodiment eight
As shown in figure 8, the embodiments of the invention provide a kind of server, the server includes:
Connection unit 802, for establishing websocket data transmission channels with first terminal;The connection unit and institute
State first terminal and establish websocket connections, establish websocket data transmission channels.
Acquiring unit 803, at least one second terminal that websocket is connected is established with the server for obtaining
Address information;At least one second terminal is established websocket with the server and is connected, and described at least one second eventually
The address information at end can be IP address, host name of at least one second terminal etc..
Transmitting element 804, for establishing websocket with server and being connected at least described in being sent to the first terminal
The address information of one second terminal;
Receiving unit 805, receive the video address information that the first terminal is sent;The video address information is used to refer to
Show the currently playing video of the first terminal in the position of the server;
The transmitting element 804 is additionally operable to, after the receiving unit receives the video address information, to it is described at least
One second terminal sends the video address information;
The receiving unit 805 is additionally operable to, and is regarded described in the transmitting element at least one second terminal transmission
After frequency address information, request of at least one second terminal according to the video address acquisition of information video is received.
The transmitting element 804 is additionally operable to, and the video is sent at least one second terminal.
The server also includes communication bus 801, for connecting the connection unit 802, acquiring unit 803, sending
Unit 804 and receiving unit 805.
In embodiment provided by the invention, terminal is obtained by establishing websocket data transmission channels with server
Video address information, the terminal receive Media Stream by browser, play video so that terminal no longer needs to install client
Software, improve the video sharing efficiency between each equipment.Especially in home network, terminal is established with server
Websocket connections, reduce network traffics, have saved Internet resources.
In a kind of implementation of the embodiment of the present invention, the receiving unit is additionally operable to, and is receiving the first terminal
Before the video address information of transmission, the first terminal is sent by the websocket data transmission channels the 8th is received
Request, the described 8th asks for asking to send the address information of the currently playing video of the first terminal to described
At least one second terminal;Receive the response message for agreement the 4th request that at least one second terminal is sent;Institute
Transmitting element is stated to be additionally operable to send the 8th request at least one second terminal;To described in first terminal transmission
Response message.
In a kind of implementation of the embodiment of the present invention, the video address information that the transmitting element is sent provides to be unified
Source finger URL(URL);The connection unit is additionally operable to, and regard corresponding with the URL is established with least one second terminal
Frequency link;The transmitting element sends the video at least one second terminal:The transmitting element passes through
The video link, the video flowing of the video is sent at least one second terminal.
The terminal also includes processor unit, and the server also includes processor unit.The processor unit is
The control centre of electronic equipment, using the various pieces of various interfaces and the whole electronic equipment of connection, by running or holding
Row is stored in software program and/or module in memory cell, and calls the data being stored in memory cell, to perform electricity
The various functions and/or processing data of sub- equipment.The processor unit can be by integrated circuit (Integrated
Circuit, abbreviation IC) composition, such as can be made up of the IC of single encapsulation, can also be by connection more identical functions or not
The encapsulation IC of congenerous and form.For example, processor unit can only include central processing unit (Central
Processing Unit, abbreviation CPU) or GPU, digital signal processor(Digital Signal Processor,
Abbreviation DSP)And the control chip in communication unit(Such as baseband chip)Combination.In embodiments of the present invention, CPU can
To be single arithmetic core, multioperation core can also be included.
In one embodiment provided by the invention, terminal can realize the control for providing server video equipment.Such as
In home network, the remote control to set top box is realized by the terminal.Specifically, terminal to server sends remote control
Request.The remote control notification is used for long-range control of the terminal request realization to the server MediaServer equipment
System.The protocol header of the data format of the remote control notification can be " RemoteIPKey ", for showing notebook data form
Request is remote control notification.The field of the remote control notification includes field " key ", for representing remote control key assignments.Institute
State terminal and receive response of the server to the remote control notification.The server parses the long-range of the terminal transmission
Control data, and send the response message for searching book remote control notification to the terminal.The sound of the remote control notification
The protocol header for answering the data format of message can be " RIRK ", and the message for representing notebook data form is to the remote control
Request is receiveed the response.The field of the response message of the remote control notification includes " key ", for representing remote manipulator key
Value.The embodiment of the present invention is realized in home network, and terminal realizes the control to video providing device by browser, carries
High terminal manipulation efficiency.
In one embodiment of the invention, terminal can obtain the information for the other terminals being connected with server.Specifically,
The terminal sends the request for obtaining the other end messages being connected with the server to the server.The acquisition terminal
The protocol header of the data format of information request can be " NetworkDiagram ", and the request for representing notebook data form is to obtain
Take the request for the other end messages being connected with the server end.The server parses the request, refreshing and server
End connects the network topological diagram of all terminals, obtains the information for all terminals being connected with the server.Described information can be with
IP address, host name including the terminal etc..The terminal receives response of the server to the request.The response
The protocol header of the data format of message can be " NtDm ", and " NtDm " indicates all devices for signing in MediaServer
Name, IP, hostname etc., the message for representing notebook data form are the response messages to the acquisition terminal information request.
The server will include described " NtDm " protocol header for the acquisition terminal information request receive the response transmission to
The terminal.The terminal obtains the information for the other terminals being connected with the server.
It should be noted that the relevant art feature in above-described embodiment can be referred to mutually.
It should be noted that in the above embodiment of the present invention, disclosed media data playing device can
With implementation into an independent table apparatus, or it is integrated in a variety of media data playing devices, such as set top box, mobile electricity
Words, tablet personal computer(Tablet Personal Computer), laptop computer(Laptop Computer), multimedia
Device, digital camera, personal digital assistant(Personal digital assistant, abbreviation PDA), guider, movement
Internet device(Mobile Internet Device, MID)Or wearable device(Wearable Device)Deng.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with
The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium
In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random
AccessMemory, RAM) etc..
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 within the art that:It still may be used
To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic;
And these modifications or replacement, the essence of appropriate technical solution is departed from the scope of various embodiments of the present invention technical scheme.