叶子的家

~●    ~●  ~●          ~●   ~●~●                           ○
    离成功还很远,距离长着叻,Fighting!
posts - 39, comments - 610, trackbacks - 17, articles - 1
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理
This project i developed recently is a web conference application.
i used .net with C# to write the web service providing the data access layer(dal) to the flash application for authentication and account management. Red5 server is an open source "flash stream server", JAVA is applyed here to write some handlers to process the stream data including the video and audio. Went without saying, Flex is used to develop the interface of the webside. The Red5 server and flash client is two way interaction, which means the flash client is able to send a request to the red5 server, so does red5, which can invoke client functions as well.

here i post the source code, you have to understand some concepts of red5 before reading:
1. the scope in Red5
a scope is used to group resouces, an Application has two kinds of scope. one is the app scope, the root scope in an application. second is the child scope. they are formed in a tree structure.
2. scope in my application
u'll see the source code in the application.java, there are a hall and many rooms. you will enter the hall after authentication, and can create or join a room in the hall. Notice that both hall and room are child scopes. hall scope is created only once by red5 automatically while the first user entering the hall. room scope is created when a user start a new room.
3. message exchange
the flash client can send public message or publish video/audio stream to the red5 server, and then these messages or stream data will be transmit to the users who are in the same room. itz real time and asynchronous.

how to make it work:
1. having MS Sql server.
create a database named "xyz" and create a table named "users" with 5 columns: Id(PK), Password, Email, Sex, and Description. you can get it done by running the dbScript.txt in your ms-sql server after the creation of database.
2. running web service
you can run the webservice directly with vistual studio 2005, or put the web service in iis. if u run it in vs2005, u might have to change the port number in the flash client. make sure it works.
3. running flash
open the flash client code source with Flex builder 2.1 (can download from Adobo), compile it, you'd better put the bin code in IIS as well.
4. running Red5 server
i used Eclipse to developed the Red5 handler, there might be some problems of using Eclipse to make red5 running at the beginning. search the solusion in Red5 webside http://osflash.org/red5, and create a new application called "XyzTalk", u can directly import my code into your red5 project. and finally build it.
5. done
once you get everything done correctly, u will see the beautiful interface (no? dam!) below:

login:


register:


hall:


room:


download URL:
/Files/wj/xyz.rar

btw, i didn't finish the shaing files part, yup. if any recommendations or bugs u firgure out, just leave msg or send me an email.
enjoy~ bye~

Feedback

#1楼    回复  引用  查看    

2008-01-18 01:18 by BirdsHover      
可惜是英文的

#2楼    回复  引用  查看    

2008-01-18 08:26 by henry      
发现你没有什么不干的....

#3楼    回复  引用  查看    

2008-01-18 08:47 by Yok      
好激情啊!

#4楼    回复  引用    

2008-01-18 09:28 by XXOXX [未注册用户]
既然你想發上來給朋友看下,為什麽不幫忙到底,翻譯一下又怎么了??寫文章,發帖子要對自己的東西負責!

#5楼    回复  引用  查看    

2008-01-18 10:52 by 巫云      
都是很基础的英语吧,不翻译亦可。

#6楼    回复  引用    

2008-01-18 10:56 by A.Z! [未注册用户]
标题就有问题,flash不是插件吗??

#7楼    回复  引用  查看    

2008-01-18 12:15 by Leem      
看看英文也不错阿,这篇英文相对来说还是比较简单的.相信SilverLight也可以开发出很好的聊天程序.听说有人用Flex来开发游戏.就是没有看过.

#8楼    回复  引用    

2008-01-18 13:38 by hihi [未注册用户]
Thumbs up!!
I will download your source code tonight and have a look!

BTW:
Just persist writing with EN.

Best wishes.

#9楼    回复  引用  查看    

2008-01-19 09:28 by ithurricane      
不错,现在正在研究Flex呢

#10楼    回复  引用    

2008-02-16 13:10 by Gupta [未注册用户]
Looking great, Nice and clean GUI.

#11楼    回复  引用    

2008-04-01 19:31 by dmitry [未注册用户]
red5 7 dont work create and join rooms

#12楼    回复  引用    

2008-04-02 13:57 by dmitry [未注册用户]
please help me run your example
my red5 dont create room and don't reconnect

#13楼 [楼主]   回复  引用  查看    

2008-04-02 14:36 by 绿叶      
@dmitry
i don't know which part causes your problem.
you have to make sure everything running correctly by testing.

1. web service and database
try to type the url of your webservice in browser, and you will see the webservice page. And you can try to enter some info to invoke the webservice, ensure both web service and dabase have no problem.

2. red5 server and flex
did you compile the red5 source code and my code? don't forget to modify the xml configuration of Ant to compile them together.
After compilation, chage the correct url of red5 in flex code:
. AccountService.as -- private var wsdl:String = "http://192.168.0.88/XyzTalk/AccountWS.asmx?WSDL";
. HallService.as -- private var strCon:String = "rtmp://192.168.0.88/xyzTalk/hall";

#14楼    回复  引用    

2008-04-04 13:29 by dmitry [未注册用户]
i use red5 0.7.0 for windows and it work

main problem in function
public boolean S_JoinRoom(String roomName)
{
if (!audiences.containsKey(roomName))
{
return false;
}
IScope roomScope = getChildScope(roomName);
IConnection conn = Red5.getConnectionLocal();
getChildScope(SCOPE_HALL).disconnect(conn); // leave hall
boolean ok = conn.connect(roomScope); // connect to the room
if (ok)
{
return true;
}
else
{
return false;
}
}


boolean ok = conn.connect(roomScope); <--- don't work

please write when version red5 you use and if posiible your ICQ i need your consult

#15楼    回复  引用    

2008-04-04 14:10 by dmitry [未注册用户]
error red5 server i download last red5 0.7.0 and compile with ant it return error

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:217)
at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:123)
at org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:157)
at org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:401)
at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:143)
at org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.java:119)
at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at org.red5.server.api.service.ServiceUtils.invokeOnClient(ServiceUtils.java:217)
at org.red5.server.api.service.ServiceUtils.invokeOnAllConnections(ServiceUtils.java:177)
at org.red5.server.api.service.ServiceUtils.invokeOnAllConnections(ServiceUtils.java:160)
at org.red5.server.webapps.xyzTalk.Application.roomJoin(Application.java:128)
at org.red5.server.adapter.MultiThreadedApplicationAdapter.join(MultiThreadedApplicationAdapter.java:387)
at org.red5.server.adapter.ApplicationAdapter.join(ApplicationAdapter.java:73)
at org.red5.server.Scope.connect(Scope.java:417)
at org.red5.server.BaseConnection.connect(BaseConnection.java:268)
at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:267)
at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:70)
at org.red5.server.BaseConnection.connect(BaseConnection.java:256)
at org.red5.server.webapps.xyzTalk.Application.S_JoinRoom(Application.java:190)
at org.red5.server.webapps.xyzTalk.Application.S_CreateAndJoinRoom(Application.java:169)
... 19 common frames omitted

#16楼 [楼主]   回复  引用  查看    

2008-04-08 15:34 by 绿叶      
i was using v0.6.1 Final.

#17楼    回复  引用    

2008-05-21 15:52 by asflash [未注册用户]
可以创建房间,但是进不去房间,提示创建房间失败,随便点一会,偶尔也会进去,但是没有连接视频信息,而且别人进不来,只有自己。我看了一下RED5的代码,好像连接摄像头部分的代码也没有。

楼主的所有功能都可以用吗?

#18楼 [楼主]   回复  引用  查看    

2008-05-21 17:32 by 绿叶      
@asflash
摄像头的连接在red5里面是不用代码的。
你可以看看action script里面的代码,你创建一个房间名字和你的登录名一样的就可以看到摄像了。
房间创建失败是什么问题你自己debug一下,我这里正常。

#19楼    回复  引用    

2008-05-21 18:03 by asflash [未注册用户]
@绿叶

问题已经解决!
原因是S_JoinRoom方法里有一个
getChildScope(SCOPE_HALL).disconnect(conn)这个是离开房间的,把他注释掉就可以了。
摄像头问题解决了,呵呵,房间名字要和登录名一样即可。没来得及细看代码啊,多谢楼主、!

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-02-10 15:21 编辑过


相关链接: