Difference between revisions of "Generate Flash Videos"

From TMM Wiki
Jump to navigationJump to search
 
Line 3: Line 3:
 
}}
 
}}
  
This article applies to [[CARMA]] versions 1.2.2.x and higher. It explains
+
'''Note''': This article applies to [[CARMA]] versions 1.2.2.x and higher.  
how to generate flash video from existing videos in CARMA and display
 
that video to your members.  If your looking for an article on how to set
 
a flash player with CARMA other then the default or show a flash video on
 
the a page other then view_clip.php please refer to the article '[[Flash Player]]'
 
  
The first thing to do when setting up CARMA to use flash is to set up
+
[[CARMA]] allows you to generate flash videos from already existing videos in your [[CARMA]] system. You can then display those flash videos to your [[Ct#Member|members]].
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 <tt>chmod</tt> command.
 
  
Next, ensure the necessary files are installed. Go to the Configuration Admin
+
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.
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
+
== Setting Up Flash for CARMA ==
'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
+
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/create_flash.sh'' 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 ''create_flash.sh'' and ''create_flash.php'' to 755.
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
+
You should then check to see if the necessary files for Flash playback are installed. You can do so through the [[CARMA Configuration Admin|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 [[CARMA Configuration Admin|Configuration Admin]].
the ''site_scripts'' directory:
+
 
 +
[[File:Carma mencoder.PNG|450px|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 [[CARMA Configuration Admin|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:
  
 
<pre>
 
<pre>
Line 39: Line 34:
 
</pre>
 
</pre>
  
Note that the original file is player.swf and the new file is
+
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.
flash_player.swf. The templates look for flash_player.swf
+
 
 +
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: <code>ln -s /path/to/carma/site_scripts/* ./</code>
 +
 
 +
This will update your symbolic links (symlinks) for the specified site, including the new links that are required by Flash.
 +
 
 +
=== Templates ===
  
Now that there are new files in site_scripts, you need to link them to
+
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 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: <code>ln -s /path/to/carma/site_scripts/* ./</code>
 
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
+
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.
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.
 
  
 
<pre>
 
<pre>

Latest revision as of 13:15, 25 September 2010

CARMA
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/create_flash.sh 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 create_flash.sh 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.

Templates

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 *}
{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>