Geekpedia Programming Tutorials






Embedding Windows Media Player into a web page

How to include the Windows Media Player plugin into your webpage so that you can play WMV or other video files. It also contains a list of the most popular attributes and parameters to pass to this plugin.

On Wednesday, December 7th 2005 at 09:36 AM
By Andrei Pociu (View Profile)
*****   (Rated 4.6 with 81 votes)
Contextual Ads
More HTML Resources
Advertisement
You probably saw many websites that include an embeded video player in their pages, such as the one in the images below.
Most of the time, the embedded video player is Windows Media Player, and in this tutorial I'll show you how you can embed Windows Media Player into a webpage.



Embedding Windows Media Player and playing a video


Open the HTML page in which you want the player embedded and place the following tag within the <body></body> tag where you want it displayed:





<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="mediaplayer1" ShowStatusBar="true" EnableContextMenu="false" autostart="false" width="320" height="240" loop="false" src="MyVideo.wmv" />




Be sure to have a video file named MyVideo.wmv in the same directory with the HTML file, or simply change the src attribute to point to the path of a real video file.



Most of the attributes of the <embed> tag are obvious, still it won't hurt to review them:



Windows Media Player Embedded
type - the type attribute defines the type of embeded object you'd like to use. This tag is mandatory for Windows Media Player to be emdedded in the web page.

pluginspage - in case the Windows Media Player plugin cannot be found on the visitor's computer, this link will point him to more information regarding this player.

name - this attribute assigns a name to this embeded object; this will allow you to access multiple embedded objects differently.

ShowStatusBar - wether the statusbar is shown or not, the statusbar being the black bar at the bottom which displays various information such as the name of the clip, elapsed time and total time.

EnableContextMenu
- if this attribute is set to true, the user will be able to access Window Media Player's context menu by right clicking the embedded player.

autostart - defines wether or not the video should start playing automatically when the page is loaded.

width and height - defines the size in pixels of the Windows Media Player embedded window. If you want the visitors to see the video at its original resolution, you should define the same size as the one of the video, but also keep in mind the controls of the embedded window (such as the statusbar) which are counted in this defined width and height. One better way of displaying the video at its original resolution is to omit the width and height attributes.

loop - set this attribute to true if you would like the video to continue looping, or to false if you want it to stop once it has ended.

src - the src attribute is mandatory since it defines the path to the file you want to play.



Ok, this was the quick and dirty way of embedding Windows Media Player plugin into a webpage, but there's more than this. If you want to specify more preferences such as the volume, the balance or the playback rate, use the following tags:






<OBJECT id="VIDEO" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" width="320" height="240">

   <PARAM NAME="URL" VALUE="MyVideo.wmv">

   <PARAM NAME="enabled" VALUE="True">

   <PARAM NAME="AutoStart" VALUE="False">

   <PARAM name="PlayCount" value="3">

   <PARAM name="Volume" value="50">

   <PARAM NAME="balance" VALUE="0">

   <PARAM NAME="Rate" VALUE="1.0">

   <PARAM NAME="Mute" VALUE="False">

   <PARAM NAME="fullScreen" VALUE="False">

   <PARAM name="uiMode" value="full">

</OBJECT>




The CLASSID attribute of the <object> tag contains the class ID for Windows Media Player versions 7, 9 and 10. The width and height attribute specify the size in pixels of the entire plugin.

The child tags define parameters for this object, just like the attributes did in our first example of embedding the WMP plugin. I haven't included all the parameters, only the most popular ones which you need:



Windows Media Player Embedded
URL - this is a mandatory attribute that specifies the path to the file you want to play

enabled - wether or not the player and its controls are enabled to the user.

AutoStart - if set to true, the video will start playing automatically after the page has finished loading.

PlayCount - how many times the video will loop.

Volume - defines the volume on a scale of 0 to 100.

balance - the speaker balance, the range is from -100 (left) to 0 (center) and to 100 (right).

Rate - the playback rate; 1.0 is the normal playback speed, 0.5 is half and 3 is three times the normal speed.

Mute - wether or not the sound is muted.

fullScreen - if set to True, the video will run in full-screen mode when it starts playing.

uiMode - the user interface for the plugin; possible values are: invisible, none, mini and full.



There is more to be said about embedding WMP in a web page. You can create your own user interface if you don't want the visitors to use the default one of WMP, that's why this tutorial will perhaps be continued.
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this tutorial
Comment Current Comments
by Nabeel Akhtar on Sunday, December 11th 2005 at 12:36 AM

Now Andrei ... this is nice... very helpful.. thanks

Nabeel
http://www.nabeelakhtar.net

by elavarasan on Friday, December 16th 2005 at 12:43 PM

excellent ....... this is very useful for me
thanks a lot

by vikram on Sunday, December 18th 2005 at 11:51 AM

Good tutorial for first timer

by Rizwan mirza on Friday, December 23rd 2005 at 01:15 AM

I need to start the clip in between so i need to define the start point and endpoint of clip in the param.. so can ne one please tell me what parameter should i set i n the object

<PARAM NAME="??????" VALUE="?????">

by Vu Quoc Viet on Tuesday, December 27th 2005 at 05:11 AM

It is a good tutorial.

However, what should I do if a user click on link of media file, then I will open a new windows to play that file? Thank you very much.

by ron on Monday, January 2nd 2006 at 11:32 PM

andrei, you said " I haven't included all the parameters, only the most popular ones which you need:"

could you please list the rest of the parameters (or tell me where i can find them) ? i know that you can adjust the brightness level on WMP... is there a parameter for brightness as well? thank you... and thanks for the article it was very helpful !

by Andrei Pociu on Tuesday, January 3rd 2006 at 03:19 AM

I'm afraid there is no parameter that allows you to specify the brightness level.
MSDN has a more complete list of parameters <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/paramtags.asp" target="_blank">here</a>.

For Rizwan: You can specify the start point in seconds from the beginning, using the <i>currentPosition</i> parameter.

by Patrick on Wednesday, January 4th 2006 at 06:50 AM

First of all, thank you for the tutorial. It was very helpful. I am wondering though if there is a way to have a wmp embedded in a HTML/DHTML/CSS only environment play a different song once one is finished. I was trying to use the player's ScriptCcommand and PlayStateChange events to then change the src attribute, but that does not seem to work, but I may be programming it incorrectly. Any ideas?

by Andrei Pociu on Wednesday, January 4th 2006 at 07:48 AM

Hi Patrick.
Have a look at this page: http://www.boutell.com/newfaq/creating/streaming.html

by lubos on Thursday, January 5th 2006 at 08:50 AM

hey this is very usefull but i want to use the media player for my radio broadcasting but it doesn't seem to work when everything is linked 2gether it still has no connexion to it!

plzzz help i ud appreciate that! thnx!

by Amit Dave on Friday, January 6th 2006 at 12:53 AM

Tahnk u very very much.
one of best tutorial for the begginer who wants to go ahead with some basic understanding to deal with.

still requires much more on this.

by Kris Strong on Friday, January 13th 2006 at 10:39 AM

When you embed a player onto a webpage, how can you get the controls to be black? I've seen it on other pages.

by Jim on Saturday, January 14th 2006 at 05:01 AM

After I embedded the play and set "loop" to true..... everything works perfect in EI but will not loop in FF
Please help,
Thank you Jim

by Andrei Pociu on Saturday, January 14th 2006 at 05:12 AM

Use the second method I showed in the tutorial (the one where param tags reside inside the object tag), and add the following param tag:

&lt;PARAM name=&quot;loop&quot; value=&quot;True&quot;&gt;

by Diane on Sunday, January 15th 2006 at 05:02 PM

Wow, this is the first time I got it to actually appear on my web page. I just can get a movie on it.
How do I do that step by step please. I know nothing about this. I have saved video slideshows from digital pictures that I have made movies out of. Please help

by Andrei Pociu on Sunday, January 15th 2006 at 05:08 PM

What format is your movie? Is it WMV?

by Diane on Sunday, January 15th 2006 at 05:11 PM

Well, I can play it with windows media player yes

by Diane on Sunday, January 15th 2006 at 05:15 PM

This is my website. I would like to show examples of a few movies for people to see.
www.memorytimeline.com

by Andrei Pociu on Sunday, January 15th 2006 at 05:17 PM

No matter which of the methods you try, make sure the movie file is in the same folder as the HTML file.

Then place the tag below in your HTML file, between the &lt;body&gt;&lt;/body&gt; tags, but remember to change the name of the file first from SampleName.wmv to whatever your file name is.

&lt;embed type=&quot;application/x-mplayer2&quot; pluginspage=&quot;http://www.microsoft.com/Windows/MediaPlayer/&quot; name=&quot;mediaplayer1&quot; ShowStatusBar=&quot;true&quot; EnableContextMenu=&quot;false&quot; autostart=&quot;false&quot; width=&quot;320&quot; height=&quot;240&quot; loop=&quot;false&quot; src=&quot;SampleName.wmv&quot; /&gt;

If it still doesn't work, let me know what browser you're using, and what does it happen when you press the play button?

Better yet, point me to the page where you tried to embed the Windows Media Player.

by Diane on Sunday, January 15th 2006 at 05:25 PM

ok, go to www.memorytimeline.com
as you can see, I have it on there but nothing else.
That stuff you told me is really really confusing. I will have to try and figure it out.

by Diane on Sunday, January 15th 2006 at 05:27 PM

wow, it takes up a lot of room also

by Andrei Pociu on Sunday, January 15th 2006 at 05:32 PM

Now rename the movie file to MyVideo.wmv and upload it to where you uploaded the Home.html file.
If you wish I can guide you through MSN Messenger (my id is andrei_pociu@hotmail.com), but I won't be available until tomorrow.

by Diane on Sunday, January 15th 2006 at 05:35 PM

it says movie file (mpeg)

by martin on Tuesday, January 24th 2006 at 05:38 AM

I have the player working BUT....

<param name="showControls" value="false">

shows all the controls.
How can I get only the volume button/slider to show?

by Andrei Pociu on Tuesday, January 24th 2006 at 08:11 AM

The volume slider should be visible. Please use the first tag listed in this tutorial and try again.

by Browser Ignoring my on Tuesday, January 24th 2006 at 09:53 PM

- I'm using the follwing code below to hide the video controls. They keep displaying in both Firefox and IE (latest versions). Is there something wrong with my syntax?


&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;div&gt;<br />
&lt;object width=&quot;320&quot; height=&quot;240&quot; border=&quot;0&quot; id=&quot;player&quot;&gt;<br />
&lt;param name=&quot;UIMode&quot; value=&quot;none&quot; /&gt;<br />
&lt;param name=&quot;URL&quot; value=&quot;bayless320.wmv&quot; /&gt;<br />
&lt;param name=&quot;autoStart&quot; value=&quot;true&quot; /&gt;<br />
&lt;embed width=&quot;320&quot; height=&quot;240&quot; src=&quot;bayless320.wmv&quot; bgcolor=&quot;#000000&quot; border=&quot;0&quot; pluginspage=&quot;http://windowsmedia.com/download/&quot;&gt;&lt;/embed&gt;<br />
&lt;/object&gt;<br />
&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;

by Andrei Pociu on Wednesday, January 25th 2006 at 04:39 AM

It doesn't work because you didn't include the CLASSID attribute of the object tag as I showed in the example.
Without the CLASSID, it embedes to an older version of WMP that doesn't support the "uiMode" tag.

Also, the embed tag shouldn't be located inside the ojbect tag, the embed tag is just a separate method of embedding the media player. Please read the tutorial more carefully.

by Abhishek on Friday, January 27th 2006 at 03:55 AM

Its Really Good One

by aviram on Sunday, February 5th 2006 at 07:43 AM

how can i control the WMP with javascript?

by joe on Thursday, February 9th 2006 at 02:26 AM

I dont want a forward, fast forward, backward buttons in a windows media player. I want that param objects!

by Frances on Saturday, February 11th 2006 at 09:26 PM

Can anyone help me with something? I do not want WMP to autostart when the page loads, but I would like to put in a default image to appear before the user clicks play. Can anyone help? The parameter TransparentAtStart does not seem to exist in WMP 10 as far as I can see from the SDK.

by Kristine on Thursday, February 16th 2006 at 01:51 AM

Is there anyone there can help me how to embed a full feature Window Media 10 with a choice of seclection buton from Video 1 to Video 10 and from Song 1 to Song 10 on a website? Thank you

by Frances on Friday, February 17th 2006 at 11:29 AM

Kristine, I'm still new to this myself, but if you haven't already, you should download the Windows Media Player SDK from the microsoft website. This comes with samples, where you can look at the javascript that you can use to control the player. Still stuck on my problem though (see above!) Andrei - please help!

by Ralph on Saturday, February 25th 2006 at 01:13 AM

How in the world? I have been trying to figure out how in the world to display the "first frame" of the video so that there is at least an image that people can see before they click play to know what they will be viewing. Most of the code I come across displays a blank or empty window the video only comes out when they hit play. How can I display the first frame of the video so that people will know what video they will be playing? Any help would be appreciated. Thanks!

by Andrei Pociu on Saturday, February 25th 2006 at 03:26 AM

Hello Frances, Ralph.

The only way to display the first frame I can think of, is to use Javascript to play the video for 1 second, and then to automatically pause, on page load. However, unless you also decrease the volume to 0, there will also be sound playing for that 1 second.
You can use JavaScript to control the embedded Windows Media Player object, such as: myPlayer.Play() and myPlayer.Pause().

by Gian Wilson on Saturday, February 25th 2006 at 08:10 PM

Hi Kristine,
Is your information stored in a database? Will the choice of videos change dynamically? Or is it fixed?

by Frances on Wednesday, March 1st 2006 at 01:16 PM

Dear Andrei

Thanks for your advice. I have solved my problem by setting uimode = "invisible". This means that the background image behind the player object shows through (I have set the background image in CSS).

When the user clicks play, I am using javascript to change the uimode = "none." This solves the problem perfectly, so Ralph - if you can capture an image from your video using print screen (and making it the right size etc), you can set this as the background image.

You can even manipulate this background image based on player state, but let me know if you need any more help on this.

Now I have another problem. I have set autostart = "false" so that the media does not play immediately. However in Firefox, it still opens the media ready for playing as soon as it opens. I really do not want it to do this! How can I stop Firefox from automatically opening the media?

Any help much appreciated
Frances

by Andrei Pociu on Wednesday, March 1st 2006 at 06:48 PM

Hello Frances,

Yes, I experienced the same problem with Firefox, lately. The solution is to use autostart="0" in the &lt;embed&gt; tag instead of autostart="false", which Firefox appears to ignore.
Let me know if that solves your problem, it worked for me.

Best regards,
Andrei

by Frances on Thursday, March 2nd 2006 at 07:36 AM

Hi Andrei

Thanks for the super-quick response. Unfortunately, I have tried this and it doesn't work either. The player automatically connects to the media and then stops, ready for play. Do you have any other ideas I could try?

Thanks very much
Frances

by Andrei Pociu on Thursday, March 2nd 2006 at 07:12 PM

Can you give me a link where I can see the player you embedded (you can send it through email)?
I'm afraid this is the way Firefox handles the WMP embedded object.

by Kristine on Saturday, March 4th 2006 at 04:53 AM

Gian Wilson, My infomation is stored on someone's database and the choice of videos will be auto-changed after finishing one and will run another for Window Media 10. Thank you for ur help.

by Ankur on Wednesday, March 8th 2006 at 07:56 AM

Hi Francis,

I am also facing the same problem. When I am trying to play the file through window media player in Firefox it is not playing the file. It shows "ready" and stops then.

Did you get the solution? If yes, can you help me.

Regards
Ankur

by ocertain on Wednesday, March 8th 2006 at 04:05 PM

Very nice. This method works well for simply streaming video media but I need a way to programmatically determine when the video has stopped. I'm using VB.net but can read C# or C++ code. I'm really struggling with this and hope you can shed a little light on this - giving me a little nudge in the right direction.

Thanks much.

by Andrei Pociu on Saturday, March 11th 2006 at 04:58 PM

This might be possible using JScript.
But first: why do you want to know when the video stopped? So you can start playing another video? Because if so, there is another way of doing that, similar to creating a playlist.

by Imbert on Thursday, March 16th 2006 at 11:22 AM

Does anyone know how to force the player to not cache? The file on the server is updated frequently, and I want the latest version to play whenever the play button is pressed. Right now, I have to close the browser just to empty wmp's cache of the file (pressing refresh on the browser won't do it). Any ideas?

Thanks muchly,
Imbert

by paul on Thursday, March 16th 2006 at 05:27 PM

add a dynamic random id to the url with a server side language e.g vid.wmv?r=46a5a5s

by Andrei Pociu on Thursday, March 16th 2006 at 06:52 PM

Hello Imbert,
Try adding the following tag inside &lt;head&gt;&lt;/head&gt;:

&lt;META HTTP-EQUIV=&quot;Pragma&quot; CONTENT=&quot;no-cache&quot;&gt;

by Abby on Sunday, March 19th 2006 at 01:46 AM

Just dropped in to thnk fr the script. Usin it on my site.

by tony on Monday, March 27th 2006 at 12:32 PM

I am trying to play a video file as soon as the page is loaded... If i browse to the video file via IIS (directory browsing) thus my url would be &quot;http://blah/blah/blah.mpeg&quot; the file does not start playing until it has been downloaded to the client machine. Although if i browse to the machine over the network it will play!?? src=&quot;//blah/blah/blah.mpeg&quot;</p>
<p>The reason is cause its over an internal network and so the user needs to be logged in to get the file.... </p>
<p>if you have any ideas let me know..... </p>
<p>&lt;OBJECT ID=&quot;MediaPlayer&quot; WIDTH=&quot;550&quot; HEIGHT=&quot;400&quot;<br />
CLASSID=&quot;CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95&quot;<br />
STANDBY=&quot;Loading Windows Media Player components...&quot; <br />
TYPE=&quot;application/x-oleobject&quot;<br />
CODEBASE=&quot;http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112&quot;&gt;</p>
<p> &lt;PARAM name=&quot;autoStart&quot; value=&quot;True&quot;&gt;<br />
&lt;PARAM name=&quot;filename&quot; value=&quot;&lt;*%= strFilePath %*&gt;&quot;&gt;<br />
&lt;PARAM NAME=&quot;transparentatStart&quot; VALUE=&quot;true&quot;&gt;<br />
&lt;PARAM NAME=&quot;showControls&quot; VALUE=&quot;true&quot;&gt;<br />
&lt;PARAM NAME=&quot;allowchangedisplaysize&quot; VALUE=&quot;true&quot;&gt;<br />
&lt;PARAM NAME=&quot;canseek&quot; VALUE=&quot;false&quot;&gt;<br />
&lt;PARAM NAME=&quot;canscan&quot; VALUE=&quot;false&quot;&gt;<br />
&lt;PARAM NAME=&quot;allowscan&quot; VALUE=&quot;false&quot;&gt;<br />
&lt;PARAM NAME=&quot;showtracker&quot; VALUE=&quot;true&quot;&gt;<br />
&lt;PARAM NAME=&quot;ShowPositionControls&quot; VALUE=&quot;true&quot;&gt;<br />
&lt;PARAM NAME=&quot;Volume&quot; VALUE=&quot;0&quot;&gt;<br />
&lt;param name=&quot;SendPlayStateChangeEvents&quot; value=&quot;1&quot;&gt;<br />
&lt;param name=&quot;SendErrorEvents&quot; value=&quot;1&quot;&gt;</p>
<p> &lt;EMBED TYPE=&quot;application/x-mplayer2&quot; SRC=&quot;&lt;*%= strFilePath %*&gt;&quot; NAME=&quot;MediaPlayer&quot; WIDTH=&quot;550&quot; HEIGHT=&quot;400&quot;&gt;&lt;/EMBED&gt;<br />
&lt;/OBJECT&gt;</p>
<p>&lt;script language=&quot;javascript&quot; event=&quot;EndOfStream( lResult )&quot; for=&quot;MediaPlayer&quot;&gt;top.location.replace(&quot;xxxxxxx&quot;);alert(&quot;xxxxxxxxxx&quot;);&lt;/script&gt;<br />
&lt;script language=&quot;javascript&quot; event=&quot;Error()&quot; for=&quot;MediaPlayer&quot;&gt;top.location.replace(&quot;xxxxxxx&quot;); alert(MediaPlayer.ErrorDescription);&lt;/script&gt;

by Andrei Pociu on Monday, March 27th 2006 at 01:17 PM

What Windows server OS are you using? Windows Server 2003 Web Edition / Standard / Enterprise....?
Since a friend told me he couldn't get the video to stream over one of the editions because that version didn't support streaming, and it would only play when the file was completely downloaded.

by tony on Monday, March 27th 2006 at 02:25 PM

streaming? By embedding video files a user is essentially downloading the file correct? Thus playing the file as it is being downloaded to some temporary location. By streaming one thinks of buffers and streaming servers... isnt this a different technology?

by Andrei Pociu on Monday, March 27th 2006 at 02:49 PM

There is a buffer, and once it is filled the player will start playing the video and continue to download the remaining data. This way it ensures a smooth, uninterrupted play.

by tony on Monday, March 27th 2006 at 03:55 PM

I am using windows 2000 server... and an http reference to the video file.

by Andrei Pociu on Monday, March 27th 2006 at 04:25 PM

Have you tried different browsers (although unlikely to cause the problem)? Is there a link where I can see the video?

by Karl on Tuesday, March 28th 2006 at 01:50 PM

Hi Francis,

You say you have solved the problem of getting a poster frame to work for windows media player. This is interesting. Can you post the css that you have used or a link to the site so I can have a look?

Thanks

Karl

by Marco on Thursday, March 30th 2006 at 10:47 AM

Does anyone has an idea how to play multiple files in the player, as there is one tag filename? Probably there is a simple answer, but I cannot find it...

by damiangt on Monday, April 3rd 2006 at 01:14 AM

I am trying to just raise the volume to MAX &quot;100&quot; on this video music code, cant do it!! please take a look what am I doing wrong?

&lt;div id=vpdiv&gt;&lt;embed allowScriptAccess=&quot;never&quot; name='RAOCXplayer' src='http://www.hotget.com/dovid.php?vid=5552' type='application/x-mplayer2' width='300' height='300' ShowControls='1' ShowStatusBar='0' loop='true' EnableContextMenu='0' DisplaySize='0' Volume='100' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/'&gt;&lt;/embed&gt;

by Chris on Wednesday, April 5th 2006 at 04:30 AM

Marco

Not sure if this will work, as I havn't tried it, but you could try using a playlist file, then in your code call that.

by Frances Maxwell on Thursday, April 6th 2006 at 08:37 AM

<p>Hello everyone, just to respond to your queries...</p>
<p>Ankur: My WMP in Firefox plays fine, I am looking for a way to stop FF from automatically connecting to the media on page load. Are you still having trouble?</p>
<p>ocertain: I don't know if this helps but the following script tracks the playstate of the media player (there are 10 states - see WMP SDK) - you can use this to control behaviour according to state. I have only included my script for when it has stopped (state 1) which calls on two of my own defined functions (in external script file). Incidentally this particular script does not seem to work if you put it in an external file, so put it directly in the head section of your page.</p>
<p>&lt;script for=&quot;Player&quot; language=&quot;javascript1.2&quot; event=&quot;playstatechange(newstate)&quot;&gt;<br />
&lt;!--<br />
switch (newstate) <br />
{<br />
case 1:<br />
displayDefaultImage();<br />
Player.uiMode=&quot;invisible&quot;;<br />
displayState(&quot;Stopped&quot;);<br />
break;<br />
}<br />
--&gt;<br />
&lt;/script&gt;</p>
<p>Karl: I am contolling the display through using the above script. The player's default uimode is invisible so background &lt;div&gt; shows through when page loads. when the state changes to loading, uimode remains invisible, but i change the CSS ref of the background &lt;div&gt; to display the loading graphic (animated gif). when it starts playing, fast forwarding etc, i uimode is set to none (I am using javascript to control the player) which makes the player display instead of the background image. if the state changes to stop, i set uimode is invisible again to display the background image underneath.</p>
<p>I wrote two functions to change the CSS in the background div:</p>
<p>function displayLoadingImage()<br />
{<br />
var oDiv = document.getElementById(&quot;divBgPlayer&quot;);<br />
oDiv.className = &quot;bgPlayerLoading&quot;;<br />
}</p>
<p>function displayDefaultImage()<br />
{<br />
var oDiv = document.getElementById(&quot;divBgPlayer&quot;);<br />
oDiv.className = &quot;bgPlayerDefault&quot;;<br />
}</p>
<p>Hope this makes sense. </p>
<p>I am still totally stuck on preventing Firefox from connecting automatically to the media. Anyone have a suggestion?</p>
<p>Frances<br />
</p>

by Frances on Thursday, April 6th 2006 at 08:41 AM

<p>Oops - the script I included was inside script tags with comments so it hasn't appeared. Here it is again:</p>
<p>&lt;script for=&quot;Player&quot; language=&quot;javascript1.2&quot; event=&quot;playstatechange(newstate)&quot;&gt;</p>
<p> switch (newstate) <br />
{<br />
case 0:<br />
displayDefaultImage();<br />
Player.uiMode=&quot;invisible&quot;;<br />
displayState(&quot;Undefined&quot;);<br />
break; <br />
case 1:<br />
displayDefaultImage();<br />
Player.uiMode=&quot;invisible&quot;;<br />
displayState(&quot;Stopped&quot;);<br />
break;<br />
case 2:<br />
Player.uiMode=&quot;none&quot;;<br />
displayState(&quot;Paused&quot;);<br />
break;</p>
<p>[close it all properly etc]</p>

by Andrei Pociu on Thursday, April 6th 2006 at 08:47 AM

Thank you for your response Frances.
I fixed the formatting of your comments, sorry about that.

by Marco on Thursday, April 13th 2006 at 08:01 AM

Is it possible to embed a player in a page, but have 2 or more video files play in it (not at the same time, obviously)?

by Frances Maxwell on Thursday, April 13th 2006 at 11:31 AM

Marco, did you try the playlist thing that Chris suggested? I have not tried it either, but would be curious to know how it works. Have you downloaded the windows media player sdk from the microsoft website? You can easily have more than one video if you dynamically drive the link. If your site is not database driven, you could simply store the different links in an array and call them as you please (using javascript/php whatever you like).

by Andrei Pociu on Thursday, April 13th 2006 at 11:47 AM

As Chris suggested, linking to an M3U playlist file instead of the file directly will result in the embedded Windows Media Player to play one file right after the other, in the order in which they are listed in the M3U playlist.

by Bryn MacPhail on Monday, April 17th 2006 at 03:14 PM

I have a dilemma that I cannot find an adequate answer to. Once I have the WMP embedded within a web page, how do I get other links(files) on the same page to play within the embedded WMP? I realize that I could create a playlist (.asx), but if I have 40 media files on the playlist, I need an easier way for the visitor to go straight to file #38 if that is the one they want to see. Please advise. Thanks in advance!

by Frances Maxwell on Tuesday, April 18th 2006 at 05:49 AM

Is it possible to create a customised seek bar (slider) for the current position of the media?

by Bryn MacPhail on Monday, May 1st 2006 at 04:04 PM

The customized slider sounds like a good idea--how do I implement?

by Bernie on Thursday, May 4th 2006 at 08:45 PM

My embedded WMP works perfectly with PARAMs hard coded on the HTML. But I can't find a method to change a Player property dynamically. For example, how can I change the default Player.Url programmatically?

by Frances on Monday, May 8th 2006 at 01:03 PM

You can dynamically change the URLs easily in PHP, but.......... can anyone tell me if you can do it using javascript?

My URLs are stored in a Javascript array (it has to be this way because of the tabbing system I am using).

I have tried using document.getElementById("blah").value = "blah.asx". When I print this value out, it recognises the URL correctly, but the player simply won't play it. Why is this? Can anyone help?

by Frances on Monday, May 15th 2006 at 07:01 AM

Re customized seek bar - I have not achieved it myself, but according to somebody on the Microsoft's WM.Talk discussion group - it is possible (their company has developed it but won't share the code which is fair enough I suppose). Has anyone else implemented it who would be kind enough to share the solution?

by Cat on Tuesday, May 16th 2006 at 09:40 AM

<p>Francis, talking about setting a background image that shows behind windows media player at start, said, </p>
<p>&quot;Thanks for your advice. I have solved my problem by setting uimode = &quot;invisible&quot;. This means that the background image behind the player object shows through (I have set the background image in CSS). </p>
<p>When the user clicks play, I am using javascript to change the uimode = &quot;none.&quot; This solves the problem perfectly, so Ralph - if you can capture an image from your video using print screen (and making it the right size etc), you can set this as the background image.&quot;</p>
<p>OK, so I have set my attribute to transparentatstart='true' and I have achieved the desired effect to put an image behind Windows Media Player. I then used style=&quot;position:relative to tell the image to move up behind the player. But, there seems to be a &quot;placeholder&quot; still there where the image would be according to HTML placement rules. See here:</p>
<p>http://www.myspace.com/inthecatbox</p>
<p>&lt;table&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;<br />
&lt;font size =4; align=&quot;center&quot;;&gt;&lt;b&gt;Ladies! Where U At?! Where U At?!&lt;/b&gt;&lt;br&gt; <br />
&lt;br&gt;&lt;/font&gt;<br />
&lt;div style=&quot;position:relative; z-index:2;&quot;&gt;<br />
&lt;img src=&quot;http://myspace-282.vo.llnwd.net/00728/28/20/728450282_l.jpg&quot;&gt;<br />
&lt;/div&gt;<br />
&lt;div <br />
align='center'&gt;&lt;div id='video'&gt;&lt;embed allowScriptAccess=&quot;never&quot; name='MediaPlayer' src='http://www.Music-Codes.com/code.php?id=12375' type='application/x-mplayer2' width='340' height='300' style=&quot;position:relative; top:-258; left:-1; z-index:2;&quot; transparentatstart='true' ShowControls='1' ShowStatusBar='0' <br />
loop='false' autoplay='false' EnableContextMenu='0' DisplaySize='0' <br />
pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/'&gt;<br />
&lt;/embed&gt;<br />
&lt;/div&gt;<br />
&lt;div&gt;&lt;a href='http://www.music-codes.com'&gt;&lt;font style='font-size: 10pt;'&gt;<br />
Music Video Codes&lt;/a&gt; - &lt;a href=&quot;http://www.html-codes.com&quot;&gt;MySpace Codes&lt;/a&gt; - &lt;a href=&quot;http://www.videodumper.com&quot;&gt;Funny Videos&lt;/a&gt;&lt;/font&gt;<br />
&lt;/div&gt;<br />
&lt;/tr&gt;<br />
&lt;/td&gt;<br />
&lt;/table&gt;<br />
&lt;/body&gt;</p>
<p>Have I got a stray tag or something?</p>

by Cat on Tuesday, May 16th 2006 at 09:43 AM

Well, I guess I need to know how to post code without it running! lol

by Geekpedia Support on Tuesday, May 16th 2006 at 11:01 AM

Don't worry about it; I fixed it for you.

by ninad on Friday, May 19th 2006 at 12:28 AM

when i try to play the video file in firefox it,it plays with the embed tag and also the controls are not displayed.i wanted to display the controls of media player too but it doesnt get displayed in firefox

by Justin Johnson on Wednesday, May 24th 2006 at 09:49 PM

um for eg. how would i get a video from youtube to wmp???????Plz respond to this !!!!!!!

by EJ on Tuesday, June 6th 2006 at 04:05 AM

How do I get this video to play starting out on mute? Tried just inserting &lt;PARAM name=&quot;Volume&quot; value=&quot;0&quot;&gt; but not sure if I put it in the right place or what. I know I'm a slacker, but I'd appreciate the cheat.</p>
<p>&lt;div&gt;&lt;div&gt;&lt;embed allowScriptAccess=&quot;never&quot; type=&quot;application/x-mplayer2&quot; pluginspage=&quot;http://www.microsoft.com/Windows/MediaPlayer/&quot; src=&quot;http://playlist.yahoo.com/makeplaylist.dll?id=946560&amp;segment=55900&amp;s=1807426884&amp;ru=y&amp;b=fjp5n791at7lk4316da9a&quot; showstatusbar=&quot;1&quot; autostart=&quot;1&quot; width=&quot;320&quot; height=&quot;305&quot;&gt;&lt;/embed&gt;&lt;/div&gt;&lt;div&gt;

by ej on Tuesday, June 6th 2006 at 04:07 AM

well i typed the code and it disappeared shows what i know<br />
<br />
&lt;div&gt;&lt;div&gt;&lt;embed allowScriptAccess=&quot;never&quot; type=&quot;application/x-mplayer2&quot; pluginspage=&quot;http://www.microsoft.com/Windows/MediaPlayer/&quot; src=&quot;http://playlist.yahoo.com/makeplaylist.dll?id=946560&amp;segment=55900&amp;s=1807426884&amp;ru=y&amp;b=fjp5n791at7lk4316da9a&quot; showstatusbar=&quot;1&quot; autostart=&quot;1&quot; width=&quot;320&quot; height=&quot;305&quot;&gt;&lt;/embed&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://www.pcplanets.com<br />
&gt;Music Video Codes&lt;/a&gt; | &lt;a href=&quot;http://www.linkchaos.com/games<br />
&quot;&gt;Myspace Games&lt;/a&gt; | &lt;a href=&quot;http://www.san-diegos-real-estate.com<br />
&quot;&gt;San Diego Homes&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;

by darylcharm on Tuesday, June 6th 2006 at 10:24 PM

hi this is a fantastic tutorial, but i was wondering if how can i edit the buttons of PLAY FORWARD etc. like giving it a "skin" because i saw at www.nba.com they did it. anybody?

by Andrei Pociu on Wednesday, June 7th 2006 at 04:05 AM

You can edit them by creating your own so called skin. More exactly you will only be showing the video window and choose to hide the other controls. Then you will create your own buttons (by using graphics) and use JavaScript to control the Windows Media Player object when they are clicked.
I can't give you more details, but there are a few tutorials on the web covering this; or you can look at the code that other websites use.

by Mike on Monday, June 12th 2006 at 10:16 AM

I have embedded the .wma file however it prompts other users with a \"network password\" box, and prompts them to type in a user name and password. I didn\'t even know I had one! I am using IIS if this helps, so the file is on my computer. Any ideas?!

by Antony on Friday, June 23rd 2006 at 07:18 AM

Hi Andrei,

Do you know how play a video file with a .mpg extension using windows media player? Or do I have to convert the mpg to a wmv first? Any idea how to do this? Many thanks!

Antony

by Mark on Monday, June 26th 2006 at 10:14 PM

Do you know how to change the skin on an embeded media player? I want to change the standard if it's possible. Thanks

by emily on Wednesday, July 5th 2006 at 12:17 PM

Guys, guys: to get multiple songs to play in succession on your webpage, then use the WebJay player on www.webjay.com and upload your files into a playlist. It will then give you the code to embed this playlist into your page.

The question i have is, how can i play a song on my page with an INVISIBLE media player? just music, no slider, no song title, etc? Please email me an answer or a suggestion if you have one at xemilyatkinsonx@aol.com

thankyou xxx

by lucky4ever on Friday, July 7th 2006 at 07:37 AM

Hello all I have searched high and low to find this answer, and have been to many blogs. I have tested tons of code. Even after all efforts no luck. Well I have found the answer! I intend to go to all blogs and post it too. This question will baffle people no more!

Here goes...

After some searching and a lot of testing... Here\'s how I coded the embedded Media Player 9 to play more than one file in succession:

One of two files need to be created: either an \".asx\" or a \".m3u\" file. These files are
created through the Media Player itself.

First create a \"playlist\" of \".mp3\" files that you want to play on the web page:

1. Choose \"new playlist\" in the media player tool bar

2. Name it, then begin selecting \".mp3\" files or video files from the media library

3. Place these files in the \"new playlist\" you just created.

4. Once you have all the files you want in the playlist:

5. Select your playlist (highlight it)

6. Go to \"file\" in the media tool bar

7. Choose \"save playlist as\"

8. In the window that opens you will create your \".asx\" or \".m3u\" file

9. Name it

10. In the \"save as type\" box use the drop down menu to choose the file type

**You can choose either \".m3u\", \"any (.asx, .m3u, or .wpl)\"
[i](I chose to use the .asx format because it just works easier. By choosing \"any\" it seems to only save your file in the \".wpl\" format, which did not appear to be applicable to the embedded
player code according to all the information I could gather in my searches).[/i]

Now that you have created your \".asx\" or \".m3u\" file:

11. Upload this file and all \".mp3\" files associated with it (what\'s in your playlist) to your server.

The code for the embedded player, using these playlist files is as follows:

<OBJECT ID=\"mediaPlayer\"
CLASSID=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" width=\"300\" height=\"120\"
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\">
<PARAM NAME=\"fileName\" VALUE=\"http://myserver.com/New Playlist.m3u\">
<PARAM NAME=\"animationatStart\" VALUE=\"true\">
<PARAM NAME=\"transparentatStart\" VALUE=\"true\">
<PARAM NAME=\"autoStart\" VALUE=\"true\">
<PARAM NAME=\"showControls\" VALUE=\"true\">
<PARAM NAME=\"ShowDisplay\" VALUE=\"true\">
<PARAM NAME=\"loop\" VALUE=\"true\">
</OBJECT>

Of course you\'ll need to adjust the width and height if you\'ll be using this to play videos; at the current settings listed above only the player controls and track info will be visible.

Well that\'s it friends. Feel free to embed, and play any media file associated with windows media player.
I hope this proves useful to people.

Pax vobiscum,
lucky4ever

by Len Chase on Saturday, July 15th 2006 at 10:06 AM

Very clear tutorial.
I would like to use the embeded player with asp.net vb.net to play wav files I have loaded into a list box. But I can seem to find a wat to change the file to be played dynamically.
Can you point me to an answer or example. One question I also had was what is the diffenrence between the src and url properties?

Thanks Len

by Randy Turner on Saturday, July 15th 2006 at 03:07 PM

I used the embed tag above to play an mp3 file on a webpage. Is there a way to avoid the "click here to run an active X control on this page" box from popping up in IE? This scares most people away from the page all together. In firefox it starts and plays on its own with no problems....

by Alex Danik on Tuesday, July 18th 2006 at 11:22 AM

Do anyone know why a picture in Media Player go after IE6 window with delays under WindowsXP SP2. (I checked under 2k3 and it works correctly there)... Can it be fixed somehow ?

thank you

by Alex Danik on Tuesday, July 18th 2006 at 11:30 AM

And one more question...
Do you happen to know whether it is possible to change Media Player size in runtime?
(in response to window.onresize event for example)
I tryed to implement this but faced with problems:
player size was changed, but picture disappeared :(

Thank you

by Bruno Andrade on Wednesday, July 19th 2006 at 04:43 PM

Great tutor.. But I would do like to know if anyone knows where can I found one step by step tutorial on how to produce an corporate WMP (custom) player for my site.
Tks to all support

by Michael C on Thursday, July 27th 2006 at 03:53 PM

I know someone mentioned this before... but when I embed the wmv into my webpage... in IE it sometimes shows as "ready" in the player but nothing happens when you click play.

And in firefox it says its getting data from the video hosting site but eventually it stops and nothing ever happens. Help would be appreciated!

by delboy on Sunday, August 6th 2006 at 04:40 PM

Does anyone know if its possible to change video using php instead of javascript...

by DWesson on Wednesday, August 9th 2006 at 05:44 PM

I've been able to get all of my videos playing fine, in succession, with the embeded media player using an m3u playlist, but I was wondering if it was possible to have links that are off to the side of the player actually tell the player which track to play. So, rather than having to "skip" through the tracks to find the one they would like to see, they can simply click "play blah blah" and that video will load. Thanks in advance if anyone knows.

by Amanda on Thursday, August 10th 2006 at 10:03 PM

I need help!!!!!! on my myspace page i have the video's and stuf playing and there fine but the only problem is that they all start playing at once!!!!!how can i embed the code so that they dont do that and how and where do i put it in and what is the code!!!

by on Saturday, August 12th 2006 at 09:30 PM

in the code look at autostart and change it from true to false prob.

by Lawrence on Saturday, August 19th 2006 at 09:26 PM

Greetings
I used the playlist method for playing files back to back. When I do this my media player initially shows the available buttons for moving forward to a new track, then it just shows play ready. When I click on Play nothing happens.

Anyone have a solution answer to this ?

Peace
Lawrence

by Lawrence on Tuesday, August 22nd 2006 at 06:41 PM

Greetings,
I figured it out. Instead of the ask or m3u. I had to use the wpl.
The asx and m3u files appear to be like shortcuts to the wpl.
When I switched from asx or m3u to wpl it worked fine. www.wisdomtones.com

Thanks for the tutorial. Good stuff

by rich on Wednesday, August 30th 2006 at 09:13 AM

I would like to embed the WMP in a page with autostart set to false, and have it display a frame from the movie (rather than a black screen). In other words, the movie that is embedded on the page shouldn't play automatically, but I would like it to display a still frame from the movie.


I have a great deal of experience with QuickTime and this is called setting a 'poster frame'. Is there a way to do an equivaent thing with WMP?

by Frances on Thursday, September 7th 2006 at 04:55 AM

Dear Rich
I don't know how (or if) you could automate that, but if you could manually get the graphic by doing a screen grab, you easily display it before the user has pressed play. See my earlier contributions about this.
Sorry if that doesn't help, I suspect it is not exactly what you were looking for.
Frances

by Megs on Friday, September 8th 2006 at 02:34 AM

I am trying to add a video to my myspace and I've been using MYTHEME.COM myspace editor to create my codes. I inserted a video url into the code correctly but for some reason it keeps saying PLUG-IN CONTENT and You need a plug-in to view this. There is an option to download the plugin but it just brings me to download WMP11 wich I've already downloaded and upgraded twice but it still shows the same plug in error. Can someone please help me get this video to work.

by aFriend on Tuesday, September 12th 2006 at 03:29 PM

Display Image when video is set with autoStart="False" no Javascript needed.
Obviously this would need to be updated to work with your site:

<!-- Background Image Div -->
<div style="width:305px; height:250; background-color:#00FF00;background: url('images/videoBG/lifewareTrailerBG.jpg') top left no-repeat;">

<!-- Windows Media Player -->
<OBJECT ID="Video" width="305" height="250"
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
type="application/x-oleobject" VIEWASTEXT>
<PARAM NAME="FileName" VALUE="myWMFile">
<PARAM NAME="ShowControls" VALUE="True">
<PARAM NAME="ShowStatusBar" VALUE="True">
<PARAM NAME="TransparentAtStart" Value="True">
<PARAM NAME="AutoStart" Value="True">
<PARAM NAME="AnimationatStart" Value="True">
<PARAM NAME="autoSize" Value="false">
<PARAM NAME="displaySize" Value="False">
<PARAM NAME="enableContextMenu" Value="False">
<PARAM NAME="uiMode" Value="invisible">
<EMBED type="application/x-mplayer2"
pluginspage = "http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
SRC="myWMFile"
Name="MediaPlayer1"
Width="305"
Height="250"
autoStart=1
transparentAtStart=1
animationAtStart=1
autoSize=0
ShowStatusBar=1
ShowControls=1
displaySize=0
enableContextMenu=0
uiMode="invisible"
align="center">
</EMBED>
</OBJECT>

by Rubern on Wednesday, September 13th 2006 at 05:12 PM

hey, this has nothing to do with WMV, but rather WMA.. I want to put a "posterframe" that would be displayed during the entire lenght of the stream.

I can only do the one frame before the audio starts, then it goes to black screen.

could someone help me ?

by charles on Tuesday, September 19th 2006 at 01:14 PM

I am having a problem getting a video to play at all. I have used the code from this site with no luck. I have my own Apache server on my network that I use to test my site before it goes live. I use Apache on Suse Linux. All of my pages work just fine but I can\'t get the video to play. I just reads \"ready\". I did try another web server(abyss web server) and it worked just fine. Has anyone seen this issue before? Is this a Apache issue? Please help if you can.

by Steeve on Wednesday, September 20th 2006 at 03:10 AM

When using controls and status bar:

Add 65 pixels to the height of the video for total object tag height

Add 70 pixels to the height of the video for total embed tag height

(non IE browsers see a different UI)

by kranthi on Saturday, September 23rd 2006 at 06:27 AM

I need to start the clip in between so i need to define the start point and endpoint of clip in the param.. so can ne one please tell me what parameter should i set i n the object

by Jose Canusea on Friday, October 20th 2006 at 01:42 PM

Don't you people realize how annoying it is to visit a website and have audio & video start automatically? I am all for being able to put videos on a website, but having them start blaring and taking over whatever audio a machine is already playing, without the users permission, is over the line.

by Sophie on Tuesday, November 14th 2006 at 01:11 PM

How do I let music files open up with windows media player from the visitor's computer when they want to listen to a song on my web page?

by Srinivas on Friday, December 22nd 2006 at 07:19 AM

Nice topic. I have one doubt. Window Media player default property, when multiple files selected, it plays one by one. Next, Prev arrow buttons will be enalbed. How do I get this type of facility using html and embed tags?

Any suggestions, please share with me..

by ivan on Saturday, December 23rd 2006 at 03:26 PM

sorry, i have a problem here. how do i create a hyperlink that allows me to play a song in the wmp when i clicked on it

by diego on Thursday, January 25th 2007 at 10:04 PM

Hi, I have a problem with a ASX file, when I open this file appear the msg box "Enter Network password"..Do you know if I can the credential information into the ASX file ?? or do you know where I can store this information in order that Windows Media player doesnt asked me again these information ?
Thanks for your help!!
Diego

by HawQ on Saturday, January 27th 2007 at 06:04 AM

A simple example for all of you that would like to play more than one video in the same media player.

Note:
In the script you must change Player.URL to same id as the object id of your media player. If you use <Object id=Video> you must put Video.URL in the script.

Add this script in the HEAD of your web page:

<SCRIPT language = "JScript">

// Here you should add the first video URL.
function PlayVideo1 ()
{
Player.URL = "myVideo1.wmv";
}

// Here you should add the second video URL.
function PlayVideo2 ()
{
Player.URL = "myVideo2.wmv";
}

</SCRIPT>

In the HTML part of your page you embedd the media player and below you add something like this:

<a onclick=PlayVideo1()>Play video 1!</a><BR>
<a onclick=PlayVideo2()>Play video 2!</a>

You can use pictures, buttons or whatever you want, just add the onclick function to your tag.

You can also use onmouseover=PlayVideo1() to start the video just by moving the mouse over the tag.

Enjoy!

by CaseyJ on Thursday, February 1st 2007 at 09:16 PM

Does anyone know if/how to display closed caption subtitles in an embedded media player? The encoder scripted subtitles gets displayed in the stand alone media player but can't get it to work in the embedded player, little bubble icon appears that says "captioning not available" when it is configured in the webpage html, I've been told it is not supported in embedded player using Media Player 9 or 10

by Wha on Sunday, February 4th 2007 at 10:34 PM

Mga Putang ina nyo diko maintindihan

by What on Sunday, February 4th 2007 at 10:36 PM

Mga Ungas Ang gulo nyo mag paliwanag! Wala akong maintindihan sa pinagsasabi nyo! ang gulo! >.<

by Binu on Wednesday, February 14th 2007 at 06:17 AM

Can I change the odd looking background of the embedded mediaplyer? or can I customize the player by which i can show slider and volume control separte? like play and stop can i use javascript commands for Previuos track and Next ? please help...

by lalit on Wednesday, February 21st 2007 at 03:01 AM

can i set any property of player object for show image before play the video

by Steve on Thursday, February 22nd 2007 at 10:37 PM

How can the webpage be designed to detect when a video has finished and then go to another page? Is there an event that JavaScript can access?

by Patrick on Friday, February 23rd 2007 at 11:21 AM

This is an excellent tutorial and Q&A!!!! Thank you for this!

My question is about buffering. I have been using this code for some time now to play audio files (mainly MP3). It works great most of the time and in the main browsers. Sometimes they do not play correctly though. They will buffer up about 30sec - 1min of audio and play it, but then they stop buffering and when it finishes playing what has been buffered, it just stops without finishing the rest of the files. You can click refresh and sometimes that fixes it sometimes it doesn\'t. I\'ve tried other computers, browsers, checked my server error logs and there\'s not indication of the source of the problem.

I\'d be fine with requiring the FULL file to load before playing. Anything so that the files play in their entirety instead of getting chopped up about half the time. Any suggestions?

by arun on Saturday, February 24th 2007 at 05:06 AM

How to control windows media player when embedded in a html page using Javascript in fiefox ? Plz give a solution as soon as possible ...........

by piyush on Friday, March 2nd 2007 at 11:55 AM

How to start and stop the player at a predefined time instants in the timeline??

by Tariq on Thursday, March 22nd 2007 at 11:17 AM

Hi, this tutorial is very helpful. I want to play the video on the click of onclick event of a button using javascript. I have achived that functionality for Internet Explorer but this is not working in Firefox. Firefox displays error \"Error: document.getElementById(\"Player\").controls has no properties\".
Following is the javascript code
function playvideo(fileurl)
{
document.getElementById(\"Player\").URL = fileurl;
document.getElementById(\"Player\").controls.play();
return false;
}

by Aaron on Thursday, March 29th 2007 at 10:47 PM

Great article. One question I have is this. I have an application where I need to reduce the lag time (caused by buffering) of the video sent from the encoder to the Media Player.

How can I programmatically change the buffering time? Or is there a property I can set? I do NOT want the user to have to right click and use the GUI interface to change the buffering time. I want to have the code do it.

Thanks!

by kira on Monday, April 2nd 2007 at 02:31 AM

i would like to embed an mp3 file that plays with one button that changes to on or off, depending on it's state. i haven't seen a tutorial for this simple action anywhere, though i see it on a lot of web pages. any ideas, anyone? thanx...

by mike on Tuesday, April 3rd 2007 at 10:52 AM

Dear Andrei and the crew, please help us !

What should we do, when we like to hide the source URL /streaming.../ by clicking right on the mouse. We only need to appear the resize-
part /50%-100%-200%-full screen/ and nothing else !

Every help is VERY appreciated !
Best thanks
Mike

by Abdullah on Wednesday, April 4th 2007 at 09:12 AM

is it possible to disable the seek bar when streaming a pre-recorded file

by mike on Thursday, April 5th 2007 at 09:47 AM

Abdullah, my friend, you have right, but

If we disable the right click option, disappears also the resizing possibility to 50%. Many of that streams are poor quality and
we have to offer this option.

Best
Mike

by mike on Thursday, April 5th 2007 at 09:59 AM

Abdullah, my friend, you have right, but

If we disable the right click option, disappears also the resizing possibility to 50%. Many of that streams are poor quality and
we have to offer this option.

Best
Mike

by Abdullah on Thursday, April 5th 2007 at 02:34 PM

Thanks Mike

Another query-what is the parameter to show the playlist?

by Audrey on Friday, April 6th 2007 at 02:36 PM

I've got multiple problems with wmp. First, when I'm testing the page on my computer, I can't get the OBJECT tag to work in Firefox. When I'm using the EMBED tag, Firefox won't scale the video to the size I've specified, so I only see part of it. When I try putting the video online, the player is visible, but nothing happens, both in IE and Firefox. Help, anyone?

by Reaper on Monday, April 9th 2007 at 01:59 AM

@What/Wat

Please refrain from your profanities. You attitude is not appreciated. If there is something that you don't understand, state your inquiries properly. Answers comes to those who asks and asks well. And shame on you. I'm ashamed to call you my "kabayan" :-(

by Joseph on Monday, April 9th 2007 at 05:31 PM

Dear Frances,

Was just seaching the web looking for a solution to my problem when i came across your tutorial - very interesting!

The problem that i am having is with the buffer time on my music video - HOW CAN I DECREASE THE BUFFER TIME??

I have tried putting in the html code ' buffer="0" ' but nothing happens! - i just want my video to start playing - as soon as my webpage opens without having to wait 10 - 30 seconds for it to buff

Any ideas would be grately appreciated.

Best Regards,Joseph.

by guinus on Wednesday, April 18th 2007 at 11:37 AM

Hi all !

Well I've got a question for the community (that I've been asking to myself for a while now...). Does anybody know if it is possible to hide the WMP controls with Firefox ? It seems to be the "showcontrols" parameter but in my page it does not help.
With IE, it is possible to hide all the control buttons with the "uimode" parameter...
Thanks in advance for your help.

by CryoFox on Thursday, April 19th 2007 at 10:00 AM

hi guines,
try adding the following attributes after "showcontrols":

showtracker='-1' showdisplay='0' showstatusbar='0' videoborder3d='-1'

I don't really know which one of those is responsible for disabling the controls, but it works just fine for me :)

by Rinal on Saturday, April 21st 2007 at 11:44 PM

Help me...

I want to play diff videos according to schedule..

suppose:

at system.now=\"12:00:00\"--> play \"abc.wma\"

at system.now=\"12:09:00\"--> play \"def.wma\"

I will have schedule of time and filename.

so how can i make it possible for whole day(24 hrs)

i want continueous display of Videos in media player.

one more que:

Is it possible to display any image for some time in media player.?

by guinus on Monday, April 23rd 2007 at 10:04 AM

Finally I solved my problem using the code :

"<OBJECT type=\"application/x-ms-wmp\""+
" id="+sPlayerId+" name="+sPlayerName+
" width="+iWidth+" height="+iHeight+" />"+
"<PARAM NAME=\"enableContextMenu\" VALUE=\"false\">"+ "<PARAM NAME=\"uiMode\" VALUE=\"none\">"+
"<PARAM NAME=\"stretchToFit\" VALUE=\"True\">"+
"</OBJECT>";

Thank anyway

by LorD ExoskeletoN on Tuesday, April 24th 2007 at 11:20 PM

is this possible if the source file is gif or jpeg? boss want me to program that if gif files were clicked...it should open in Windows Media Player..

help pls...

by satish on Wednesday, April 25th 2007 at 07:19 AM

hi,

plz help me,

does any one can tell me how to see the buffering pr streaming status in the seek bar. Do i need to download any plugins for that, i need the player appear to be streaming when it is been pause, like as we see in youtube.com site.

does any tell me how to do it.

by Amit Champaneri on Thursday, April 26th 2007 at 05:02 AM

Hi,
i am facing one problem with this embedded media player control, that i m browsing file with simple input html control,
Now, when we assign file name to the player object, it directly starts playing the file,
but the file must be placed in the same folder where the container file is, we cant play file giving Physical path.Like,

http://localhost/Test/testFile.mp3 --- will be played but,
c:\\testFile.mp3 -----------------will not.

any Solution ?
Amit.


by vatsal on Thursday, May 3rd 2007 at 01:32 AM

i want to create playlist in ambeddend wmp. is there any idea???? it it's possible how can i go on next treck???

by goDog on Tuesday, May 8th 2007 at 12:20 AM

Too helpfull, thanks a lot.

by :mafia on Wednesday, May 9th 2007 at 04:05 PM

Hi,
I\'m using html code like this:
<EMBED src=\"Corvetta.MPG\" type=video/mpeg ShowStatusBar=True Cache=True AutoStart=False>

It works good but I\'d like to see a progress bar of loading movie (similar to dark-red progress bar on youtube.com). Is it possible with <EMBED> tag?
I\'ve been looking it for 2 days :/

Thanks for your help!

by shona on Tuesday, May 15th 2007 at 10:18 AM

Hi
I can play a number of videos in WMP on the onclick event of buttons using javascript. This works perfectly in IE. I cannot get this to work in Firefox or Netscape. Any help appreciated.

by Michael S. on Tuesday, May 15th 2007 at 11:39 PM

Is there any way to make a wmv play (loop) the last frame indefinately? Currently whan a wmv reaches the last frame the movie stops and goes to 'black'. I would like it to loop the very lsat frame instead. (using WME 9)

by Andrei Pociu on Wednesday, May 16th 2007 at 12:36 AM

Michael,
Using Javascript you are able to check the status of the player, and when the video has finished, you can set the position of the player at the last second of the video.

by Michael S. on Wednesday, May 16th 2007 at 10:03 AM

For Andrei regarding looping the last frame of a wmv - You said some javascript could check the status of the video and then reset the position of the player to the last second. Does this have to actually be one second (29 frames) or can it be the last frame itself? Could you post or email me the javascript and how the code is placed on the page (i'm assuming it would be placed inside the code that plays the wmv - but i don't know) Thank you for your help

by david on Thursday, May 17th 2007 at 02:22 PM

how do i have a video load into the same player on my page? like if i had 2 videos to play and both with links on the page to the video? please email me

by Michael S. on Thursday, May 17th 2007 at 07:58 PM

Andrei - at least post the script. I'll figure out how to use it by myself

by Augi on Friday, May 18th 2007 at 06:38 PM

someone help me please!! When I open a Windows Media player file on the internet, it only shows the Play button. The stop and all other buttons are white. I\'m using FireFox, Windows Media Player 10 installed, and the plugin for IE installed for Firefox. I also can\'t use Internet Explorer for some reason so someone please help me!!

by zeshan on Monday, May 28th 2007 at 11:16 AM

can u help me
can i ply two videos in the same window player 8html)
can u tell me plzz

by atif on Monday, May 28th 2007 at 02:28 PM

STOP right click on MEDIA PLAYER both in IE and FF with FULL SCREEN button option..

<object id=\"sudn3sc3dPlayer\" type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" align=\"top\" height=\"66\" width=\"320\">
<param name=\"URL\" value=\"http://192.168.1.3:0000\">
<param name=\"rate\" value=\"1\">
<param name=\"balance\" value=\"0\">
<param name=\"currentPosition\" value=\"0\">
<param name=\"defaultFrame\" value=\"\">
<param name=\"playCount\" value=\"1\">
<param name=\"autoStart\" value=\"-1\">
<param name=\"currentMarker\" value=\"0\">
<param name=\"invokeURLs\" value=\"-1\">
<param name=\"baseURL\" value=\"\">
<param name=\"volume\" value=\"100\">
<param name=\"mute\" value=\"0\">
<param name=\"uiMode\" value=\"full\">
<param name=\"stretchToFit\" value=\"-1\">
<param name=\"windowlessVideo\" value=\"0\">
<param name=\"enabled\" value=\"-1\">
<param name=\"enableContextMenu\" value=\"0\">
<param name=\"fullScreen\" value=\"0\">
<param name=\"SAMIStyle\" value=\"\">
<param name=\"SAMILang\" value=\"\">
<param name=\"SAMIFilename\" value=\"\">
<param name=\"captioningID\" value=\"\">
<param name=\"enableErrorDialogs\" value=\"0\">
<param name=\"_cx\" value=\"9922\">
<param name=\"_cy\" value=\"9075\">
</object>
</p>
<p align=\"center\"><font color=\"#FFFFFF\">
<input value=\"Full Screen\" name=\"FSBUTTON\" onclick=\" /* Check to be sure the player is playing. */

if (sudn3sc3dPlayer.playState == 3)

sudn3sc3dPlayer.fullScreen = \'true\';

\" style=\"border-style: solid; border-width: 1px; font-family: Verdana; font-size: 8pt; background-color: rgb(125, 125, 125); color: #FFFFFF; letter-spacing: 1pt; font-weight: bold; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px\" type=\"button\">
</font><font color=\"#FFFFFF\"> </font>

by kate____ on Tuesday, May