简体   繁体   English

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

[英]Video File streaming not working on Safari/ iOS device in asp.NET Core 2.0

I have created the API in asp.net core 2.0 that returns the video file streaming Result.我在 asp.net core 2.0 中创建了返回视频文件流结果的 API。 Below is the code sample for returning the filestream result.下面是返回文件流结果的代码示例。 The URL is working fine on Chrome but the URL will not work on iOS device and Safari browser.该 URL 在 Chrome 上运行良好,但该 URL 在 iOS 设备和 Safari 浏览器上不起作用。

How to implement the range request / response in asp.net core 2.0?如何在asp.net core 2.0 中实现范围请求/响应?

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

return new FileStreamResult(fileStream, this.GetContentType(request.FileName));

What iOS considered to be is stream range and content-length header iOS 考虑的是流范围和内容长度标头

In dotnet Core 2.1 was added support for Ranges在 dotnet Core 2.1 中添加了对 Ranges 的支持

Use File constructor with enableRangeProcessing将文件构造函数与 enableRangeProcessing 结合使用

 return File(fileStream, this.GetContentType(request.FileName), true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM