Difference between revisions of "Xmoov-php"
TMMStephenY (talk | contribs) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{CARMA1 Manual | |
− | + | | show_extras_section = true | |
− | + | }} | |
− | + | [[CARMA]] contains support for Xmoov-php, which can be used as a pseudo flash streamer. This allows your members to skip ahead while streaming video content from your [[Ct#Site|site(s)]] without having to first download the entire file. | |
− | + | '''Note:''' xmoov-php does not support playback of .mp4 files. If you wish to allow streaming for .mp4 files, we recommend that you use [http://www.longtailvideo.com/ jwplayer] or [http://flowplayer.org/ flowplayer] and install any necessary plugins for .mp4 playback. | |
+ | Allowing for pseudo flash streaming provides two great advantages: | ||
+ | * Your members will be able to instantly skip around a movie they are streaming. | ||
+ | * When a member skips ahead when playing back a flash video, it will save you a considerable amount of bandwidth. | ||
+ | |||
+ | '''''As xmoov-php is not part of CARMA, we can not provide direct support in setting it up for you, however the following provides a quick setup guide to help you.''''' | ||
+ | |||
+ | In order to set up xmoov-php, you must first retrieve the xmoov-php streamer and replace the default [[CARMA]] flash player with a media player that supports streaming. You will also need to make some minor adjustments to xmoov-php in order for it to work with [[CARMA]]. | ||
== XMOOV-PHP == | == XMOOV-PHP == | ||
− | You can get the script from http://xmoov.com/xmoov-php/source/ | + | You can get the script for xmoov-php playback from http://xmoov.com/xmoov-php/source/. After getting the file, save it as ''xmoov.php'' inside the ''carma/site_scripts'' directory. |
=== Modifications === | === Modifications === | ||
− | |||
− | Change 134: | + | In order for xmoov-php to work with [[CARMA]], you will need to modify the following lines in the xmoov-php code. (Your line numbers may vary slightly, make sure to look for the actual code instead) |
+ | |||
+ | Change line 134: | ||
<pre>define('XMOOV_GET_POSITION', 'position');</pre> | <pre>define('XMOOV_GET_POSITION', 'position');</pre> | ||
To: | To: | ||
Line 25: | Line 33: | ||
To: | To: | ||
<pre>if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName))</pre> | <pre>if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName))</pre> | ||
− | |||
=== Configuration === | === Configuration === | ||
− | + | Xmoov-php's script contains many different configuration options that you can change in order to make it behave differently. However, the only option that you need to change in order for xmoov-php to work with [[CARMA]] is the XMOOV_PATH_FILES configuration: | |
Change line 36: | Change line 36: | ||
Line 35: | Line 42: | ||
To: | To: | ||
<pre>define('XMOOV_PATH_FILES', '/full/path/to/carma/cms_data/');</pre> | <pre>define('XMOOV_PATH_FILES', '/full/path/to/carma/cms_data/');</pre> | ||
− | |||
== Flash Player == | == Flash Player == | ||
− | + | [[CARMA]]'s default flash player does not contain support for streaming. However, there are a few different flash players that support this feature. | |
+ | The following are example instructions for [http://www.longtailvideo.com/players/ JW Player]. We recommend this player, as it has a considerable amount of advanced features and is fairly simple to set up. | ||
=== Get Files === | === Get Files === | ||
− | You can | + | |
+ | You can download JW Player from its website at http://www.longtailvideo.com/players/jw-flv-player/. | ||
+ | |||
+ | After you have downloaded the file, unzip its contents and upload the following files to the ''site_script'' directory in ''carma/site_scripts'': | ||
* player.sqf | * player.sqf | ||
* swfobject.js | * swfobject.js | ||
− | If you have your member site | + | If you have set up your member site with symbolic links (symlinks) to your ''site_scripts'' files, you will need to set up a symlink for these files as well. |
=== Template Modifications === | === Template Modifications === | ||
− | There are two different formats to call up the flash player. The default | + | |
+ | There are two different formats that can be used to call up the flash player. The default method uses the ''view_clip.php'' [[Ct#Template|template]], while the other method uses the ''$carma_video'' [[Smarty]] script on another page. | ||
+ | |||
+ | The following provides information regarding both methods. | ||
==== view_clip.php ==== | ==== 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: | + | |
+ | On the view_clip [[Ct#Template|template]], you will need to change the code for the flash mime type. You only need to edit the code after: | ||
<pre> | <pre> | ||
{elseif $mime == 'video/x-flv'} | {elseif $mime == 'video/x-flv'} | ||
Line 81: | Line 95: | ||
</pre> | </pre> | ||
− | You should replace ''470'' and ''320'' with your desired width and height. | + | You should replace ''470'' and ''320'' with your desired pixel width and height. |
==== $carma_video ==== | ==== $carma_video ==== | ||
− | If you are | + | If you are using ''$carma_video'' to call the flash player from another page, you must first get the ''galid'' data for the video you wish to call. 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 will automatically be done for you. |
− | Once you have the {$carma_video} variable you can then show the video with code like | + | Once you have the {$carma_video} variable, you can then show the video with code like the following: |
<pre> | <pre> | ||
Line 109: | Line 123: | ||
</pre> | </pre> | ||
− | + | * $type is a variable that holds the specified video's 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. |
Latest revision as of 12:46, 12 November 2010
CARMA contains support for Xmoov-php, which can be used as a pseudo flash streamer. This allows your members to skip ahead while streaming video content from your site(s) without having to first download the entire file.
Note: xmoov-php does not support playback of .mp4 files. If you wish to allow streaming for .mp4 files, we recommend that you use jwplayer or flowplayer and install any necessary plugins for .mp4 playback.
Allowing for pseudo flash streaming provides two great advantages:
- Your members will be able to instantly skip around a movie they are streaming.
- When a member skips ahead when playing back a flash video, it will save you a considerable amount of bandwidth.
As xmoov-php is not part of CARMA, we can not provide direct support in setting it up for you, however the following provides a quick setup guide to help you.
In order to set up xmoov-php, you must first retrieve the xmoov-php streamer and replace the default CARMA flash player with a media player that supports streaming. You will also need to make some minor adjustments to xmoov-php in order for it to work with CARMA.
XMOOV-PHP
You can get the script for xmoov-php playback from http://xmoov.com/xmoov-php/source/. After getting the file, save it as xmoov.php inside the carma/site_scripts directory.
Modifications
In order for xmoov-php to work with CARMA, you will need to modify the following lines in the xmoov-php code. (Your line numbers may vary slightly, make sure to look for the actual code instead)
Change line 134:
define('XMOOV_GET_POSITION', 'position');
To:
define('XMOOV_GET_POSITION', 'start');
Change line 170:
if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName) && ereg('^[^./][^/]*$', $fileName))
To:
if(file_exists($file) && strrchr($fileName, '.') == '.flv' && strlen($fileName) > 2 && !eregi(basename($_SERVER['PHP_SELF']), $fileName))
Configuration
Xmoov-php's script contains many different configuration options that you can change in order to make it behave differently. However, the only option that you need to change in order for xmoov-php to work with CARMA is the XMOOV_PATH_FILES configuration:
Change line 36:
define('XMOOV_PATH_FILES', 'library/media/video/');
To:
define('XMOOV_PATH_FILES', '/full/path/to/carma/cms_data/');
Flash Player
CARMA's default flash player does not contain support for streaming. However, there are a few different flash players that support this feature.
The following are example instructions for JW Player. We recommend this player, as it has a considerable amount of advanced features and is fairly simple to set up.
Get Files
You can download JW Player from its website at http://www.longtailvideo.com/players/jw-flv-player/.
After you have downloaded the 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 set up your member site with symbolic links (symlinks) to your site_scripts files, you will need to set up a symlink for these files as well.
Template Modifications
There are two different formats that can be used to call up the flash player. The default method uses the view_clip.php template, while the other method uses the $carma_video Smarty script on another page.
The following provides information regarding both methods.
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> <div id="player">This text will be replaced</div> <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 pixel width and height.
$carma_video
If you are using $carma_video to call the flash player from another page, you must first get the galid data for the video you wish to call. 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 will automatically be done for you.
Once you have the {$carma_video} variable, you can then show the video with code like the following:
{if $smarty.request.type == 'flv_high'} {assign var=type value=$smarty.get.type} <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','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 that holds the specified video's 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.