I am using .net core 3.1 in order to stream an audio file.
The code works 100%, but I am trying to disable the download button.
Here is my controller code:
Public IActionResult Play(int id)
{
var recording = _recordingRepository.PlayRecording(id);
var path = recording.FilePath + "\\" + recording.FileName; ;
if (recording.NewFilePath != null)
path = recording.NewFilePath + "\\" + recording.FileName;
var fs = new FileStream(path, FileMode.Open, FileAccess.Read);
return new FileStreamResult(fs, "audio/mp3")
{
EnableRangeProcessing = true,
};
}
My view has no code. The return of FileStreamResult from the controller automatically creates the video control player. I know this because the browser inspect tool shows that.
Here is what the code looks in the browser when I inspect the player control
<video controls="" autoplay="" name="media"><source src="https://localhost:44330/Player/Play/14837" type="audio/mp3"></video>
I have tried to disable the download feature using javascript, css, nothing works.
Does anyone know how to disable the download feature.
