Difference between revisions of "Flash Player"
Line 2: | Line 2: | ||
| show_video_content_admin_section = true | | show_video_content_admin_section = true | ||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
== Using a Custom Flash Player == | == Using a Custom Flash Player == |
Revision as of 10:04, 9 April 2009
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}
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.
JW Player
The JW Player[1] is a popular and freely available flash player. It is fairly simple to set up and has a lot of advance features that make the player stand out.
Get the Player
You can get the JW Player from http://www.longtailvideo.com/players/jw-flv-player/. Once you've download 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 your member site set up with symbolic links to the individual files in site_scripts, instead of the folder, the you will also need to set up a symbolic link for these files as well.
Modifying the Template
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('jw_player.swf','mpl','640','480','9'); so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true'); so.addParam('flashvars','&file={rebuild_link without="style" using="GET" encode=1}%26ext%3Dfile.flv'); so.write('player'); </script>
You should replace 640 and 480 with your desired width and height.
Using a Flash Player on a different template
To use a Flash player on a page that is not view_clip.php, such as index.php, your video source must be entered manually. Most flash players will want the path url encoded. For more information about URL encoding, please see the Percent Encoding article on Wikipedia.
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. Below is an example of this. The code assumes that the video short name is flv_high
{assign var=type value='flv_high'} {assign var=galid value='1303'} {assign var=num value='0'} <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','640','480','9'); so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true'); so.addParam('flashvars','&file=view_clip.php%3Fgalid%3D{$galid}%26num%3D{$num|default:0}%26type%3D{$type}%26ext%3Dfile.flv'); so.write('player'); </script>
- $type is a variable holding the video 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.