rborgese / hexcord-mediaserver

WebRTC to RTMP media server heavily inspired by https://github.com/pion/webrtc/tree/master/examples/rtp-forwarder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hexcord mediaserver

Hexcord mediaserver is a standalone server that allows you to initiate a peer connection and forward audio and video streams via WebRTC to an rtmp endpoint.

Instructions

The mediaserver makes use of ffmpeg to forward the streams so you would need that installed. You would find installation instructions for ffmpeg here. The Pion webrtc library was used for the WebRTC implementation.

Start the server by either running go run main.go or run go build to build the binaries instead.

The server starts up at http://localhost:8090 and exposes an endpoint http://localhost:8090/webrtc/offer

Send a POST request with body

  {
    "ingestionAddress": "rtmp://RTMP_ADDRESS",
	"streamKey":        "234343sdsd-sdsfdfd-232dfdf",
	"offer":            "sdfarergehteafadfadfrrererdfdfdfd" // WebRTC offer from client
  }

Content-type for the request is application/json

The endpoint responds with a JSON body containing a webrtc session description

  {
    "type": "answer",
    "sdp": "sdsawewsdf434-dsdf34-sfdsfdgs434.sfdfdbvererasdsds" // use this as the remote description of the peer connection initiated on the client
  }

Have fun ❤️

About

WebRTC to RTMP media server heavily inspired by https://github.com/pion/webrtc/tree/master/examples/rtp-forwarder

License:Apache License 2.0


Languages

Language:Go 100.0%