Extension:WMPEmbed
|
|
WARNING: the code or configuration described here poses a major security risk.
Problem: Vulnerable to Cross-site scripting attacks, because it passes user input directly to the browser. This may lead to user accounts being hijacked, among other things. |
|
Windows Media Player Embedder Release status: stable |
|||
|---|---|---|---|
| Implementation | Media, Tag | ||
| Description | Embeds a Windows Media Player Object | ||
| Author(s) | Philip Gustafson (pwgusTalk) | ||
| Last version | 1.00.1 (2009/10/31) | ||
| PHP | 5 | ||
| License | GPL | ||
| Download | Extension:WMPEmbed#Code | ||
| Example | http://festiva.bntbtc.com/wiki/Anywebtest | ||
|
|||
|
Check usage (experimental) |
|||
Contents |
[edit] What can this extension do?
This extension will embed a Windows Media Player activex object using the
<OBJECT ID=\"WMP7\" CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\">
function to embed the Windows Media Player ActiveX control. It requires the client to have Windows Media Player (at least version 7 or 9, not sure which). It you can specify size, source, full screen, and all sorts of things. It will play WMA and WMV files, and possibly more. It supports the MMS (streaming via Windows Media Services for the Windows Server system) and HTTP (progressive download streaming) protocols. Your server DOES NOT have to have Windows, IIS, or even Windows Media Player, only the client's computer needs to have Windows Media Player. In other words this should work on Linux or Windows or Mac, with Apache or IIS or anyother web server as long as PHP and MediaWiki are installed properly. I assume that PHP 5 is required, it was tested on PHP 5.3 however so versions below that are not known to me. Please report problems in the discussion area.
[edit] Usage
Minimum options example:
<mms>File.wmv</mms>
All options example:
<mms baseurl="http://foo.com" autoplay="true" w="640px" h="480px" stretch="true" point="folder/folder/" full="true">File.wmv</mms>
baseurl="webaddress"
allows you to specify a url other than your default....if you so choose
autoplay="boolean"
(defaults to false)
w="#px%"
(defaults to 640px) width, use px if you whish to specify as pixels or % if you whish to specify as a percentage of your screen size
h="#px%"
(defaults to 480px) height, use px if you whish to specify as pixels or % if you whish to specify as a percentage of your screen size
stretch="boolean"
(defaults to true)
point="folder path not beginning with '/'"
defaults to the root of your base url so if you want to play mms://mms.bntbtc.com/Festiva/File.wmv" than assuming your baseurl is "mms://mms.bntbtc.com" and point is "Festiva/", if your default is path is something else you could change the default path below on the line that says
$point "/"
to
$point = "your/path/here"
full="boolean"
allows or disallows full screen
[edit] Download instructions
Please cut and paste the code found below and place it in $IP/extensions/ExtensionName/mmsembed.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
include("extensions/mmsembed.php");
Then change the
$baseurl
to the
$baseurl
of the site you want all your videos to be pulled from.
[edit] Code
<?php #Windows Media Player Embedder #1.00.1 #2009/10/31 #Tested on PHP 5.3, Windows Server 2008R2, IIS7.5, MediaWiki 1.16alpha #(see http://festiva.bntbtc.com) # # #Example and Directions #to install, add include("extensions/mmsembed.php"); to your local settings and #set your base url string in $baseurl below #Minimum: <mms>File.wmv</mms> #All options: <mms baseurl="http://www.foo.com" autoplay="true" w="640" h="480" stretch="true" point="folder/folder" full="true">File.wmv</mms> #baseurl="webaddress" allows you to specify a url other than your default....if you so choose #autoplay="boolean" (defaults to false) #w="#px" or "#%" (defaults to 640px) width in pixels or as percent of your screen size #h="#px" or "#%" (defaults to 480px) height in pixels or as percent of your screen size #stretch="boolean" (defaults to true) #point="folder path ending with /" (defaults to the root of your base url so if you want to # play mms://mms.bntbtc.com/Festiva/File.wmv" than "baseurl is "mms://mms.bntbtc.com" # and point is "Festiva/", if your default is path is something else you could change # the default path below on the line that says $point "/" to $point = "your/path/here" #full="boolean" allows or disallows full screen # $wgExtensionFunctions[] = 'mmsembed'; $wgExtensionCredits['parserhook'][] = array( 'name' => 'Windows Media Player Embedder', 'description' => 'Embed Windows Media Player Object', 'author' => 'Philip Gustafson', 'url' => 'http://www.mediawiki.org/wiki/Extension:WMPEmbed' ); function mmsembed() { global $wgParser; $wgParser->setHook('mms', 'rendermms'); } # The callback function for converting the input text to HTML output function rendermms($input, $argv) { $baseurl = "SET YOUR BASE URL"; #don't add a / after the url, url can be mms or http if ($argv['baseurl'] != "") $baseurl = $argv['baseurl']; $auto = $argv['autoplay']; $w = $argv['w']; if ($w == '') $w = "640px"; $h = $argv['h']; if ($h == '') $h = "480px"; $stretch = $argv['stretch']; $fit = "-1"; if ($stretch == 'false') $fit = "0"; $full = "0"; $allowfull = $argv['full']; if ($allowfull == 'false') $full = "1"; $file = $input; $point = $argv['point']; if ($point == '') $point = ""; $autostart = "0"; if ($auto == "true") $autostart = "1"; $url = "$baseurl/$point$file"; $hwstr = "style=\"width: ".$w."; height: ".$h.";\""; $output= "<OBJECT ID=\"WMP7\" CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\" $hwstr><PARAM NAME=\"URL\" VALUE=\"$url\"> <param name=\"stretchToFit\" value=\"$fit\" /> <param name=\"windowlessVideo\" value=\"$full\" /> <param name=\"autoStart\" value=\"$autostart\" /></OBJECT>"; return $output; } ?>
[edit] See Also
Also see http://sctv.bntbtc.com and Extension:WMPEmbed/bntv for this projects brain child.
