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

情到浓时终转凉″ 提交于 2021-01-27 17:35:43

问题


I have created the API in asp.net core 2.0 that returns the video file streaming Result. 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.

How to implement the range request / response in asp.net core 2.0?

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

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

回答1:


What iOS considered to be is stream range and content-length header

In dotnet Core 2.1 was added support for Ranges

Use File constructor with enableRangeProcessing

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


来源:https://stackoverflow.com/questions/51632656/video-file-streaming-not-working-on-safari-ios-device-in-asp-net-core-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!