On-demand Content

On-demand Content

About the Widget

The On-demand Content widget shows a file browser for your on-demand content. On-demand content is a set of files that visitors can play or download when they want, for example podcasts or recordings of earlier shows.

The widget shows the files and folders of the ondemand folder of your account, with the size of each file. Visitors can open the folders. Visitors can select files with the check boxes, then do these actions with the selected files:

  • Play selected
    Plays the selected files, one after the other, in the player of the widget. This button is shown only if the Web Player widget is also on the page, and the ignorePlayer option is false.

  • Download playlist
    Downloads an M3U playlist of the selected files. The visitor can open the playlist in a media player.

If the ondemand folder is empty, the widget shows No on-demand content is available at this time.

This widget is available only if Enable on-demand content widget is set to Yes. For more information, see the Widgets section of the configuration settings.

Publishing On-demand Content

To publish files as on-demand content:

  1. Open the File Manager.
  2. Open the ondemand folder.
  3. Upload the files into the ondemand folder. You can also make subfolders in it.

The widget reads the folder when a visitor opens your web page. A visitor sees the new files after the page loads again. Note that the files in the ondemand folder are public. Any visitor of your web page can play and download them.

Playing Files on Your Page

The On-demand Content widget uses the Web Player widget to play files on your page. If you put the code of both widgets on your page, the player shows in the On-demand Content widget. For more information, see the Web Player section.

If the Web Player widget is not on the page, a click on a file name opens the file in the web browser. The newWindow option controls whether the file opens in a new browser window.

Widget Code

The anchor code is a <div> element with the class cc_ondemand_content. Before the widget loads, the element shows the text Loading ....

Advanced Customization

Configurable Options

The advanced code sets these options:

  • unstyled
    Controls whether the widget applies its own styles. If true, the widget applies no styles, and your own CSS controls the appearance. The default is false.

  • extensions
    Controls whether the widget shows the file name extensions of known file types, for example .mp3. The default is false.

  • clickToPlay
    Controls what a click on a file name does when the Web Player widget is on the page. If true, the file plays in the player. If false, the web browser opens or saves the file. The default is true.

  • newWindow
    Controls whether the web browser opens a file in a new window when it opens the file. The default is false. Note that the advanced code on the Widgets page sets this option to true.

  • downloadm3u
    Controls whether the widget shows the Download playlist button. The default is true.

  • ignorePlayer
    Controls whether the widget ignores the Web Player widget on the page. If true, the widget does not use the player, and the player works on its own. The default is false.

Example: to show file name extensions and hide the Download playlist button, use these values:

<script type="text/javascript">
(function(){ (window.$CC||(window.$CC={})).ondemand = {

    unstyled: false,
    extensions: true,
    clickToPlay: true,
    newWindow: true,
    downloadm3u: false,
    ignorePlayer: false,

};})();
</script>

CSS

The widget uses these CSS classes:

/* container for the default styles; not present if unstyled is true */
.cc_ondemand_basic_style {
}
/* container for the player, if the Web Player widget is on the page */
.cc_ondemand_player {
}
/* the current folder: the path and the "select all" check box */
.cc_ondemand_cwd {
}
/* the path of the current folder */
.cc_ondemand_cwd_path {
}
/* the message that shows when no content is available */
.cc_ondemand_none {
}
/* the list of files and folders */
.cc_ondemand_dir {
}
/* the check box of a file */
.cc_ondemand_file_checkbox {
}
/* the name of a file or folder */
.cc_ondemand_file_name {
}
/* the size of a file */
.cc_ondemand_file_size {
}
/* container for the buttons */
.cc_ondemand_buttons {
}

Previous: Listener Map
Section: Widgets