fix: video and audio can't play on safari (#980)

* fix: video can't play on safari

* fix: audio can't play on safari
pull/982/head
Wujiao233 2 years ago committed by GitHub
parent 942e1f887b
commit 0aaf153717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -274,6 +274,10 @@ func (s *Server) registerResourcePublicRoutes(g *echo.Group) {
}
c.Response().Writer.Header().Set(echo.HeaderCacheControl, "max-age=31536000, immutable")
c.Response().Writer.Header().Set(echo.HeaderContentSecurityPolicy, "default-src 'self'")
if strings.HasPrefix(resourceType, "video") || strings.HasPrefix(resourceType, "audio") {
http.ServeContent(c.Response(), c.Request(), resource.Filename, time.Unix(resource.UpdatedTs, 0), bytes.NewReader(resource.Blob))
return nil
}
return c.Stream(http.StatusOK, resourceType, bytes.NewReader(resource.Blob))
})
}

Loading…
Cancel
Save