You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
531 B

2 years ago
package ffmpeg
import (
"ycmediakit/internal/pkg/server/ffmpegServer"
"ycmediakit/internal/pkg/unit/result"
2 years ago
"github.com/gin-gonic/gin"
)
func ProbeStream(c *gin.Context) {
target := c.Query("target")
target, ok := ffmpegServer.PrepareUrl(target)
if !ok {
result.InvalidParams.WithVoidData().Failure(c)
return
}
jsonStr, err := ffmpegServer.ProbeStreamsWithTimeout(target, cfg.Timeout)
if err != nil {
result.Wrong.WithVoidData().WithMsg(err.Error()).Error(c)
return
}
result.Ok.WithData(jsonStr).Success(c)
}