Embedding Windows Media Player

Windows media player (7.0 and higher) code (For IE and Firefox)


<object
id=”MediaPlayer” width=”300″ height=”300″
classid=”CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6″
standby=”Loading Microsoft Windows Media Player components…”
type=”application/x-oleobject”>
<param name=”Url” value=”../../download/html/logo.avi”>
<param name=”AutoSize” value=”true”>
<param name=”AutoStart” value=”true”>
<param name=”Balance” value=”0″>
<param name=”DisplaySize” value=”0″>
<param name=”Mute” value=”false”>
<param name=”PlayCount” value=”0″>
<param name=”Rate” value=”1.0″>
<param name=”ShowAudioControls” value=”true”>
<param name=”ShowControls” value=”true”>
<param name=”ShowDisplay” value=”true”>
<param name=”ShowStatusBar” value=”true”>
<param name=”ShowTracker” value=”true”>
<param name=”StretchToFit” value=”false”>
<param name=”TransparentAtStart” value=”false”>
<param name=”Volume” value=”100″>
<embed type=”application/x-mplayer2″
name=”mediaplayer”
pluginspage=”http://www.microsoft.com/Windows/MediaPlayer”
src=”../../download/html/logo.avi”
Height=”300″
Width=”300″
AutoSize=”1″
AutoStart=”1″
Balance=”0″
DisplaySize=”0″
Mute=”0″
PlayCount=”0″
Rate=”1.0″
ShowAudioControls=”1″
ShowControls=”1″
ShowDisplay=”1″
ShowStatusBar=”1″
ShowTracker=”1″
StretchToFit=”0″
TransparentAtStart=”0″>
Volume=”100″
</embed>
</object>

Windows media player (6.4) code


<object
id=”MediaPlayer” width=”300″ height=”300″
classid=”CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95″
codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#
Version=6,4,5,715
standby=”Loading Microsoft Windows Media Player components…”
type=”application/x-oleobject”>
<param name=”FileName” value=”../../download/html/logo.avi”>
<param name=”AutoSize” value=”true”>
<param name=”AutoStart” value=”true”>
<param name=”Balance” value=”0″>
<param name=”DisplaySize” value=”0″>
<param name=”Mute” value=”false”>
<param name=”PlayCount” value=”0″>
<param name=”Rate” value=”1.0″>
<param name=”ShowAudioControls” value=”true”>
<param name=”ShowControls” value=”true”>
<param name=”ShowDisplay” value=”true”>
<param name=”ShowStatusBar” value=”true”>
<param name=”ShowTracker” value=”true”>
<param name=”StretchToFit” value=”false”>
<param name=”TransparentAtStart” value=”false”>
<param name=”Volume” value=”100″>
<embed type=”application/x-mplayer2″
name=”mediaplayer”
pluginspage=”http://www.microsoft.com/Windows/MediaPlayer”
src=”../../download/html/logo.avi”
Height=”300″
Width=”300″
AutoSize=”1″
AutoStart=”1″
Balance=”0″
DisplaySize=”0″
Mute=”0″
PlayCount=”0″
Rate=”1.0″
ShowAudioControls=”1″
ShowControls=”1″
ShowDisplay=”1″
ShowStatusBar=”1″
ShowTracker=”1″
StretchToFit=”0″
TransparentAtStart=”0″>
Volume=”100″
</embed>
</object>

Parameters

Name Type Description
AutoSize Boolean This property specifies or retrieves a value indicating whether the Windows Media Player control automatically resizes to accommodate the current media item at the size specified by the DisplaySize property.
AutoStart Boolean If this value is set to true/1, the video will begin playback as soon as it has buffered. Otherwise it will wait for the user to press Play.
Balance Integer Controls the left/right stereo balance of any audio. -10000 is 100% left speaker, 10000 is 100% right speaker, and 0 is perfectly balanced.
DisplaySize Integer This property specifies or retrieves a value indicating whether the Windows Media Player control automatically resizes to accommodate the current media item at the size specified by the DisplaySize property.

  • 0 – Same size as the source image.
  • 1 – Width and height are one-half of the source image dimensions, resulting in an image that is one-fourth the original size.
  • 2 – Double the dimensions of the source image.
  • 3 – Size of the entire screen.
  • 4 – Size specified at design time.
  • 5 – One-sixteenth the size of the screen.
  • 6 – One-quarter the size of the screen.
  • 7 – Half the size of the screen.
FileName/Url/src String The URL of the file to play.
Height Integer Defines the height of the displayed object in pixels.
Mute Boolean If Mute is enabled (true/1), the sound is disabled. The volume parameter is ignored.
PlayCount Integer Controls the number of times the file is played. A value of 0 repeats forever. Default is one.
Rate Double This property acts as a multiplier value that allows you to play a clip at a faster or slower rate. The default value of 1.0 indicates the authored speed. Note that an audio track becomes difficult to understand at rates lower than 0.5 or higher than 1.5. A playback rate of 2 equates to twice the normal playback speed.
ShowAudioControls Boolean If this value is set to true/1, the audio controls will be shown.
ShowControls Integer If this value is set to true/1, the video transport controls will be shown (play, stop, pause, etc). If it is set to false/0, the controls will not be shown and the user will not be able to control playback at all. Obviously, in this case you would need to have autostart enabled or there will be no way to play the video.

Height: 46 pixels

ShowDisplay Boolean When set to true/1, this displays information such as the the title and artist of the clip.

Height: 74 pixels

ShowStatusBar Boolean If this value is set to true/1, the status bar is shown. This includes the buffering progress and playback status of the clip. Showing the status bar is a good idea as it shows the user how long they have to wait before the clip will be ready for playback

Height: 26 pixels

ShowTracker Boolean If this value is set to true/1, the tracker is shown.
StetchToFit Boolean The stretchToFit property specifies or retrieves a value indicating whether video displayed by the Windows Media Player control automatically sizes to fit the video window, when the video window is larger than the dimensions of the video image.
TransparentAtStart Boolean Specifies whether to make the player transparent at the start of the play. Default is false.
Volume Integer (-3400 till 0) Sets the audio volume (Loud=0)
Width Integer Defines the width of the embedded object in pixels.

mediaplayer

Note 1:
Use true or false for the <object> tag, 1 or 0 for the <embed> tag.

Note 2:
Windows Media Player 6, clsid:05589FA1-C356-11CE-BF01-00AA0055595A
Windows Media Player 6.4, clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95
Windows Media Player 7, 9 and 10, clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6

Note 3:
The <embed> tag is not approved by W3C. However you need this tag to make the code work for the Firefox browser.

 

You may also like...