Должно работать
<?php
// SNIPPET NAME: JWPlayer
// SNIPPET DESCRIPTION: A Snippet to place the JW FLV Player into a MODx Page
// VERSION 1.1
/*---------------------------------
================
:: CREDIT
================
This Snippet writes the code necessary to properly display the JW FLV player in MODx
THE JW FLV player is developed by Jeroen Wijering and is available at http://www.jeroenwijering.com/
Respect the developer's license: http://creativecommons.org/licenses/by-nc-sa/3.0/
MODx Snippet thingie by George D. Carstensen
www.anablepo.com
================
:: INSTALL
================
- Download the .zip at http://www.jeroenwijering.com/?item=JW_FLV_Player
- Unzip the file and rename it 'embed'
- Place /embed/ inside another directory entitled 'JWPlayer'
- Upload the JWPlayer directory to your assets/snippets/ directory
- Paste the text of this document in a snippet - entitled 'JWPlayer'
- Reccommended: Create a Templave Variable (TV) Called 'videosrc' and
Set the input type as 'file'
* I'm not packaging these files in the snippet download - because the player is
sometimes updated - and you probably want the newest one.
* Tested and written for JW FLV MEDIA PLAYER v. 4.0
================
:: USAGE
================
- Simple! Place the snippet call [[JWPlayer? &src=[*videosrc*]]] in your document.
- If you chose to create the TV above, use the call [[JWPlayer? &src=[*videosrc*]]]
and set the filename using the TV dialog in your document.
- If you choose to use paramaters, simply append them like so:
[[JWPlayer? &src=[*videosrc*]¶meter1=value1¶meter2=value2&]]
(kind-of like a URL line, but make sure there's a space between the ? and the &.)
- If you use the player more than once in a page with different sources, scrap the TV and do this:
[[JWPlayer? &src=path/to/file]]
================
:: AVAILABLE PARAMETERS
================
*- All of these parameters defaults are editable below
&width - width in px
&height - height in px
&logo - location of logo from MODx install root. (ex: assets/images/monkeys/logo.png )
&fullscreen - enables fullscreen function ( true | false )
&stretching - specifies stretch type (uniform | fill | exactfit | none )
-'uniform' plays the video and fills up the frame - using black bars to perserve aspect
-'fill' fills up the frame while maintaining aspect ratio - may result in clipping.
-'exactfit' stretches the movie to fit the frame - aspect ratio is out the window
-'none' doesn't stretch at all - just plays the video in it's original dimensions.
Clipping possible.
&controlbar - displays controlbar either as a floaty transparent thing, or the traditional
bottom ( float | over | none )
================
:: FORMATS
================
Baseline h.264. The player isn't too picky about the file extension - I use .mp4, but I tested it with .flv and .m4v.
To be kind, stick to about 600/700 mb/sec or less.
---------------------------------*/
//EDITABLE PARAMETER DEFAULTS - only edit the stuff in Quotes - " ~ "
$width = (isset($width)) ? strtolower($width) : "470" ; //default video width in px
$height = (isset($height)) ? strtolower($height) : "320" ; //default video height in px
$logo = (isset($logo)) ? strtolower($logo) : "assets/images/system/vidlogo.png" ; //location of logo for overlay
$fullscreen = (isset($fullscreen)) ? strtolower($fullscreen) : "true" ; //Enable fullscreen function
$stretching = (isset($stretching)) ? strtolower($stretching) : "fill" ; //Stretching options available: uniform | fill | exactfit | none
$controlbar = (isset($controlbar)) ? strtolower($controlbar) : "over" ; //Controlbar location options available: bottom | over | none
//FINISH EDITABLE CONTENT - if you don't know what you're doing - Keep Out!
$jw_base = $modx->config['site_url'] . "assets/snippets/JWPlayer/";
$Site_base = $modx->config['site_url'];
$file = $modx->config['site_url'] . $src;
$logosrc = $modx->config['site_url'].$logo;
$jwpid = mt_rand(); //Generate random id for div element
echo "<script type=\"text/javascript\" src=\"" . $jw_base."embed/swfobject.js\"></script> \n";
echo "<div id=\"".$jwpid."\"></div>\n<script type=\"text/javascript\"> \n";
echo "var so = new SWFObject('" . $jw_base . "embed/player.swf','mpl','$width','$height','9'); \n";
echo "so.addParam('allowscriptaccess','always'); \n";
echo "so.addParam('allowfullscreen','true'); \n";
echo "so.addParam('flashvars','&file=$file&logo=$logosrc&skin=/upload/simple.swf&controlbar=$controlbar&fullscreen=$fullscreen&stretching=$stretching'); \n";
echo "so.write('".$jwpid."'); \n";
echo "</script>";
?>