Web version of audio and video chat room development

Source: Internet
Author: User

At present, online video chat rooms, video conferencing software, visual IP telephony software everywhere, do you want to do a play? In fact, this kind of software is nothing more than video plus network built. If you are familiar with video capture and network transmission technology, it is hard to fail you at all. This article describes in detail how to use the SDK provided by others to develop video chat room first introduce the video chat technology development process 1, C/s structure of video chat software or plug-ins.  This is the earliest video chat development technology, has been eliminated. 2. Video chat software or plug-in with peer mode. This is the main use of many large video chat projects in previous years and now.  It is also a technique used by many small video chat rooms. 3, based on the peer mode +c/s mode mixed. This is currently the highest performance technical architecture model. such as QQ chat tools such as video chat function.  Use the C/S mode with a low speed when the network connection is fast and the peer is slow. 4, pure web, based on the video server construction of B/s structure video chat site. This is the main research direction of video technology in the previous 1-2 years. This model is exactly the C/s structure that can be used on the website. And the first stage C/s structure performance is not very different, but has a strong cross-platform advantages. Because of its performance can not be compared with the 2nd and 3rd stage performance, and lead to more research, but less practical, less products. 5, the pure web based on the video server B/s structure + plus flash peer structure. This stage is the main research direction of video technology at present. But the current flash peer can not achieve data distribution, forwarding and other functions, the use of 1 people and more than one person at the same time to establish the mode of communication between peers, so when the number of more, this mode will occupy a large amount of client bandwidth. Therefore, this mode needs to be paired with B/s mode. When the number of people, the use of video server, when the number of people, use peer-to.
The next step is to develop the tools used and the language to develop the introduction in order to enable people to better develop their needs and audio and video instant communication related systems. I introduce to you how to use the Anychat SDK to develop, you can understand as a development guide to download this SDK first, (can be downloaded on its website free) support for Windows platform Audio Instant Messaging application Development Support C + +, C #, Java, Delphi, vb.net, Qt and other development language integration of H. C, AAC, AMR and other codec technology package audio and video collection, codec, transmission, display and playback modules to provide the Client SDK and Server SDK API interface below is the user's guide: first, the initialization ofThis section is the first to be done to set some behavior of the SDK, including setting the corresponding callback function, setting the SDK component path, setting whether to produce log files, etc., usually initialize the code of the Anychat SDK as follows (C + +)://Turn on (off) The SDK logging feature
Brac_activecalllog (TRUE);

//Set the directory where the SDK core components reside
CHAR Szcoresdkpath[max_path] = {0};
GetModuleFileName (Null,szcoresdkpath,sizeof(Szcoresdkpath));
(STRRCHR (szcoresdkpath, ' \ \ ')) [1] = 0;
Brac_setsdkoption (Brac_so_coresdk_path,szcoresdkpath,strlen (Szcoresdkpath));

//According to BRAC_INITSDK's second parameter: Dwfuncmode, tell the SDK how to handle the related tasks (see Development documentation for details)
DWORD Dwfuncmode = Brac_func_video_cbdata | Brac_func_audio_autoplay | Brac_func_chkdependmodule | Brac_func_audio_volumecalc | Brac_func_net_supportupnp | Brac_func_firewall_open |
Brac_func_audio_autovolume | Brac_func_config_localini;
BRAC_INITSDK ( This->getsafehwnd ()/*null*/, Dwfuncmode);

//Set recording temporary file save path
CHAR Szrecorddirectory[max_path] = {0};
:: GetModuleFileName (Null,szrecorddirectory,max_path);
(STRRCHR (szrecorddirectory, ' \ \ ')) [1] = 0;
strcat (Szrecorddirectory,"Record");
Brac_setsdkoption (Brac_so_record_tmpdir,szrecorddirectory,strlen (szrecorddirectory));

//Set Video file quality parameters
DWORD dwvideobitrate = 200 * 1000;//200kbps
Brac_setsdkoption (BRAC_SO_RECORD_VIDEOBR, (PCHAR) &dwvideobitrate,sizeof(DWORD));
DWORD dwaudiobitrate = 96 * 1000;//96kbps
Brac_setsdkoption (BRAC_SO_RECORD_AUDIOBR, (PCHAR) &dwaudiobitrate,sizeof(DWORD));

//Set snapshot temporary file save path
CHAR Szsnapshotdirectory[max_path] = {0};
:: GetModuleFileName (Null,szsnapshotdirectory,max_path);
(STRRCHR (szsnapshotdirectory, ' \ \ ')) [1] = 0;
strcat (Szsnapshotdirectory,"SnapShot");
Brac_setsdkoption (Brac_so_snapshot_tmpdir,szsnapshotdirectory,strlen (szsnapshotdirectory));

//Set SDK temp file path
CHAR Sztemppath[max_path] = {0};
:: GetModuleFileName (Null,sztemppath,max_path);
(STRRCHR (sztemppath, ' \ \ ')) [1] = 0;
strcat (Sztemppath,"Temp");
Brac_setsdkoption (Brac_so_coresdk_tmpdir,sztemppath,strlen (Sztemppath));

//Enable audio Auto-parameter function (default off)
DWORD Baudioautoparam = TRUE;
Brac_setsdkoption (Brac_so_audio_autoparam, (PCHAR) &baudioautoparam,sizeof(DWORD)); Second, login systemWhen the first step is complete, you can connect to the server and authenticate the user. The usual calling code is as follows (C + +):1. 3.//Login System4. 2.brac_enterroom (1, "", 0); The room is dynamically managed by the server and is uniquely marked by a 32-bit room ID number, which is automatically created when the client-specified room ID number does not exist. Entering the room is also an asynchronous process, whether the success will trigger an asynchronous message, after entering the room successfully, the server will be the current room online user list to the client, after the transfer is completed, will trigger an asynchronous message (the message is triggered only once), only received the server's online user list, To perform audio and video operations on the user in the room. When you enter the room successfully, and receive the server online user message, a new user enters the room, or the old user leaves the room, will trigger an asynchronous message, so that they know who entered, or left the room. 1. Open your own audio and videoAfter entering the room successfully, you can open your own audio and video device, usually the calling code is as follows (C + +):1. 3.//to open your own audio device4. 2.brac_usercameracontrol (dwuserid,true);3. 1.//Sending text messages2. 1.//left the room.2. 4.brac_logout ();5.<span times= "" new= "" roman "; =" "" = "style=" padding:0px; margin:0px; font-size:7pt; line-height:normal; " >5.//Releasing Resources6.<span times= "" new= "" roman "; =" "" = "style=" padding:0px; margin:0px; font-size:7pt; line-height:normal; " >6.brac_release (); After leaving the room, you can enter a new room, after the system logoff, you can again call the Connection Server API interface, but after releasing the resources, the SDK will no longer work.
If there is a problem, you can enter the official forum through the website post, or add my QQ communication 2921533637

Web version of audio and video chat room development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.