cfmediaplayer
Description
Creates an in-built media player that lets you play FLV, MPEG-3, and MPEG-4 files.
Categories
History
ColdFusion
9: Added this tag.
Syntax
<cfmediaplayer
align="alignment option"
autoplay="true|false"
bgcolor="hexadecimal value"
hideborder="true|false"
hidetitle="true|false"
controlbar="true|false"
fullScreenControl="yes|no"
name="name"
onComplete="JavaScript function name"
onLoad="JavaScript function name"
onStart="JavaScript function name"
quality="low|high|medium"
source="source name"
style=="style specification"
height="integer"
width="integer"
wmode="window|opaque|transparent">
</cfmediaplayer>
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| align | Specifies the horizontal alignment of the media player. You can select from left, right, and center. | Optional | left |
| autoplay | A Boolean value that specifies if the media player must automatically play the FLV file on loading the CFM page:true false | Optional | false |
| bgcolor | The background color of the media player specified as a Hexadecimal value or or a recognized color name, for example red. | Optional | 6b7c85 |
| controlbar | A Boolean value that specifies if you want to display the control panel for the media player: true false | Optional | true |
| fullScreenControl | Whether full screen is enabled:yes no The following characteristics apply: Single click plays/pauses the media player. Borders, if defined, are not displayed in full-screen mode. Double-click for full-screen mode. (If you are in full-screen mode) Press "Esc" or double-click to restore the player to normal mode. | Optional | yes |
| height | Height of the media player, in pixels. | Optional | 360 pixels |
| hideborder | A Boolean value that specifies if you want a border for the media player panel: true false | Optional | true |
| hidetitle | If true, displays the video file name. | Optional | false |
| name | Name of the media player. The name attribute is required when you invoke JavaScript functions. | Required if source is not defined | |
| onComplete | Custom JavaScript function to run when the FLV file has finished playing. | Optional | |
| onLoad | Custom JavaScript function to run on loading of the player component. | Optional | |
| onStart | Custom JavaScript function to run when the FLV file starts playing. | Optional | |
| quality | The quality of the media playback:low medium high | Optional | high |
| source | The URL to the FLV file. This can be a URL relative to the current page. You can store the FLV file on the ColdFusion server or any other streaming server. | Required if name is not defined | |
| style | The following are the supported styles: bgcolor: The background color of the media player. borderbottom: A numeric value. The default is 10. bordertop: A numeric value. The default is 10. borderleft: A numeric value. The default is 10. borderright: A numeric value. The default is 10. titletextcolor: Hexadecimal value of RGB color. For example, specify the color white as ##FFFFFF or FFFFFF. The default is black. titlebgcolor: Hexadecimal value of RGB color. The default is black. progresscolor: The foreground color for the progress bar. Hexadecimal value of RGB color. The default is black. progressbgcolor: The background color for the progress bar. Hexadecimal value of RGB color. The default is black. controlscolor: The foreground color of the controls in the Control panel. Hexadecimal value of RGB color. The default is black. controlbarbgcolor: The background color of the controls. Hexadecimal value of RGB color. The default is black. | Optional | |
| width | Width of the media player, in pixels. | Optional | 480 pixels |
| wmode | Specifies the absolute positioning and layering capabilities in your browser:window: Plays the media player in its own rectangular window on a web page opaque: Hides everything behind the media player on the web page transparent: Lets the background of the web page show through the transparent portions of the media player | Optional | window |
Example
In
this example, the FLV file is stored in the web root used by the
ColdFusion server. You need to store an FLV file - mediafile.flv in
the location web_root\xyz\. You can now create the
media player with the following content:
<h3>cfmediaplayer Example</h3>
<cfmediaplayer
name="Myvideo"
source="/xyz/mediafile.flv"
width=500
height=400
align="middle"
quality="high"
fullscreencontrol="true"/>
The following code
illustrates styling of the media player:
<cfset bgColorTheme = "EDC393"> <cfset titleColorTheme = "800517"> <cfset controlsColorTheme = titleColorTheme> <cfset progressColorTheme = "E67451"> <cfset progressbgColorTheme = "FFF8C6"> <cfmediaplayer name="player2" style="bgcolor:#bgColorTheme#; titletextcolor:#titleColorTheme#;titlebgcolor:#bgColorTheme#;controlbarbgcolor:#bgColorTheme#;controlscolor:#controlsColorTheme#;progressbgcolor:#progressbgColorTheme#;progresscolor:#progressColorTheme#;borderleft:20;borderright:20;bordertop:10;borderbottom:13" hideborder="false" hideTitle=false controlbar="true" source="#defaultFlvfile#">