mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 15:02:19 +00:00
Web handler adapts its configuration wherever OME support is enabled or not
This commit is contained in:
parent
a20c6202fd
commit
6ca354f44f
@ -13,6 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/markbates/pkger"
|
"github.com/markbates/pkger"
|
||||||
"gitlab.crans.org/nounous/ghostream/internal/monitoring"
|
"gitlab.crans.org/nounous/ghostream/internal/monitoring"
|
||||||
|
"gitlab.crans.org/nounous/ghostream/stream/ovenmediaengine"
|
||||||
"gitlab.crans.org/nounous/ghostream/stream/webrtc"
|
"gitlab.crans.org/nounous/ghostream/stream/webrtc"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -61,8 +62,8 @@ func viewerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Cfg *Options
|
Cfg *Options
|
||||||
Path string
|
Path string
|
||||||
WidgetURL string
|
WidgetURL string
|
||||||
OMEApp string
|
OMECfg *ovenmediaengine.Options
|
||||||
}{Path: path, Cfg: cfg, WidgetURL: "", OMEApp: omeCfg.App}
|
}{Path: path, Cfg: cfg, WidgetURL: "", OMECfg: omeCfg}
|
||||||
|
|
||||||
// Load widget is user does not disable it with ?nowidget
|
// Load widget is user does not disable it with ?nowidget
|
||||||
if _, ok := r.URL.Query()["nowidget"]; !ok {
|
if _, ok := r.URL.Query()["nowidget"]; !ok {
|
||||||
|
@ -34,13 +34,17 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{if .OMECfg.Enabled}}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||||
<script src="/static/ovenplayer/ovenplayer.js"></script>
|
<script src="/static/ovenplayer/ovenplayer.js"></script>
|
||||||
<script src="/static/js/ovenplayer.js"></script>
|
<script src="/static/js/ovenplayer.js"></script>
|
||||||
|
{{end}}
|
||||||
<script type="module">
|
<script type="module">
|
||||||
// import { initViewerPage } from "/static/js/viewer.js";
|
{{if .OMECfg.Enabled}}
|
||||||
import { initViewerPage } from "/static/js/ovenplayer.js";
|
import { initViewerPage } from "/static/js/ovenplayer.js";
|
||||||
|
{{else}}
|
||||||
|
import { initViewerPage } from "/static/js/viewer.js";
|
||||||
|
{{end}}
|
||||||
|
|
||||||
// Some variables that need to be fixed by web page
|
// Some variables that need to be fixed by web page
|
||||||
const viewersCounterRefreshPeriod = Number("{{.Cfg.ViewersCounterRefreshPeriod}}");
|
const viewersCounterRefreshPeriod = Number("{{.Cfg.ViewersCounterRefreshPeriod}}");
|
||||||
@ -50,6 +54,10 @@
|
|||||||
"{{$value}}",
|
"{{$value}}",
|
||||||
{{end}}
|
{{end}}
|
||||||
]
|
]
|
||||||
initViewerPage(stream, {{.OMEApp}}, /*stunServers,*/ viewersCounterRefreshPeriod, {{.Cfg.PlayerPoster}})
|
{{if .OMECfg.Enabled}}
|
||||||
|
initViewerPage(stream, {{.OMECfg.App}}, viewersCounterRefreshPeriod, {{.Cfg.PlayerPoster}})
|
||||||
|
{{else}}
|
||||||
|
initViewerPage(stream, stunServers, viewersCounterRefreshPeriod)
|
||||||
|
{{end}}
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
Reference in New Issue
Block a user