Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.1 KB

README.md

File metadata and controls

58 lines (43 loc) · 1.1 KB

Hadean

{:ok, pid} =
  RTSPConnection.start_link({
    "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov",
    :udp
  })

RTSPConnection.connect(pid, :all)

packet_processor = spawn(fn -> packet_processor() end)
RTSPConnection.attach_packet_processor(pid, packet_processor)

RTSPConnection.play(pid)

loop()
...

defp packet_processor() do
  receive do
    {:audio, _packet} ->
      IO.puts("audio packet received")

    {:video, packet} ->
      IO.puts("frame_type: #{inspect(packet.frame_type)}")

    {:unknown, _} ->
      IO.puts("Unknown packet")
  end

  packet_processor()
end

def loop() do
  receive do
    _ -> :ok
  end
end

Installation

If available in Hex, the package can be installed by adding hadean to your list of dependencies in mix.exs:

def deps do
  [
    {:hadean, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/hadean.