membrane_rtsp

RTSP client for Elixir


License
Apache-2.0

Documentation

Membrane RTSP

Hex.pm API Docs CircleCI

The RTSP client for Elixir

Currently supports only RTSP 1.1 defined by RFC2326

Installation

The package can be installed by adding membrane_rtsp to your list of dependencies in mix.exs:

def deps do
  [
    {:membrane_rtsp, "~> 0.6.1"}
  ]
end

Usage

To use the Membrane RTSP client you must first start a session:

{:ok, session} = Membrane.RTSP.start_link("rtsp://domain.name:port/path")

Then you can proceed with executing requests:

alias Membrane.RTSP
alias Membrane.RTSP.Response

{:ok, %Response{status: 200}} = RTSP.describe(session)

{:ok, %Response{status: 200}} =
  RTSP.setup(session, "/trackID=1", [
    {"Transport", "RTP/AVP;unicast;client_port=57614-57615"}
  ])

{:ok, %Response{status: 200}} =
  RTSP.setup(session, "/trackID=2", [
    {"Transport", "RTP/AVP;unicast;client_port=52614-52615"}
  ])

{:ok, %Response{status: 200}} = RTSP.play(session)

If you started a session without linking it, it is advised to close it manually by calling:

RTSP.close(session)

Implementing a custom transport layer

To implement custom request execution logic you must implement Membrane.RTSP.Transport behavior. Then you can pass the name of your transport module to Membrane.RTSP.start_link/3.

External tests

Tests that use external RTSP service are disabled by default but they are present in the codebase. They are tagged as external and are usually accompanied by tests that mimic their behavior by using predefined responses.

Copyright and License

Copyright 2019, Software Mansion

Software Mansion

Licensed under the Apache License, Version 2.0