视频文件流在asp.NET Core 2.0中的Safari / iOS设备上不起作用

问题描述 投票:2回答:1

我已经在asp.net core 2.0中创建了API,该API返回视频文件流结果。以下是用于返回文件流结果的代码示例。该网址在Chrome上正常运行,但在iOS设备和Safari浏览器上不起作用。

如何在asp.net core 2.0中实现范围请求/响应?

var fileStream = await this.amazonS3Service.Open(
               request.FileName,
               path,
               cancellationToken);

return new FileStreamResult(fileStream, this.GetContentType(request.FileName));
c# asp.net asp.net-core-2.0
1个回答
0
投票

iOS认为是流范围和内容长度标头

在dotnet Core 2.1中添加了对范围的支持

将文件构造函数与enableRangeProcessing一起使用

 return File(fileStream, this.GetContentType(request.FileName), true);
© www.soinside.com 2019 - 2024. All rights reserved.