Thursday, November 7, 2013

Disabling idle streams in nginx-rtmp-module

By default nginx-rtmp allows subscribers to connect to any (even nonexistent) stream within application. You can connect to a stream with no publisher in it. When publisher disconnects all subscribers remain connected. That can be controlled with on_play and on_update HTTP notifications. The most recent version of nginx-rtmp has one more way to limit subscribers in idle streams.

The new directive is idle_streams. Default value on is consistent with the current behavior. If turned off subscribers will not be able to connect to idle (not published to) streams and will be disconnected when stream publisher disconnects.

application live {
    live on;
    idle_streams off;
}

7 comments:

  1. Hi,

    Thank for your great work. I use idle_streams off; with pull. Then we can't watch any live video.

    Thank.

    ReplyDelete
  2. All subscribers are disconnect after few minutes play;-( idle_streams off; nginx-rtmp-module 1.0.6, nginx 1.5.6, do u know why ?
    If I remove idle_streams off; fron conf everything back normal

    ReplyDelete
    Replies
    1. What about the publisher? Please post debug log.

      Delete
  3. i have that same effect. nginx-1.4.2

    ReplyDelete
  4. I am on 1.5. As the publisher, the stream does disconnect when I stop broadcasting (as it should); however, those watching my live stream are disconnecting every few minutes -- turning idle_streams on fixes this for my viewers.

    ReplyDelete
  5. Great work. I've waited for this implementation.

    ReplyDelete