Generate Flash Videos

From TMM Wiki
Jump to navigationJump to search
Video Content Admin
The Video Content Admin
Adding Content
Video Clips
Out of Order Video Thumbnails
Content Set Locations
Content Set Categories
Video Format
Flash Player
Generate Flash Videos
Using mp4 Videos
Video Content Names

Note: This article applies to CARMA versions 1.2.2.x and higher.

CARMA allows you to generate flash videos from already existing videos in your CARMA system. You can then display those flash videos to your members.

For information on changing the default flash player, or showing a flash video on a page other than view_clip.php, please see our Flash Player article.

Setting Up Flash for CARMA

Before you begin setting up CARMA to use flash, make sure the correct path for Flash is set. To do so, check the carma/includes/ file and make sure the correct paths to CARMA and PHP are specified. Once you have ensured that the paths are correct, use the "chmod" PHP command to change the permissions for and create_flash.php to 755.

You should then check to see if the necessary files for Flash playback are installed. You can do so through the Configuration Admin. Under the "Image/Video Manipulation" section, there will be settings labeled "MENCODER" and "FLVTOOL2". Both of these programs must be installed on your server, and must have the correct path specified in the Configuration Admin.

Setting the path of MENCODER and FLVTOOL2

Configuring Flash

After you have set the paths to MENCODER and FLVTOOL2, click on the "Video Formats" tab in the Configuration Admin. This will bring up additional options for converting your existing videos to Flash videos.

Next to the video format you wish to allow Flash for, check the "Flash" checkbox. This will allow you to specify the video's scale, bitrate, FPS (Frames Per Second), and its BR (Audio bitrate -- we recommend leaving this setting at 36).

You will then see two action icons-- one marked with two blue arrows, and one marked with two red arrows. The "Generate Flash Video Files" icon (blue arrows) will generate Flash videos for every set in this video format. CARMA generates Flash videos in the background, so that you can keep working while the videos are being converted. The "Re-Generate Flash Videos" icon (red arrows) allows you to re-convert the videos in that file format to Flash.

Displaying Videos

In order to display videos, you must first make sure that your site_scripts directory contains the flash_player.swf and the swfobject.js files. If you do not see these two files in your site_scripts directory, run the following commands from that directory:

ln -s ../flash/swfobject.js ./swfobject.js
ln -s ../flash/player.swf ./flash_player.swf

Note in the above example that the original file here is "player.swf", and the new file is "flash_player.swf". The templates used in CARMA will look for "flash_player.swf", so make sure you change your file.

After you put your new files in site_scripts, you will then need to link them to the specific site where they will be used.

To do so, go to the document root for your members area and run the following command: ln -s /path/to/carma/site_scripts/* ./

This will update your symbolic links (symlinks) for the specified site, including the new links that are required by Flash.


The final step to complete before you use the Flash player is setting up your templates. If you are creating a new site in CARMA, this should already be set up. However if you are adding Flash capabilities to a site that you have already customized, you may need to make some changes in your view_clip template. You can find this template in the Members Area Templates.

The following code is an example of changes you may need to make to your view_clip template. These are a series of 'elseif' statements in the template, which tell CARMA what to display depending on the video type.

{elseif $mime == 'video/x-flv'}
{* Video type flv *}
<script type="text/javascript" src="swfobject.js"></script>
<script language="JavaScript" type="text/JavaScript">
function en_flash_thisMovie(en_flash_movieName){
if (window.document[en_flash_movieName]) {
return window.document[en_flash_movieName];
if (navigator.appName.indexOf("Microsoft Internet")==-1){
if (document.embeds && document.embeds[en_flash_movieName])
return document.embeds[en_flash_movieName];
else {
return document.getElementById(en_flash_movieName);

function en_flash_resize(en_flash_args) {
var en_flash_arr = en_flash_args.split('_');
document.getElementById('videoholder').style.width = en_flash_arr[0] + 'px';
document.getElementById('videoholder').style.height = en_flash_arr[1]+ 'px';

<div id="videoholder" style="width:100%;height:100%;">
<script type="text/javascript">
var so = new SWFObject("flash_player.swf?{$time}", "flash", "100%", "100%", "8");
so.addParam("quality", "high");
so.addParam("scale", "noscale");
so.addParam("swLiveConnect", "true");
so.addParam("allowFullScreen", "true");

so.addVariable("en_flash_movie_width", "auto");
so.addVariable("en_flash_movie_height", "auto");
so.addVariable("en_flash_movie_name", "{rebuild_link without="style" using="GET" encode=1 start=$smarty.server.HTTP_HOST}");
//so.addVariable("en_flash_movie_width", "320");
//so.addVariable("en_flash_movie_height", "240");
so.addVariable("en_flash_jump_value", "6");