Summary of the invention
The object of the invention is to, a kind of method that realizes based on the Video chat of webpage is provided.The method need not to consume than multi-system resource, does not affect user's service efficiency, guarantees the fail safe of chat, can make the user only just realize Video chat on the Internet by browser, and can realize between the user at random Video chat.
For solving the problems of the technologies described above, technical scheme provided by the invention is as follows: a kind ofly realize the method based on the Video chat of webpage: comprise and realize that user and designated user are based on the method for the Video chat of webpage and realization user and the random user method based on the Video chat of webpage.
In the method for aforesaid realization based on the Video chat of webpage, described realization user and designated user are specially based on the method for the Video chat of webpage:
Described realization user and designated user are specially based on the method for the Video chat of webpage:
A. user's browser starts user's camera and microphone, then sends the request of Video chat to designated user;
B. after the browser of designated user receives the request and agreement of Video chat, start camera and the microphone of designated user, and send agreement information to user's browser, then send a request of issuing video flowing to server by the rtmp agreement;
C. after user's browser receives agreement information, send the request of an issue video flowing to server by the rtmp agreement;
D. after server receives the request of issue video flowing of user and designated user, be that two usefulness generate a unique video flowing indications (Vid) per family, the long-chain that then all forms a server and browser connects;
E. the browser of user's browser and designated user sends to server by connecing the Video stream information that will get access to by camera separately with the long-chain of server separately;
F. user's browser and designated user browser are finished the connection of Video chat by the mutual Video stream information of subscribing to each other of video flowing indications (Vid);
G. after Video chat finishes, the Video stream information that server destruction user and designated user are preserved at server.
In the method for aforesaid realization based on the Video chat of webpage, described realization user and random user are specially based on the method for the Video chat of webpage:
A. need to start with the user's of random user Video chat browser user's camera and microphone, then send the request of an issue video flowing to server by the rtmp agreement;
B. after server receives user's the request of issue video flowing, the long-chain that forms between a server and the user browser connects, then server connects by long-chain and preserves the Video stream information that the user gets access to by camera, and generates the Video stream information that a unique video flowing indications (Vid) identifies this user and this user in server;
C. after the long-chain of server and browser connects above two, server creates two video queue C1 and C2, the video flowing indications with the user of random user Video chat is deposited in the C1 formation, and the C2 formation is deposited and waited for the video flowing indications that participates in the user of random user Video chat;
D. server is chosen two users' video flowing indications Vid1 and Vid2 at random from the C2 formation, then the video flowing indications is turned back to user browser, user browser is subscribed to the other side in the Video stream information that is kept on the server according to the video flowing indications, then the device of being engaged in is put into the C1 formation with Vid1 and Vid2, finishes the connection of Video chat;
E. after Video chat finishes, the Video stream information that server destruction Vid1 and Vid2 representative user preserve at server.
Compared with prior art, the present invention need not to use particular chat software, only can realize Video chat by browser with just exchanging of server, need not to consume than multi-system resource, does not affect user's service efficiency, guarantees the fail safe of chat, uses convenient; And the present invention has realized Video chat between user and the random user by creating two video queue, is that existing chat method is not available, has increased the interest of user video chat.The present invention can destroy user's Video stream information after Video chat finishes, protected user's privacy.
The present invention is further illustrated below in conjunction with embodiment, but not as the foundation to the present invention's restriction.
Embodiment.
A kind ofly realize the method based on the Video chat of webpage: comprise and realize that user and designated user are based on the method for the Video chat of webpage and realization user and the random user method based on the Video chat of webpage.
Realize that user and designated user based on the method for the Video chat of webpage, are specially:
A. user's browser starts user's camera and microphone, then sends the request of Video chat to designated user;
B. after the browser of designated user receives the request and agreement of Video chat, start camera and the microphone of designated user, and send agreement information to user's browser, then send a request of issuing video flowing to server by the rtmp agreement;
C. after user's browser receives agreement information, send the request of an issue video flowing to server by the rtmp agreement;
D. after server receives the request of issue video flowing of user and designated user, be that two usefulness generate a unique video flowing indications per family, the long-chain that then all forms a server and browser connects;
E. the browser of user's browser and designated user sends to server by connecing the Video stream information that will get access to by camera separately with the long-chain of server separately;
F. user's browser and designated user browser are subscribed to each other Video stream information mutually by the video flowing indications, finish the connection of Video chat;
G. after Video chat finishes, the Video stream information that server destruction user and designated user are preserved at server.
Realize that user and random user based on the method for the Video chat of webpage, are specially:
A. need to start with the user's of random user Video chat browser user's camera and microphone, then send the request of an issue video flowing to server by the rtmp agreement;
B. after server receives user's the request of issue video flowing, the long-chain that forms between a server and the user browser connects, then server connects by long-chain and preserves the Video stream information that the user gets access to by camera, and generates the Video stream information that a unique video flowing indications identifies this user and this user in server;
C. after the long-chain of server and browser connects above two, server creates two video queue C1 and C2, the video flowing indications with the user of random user Video chat is deposited in the C1 formation, and the C2 formation is deposited and waited for the video flowing indications that participates in the user of random user Video chat;
D. server is chosen two users' video flowing indications Vid1 and Vid2 at random from the C2 formation, then the video flowing indications is turned back to user browser, user browser is subscribed to the other side in the Video stream information that is kept on the server according to video flowing indications (Vid), then server is put into the C1 formation with Vid1 and Vid2, finishes the connection of Video chat;
E. after Video chat finishes, the Video stream information that server destruction Vid1 and Vid2 representative user preserve at server.
The user uses when of the present invention, connects logon server by browser first, then selects as required to carry out Video chat or carry out Video chat with random user with designated user.
When selecting to carry out Video chat with designated user, browser elder generation's logon server of user also starts user's camera and microphone, then sends the request of Video chat and specifies chat user to server; Server is forwarded to designated user after receiving request, the browser of designated user receive the user Video chat request and agree after, start camera and the microphone of designated user, and send agreement information to server, then send the request of an issue video flowing to server by the rtmp agreement; Server is that two usefulness generate a unique video flowing indications (Vid) per family after receiving the request of issue video flowing of user and designated user, and the long-chain that then all forms a server and browser connects; User's browser and the browser of designated user send to server by connecing the Video stream information that will get access to by camera separately with the long-chain of server separately; User's browser and designated user browser are finished the connection of Video chat by the mutual Video stream information of subscribing to each other of video flowing indications (Vid); After Video chat finishes, the Video stream information that server destruction user and designated user are preserved at server.
When selecting to carry out at random Video chat with the user, need to start camera and microphone with the user's of random user Video chat browser, then send the request of an issue video flowing to server by the rtmp agreement; After server receives user's the request of issue video flowing, the long-chain that forms between a server and the user browser connects, then server connects by long-chain and preserves the Video stream information that the user gets access to by camera, and generates the Video stream information that a unique video flowing indications (Vid) identifies this user in server; After the long-chain of server and browser connects above two, server creates two formation C1 and C2, the video flowing indications (Vid) with the user of random user Video chat is deposited in the C1 formation, and the C2 formation is deposited and waited for the video flowing indications (Vid) that participates in the user of random user Video chat; Server is chosen two users' video flowing indications Vid1 and Vid2 at random from the C2 formation, then the video flowing indications is turned back to user browser, user browser is subscribed to the other side in the Video stream information that is kept on the server according to video flowing indications (Vid), and Vid1 and Vid2 put into the C1 formation, finish the at random coupling of Video chat; After Video chat finishes, the Video stream information that server destruction Vid1 and Vid2 representative user preserve at server, Vid1 and Vid2 turn back to the C2 formation again.
When the present invention used, the Flash plug-in unit that user's browser only need to be installed the basis got final product.