Feature: default broadcast endpoint config option (#123)

* feat: add broadcast_default_endpoint config

* chore: add documentation for new env variable

* rename to broadcast URL.

* update changelog.

Co-authored-by: Miroslav Šedivý <sedivy.miro@gmail.com>
This commit is contained in:
Konstantin Krauss 2022-01-02 22:19:36 +01:00 committed by GitHub
parent f37a2347e1
commit 50a85c6b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 2 deletions

View File

@ -9,6 +9,7 @@
- Added `m1k1o/neko:microsoft-edge` tag. - Added `m1k1o/neko:microsoft-edge` tag.
- Fixed clipboard sync in chromium based browsers. - Fixed clipboard sync in chromium based browsers.
- Added support for implicit control (using `NEKO_IMPLICITCONTROL=1`). That means, users do not need to request control prior usage. - Added support for implicit control (using `NEKO_IMPLICITCONTROL=1`). That means, users do not need to request control prior usage.
- Automatically start broadcasting using `NEKO_BROADCAST_URL=rtmp://your-rtmp-endpoint/live` (thanks @konsti).
### Misc ### Misc
- Automatic WebRTC SDP negotiation using onnegotiationneeded handlers. This allows adding/removing track on demand in a session. - Automatic WebRTC SDP negotiation using onnegotiationneeded handlers. This allows adding/removing track on demand in a session.

View File

@ -71,6 +71,8 @@ NEKO_LOCKS:
NEKO_CONTROL_PROTECTION: NEKO_CONTROL_PROTECTION:
- Control protection means, users can gain control only if at least one admin is in the room. - Control protection means, users can gain control only if at least one admin is in the room.
- e.g. false - e.g. false
NEKO_BROADCAST_URL:
- Set a default URL for broadcast streams. Setting this value will automatically enable broadcasting when n.eko starts. It can be disabled/changed later in GUI.
``` ```
## Agruments ## Agruments
@ -86,7 +88,9 @@ Flags:
--audio_bitrate int audio bitrate in kbit/s (default 128) --audio_bitrate int audio bitrate in kbit/s (default 128)
--bind string address/port/socket to serve neko (default "127.0.0.1:8080") --bind string address/port/socket to serve neko (default "127.0.0.1:8080")
--broadcast_pipeline string custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced --broadcast_pipeline string custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced
--broadcast_url string URL for broadcasting, setting this value will automatically enable broadcasting
--cert string path to the SSL cert used to secure the neko server --cert string path to the SSL cert used to secure the neko server
--control_protection control protection means, users can gain control only if at least one admin is in the room
--device string audio device to capture (default "auto_null.monitor") --device string audio device to capture (default "auto_null.monitor")
--display string XDisplay to capture (default ":99.0") --display string XDisplay to capture (default ":99.0")
--epr string limits the pool of ephemeral ports that ICE UDP connections can allocate from (default "59000-59100") --epr string limits the pool of ephemeral ports that ICE UDP connections can allocate from (default "59000-59100")
@ -96,8 +100,10 @@ Flags:
--icelite configures whether or not the ice agent should be a lite agent --icelite configures whether or not the ice agent should be a lite agent
--iceserver strings describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer (default [stun:stun.l.google.com:19302]) --iceserver strings describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer (default [stun:stun.l.google.com:19302])
--iceservers string describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer --iceservers string describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer
--implicit_control if enabled members can gain control implicitly
--ipfetch string automatically fetch IP address from given URL when nat1to1 is not present (default "http://checkip.amazonaws.com") --ipfetch string automatically fetch IP address from given URL when nat1to1 is not present (default "http://checkip.amazonaws.com")
--key string path to the SSL key used to secure the neko server --key string path to the SSL key used to secure the neko server
--locks strings resources, that will be locked when starting (control, login)
--max_fps int maximum fps delivered via WebRTC, 0 is for no maximum (default 25) --max_fps int maximum fps delivered via WebRTC, 0 is for no maximum (default 25)
--nat1to1 strings sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used --nat1to1 strings sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used
--opus use Opus audio codec --opus use Opus audio codec
@ -108,6 +114,8 @@ Flags:
--proxy enable reverse proxy mode --proxy enable reverse proxy mode
--screen string default screen resolution and framerate (default "1280x720@30") --screen string default screen resolution and framerate (default "1280x720@30")
--static string path to neko client files to serve (default "./www") --static string path to neko client files to serve (default "./www")
--tcpmux int single TCP mux port for all peers
--udpmux int single UDP mux port for all peers
--video string video codec parameters to use for streaming --video string video codec parameters to use for streaming
--video_bitrate int video bitrate in kbit/s (default 3072) --video_bitrate int video bitrate in kbit/s (default 3072)
--vp8 use VP8 video codec --vp8 use VP8 video codec

View File

@ -25,8 +25,8 @@ func New(remote *config.Remote, config *config.Broadcast) *BroadcastManager {
logger: log.With().Str("module", "remote").Logger(), logger: log.With().Str("module", "remote").Logger(),
remote: remote, remote: remote,
config: config, config: config,
enabled: false, enabled: config.Enabled,
url: "", url: config.URL,
} }
} }

View File

@ -7,6 +7,8 @@ import (
type Broadcast struct { type Broadcast struct {
Pipeline string Pipeline string
URL string
Enabled bool
} }
func (Broadcast) Init(cmd *cobra.Command) error { func (Broadcast) Init(cmd *cobra.Command) error {
@ -15,9 +17,16 @@ func (Broadcast) Init(cmd *cobra.Command) error {
return err return err
} }
cmd.PersistentFlags().String("broadcast_url", "", "URL for broadcasting, setting this value will automatically enable broadcasting")
if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil {
return err
}
return nil return nil
} }
func (s *Broadcast) Set() { func (s *Broadcast) Set() {
s.Pipeline = viper.GetString("broadcast_pipeline") s.Pipeline = viper.GetString("broadcast_pipeline")
s.URL = viper.GetString("broadcast_url")
s.Enabled = s.URL != ""
} }