Block download in an audio streaming

0

I have an MVC Web application in which it picks up an audio stream according to the received parameters:

public new ActionResult File(string q, string url)
    {
        try
        {
            var query = new GetFileQuery()
            {
                q = q.Substring(0, 8),
                sequencial = q.Substring(8),
                path = url
            };

            if (query.q == query.Hash1)
            {
                string contentType = MimeMapping.GetMimeMapping(query.fileName);

                var cd = new System.Net.Mime.ContentDisposition
                {
                    FileName = query.fileName,
                    Inline = true,
                };

                Response.AppendHeader("Content-Disposition", cd.ToString());

                query.ConvertWavMP3(query.path);

                 File(
                    query.fileBytes
                    , contentType);

            }
        }
        catch (Exception e)
        {

        }
        return View("Index");
    }

But I need this audio to be only for viewing without the download option and it is in an audio tag , as I call that file in the tag and block the option of download?

    
asked by anonymous 04.07.2018 / 18:43

1 answer

1

To remove the audio tag download option you can use controlsList="nodownload" see documentation . But that does not guarantee that the download will be done.

<div id="player">
  <audio id="audio" src="https://upload.wikimedia.org/wikipedia/commons/8/8f/Fur_Elise.ogg"controlscontrolsList="nodownload"></audio>
</div>
    
04.07.2018 / 19:06