Red5中如何处理多个视频流?

发布于 2024-10-12 08:32:03 字数 927 浏览 6 评论 0原文

我正在编写一个 Red5 应用程序,该应用程序通过 RTMP

不幸的是,我能找到的大多数教程充其量都是粗略的,而且 Red5 本身的文档在涉及 API 概念和预期用途时往往很模糊。

简而言之,我有点卡住了,正在寻找有关 Red5 ApplicationAdapter 实现的提示。粗糙的细节如下:

  • 首先,联系有两种形式:访客和顾问。访问者应该能够表明他希望与哪位顾问沟通。只要顾问不忙于为其他人提供服务,顾问就可以与发出请求的访问者建立联系。

  • 显然,每个 RTMP 连接都有双向流量:发送和接收视频。从服务器的角度来看,连接引入了一堆视频流,这些视频流根据请求分配其接收端点。

  • 由于多个视频对话可以同时进行,因此应用程序的主要任务是处理访客流与顾问的映射,并通过 AMF

所以,总而言之,我很清楚我的目标是什么,但如何使用 Red5 实现它仍然有点神秘。

希望有人能够在以下任何或所有方面启发我:

  1. 建立连接类型(访客/顾问)的最简单方法是什么?

  2. 应使用哪些 API 类来实现持久的、全局可访问的活动连接列表,以报告每个顾问的状态?

  3. 当目标是将特定访问者连接到所选顾问时,如何动态切换接收端点?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月如刀 2024-10-19 08:32:03

扫罗,

1.最简单的建立方法是什么
连接类型
(访客/顾问)?

假设双方(访客/顾问)都使用 Flex 客户端,通过该客户端开始发布实时视频流,这里您需要确保每个发布的视频流名称是唯一的(演示中已经提到了 HOWTO)应用程序)

2.应该使用哪些API类
实施持久的、全球性的
可访问的活动连接列表
用于报告每个的状态
顾问?

为了提供活动连接的列表,您只需存储(最好在您的数据库中)每个用户的 ID 和流名称(也可以作为 教程演示应用)进行连接。

我相信所有代码都可用于 red5 演示,请尝试 oflaDemo 、 simpleSubscriber 、 fitcDemo 演示应用程序。

我希望我更接近你的解决方案。

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.

小…红帽 2024-10-19 08:32:03

由于 Oflademo 或 red5 能够进行 1v1 聊天,因此复制此代码以进行大约 50 次聊天。您可以维护一个包含以下列的表:

  • 聊天室号码(1 到 50)
  • user1
  • user2
  • 状态(0 或 1 - 空闲或占用)

如果假设访客 V22 想要获得顾问 C33 的咨询,则程序可以检测到第一个无人房间从1到50,如果第7个房间无人,则将V22和C33重定向到7号房间并将状态更改为1(有人)。视频通话结束后,状态可以重置为0,并且roomno:7处的表、roomno:7的user1、roomno:7的user2可以设置为NULL。这就像用计算机维护餐厅的桌子一样。

您基本上可以使用数据库和 php 查询使用 1to1 开发多个聊天,无需编辑任何 swf 代码或维护复杂的服务器等。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文