Flash Player

From TMM Wiki
Revision as of 10:35, 9 April 2009 by Tmmdan (talk | contribs)
Jump to navigationJump to search
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



Using a Custom Flash Player

You are not limited to use the flash player that is provided with Carma. To use a custom flash player you need to copy the files into the carma/site_scripts/ directory and set up any sym-links if your files are linked individually. After that is done you have to adjust the templates to use your player instead of ours. Most 3rd party players provide documentation in order to configure them. The only thing you will need for use is the URL to the flash file. If the flash player is being used on view_clip.php, you can simply use the {rebuild_link} template function:

{rebuild_link without="style" using="GET" encode=1 start=$smarty.server.HTTP_HOST}

To use a Flash player on a page that is not view_clip.php, such as index.php, your video source must be entered manualy. Most flash players will want the path url encoded. For more information about URL encoding, please see the Percent Encoding article on Wikipedia.

Some flash players may need the path to end in a .flv extension so it knows it is a flash file. If this is the case then add then to the end of the URL to view_clip.php

&ext=file.flv

This will assist in helping the flash player identifying the file as flash.


Using a Flash Player on a different template

There are two different formats to call up the flash player. The default way, by using view_clip.php, and by using $carma_video on another page. [edit] view_clip.php

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>

This text will be replaced

<script type="text/javascript"> var so = new SWFObject('player.swf','mpl','470','320','9'); so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true'); so.addParam('flashvars','&file={$path}/{$filename}&streamer=xmoov.php'); so.write('player'); </script>

You should replace 470 and 320 with your desired width and height. [edit] $carma_video

If you are calling the flash player from another page you will first have to get the video data for the galid belonging to your video. 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 is done automatically for you).

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

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

<script type="text/javascript" src="swfobject.js"></script>

This text will be replaced

<script type="text/javascript"> var so = new SWFObject('jw_player.swf','mpl','470','320','9'); so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true'); so.addParam('flashvars','&file={$carma_video.path}/{$carma_video.files.$type[0]}&streamer=xmoov.php'); so.write('player'); </script>


{/if}

   * $type is a variable holding the video short name
         o 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.