Generate Flash Videos
This article applies to CARMA versions 1.2.2.x and higher. It explains how to generate flash video from existing videos in CARMA and display that video to your members.
The first thing to do when setting up CARMA to use flash is to set up the correct path. In the file carma/includes/create_flash.sh, make sure the correct paths to CARMA and PHP are specified. After the paths are correct, change the permissions for create_flash.sh and create_flash.php to 755 using the chmod command.
Next, ensure the necessary files are installed. Go to the Configuration Admin and look under the Image/Video Manipulation section, you should see entries for "MENCODER" and "FLVTOOL2". Both these programs need to be installed and have the correct path specified.
After the paths to both MENCODER and FLVTOOL2 are set, click on the 'video formats' tab to get the additional options for converting video format to Flash. Checking the 'flash' checkbox lets you to specify the scale, the bitrate, the Frames Per Second (FPS) and the BR (audio bitrate -- we recommend leaving BR at 36). The last column has two blue arrows; these arrows start generating Flash movies for every set in this video format -- generating the videos as fast as possible in the background.
To display videos, make sure your site_scripts directory has 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 the site_scripts directory:
ln -s ../flash/swfobject.js ./swfobject.js ln -s ../flash/player.swf ./flash_player.swf
Note that the original file is player.swf and the new file is flash_player.swf. The templates look for flash_player.swf
Now that there are new files in site_scripts, you need to link them to
the specific site where you want to use them. This is like setting up
the site in CARMA for the first time. Go to the document root for your
members area and run: ln -s /path/to/carma/site_scripts/* ./
This updates your symbolic links for that site, including the new links
required by Flash.
Finally, set up the templates to use the flash player. If you are creating a new site, this should already be set up. If you are adding flash to a site that you have already customized, you may need to add the following lines to your view_clip template. These are a series of 'elseif' statements in this template telling CARMA what to display depending on the video type.
{elseif $mime == 'video/x-flv'} {* Video type flv *} {literal} <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'; } </script> {/literal} <div id="videoholder" style="width:100%;height:100%;"> </div> <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"); so.write("videoholder"); </script>