From TMM Wiki
Jump to navigationJump to search
The Support Admin
Admin Areas
Pseudo Streaming
Flash Player
Using mp4 Videos
Zipping Content
Third Party Content

CARMA contains support for Xmoov-php, which can be used as a pseudo flash streamer. This allows your members to skip ahead while streaming video content from your site(s) without having to first download the entire file.

Note: xmoov-php does not support playback of .mp4 files. If you wish to allow streaming for .mp4 files, we recommend that you use jwplayer or flowplayer and install any necessary plugins for .mp4 playback.

Allowing for pseudo flash streaming provides two great advantages:

  • Your members will be able to instantly skip around a movie they are streaming.
  • When a member skips ahead when playing back a flash video, it will save you a considerable amount of bandwidth.

As xmoov-php is not part of CARMA, we can not provide direct support in setting it up for you, however the following provides a quick setup guide to help you.

In order to set up xmoov-php, you must first retrieve the xmoov-php streamer and replace the default CARMA flash player with a media player that supports streaming. You will also need to make some minor adjustments to xmoov-php in order for it to work with CARMA.


You can get the script for xmoov-php playback from http://xmoov.com/xmoov-php/source/. After getting the file, save it as xmoov.php inside the carma/site_scripts directory.


In order for xmoov-php to work with CARMA, you will need to modify the following lines in the xmoov-php code. (Your line numbers may vary slightly, make sure to look for the actual code instead)

Change line 134:

define('XMOOV_GET_POSITION', 'position');


define('XMOOV_GET_POSITION', 'start');

Change line 170:

if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName) && ereg('^[^./][^/]*$', $fileName))


if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName))


Xmoov-php's script contains many different configuration options that you can change in order to make it behave differently. However, the only option that you need to change in order for xmoov-php to work with CARMA is the XMOOV_PATH_FILES configuration:

Change line 36:

define('XMOOV_PATH_FILES', 'library/media/video/');


define('XMOOV_PATH_FILES', '/full/path/to/carma/cms_data/');

Flash Player

CARMA's default flash player does not contain support for streaming. However, there are a few different flash players that support this feature.

The following are example instructions for JW Player. We recommend this player, as it has a considerable amount of advanced features and is fairly simple to set up.

Get Files

You can download JW Player from its website at http://www.longtailvideo.com/players/jw-flv-player/.

After you have downloaded the file, unzip its contents and upload the following files to the site_script directory in carma/site_scripts:

  • player.sqf
  • swfobject.js

If you have set up your member site with symbolic links (symlinks) to your site_scripts files, you will need to set up a symlink for these files as well.

Template Modifications

There are two different formats that can be used to call up the flash player. The default method uses the view_clip.php template, while the other method uses the $carma_video Smarty script on another page.

The following provides information regarding both methods.


On the view_clip template, you will need to change the code for the flash mime type. You only need to edit the code after:

{elseif $mime == 'video/x-flv'}
{* Video type flv *}

and before

{elseif $mime == 'video/mpeg'}
{* Video type mpg, mpeg, mpe *}

Replace the flash code that is already there with the following code:

<script type="text/javascript" src="swfobject.js"></script>
<div id="player">This text will be replaced</div>
<script type="text/javascript">
var so = new SWFObject('player.swf','mpl','470','320','9');

You should replace 470 and 320 with your desired pixel width and height.


If you are using $carma_video to call the flash player from another page, you must first get the galid data for the video you wish to call. You can do this with a call to {carma_show_video galid='<galid>' data_only=1}, unless you are on show_video.php, in which case this will automatically be done for you.

Once you have the {$carma_video} variable, you can then show the video with code like the following:

{if $smarty.request.type == 'flv_high'}
{assign var=type value=$smarty.get.type}

<script type="text/javascript" src="swfobject.js"></script>
<div id="player">This text will be replaced</div>
<script type="text/javascript">
var so = new SWFObject('jw_player.swf','mpl','470','320','9');

  • $type is a variable that holds the specified video's short name
    • This can be changed to be $carma_video.files.flv_type if you always know the type of video.
  • [0] is the clip number you are showing, starting at 0.