Recent Changes - Search:




Summary: Embedding a Windows Media Player
Version: 2006-04-13 (v.0.2)
Prerequisites: pmwiki 2
Status: stable
Categories: Media Images Audio Video

Questions answered by this recipe

How can I play windows media files from within wiki pages?
How can I embed Windows Media Player?

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.


Download wmplayer.phpΔ, copy to cookbook/ and install by adding to config.php:


This adds the directive (:wmplayer file parameters... :) to associate media files with the player.


(:wmplayer Attach:filename.ext width=number height=number [key=value] [key=value] ... :)

  • use Attach:filename or http://urlpath/filepath/filename
  • height= and width= parameters are mandatory
  • other parameters can be supplied to control the player's behaviour
  • Example (music): (:wmplayer Attach:mymusic.wma width=200 height=25 :)
  • Example (video): (:wmplayer Attach:myvideo.wmv width=320 height=240 :)
  • You can use any other media formats the player supports. You may need to add more formats to the formats uploads allow.
  • External fileurls of form http://.... can be used.
  • Setting $EnableExternalResource = 0; will disable the use of http://... fileurls.


You may wish to add wma, wmv, or other extensions to be allowed for file uploads. Add to config.php:

$UploadExts['wma'] = 'audio/wma';
$UploadExts['wmv'] = 'video/wmv';
$UploadExts['mid'] = 'video/wmv';
$UploadExts['midi'] = 'video/wmv';

I had not much luck with the following long list of parameters. The ones which worked were:

  • autostart=false -- default is true
  • playcount=nn

Most important parameters supported by Windows Media Player 7 and later:

autoStarttrueSpecifies or retrieves a value indicating whether the current media item begins playing automatically.
balance0Specifies the current stereo balance.
Values range from –100 to 100.
baseURL Specifies the base URL used for relative path resolution with URL script commands that are embedded in media items.
captioningID0Specifies the name of the element displaying the captioning.
currentMarker0Specifies the current marker number.
currentPosition0Specifies the current position in the media item in seconds.
defaultFrame-Specifies the name of the frame used to display a URL.
enableContextMenutrueSpecifies a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.
enabledfalseSpecifies whether the Windows Media Player control is enabled.
fullScreenfalseSpecifies whether video content is played back in full-screen mode.
InvokeURLstrueSpecifies a value indicating whether URL events should launch a Web browser.
MutefalseSpecifies if audio is muted.
PlayCount1Specifies the number of times a media item will play. Minimum value of one.
Rate1.0Specifies the playback rate.
0.5 equates to half the normal playback speed, 2 equates to twice.
stretchToFitfalseSpecifies whether video displayed by the control automatically sizes to fit the video window, when the video window is larger than the dimensions of the video image.
uiModefullSpecifies which controls are shown in the user interface.
Possible values: invisible, none, mini, full.
URL-Specifies the name of the media item to play.
You can specify a local filename or a URL.
VolumeLast settingZero specifies no volume and 100 specifies full volume.
windowlessVideofalseSpecifies or retrieves a value indicating whether the Windows Media Player control renders video in windowless mode.
When windowlessVideo is set to true, the Player control renders video directly in the client area, so you can apply special effects or layer the video with text.
Supported by Windows Media Player for Windows XP or later.

More info: Windows Media Player PARAM tags

Release Notes

  • 2006-04-13: added type declaration to code
  • 2006-03-10: initial release. The code is modified from Schlaefer's QuickTime recipe.


I've hacked together a version of this script which uses <embed> and also works under Firefox, although not all the options are configurable. If there's anywhere I can post it, just let me know. Paul C - 19/9/2007 -

Would it be possible for someone to make a recipe which embed media with the <embed src="file.ext" autostart="..." width="..." height="..." ...> syntax, in order for more compatible pages. e.g. with linux?
-- tlucas


I've modified the script by Paul C. which uses <object> and also works under Firefox. The syntax is now a little bit different:

Download wmplayer2.phpΔ, rename to wmplayer.php, copy to cookbook/ and install by adding to config.php:


This adds the directive (:wmplayer Attach:filename type=MIME-Type width=number height=number:)

  • Example (music): (:wmplayer Attach:mymusic.wma type=audio/x-ms-wma width=320 height=45:)
  • Example (video): (:wmplayer Attach:myvideo.wmv type=video/x-ms-wmv width=320 height=285:)


wmplayer2 worked well for me with Windows on Firefox 3 (and IE7), but not Opera.

Be good to see two versions merged


2010-01-24 Where can I find/modify the source directory of the media files used in the 'attach' parameter ?

See Also


User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM