FCPlayer How-tos

IndexHow to use The options parameter to add options to your videos.



where is it
By now, you should have installed FCPlayer, and know how to call the FCPlayer.play function to play your videos. If not, go back and read the previous sections. In this tutorial we will focus on the options parameter, which is an optional fourth argument to the FCPlayer.play function.


The FCPlayer.play function again...

The use of this function was discussed in How to play a video. Once again, here is its general form:

FCPlayer.play( streamer, path/resource, file, [options] )

The fourth argument of this function is the options object. The options object allows you to control a variety of player behaviors, as we will see below.
.


Contructing the options argument.

You need to make sure you use the correct syntax when adding options to your videos. The options object is constructed using Javascript object literal notation. Here we introduce you to this notation, and give you a few simple examples.

First, the FCPlayer.play function without an options argument. The example below shows a simple call to FCPlayer.play. We are going to use a vertical representation of the function from here on out.


FCPlayer.play(
'null',
'null',
'myVideo.flv'
)

A play call with only the first three arguments.


Add the options argument with curly braces. The example below adds the options argument to our play call, as shown in red. The argument, in this case, is just a pair of curly braces with nothing inside. As the options object is empty, no options are presently being added.


FCPlayer.play(
'null',
'null',
'myVideo.flv',
{}
)

A play call with an "empty" options argument.
Notice that each argument is followed by a comma, except the last one.

Now, add an option... any option. Here we add the playState option to our example. The playState option tells the player whether to start playing the video immediately on loading, show the first frame and pause, or just stand by. The three values that this option can take are, accordingly, "Run" and "FirstFrame" and "Standby".


FCPlayer.play(
'null',
'null',
'myVideo.flv',
{
playState:'FirstFrame'
}

)

This video will now show the first frame and pause.
Observe the syntax, which is, in general, option:value

More options, please. Let's add a few more options to our example. We will add the volume option and the quality option. The volume option specifies the starting volume level for this video. The range of this option is from 0 to 1. The quality option, if enabled, tells the player to turn on video smoothing. This option takes the values, true or false.


FCPlayer.play(
'null',
'null',
'myVideo.flv',
{
playState:'FirstFrame',
volume:.1,
quality:true
}

)

Notes:
Numbers and things likes true or false are standard values, so they don't need the quotes around them. It would not hurt to put quotes around them, though. ie quality:'true'
On the other hand, labels like 'FirstFrame' always need quotes around them.
Again, each option is followed by a comma, except the last.

Thats's about it. You may insert any combination of options into to your play calls.



A list of available options.

A full list of optional parameters with their description and usage can be found in the section: A list of the optional parameters for use with FCPlayer.play




If you have a pre-sales question, submit your inquiry via our sales contact page. For general, non-sales inquiries, contact us at support@fastcatsoftware.com.

Solution Graphics