增加 hls.js

This commit is contained in:
snowlyg
2020-09-14 10:13:18 +08:00
parent 7b8dc93135
commit 2f18e1bf01
2 changed files with 6 additions and 24 deletions
+5 -1
View File
@@ -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 ""
+1 -23
View File
@@ -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
}