Stratus is a service that enables Flash Player clients to connect directly point to point, to share data (audio, video, binary...)

In the article, Jozsef makes an introduction about Stratus and the Real-Time Media Flow Protocol (RTMFP), introduced also in FP10, built on UDP, that is perfectly suited for audio/video transfers and simplifies connections when clients are behind NATs. To make applications that use this beta service from Adobe, developers have to apply for a developer key.
The article comes with a source code example which is really illustrative, which is a video conference application built in Flex, using the Stratus service.

You can try it out here). Just open a couple of browsers and sign in the application using two different nick names. Once signed, enter your "buddy's" nickname and call him/her to see him/her doing strange faces (as in the picture, me talking to myself).
The example is really cool, and a great start point for plenty of possible applications where messaging is involved. I found it a little tricky to follow, because there are big code jumps, 2 user scenarios depending on whether one is calling/answering, and some auxiliar classes to deal with the user login service.
How does the connection process work?
I think this is the interesting point in this example. To put both peers in touch, the process is more or less like this:
- User A connects to Stratus service (rtmfp://stratus.adobe.com) using a NetConnection object, from the application that has a specific developer key. The service assigns the User A an ID.
- User A registers this ID into some kind of user manager service. This is independent from Stratus and Adobe, and has to manage the pair User Name - User ID.
- Once registered, User A publishes a listener Stream, that will be waiting for other user connections.
- User B makes the same process as User A about registering.
- User B publishes its listener stream.
- User B decides to call User A, so he/she publishes its media stream, with the audio/video from his/her webcam. At this point, B doesn't know nothing about A, so he/she has to ask te user managment service which ID has the user with name "User B".
- With the returned ID and through Stratus (by means of the NetConnection object that keeps the connection with Stratus alive), User B reaches User A.
- User A listener StreamHhandler function is called. This is where by accepting the call, User A will subscribe to User B published media stream and at the same time, A will publish his/her media stream.
- User A will send a notification to B about it's call acceptance, so B will know he/she can subscribe to A's recently published media stream.
- A and B will start chatting, fall in love, or whatever.
And it works great! So I started thinking about if it could be also used for other purposes as binary data transmition, and of course, I was not the first to think about it. Anyway, here comes my example!
No comments:
Post a Comment