|
FCPlayer How-tos |
IndexHow to play a video.
|

|
Now that you have installed FCplayer in your web page, you are ready to start playing videos, (or displaying pictures). We will cover displaying images in the next section. This section will focus on playing movies using the built in FCPlayer.play function. FCPlayer can play flvs and mp4's delivered by progressive download, psuedo-streaming, or full streaming technologies. This section shows you how to set up FCPlayer, in accordance with your video delivery method.
Getting Started
If this is your first time using using FCPlayer, you need to read these little tutorials first, before continuing.
Where do I put the videos?
For progressive downloads, place your flvs in the FCPlayer/videos folder. FCPlayer is set, by default, to play videos from this folder. For streaming videos, you do not need to use this folder, you just need to set it up so that your streaming resource (FMS, Red5, etc.) can find them. You can change the default video folder at a later time by setting the videoRoot variable in FCPlayer/config/FCPlayerConfig.js. A discussion of FCPlayer configuration variables can be found in Setting the global configuration for your player.
The FCPlayer.play function
You use the FCPlayer.play function to communicate with the FCPlayer video player. With this function, you can tell FCPlayer which video to play, how to play it, and which options to use.
The general form of this function is:
FCPlayer.play( streamer, path/resource, file, [options] )
The four arguments are defined as follows:
streamer: (String)
This indicates which method will be used to stream videos.
path/resource: (String)
For progressive downloads and psuedo-streaming, this defines the path to the video file. If the value is 'null', FCPlayer will look for the video file in the default video path. For streaming video (via. FMS Red5, etc) this defines the application resource which will serve the stream.
file: (String)
The video file that will be played.
options: (Object)
Defines various options that will be used with playback.
The options argument is optional, and will be discussed in the section: Use the options parameter to add options to your videos.
Below, we will take a look at how you use the first three arguments to play videos from a variety of media sources.
Playing progressive downloads.
Progressive downloads are the simplest way to to deliver video to your end users.
1) Place your videos in the video folder, which is set, by default, to FCPlayer/videos.
2) Next, call FCPlayer to play one of your videos.
FCPlayer.play( 'null', 'null', 'myVideo.flv')
For progressive downloads, the first argument is always 'null'. If the path/resource argument is null, the player will look for the video in the default video folder.
You can change the default video folder by setting the videoRoot variable in FCPlayer/config/FCPlayerConfig.js to the path of your video folder.
You may also call FCPlayer.play with the path to your video included. ie.
FCPlayer.play( 'null', 'http://www.yoursite.com/videofiles/','myVideo.flv')
Note: Make sure the path variable ends in a forward slash.
A discussion of FCPlayer configuration variables can be found in Setting the global configuration for your player.
Playing streaming videos.
FCPlayer has only been tested on Flash Media Server and Red5 at this time, but it should work on Wowza as well. To play streaming media:
1) Call FCPlayer to play one of your videos, ie.
FCPlayer.play( 'fms','rtmp://someDomain/someApp','sample')
The first argument should be the name of your server. 'fms' , 'red5', 'wowza', etc.
The second argument is the application resource that will serve your streaming video. This is specific to your server and your setup.
The third argument is the name of your video file, in this case 'sample'. The actual file in this case would be sample.flv, however, in FMS, you usually do not include the '.flv' part as part of the file name.
Here are some more examples.
FCPlayer.play( 'fms','rtmp://someDomain/someApp','mp4:sample')
Here we are playing the file 'sample.mp4'. Notice the syntax when calling this file.
FCPlayer.play( 'red5','rtmp://someDomain/someApp','sample.flv')
Playing the sample.flv file in Red5.
Playing psuedo-streaming videos with xmoov.php.
FCPlayer includes a copy of the xmoov.php script, which allows you to deliver psuedo-streaming (progressive download with seek-ahead capabilities) video. In order to use this script, your server must be running PHP4 or above. Below are the steps needed to implement this script:
1) You will need to open up the xmoov.php file, which is in the folder /FCPlayer/streamers.
2) Next, in the xmoov.php file, find the line of code that begins:
and enter in the full system path to your server root directory. Here is an example:
define('XMOOV_PATH_ROOT', 'C:/Websites/Production Websites/Your Site/');
3) Find the line of code that begins:
define('XMOOV_PATH_FILES'
and enter in the path to your video directory. Here is an example:
define('XMOOV_PATH_FILES', 'FCPlayer/videos/');
4) Place your videos in the folder you specified for XMOOV_PATH_FILES.
5) Call FCPlayer.play like this:
FCPlayer.play( 'xmoov','null','sample.flv')
The xmoov.php script can only be used with videos that have been encoded with keyframes metadata. Visit xmoov.com for more info.
H264 psuedo-streaming.
FCPlayer works with the H264 streaming plugin available from h264.code-shop.com. This plugin, which is available for Lighttpd, Apache and Ngingx, and allows you to deliver psuedo-streaming (progressive download with seek-ahead capabilities) H264 (mp4) video.
To use this plugin, call FCPlayer.play like this:
FCPlayer.play( 'codeshop_h264','null','sample.flv')
Playing psuedo-streaming videos with other scripts.
Comming Soon
|
|
|
| |