Jump to content

js to add sound in html page

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
edwin namisi

edwin namisi

    Newbie

  • Members
  • Pip
  • 6 posts
help me write a java script code to add sound file in html page and another to add video file in html page

#2
technica

technica

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts
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.