Skip to content

Commit

Permalink
changed path name
Browse files Browse the repository at this point in the history
  • Loading branch information
TimIsOverpowered committed Jul 29, 2024
1 parent a347401 commit 301e553
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
type Stream struct {
Created_at string `json:"createdAt"`
User struct {
Username string `json:"username"`
Username string `json:"username"`
StreamKey string `json:"stream_key"`
} `json:"user"`
Ingest struct {
Server string `json:"server"`
Expand Down
4 changes: 3 additions & 1 deletion server/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func Initalize() {
}

fullEndUrl := strings.Replace(c.Param("endUrl"), "index", "stream", 1) + "?" + c.Request.URL.Query().Encode()
mediamtxEndUrl := "https://" + utils.Config.IngestAPI.Username + ":" + utils.Config.IngestAPI.Password + "@" + streamData.Ingest.Server + ".angelthump.com/hls/live/" + streamData.User.Username + "/" + fullEndUrl
mediamtxEndUrl := "https://" + utils.Config.IngestAPI.Username + ":" + utils.Config.IngestAPI.Password + "@" + streamData.Ingest.Server + ".angelthump.com/hls/live/" + streamData.User.StreamKey + "/" + fullEndUrl

restyClient := resty.New()
resp, _ := restyClient.R().
Expand All @@ -147,6 +147,7 @@ func Initalize() {
client.Rdb.Set(client.Ctx, key, resp.Body(), 20*time.Second)
c.Data(200, "video/mp2t", []byte(resp.Body()))
} else if strings.HasSuffix(endUrl, "init.mp4") {
client.Rdb.Set(client.Ctx, key, resp.Body(), 24*time.Hour)
c.Data(200, "video/mp4", []byte(resp.Body()))
} else if strings.HasSuffix(endUrl, ".mp4") {
client.Rdb.Set(client.Ctx, key, resp.Body(), 20*time.Second)
Expand All @@ -155,6 +156,7 @@ func Initalize() {
client.Rdb.Set(client.Ctx, key, resp.Body(), 20*time.Second)
c.Data(200, "video/mp4", []byte(resp.Body()))
} else if strings.HasSuffix(endUrl, ".m3u8") {
client.Rdb.Set(client.Ctx, key, resp.Body(), 1*time.Second)
c.Data(200, "application/x-mpegURL", []byte(resp.Body()))
} else {
c.AbortWithStatus(400)
Expand Down

0 comments on commit 301e553

Please sign in to comment.