Results 1 to 2 of 2

Thread: Show audio and vedio on website

  1. #1
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Show audio and vedio on website

    Hi,

    I a newbie in creating website, although I am a java guy.
    I am creating a website for showcasing the audio and vedio clips of a singer.
    I have done research on internet since few days but not able to come up with the way to show the audio on the website. Few of the things I have found which is not working on all browsers and all operating systems:

    1. embed tag:
    <embed src="music.mp3" height="45" width="170"
    type="audio/mpeg" autostart="0" loop="0" controlbar="true"></embed>

    or

    HTML Code:
    <OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
    
    CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701" STANDBY="Loading 
    
    Microsoft Windows® Media Player components..." TYPE="application/x-oleobject" width="280" height="46">
    <param name="fileName" value="music.m3u">
    <param name="animationatStart" value="true">
    <param name="transparentatStart" value="true">
    <param name="autoStart" value="true">
    <param name="showControls" value="true">
    <param name="Volume" value="-300">
    <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="music.m3u" 
    
    name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1 volume=-300>
    </OBJECT>

    Above two ways of code shows the music controller on IE but not in Mozilla Firefox, it just shows a black colored rectangle box. How can I make this work in all browsers and on all operating systems.
    2. This code:
    HTML Code:
    <html>
    <script language="JavaScript" type="text/javascript">
    
    function setEmbed(ID) {
        var element = document.getElementById(ID);
        document.write("hello");
        element.innerHTML = '<embed src="'ID+'.m3u" autostart="0" loop="0" height="45" width="170"  ></embed>';
    }
    
    function getMimeType(){
        var mimeType = "application/x-mplayer2"; //default
        var agt=navigator.userAgent.toLowerCase();    
        if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
            //non-IE, no-Windows
              var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
              if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
        }//end no-Windows
    return mimeType
    }//end function getMimeType
    
    
    </script>
    <body onload="setEmbed('sample')"> 
    
    <span id="sample">Finding plugin...</span>  
    
    </body>
    </html>
    This code is not working. But on a certain website it was written that on some browsers this works.

    I want a way through which I can show audio on the website so that the user can listen, play, stop, pause the audio.

    -
    Regards,
    Carox
    Last edited by Carox; 11-17-2010 at 02:05 PM.

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    http://www.dynamicdrive.com/forums/s...868#post203868

    I like this player from a previous post. It plays music as well as video (it can even be used as a slideshow for jpegs)

    Go to the main website for the latest major update though. http://www.longtailvideo.com/players/jw-flv-player/
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •