fix: play segments

This commit is contained in:
Rogee
2024-12-28 16:05:25 +08:00
parent dae2941168
commit cee14cb3fd
5 changed files with 22 additions and 22 deletions

View File

@@ -83,6 +83,8 @@ func (c *Controller) MediaIndex(ctx fiber.Ctx) error {
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)
if err != nil {
log.WithField("action", "medias.MediaIndex").WithError(err).Error("GetMediaByHash")
@@ -95,7 +97,7 @@ func (c *Controller) MediaIndex(ctx fiber.Ctx) error {
return err
}
playlist, err := c.svc.GetM3U8(ctx.Context(), claim.TenantID, mediaType, model.Hash, bought)
playlist, err := c.svc.GetM3U8(ctx.Context(), claim.TenantID, mediaType, model.Hash, bought, token)
if err != nil {
log.WithField("action", "medias.MediaIndex").WithError(err).Error("GetMediaPlaylist")
return err