ComunicRTCProxy/callconfig.go

36 lines
722 B
Go
Raw Normal View History

2020-04-10 08:38:21 +00:00
/// Call configuration
///
/// This files handles dynamic call configuration
///
/// @author Pierre HUBERT
package main
import (
"github.com/pion/webrtc/v2"
)
type callConfig struct {
iceServers []webrtc.ICEServer
2020-04-12 15:36:27 +00:00
allowVideo bool
2020-04-10 08:38:21 +00:00
}
// This configuration is intialized as soon as
// websocket connection is made
var callConf = callConfig{}
/// Load configuration
func setCallConfig(data map[string]interface{}) {
// Process ice servers
servers := data["iceServers"].([]interface{})
for _, server := range servers {
callConf.iceServers = append(callConf.iceServers, webrtc.ICEServer{
URLs: []string{server.(string)},
})
}
2020-04-12 15:36:27 +00:00
// Update allow video status
callConf.allowVideo = data["allowVideo"].(bool)
2020-04-10 08:38:21 +00:00
}