简体   繁体   中英

How to handle multiple video streams in Red5?

I am writing a Red5 application that provides 1-on-1 video chat to a Flash client over RTMP .

Unfortunately most tutorials I was able to find were sketchy at best and the documentation of Red5 itself tends to be vague when it comes to API concepts and intended usage.

In short, I am a bit stuck and looking for hints on Red5 ApplicationAdapter implementation. Gnarly details are as follows:

  • First of all, the connections come in two flavors: visitors and consultants. A visitor should be able to indicate which consultant it wishes to communicate with. A consultant simply gets connected to the requesting visitor as long as the consultant is not busy servicing another.

  • Obviously, every RTMP connection has two-way traffic: both sending and receiving video. From the standpoint of the server, connections bring in a bunch of video streams that get their receiving endpoints assigned by request.

  • Since several video conversations can be in progress simultaneously, the main task of the application is to handle the mapping of visitor streams to consultants and provide a list indicating each consultant's state (busy/available) via AMF .

So, all in all, I have a pretty good idea what I am aiming for but how to achieve it with Red5 is still a bit of a mystery.

Hopefully someone can enlighten me in any or all of the following:

  1. What is the easiest way to establish the connection type (visitor/consultant)?

  2. Which API classes should be used to implement a persistent, globally accessible list of active connections for reporting the state of each consultant?

  3. How to switch receving endpoints dynamically when the goal is to connect a specific visitor to the selected consultant?

Saul ,

1.What is the easiest way to establish the connection type (visitor/consultant)?

assuming that both(visitor/consultant) are using flex client via which they start publishing their live video stream ,here you need to make sure that each published video stream name is unique (HOWTO is already mentioned in demo apps)

2.Which API classes should be used to implement a persistent, globally accessible list of active connections for reporting the state of each consultant?

and for providing the list of active connections you simply need to store(preferably in your db) each user's id with the stream name (which is also available as a tutorial demo app ) to connect to.

I believe all the code is available for the red5 demos Do try oflaDemo , simpleSubscriber , fitcDemo demo apps.

I hope I am closer to your solution.

Since Oflademo or red5 is capable of 1v1 chats, then replicate this code to make around 50 chats. You can maintain a table with the following columns :

  • chat room number (1 to 50)
  • user1
  • user2
  • status(0 or 1 - unoccupied or occupied)

If let say a visitor V22 wants to get consulted from consultor C33, then a program can detect the first unoccupied room from 1 to 50, if the 7th room is unoccupied then, redirect V22 and C33 to room 7 and change status to 1(occupied). After the video call, the status can be reset to 0, and the table at roomno:7 , user1 of roomno:7, user2 of roomno:7, can be set to NULL. Its like maintaining tables in a restaurant in a computer.

You can basically develop multiple chatting using 1to1 using a database and php queries, no need to edit any swf code or maintain a complicated server etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM