Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:30:36+00:00 2026-05-28T16:30:36+00:00

I am trying to stream a file using the audio HTML5 tag. I have

  • 0

I am trying to stream a file using the audio HTML5 tag. I have put the Controller action to return a FileStream and attached it to the src for the audio. However, the content is not loading into the audio tag and doesn’t play when I press the default play button. I know the controller is working when I access the src directly. However, it doesn’t work in the HTML5 audio tag.

Can anyone tell me what I am missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:30:37+00:00Added an answer on May 28, 2026 at 4:30 pm

    You should not return a FileStream, you should return a FileStreamResult or a FilePathResult from your controller action, like this:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        public ActionResult MyAudio()
        {
            var file = Server.MapPath("~/app_data/test.mp3");
            return File(file, "audio/mp3");
        }
    }
    

    and the ~/Views/Home/Index.cshtml view:

    @{
        Layout = null;
    }
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Sound Sample</title>
    </head>
    <body>
        <article class="audio">
            <header>
                <h2>Some audio</h2>
            </header>
    
            <audio controls>
                <source src="@Url.Action("myaudio")" type="audio/mp3" />
                <p>Your browser does not support HTML 5 audio element</p>
            </audio>
        </article>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read data from a file stream as shown below: fileStream.Read(byteArray,
I'm trying to stream sound from my soundcard using sox's default audio device and
I'm trying to send a file using ftp. I have the following code: string
I'm trying to stream an audio file from a server protected by session-based authentication,
I am trying to play an audio file in silverlight using WCF, language C#,
I am trying to go line by line through text file using stream reader,
I'm trying to stream 1.5-4 hour audio files from a URL. I have my
I am trying to stream a remote mp3 using AVPlayer. I have set up
I am trying to stream files from a zip file using ZipEntry class in
I am currently trying to stream a .mp4 file on an iPad using FlowPlayer.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.