c# - 如何在 ASP.NET MVC HTML 音频播放器中播放大文件 500Мb?
问题描述
我尝试了这些方法来解决这个问题。
返回文件的路径;
[HttpGet] public ActionResult GetTrackById(Guid id) { string fileNameOnServer = GetFile(id); return File(fileNameOnServer , Response.ContentType); }
返回字节数组
[HttpGet] public ActionResult GetTrackById(Guid id) { byte[] bufferToSend = GetFile(id); return File(bufferToSend, Response.ContentType); }
在这种情况下,我得到 OutOfMemoryException。
返回流
[HttpGet] public ActionResult GetTrackById(Guid id) { Stream stream = GetFile(id); return File(stream , Response.ContentType); }
所以问题是,如何分部播放音频文件,并让音频播放器发送文件播放和加载的范围请求。我在谷歌上没有找到任何有用的东西。
解决方案
推荐阅读
- c# - 批量插入时ADO.net服务器超时,如何改进?
- amazon-web-services - 爬虫如何比直接连接到数据库和检索数据好得多?
- javascript - 为什么我的删除事件侦听器不起作用?
- javascript - 在功能组件中使用外部 js 库
- jooq - 使用 MDC 的 JOOQ 日志
- node.js - node.js 函数返回 Promise {
}, 为什么? - r - 在 dplyr 中对特定范围的列名进行排序
- android - Android 应用程序仅在 Redmi Note 3、Note4 中因 ClassNotFoundException 而崩溃
- teamcity - 未设置 Teamcity 默认系统属性
- go - 如何使用 Golang 在控制台中更新多行