Difference between revisions of "Xmoov-php"

From TMM Wiki
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
}}
 
}}
  
Xmoov-php can be used with Carma as a pseudo flash streamer. This will allow your members to skip ahead in a video with out first having to download the entire file.  This has two great advantages:
+
[[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.
* You members will be able to skip around the movie instantly
 
* When a member skips ahead in a video, it will save you a lot of bandwidth.
 
  
'''''As xmoov-php is not part of CARMA, we can not provide direct support in setting it up for you, however below is a quick setup guide to help you.'''''
+
'''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.
  
In order to set this up you will need to retrieve the xmoov-php streamer and replace the default flash player with a media player that supports streaming. Additionally, you will need to make some minor adjustments to xmoov-php in order for it to work with carma.
+
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/ Save the file as as xmoov.php in side the ''carma/site_scripts/'' directory.
+
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 ===
In order for xmoov-php to work with carma you need to modify the following code. (Your line number maybe slightly different)
 
  
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 29: 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 ===
  
There are lots of configuration options that you can change in the xmoov-php script to make to behave differently. The only one you to change to get it to work with CARMA is the XMOOV_PATH_FILES 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 39: 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 ==
  
The default CARMA flash player does not have support for streaming. There are a few different flash players that have this support. Below is example instructions for JW Player[http://www.longtailvideo.com/players/].  We chose this player since it has a lot more advance features and is fairly simple to set up.
+
[[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 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''
+
 
 +
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 set up with symbolic links to the site_scripts files the you will also need to set up a symlink for these files as well.
+
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 way, by using view_clip.php, and by using $carma_video on another page.
+
 
 +
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 85: 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 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).
+
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 this
+
Once you have the {$carma_video} variable, you can then show the video with code like the following:
  
 
<pre>
 
<pre>
Line 113: Line 123:
 
</pre>
 
</pre>
  
* $type is a variable holding the video short name
+
* $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.   
+
** 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.
+
* [0] is the clip number you are showing, starting at 0.

Latest revision as of 12:46, 12 November 2010

CARMA
Extras
The Support Admin
Admin Areas
CARMA Home
Pseudo Streaming
Flash Player
Using mp4 Videos
Zipping Content
Third Party Content
X-Sendfile
Xmoov-php
TMMid

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.