diff --git a/extend/utils/http.go b/extend/utils/http.go index 9b15aeb..4708118 100644 --- a/extend/utils/http.go +++ b/extend/utils/http.go @@ -71,6 +71,7 @@ func getServerType() string { func GetOutPutUrl(roomName, transType, customPath string) string { outputIp := Conf().Section("rtsp").Key("out_put_ip").MustString("localhost") + httpPort := Conf().Section("http").Key("port").MustInt(10008) url := fmt.Sprintf("rtsp://%s:8554/%v", outputIp, roomName) if getServerType() == "flv" { if transType == "RTMP" { @@ -85,7 +86,10 @@ func GetOutPutUrl(roomName, transType, customPath string) string { url = fmt.Sprintf("rtsp://%s:8554/%v", outputIp, roomName) return url } else if getServerType() == "hls" { - url = "http://" + path.Join(fmt.Sprintf("%s:10008/record", outputIp), customPath, fmt.Sprintf("out.m3u8")) + if !strings.Contains(".com", outputIp) { + outputIp = fmt.Sprintf(fmt.Sprintf("%s:%d", outputIp, httpPort)) + } + url = "http://" + path.Join(fmt.Sprintf("%s/record", outputIp), customPath, fmt.Sprintf("out.m3u8")) return url } else { return "" diff --git a/routers/routers.go b/routers/routers.go index abcdaac..8c60930 100644 --- a/routers/routers.go +++ b/routers/routers.go @@ -2,15 +2,11 @@ package routers import ( "fmt" - "html/template" - "io/ioutil" + "github.com/snowlyg/GoEasyFfmpeg/extend/db" "log" "mime" "net/http" "path/filepath" - "strings" - - "github.com/snowlyg/GoEasyFfmpeg/extend/db" "github.com/gin-contrib/pprof" "github.com/gin-contrib/static" @@ -172,21 +168,3 @@ func Init() (err error) { return } - -func loadTemplate() (*template.Template, error) { - t := template.New("") - for name, file := range Assets.Files { - if file.IsDir() || !strings.HasSuffix(name, ".html") { - continue - } - h, err := ioutil.ReadAll(file) - if err != nil { - return nil, err - } - t, err = t.New(name).Parse(string(h)) - if err != nil { - return nil, err - } - } - return t, nil -}