Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Returning a mp3 file trough File Action results, stops after being played for 10 minutes

$
0
0

I have an action that returns mp3 file as below : 

                var memory = new MemoryStream();
                using (var stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    await stream.CopyToAsync(memory);
                }
                memory.Position = 0;

                //Response.Headers.Add("Accept-Ranges", "bytes");
                //Response.Headers.Add("Connection", "keep-alive");

                return File(memory, "audio/mpeg", $"music.mp3", true);

So the is partial content. After 10 minutes of playing the mp3 file by calling my action, the player stops. I saw that html default player has logged following error in the browser console :

" net::ERR_CONNECTION_RESET 206 (Partial Content)"

What would be the reason ? 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>