Dropye
Dropye

Reputation: 224

More than one stream on single RTMP Application

Iam currently setting up an RTMP Streaming server. The Server runs nginx with an RTMP module.

This Works like the following:

enter image description here

As u can see I have multiple applications for each and every streamer. But I want a single Application for all streamers.

I prepared the nginx config like this.

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                hls on;
                hls_path /***/hls0;
                hls_nested on;
                hls_fragment 2s;
                hls_playlist_length 600s;
                hls_fragment_naming system;

 application test {
  live on;
  record off;
  on_publish http://localhost/php/***.php;
  on_publish_done http://localhost/php/***.php
}
[...]

Now everything is prepared but works for only one streamer at a time. 2 diffrent streamers are accepted (app returns http code 200) but the second one couldnt start streaming.

Is there a way to get this going?

Upvotes: 0

Views: 2179

Answers (1)

szatmary
szatmary

Reputation: 31140

nginx will not do that for you. To accomplish this you need to know if a streamer is currently streaming in order to reject the second connection. The application need to keep a record of all streams in a database, or a in memory map, check on on_publish and respond to nginx with a 200, or other code to reject.

Upvotes: 1

Related Questions