mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-21 17:02:19 +00:00
Use config file for OME broadcasting
This commit is contained in:
parent
cfcde6f530
commit
3d8ba0623d
@ -36,7 +36,7 @@
|
||||
</Domain>
|
||||
<Applications>
|
||||
<Application>
|
||||
<Name>app</Name>
|
||||
<Name>play</Name>
|
||||
<Type>live</Type>
|
||||
<Encodes>
|
||||
<Encode>
|
||||
|
@ -51,7 +51,7 @@ services:
|
||||
labels:
|
||||
- "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||
|
||||
- "traefik.http.routers.ovenmediaengine.rule=Host(`stream.example.com`) && PathPrefix(`/app/`)"
|
||||
- "traefik.http.routers.ovenmediaengine.rule=Host(`stream.example.com`) && PathPrefix(`/play/`)"
|
||||
- "traefik.http.routers.ovenmediaengine.priority=101"
|
||||
- "traefik.http.routers.ovenmediaengine.entrypoints=websecure"
|
||||
- "traefik.http.routers.ovenmediaengine.tls.certresolver=mytlschallenge"
|
||||
@ -59,7 +59,7 @@ services:
|
||||
- "traefik.http.routers.ovenmediaengine.service=ovenmediaengine"
|
||||
- "traefik.http.routers.ovenmediaengine.middlewares=sslheader"
|
||||
|
||||
- "traefik.http.routers.ovenmediaengine-hls.rule=Host(`stream.example.com`) && Path(`/app/{app_name:.*}/{filename:.*}.{ext:(m3u8|mpd|ts)}`)"
|
||||
- "traefik.http.routers.ovenmediaengine-hls.rule=Host(`stream.example.com`) && Path(`/play/{app_name:.*}/{filename:.*}.{ext:(m3u8|mpd|ts)}`)"
|
||||
- "traefik.http.routers.ovenmediaengine-hls.priority=102"
|
||||
- "traefik.http.routers.ovenmediaengine-hls.entrypoints=websecure"
|
||||
- "traefik.http.routers.ovenmediaengine-hls.tls.certresolver=mytlschallenge"
|
||||
|
@ -49,7 +49,6 @@ forwarding:
|
||||
# - rtmp://live-cdg.twitch.tv/app/STREAM_KEY
|
||||
# - rtmp://a.rtmp.youtube.com/live2/STREAM_KEY
|
||||
# - /home/ghostream/lives/%name/live-%Y-%m-%d-%H-%M-%S.flv
|
||||
# - rtmp://ovenmediaengine:1915/app/demo # For player
|
||||
|
||||
## Prometheus monitoring ##
|
||||
# Expose a monitoring endpoint for Prometheus
|
||||
@ -62,6 +61,19 @@ monitoring:
|
||||
# To limit access to only localhost, use 127.0.0.1:2112
|
||||
#listenAddress: :2112
|
||||
|
||||
## OvenMediaEngine ##
|
||||
# Send the stream data to OvenMediaEngine to handle properly the web client
|
||||
ome:
|
||||
# If you disable OME module, the laggy webrtc client will be used.
|
||||
#
|
||||
#enabled: true
|
||||
#
|
||||
# The URL where OME listens RTMP, without the prefix.
|
||||
#url: ovenmediaengine:1915
|
||||
#
|
||||
# The OME app where OME is waiting for the data of Ghostream.
|
||||
#app: play
|
||||
|
||||
## SRT server ##
|
||||
# The SRT server receive incoming stream and can also serve video to clients.
|
||||
srt:
|
||||
|
@ -2,6 +2,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"gitlab.crans.org/nounous/ghostream/stream/ovenmediaengine"
|
||||
"net"
|
||||
|
||||
"github.com/sherifabdlnaby/configuro"
|
||||
@ -23,6 +24,7 @@ type Config struct {
|
||||
Auth auth.Options
|
||||
Forwarding forwarding.Options
|
||||
Monitoring monitoring.Options
|
||||
OME ovenmediaengine.Options
|
||||
Srt srt.Options
|
||||
Telnet telnet.Options
|
||||
Transcoder transcoder.Options
|
||||
@ -49,6 +51,11 @@ func New() *Config {
|
||||
Enabled: true,
|
||||
ListenAddress: ":2112",
|
||||
},
|
||||
OME: ovenmediaengine.Options{
|
||||
Enabled: true,
|
||||
URL: "ovenmediaengine:1915",
|
||||
App: "play",
|
||||
},
|
||||
Srt: srt.Options{
|
||||
Enabled: true,
|
||||
ListenAddress: ":9710",
|
||||
|
4
main.go
4
main.go
@ -5,6 +5,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"gitlab.crans.org/nounous/ghostream/stream/ovenmediaengine"
|
||||
"log"
|
||||
|
||||
"github.com/pkg/profile"
|
||||
@ -49,9 +50,10 @@ func main() {
|
||||
go transcoder.Init(streams, &cfg.Transcoder)
|
||||
go forwarding.Serve(streams, cfg.Forwarding)
|
||||
go monitoring.Serve(&cfg.Monitoring)
|
||||
go ovenmediaengine.Serve(streams, &cfg.OME)
|
||||
go srt.Serve(streams, authBackend, &cfg.Srt)
|
||||
go telnet.Serve(streams, &cfg.Telnet)
|
||||
go web.Serve(streams, &cfg.Web)
|
||||
go web.Serve(streams, &cfg.Web, &cfg.OME)
|
||||
go webrtc.Serve(streams, &cfg.WebRTC)
|
||||
|
||||
// Wait for routines
|
||||
|
17
stream/ovenmediaengine/ovenmediaengine.go
Normal file
17
stream/ovenmediaengine/ovenmediaengine.go
Normal file
@ -0,0 +1,17 @@
|
||||
// Package ovenmediaengine provides the forwarding to an ovenmediaengine server to handle the web client
|
||||
package ovenmediaengine
|
||||
|
||||
import "gitlab.crans.org/nounous/ghostream/messaging"
|
||||
|
||||
// Options holds ovenmediaengine package configuration
|
||||
type Options struct {
|
||||
Enabled bool
|
||||
URL string
|
||||
App string
|
||||
}
|
||||
|
||||
func Serve(streams *messaging.Streams, cfg *Options) {
|
||||
if !cfg.Enabled {
|
||||
return
|
||||
}
|
||||
}
|
@ -61,7 +61,8 @@ func viewerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
Cfg *Options
|
||||
Path string
|
||||
WidgetURL string
|
||||
}{Path: path, Cfg: cfg, WidgetURL: ""}
|
||||
OMEApp string
|
||||
}{Path: path, Cfg: cfg, WidgetURL: "", OMEApp: omeCfg.App}
|
||||
|
||||
// Load widget is user does not disable it with ?nowidget
|
||||
if _, ok := r.URL.Query()["nowidget"]; !ok {
|
||||
|
@ -4,10 +4,11 @@ import { ViewerCounter } from "./modules/viewerCounter.js";
|
||||
* Initialize viewer page
|
||||
*
|
||||
* @param {String} stream
|
||||
* @param {String} omeApp
|
||||
* @param {Number} viewersCounterRefreshPeriod
|
||||
* @param {String} posterUrl
|
||||
*/
|
||||
export function initViewerPage(stream, viewersCounterRefreshPeriod, posterUrl) {
|
||||
export function initViewerPage(stream, omeApp, viewersCounterRefreshPeriod, posterUrl) {
|
||||
// Create viewer counter
|
||||
const viewerCounter = new ViewerCounter(
|
||||
document.getElementById("connected-people"),
|
||||
@ -41,13 +42,13 @@ export function initViewerPage(stream, viewersCounterRefreshPeriod, posterUrl) {
|
||||
expandFullScreenUI: true,
|
||||
sources: [
|
||||
{
|
||||
"file": "wss://" + window.location.host + "/app/" + stream,
|
||||
"file": "wss://" + window.location.host + "/" + omeApp + "/" + stream,
|
||||
"type": "webrtc",
|
||||
"label": " WebRTC - Source"
|
||||
},
|
||||
{
|
||||
"type": "hls",
|
||||
"file": "https://" + window.location.host + "/app/" + stream + "_bypass/playlist.m3u8",
|
||||
"file": "https://" + window.location.host + "/" + omeApp + "/" + stream + "_bypass/playlist.m3u8",
|
||||
"label": " HLS"
|
||||
}
|
||||
]
|
||||
|
@ -50,6 +50,6 @@
|
||||
"{{$value}}",
|
||||
{{end}}
|
||||
]
|
||||
initViewerPage(stream, /*stunServers,*/ viewersCounterRefreshPeriod, {{.Cfg.PlayerPoster}})
|
||||
initViewerPage(stream, {{.OMEApp}}, /*stunServers,*/ viewersCounterRefreshPeriod, {{.Cfg.PlayerPoster}})
|
||||
</script>
|
||||
{{end}}
|
||||
|
@ -2,6 +2,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"gitlab.crans.org/nounous/ghostream/stream/ovenmediaengine"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@ -32,6 +33,8 @@ type Options struct {
|
||||
var (
|
||||
cfg *Options
|
||||
|
||||
omeCfg *ovenmediaengine.Options
|
||||
|
||||
// Preload templates
|
||||
templates *template.Template
|
||||
|
||||
@ -70,9 +73,10 @@ func loadTemplates() error {
|
||||
}
|
||||
|
||||
// Serve HTTP server
|
||||
func Serve(s *messaging.Streams, c *Options) {
|
||||
func Serve(s *messaging.Streams, c *Options, ome *ovenmediaengine.Options) {
|
||||
streams = s
|
||||
cfg = c
|
||||
omeCfg = ome
|
||||
|
||||
if !cfg.Enabled {
|
||||
// Web server is not enabled, ignore
|
||||
|
Loading…
Reference in New Issue
Block a user