fix: ios player

This commit is contained in:
Rogee
2025-01-04 01:02:35 +08:00
parent 9df2663b6e
commit 019297d261
6 changed files with 131 additions and 64 deletions

View File

@@ -82,7 +82,6 @@ func (c *Controller) MediaIndex(ctx fiber.Ctx) error {
if claim == nil {
return errorx.RequestUnAuthorized
}
// c.Locals(consts.CtxKeyJwt, token)
token := fiber.Locals[string](ctx, consts.CtxKeyJwt)
model, err := c.svc.GetMediaByHash(ctx.Context(), claim.TenantID, hash)
@@ -103,6 +102,7 @@ func (c *Controller) MediaIndex(ctx fiber.Ctx) error {
return err
}
ctx.Set("Content-Type", "application/vnd.apple.mpegurl")
return ctx.SendString(playlist.String())
}
@@ -133,6 +133,7 @@ func (c *Controller) MediaSegment(ctx fiber.Ctx) error {
}
filepath := c.svc.GetSegmentPath(ctx.Context(), mediaType, model.TenantID, model.Hash, segments[0])
ctx.Set("Content-Type", "video/mp2t")
return ctx.SendFile(filepath)
}