# `Membrane.RTMP.Source`
[🔗](https://github.com/membraneframework/membrane_rtmp_plugin/blob/v0.29.5/lib/membrane_rtmp_plugin/rtmp/source/source.ex#L1)

Membrane Element for receiving an RTMP stream. Acts as a RTMP Server.
This implementation is limited to only AAC and H264 streams.

The source can be used in the following two scenarios:
* by providing the URL on which the client is expected to connect - note, that if the client doesn't
connect on this URL, the source won't complete its setup. Note that all attempted connections to
other `app` or `stream_key` than specified ones will be rejected.

* by spawning `Membrane.RTMPServer`, receiving a client reference and passing it to the `Membrane.RTMP.Source`.

## Element options

Passed via struct `t:Membrane.RTMP.Source.t/0`

- `client_ref`  

  ```
  pid()
  ```
  
  Default value: `nil`  
  A pid of a process acting as a client reference.
  Can be gained with the use of `Membrane.RTMPServer`.

- `url`  

  ```
  String.t()
  ```
  
  Default value: `nil`  
  An URL on which the client is expected to connect, for example:
  rtmp://127.0.0.1:1935/app/stream_key

- `client_timeout`  

  ```
  Membrane.Time.t()
  ```
  
  Default value: `5000000000`  
  Time after which an unused client connection is automatically closed, expressed in `Membrane.Time.t()` units. Defaults to 5 seconds.

## Pads

### `:output`

Accepted formats:
```
Membrane.RemoteStream
```

Direction: | `:output`
Availability: | `:always`
Flow control: | `:manual`
Demand unit: | `:buffers`

# `t`

```elixir
@type t() :: %Membrane.RTMP.Source{
  client_ref: pid(),
  client_timeout: Membrane.Time.t(),
  url: String.t()
}
```

Struct containing options for `Membrane.RTMP.Source`

# `options`

```elixir
@spec options() :: keyword()
```

Returns description of options available for this module

---

*Consult [api-reference.md](api-reference.md) for complete listing*
