Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

js to add sound in html page

HTML

  • Please log in to reply
1 reply to this topic

#1 edwin namisi

edwin namisi

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 19 April 2010 - 01:06 AM

help me write a java script code to add sound file in html page and another to add video file in html page
  • 0

#2 technica

technica

    CC Regular

  • Just Joined
  • PipPipPip
  • 43 posts

Posted 19 April 2010 - 02:15 AM

Adding video file is simple. You will need to use <object> tag in HTML for embedding video file.


<object id="MediaPlayer" width="320" height="240" classid="Class ID Value" standby="Loading Windows Media Player components..." type="application/x-oleobject">
                    <param name="FileName" value="Your Video File Path">
                    <param name="uiMode" value="none" />
                    <param name="stretchToFit" value="0" />
                    <param name="windowlessVideo" value="0" />
                    <param name="enabled" value="-1" />
                    <param name="enableContextMenu" value="0" />
                    <param name="currentPosition" value="50" />
                    <param name="ShowControls" value="true">
                    <param name="ShowDisplay" value="false">
                    <param name="autostart" value="true">
                <embed type="application/x-mplayer2" src="Your Video File Path" name="MediaPlayer" width="320" height="240" showcontrols="1" showstatusbar="1" showdisplay="0" autostart="0"></embed>
                </object>



For audio file you have to use similar HTML tag and set its autoplay property to "true", so that the audio start playing when the page loads.

Hope this helps you.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download