简体   繁体   中英

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. 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));

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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