1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-30 07:41:09 +02:00

Use messaging in web package

This commit is contained in:
Alexandre Iooss
2020-10-17 12:38:18 +02:00
parent 68d4ad8aee
commit b8ee60ce9f
3 changed files with 28 additions and 14 deletions

View File

@ -11,6 +11,7 @@ import (
"github.com/markbates/pkger"
"github.com/pion/webrtc/v3"
"gitlab.crans.org/nounous/ghostream/stream"
)
// Options holds web package configuration
@ -41,6 +42,9 @@ var (
// Preload templates
templates *template.Template
// Streams to get statistics
streams map[string]stream.Stream
)
// Load templates with pkger
@ -74,10 +78,11 @@ func loadTemplates() error {
}
// Serve HTTP server
func Serve(rSdpChan chan struct {
func Serve(s map[string]stream.Stream, rSdpChan chan struct {
StreamID string
RemoteDescription webrtc.SessionDescription
}, lSdpChan chan webrtc.SessionDescription, c *Options) {
streams = s
remoteSdpChan = rSdpChan
localSdpChan = lSdpChan
cfg = c