How To Play audio file in

Posted on 2014-07-13
Last Modified: 2014-08-03
Dear EE,

i have uploaded some audio files to my site with extension ".WMA"

i want when the user click a button to play the audio file , to open a small popup windows and display the windows media players inside it and play the sound

Question by:Kamal Khaleefa
    LVL 14

    Accepted Solution

    I'd recommend mp3 over WMA since it's more cross platform compatible. That being said, check out for embedding audio files.

    In case that site goes down, the summary is:

    The example below shows the code for embedding a Windows Media file. Note that it uses two tags: <object> and <embed>. This is to enable maximum browser compatibility.You will need to set the file name (and other attributes if required) for both tags. Use true or false for the <object> tag, 1 or 0 for the <embed> tag.

    Code for HTML5:

    <object id="MediaPlayer" width="192" height="190" type="video/x-ms-asf">
    <param name="FileName"value="videofilename.wmv">
    <param name="autostart" value="false">
    <param name="ShowControls" value="true">
    <param name="ShowStatusBar" value="false">
    <param name="ShowDisplay" value="false">
    <embed type="application/x-mplayer2" src="videofilename.wmv"
    width="192" height="190" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0" />
    Code for HTML 4.01:

    <OBJECT ID="MediaPlayer" WIDTH="192" HEIGHT="190" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
    <PARAM NAME="FileName" VALUE="videofilename.wmv">
    <PARAM name="autostart" VALUE="false">
    <PARAM name="ShowControls" VALUE="true">
    <param name="ShowStatusBar" value="false">
    <PARAM name="ShowDisplay" VALUE="false">
    <EMBED TYPE="application/x-mplayer2" SRC="videofilename.wmv" NAME="MediaPlayer"
    WIDTH="192" HEIGHT="190" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>
    To get started, all you have to do is copy the code above into your web page and replace videofilename.wmv with your own file name.
    LVL 52

    Assisted Solution

    by:Scott Fell, EE MVE
    This is really a front end thing and not .NET.

    The audio tag can be easily used and is available on modern browsers (ie9+)
    <!-- Simple audio playback -->
    <audio src="" autoplay>
      Your browser does not support the <code>audio</code> element.
    <!-- Audio playback with captions -->
    <audio src="foo.ogg">
      <track kind="captions" src="foo.en.vtt" srclang="en" label="English">
      <track kind="captions" src="" srclang="sv" label="Svenska">

    Open in new window

    There are js projects like or you can use video projects for audio only  With flowplayer you can fall back to flash if you want to support ie8 and  below and there is an html5 player as well.  No need to support ie8 anymore in my opinion.
    LVL 16

    Author Closing Comment

    by:Kamal Khaleefa
    Thank u all

    what i did that i convert all the wma files i have to mp3 and then use the code


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now