mirror of
https://github.com/snowlyg/GoEasyFfmpeg
synced 2026-04-22 22:57:07 +08:00
增加 hls.js
This commit is contained in:
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user