开发者

Audio/Video/Text chat in ASP.Net app

开发者 https://www.devze.com 2023-02-03 13:32 出处:网络
I need to develop a chat system in ASP.Net. I have gone through lots of SO question asked on similar topic, but did\'nt find any one satisfactory. Is it possible to create it from scratch or do i need

I need to develop a chat system in ASP.Net. I have gone through lots of SO question asked on similar topic, but did'nt find any one satisfactory. Is it possible to create it from scratch or do i need to go for some API's. My requir开发者_运维知识库ement is limited to my site users only, can say intranet based.

Please help me.


To make the text chat is one think that you can done with a simple table, everyone write on it, every one read time to time, and you show it to the page.

Here is an example http://www.codeproject.com/KB/ajax/ChatRoom.aspx

The Video/Audio chat is a complicate one. You can start with this example

http://www.codeproject.com/KB/IP/videochat.aspx

and you can read more here: how to work with videos in ASP.NET?


Text chat is relatively simple. It involves three tier architecture. 1) Javascript timer. 2) WCF Ajax Enabled web service or Generic Http Handler, 3) Data Storage (Preferably SQL).

1) On the page - sending: input text box + button (used to send). The button click event handler or the text box's key down (for enter key) and blur events would invoke a post (via JQuery, plain ol' JavaScript or whatever Javascript library you use) to the WCF service/Generic handler, sending the contents of the text box, along with the chartroom name, the addressee, and the recipient.

2) On the server: WCF Service/Generic Http handler receives the post and stores it in DB.

3) On the page - receiving: using JQuery for example, you would create a javascript timer on document ready (when the page loaded). On every timer's tick event you want to create a GET (or post) via your handy JavaScript framework (or Plain Javascript) to your WCF service/ Generic Handler requesting the latest records stored in the DB for that chatroom. Append the result received (assuming xml/html/json) to the Div or whatever element is used to display your "chats".

This is a very simplified chat in jquery/asp.net.

As far as audio-video is concerned, you have a few problems. 1) The browser itself has no means of interacting with the mike, speakers, and video camera, unless it uses a plugin. Moreover, browsers typically have no way of knowing how to decode a video stream (though some of the smarter ones have it built in... chrome, firefox). 3) Javascript has no way interacting with all the necessary hardware as it lives inside the browser.

All that said, you can use a plugin such as Flash or Silverlight, (that has built in access to the necessary hardware), or whatever. You will also have a conceptual dilemma with those as you have to simultaneously deal with 2 streams - one for coming in, another going out and displaying both. However it is possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消