Widgets

Widgets

Centova Cast supplies widgets that show information about your stream on your own web site. A widget is a short piece of HTML code that you copy into a page of your web site. You do not need programming knowledge to use a widget. You must be able to edit the HTML of your web pages. Knowledge of CSS helps you to change the appearance of the widgets.

To open the Widgets page, click the Account menu (the person icon at the top right of the page), then click Widgets. DJs also see this page.

Each widget has its own section in this manual:

  • Stream Status Summary - the current song of your stream, in one line
  • Stream Details - separate items of stream information that you put anywhere on your page
  • Recent Tracks - a list of the tracks that your stream played most recently
  • Listener Map - a map that shows the locations of your current listeners
  • On-demand Content - a browser for files that your visitors can play or download
  • Song Requests - a form that your visitors use to request songs
  • Tune In - tune-in links for your stream in several playlist formats
  • Stream Directory - a list of the streams on the server
  • Web Player - an audio player for your stream
  • Listener Meter - a meter that shows the number of current listeners

The Widgets Page

The Widgets page has these boxes:

  • Choose Widget
    Shows the list of the widgets that are available for your account. Click a widget name to show the code of that widget.

  • Mount Point
    Specifies the mount point that the widget code refers to. The options are:

    • Default
      The widget code does not name a mount point. Each widget section tells which mount point the widget then uses. This is the default.

    • The mount points of your stream
      The widget code names the selected mount point. If you select a mount point, Centova Cast updates the code of all widgets on the page.

  • The widget box
    Shows the name of the selected widget, a description, and the code of the widget. The box contains these items:

    • Advanced
      Shows the advanced code of the widget. The advanced code contains the options of the widget. This button is shown only if the widget has advanced code. After you click it, its label changes to Basic. Click Basic to show the basic code again.

    • The code boxes
      Show the HTML code of the widget, with an instruction above each box.

    • Option buttons
      Change one option in the advanced code each time that you click them, for example Toggle seek bar. Each click changes the option from true to false, or from false to true. The widget box then shows the advanced code. Only some widgets have option buttons.

    • Also available as
      Shows links to the same information in other formats, for example JSON. Only some widgets have these links.

  • Preview
    Shows the selected widget as it will look on a web page, with the current code. The icon at the right of the box title switches the preview between the light color scheme and the dark color scheme. The preview updates when you select a different widget or mount point, or click an option button.

The Tune In widget has a different box. For more information, see the Tune In section.

Which Widgets Are Available

The Choose Widget list shows only the widgets that are enabled for your account. You enable most widgets on the Widgets tab of the configuration settings. For more information, see the Widgets section of the configuration settings.

  • Stream Status Summary, Stream Details, Web Player, Tune In
    Always available.

  • Recent Tracks
    Available only if Enable recent tracks widget is set to Yes.

  • Listener Meter
    Available only if Publish listener counts is set to Yes.

  • Listener Map
    Available only if Enable listener map widget and Publish listener counts are both set to Yes.

  • On-demand Content
    Available only if Enable on-demand content widget is set to Yes.

  • Song Requests
    Available only if Enable song request widget is set to Yes.

  • Stream Directory
    Available only if the administrator of the server enables the stream directory for the whole server.

Using the Widgets

The code of each widget has two parts:

  1. The anchor code. It is an HTML element that marks the position of the widget on your page. Put it where you want the widget to appear.
  2. The script code. It is a <script> tag that loads the widget program from Centova Cast. Put it at the end of your page, immediately before the closing </body> tag.

When a visitor opens your page, the widget program finds the anchor element and fills it with the stream information. Most widgets update their information automatically while the page is open.

For the procedure, see the Publishing Station Information on Your Web Site section of the usage guide.

Note: The widget code uses the same protocol as your connection to the control panel. If you open the control panel with HTTPS, the code loads the widgets with HTTPS. If your web site uses HTTPS, open the control panel with HTTPS before you copy the code. Most web browsers do not load an HTTP script into an HTTPS page.

Attributes in the Widget Code

The anchor code contains attributes that tell the widget which stream to show:

  • data-username
    Specifies the username of your account. The widget shows the information of this account.

  • data-mount
    Specifies the mount point that the widget shows. This attribute is present only if you select a mount point in the Mount Point box.

The script code can contain one more attribute:

  • data-xlat
    Specifies the text that the widget shows, in the language of your account. The value is a list of key=text pairs, separated by semicolons. You can change the text after the equals sign to change the text that the widget shows. Do not change the keys. For example, data-xlat="online=On the air;offline=Off the air" changes the text for the online and offline states.

Advanced Customization

The advanced code of a widget starts with a <script> block that sets the options of the widget. The option block must come before the script code of the widget. The advanced code replaces the basic script code. Do not put both on the same page.

You can change the option values in the advanced code before you copy it. Each widget section lists the options of that widget. If you remove an option from the block, the widget uses the default value of that option.

All widgets that use the same script on one page share one option block. For example, the Stream Status Summary widget and the Stream Details widget use the same script. If you use both widgets on one page, put the script code on the page only once.

Each widget section also lists the CSS classes that the widget uses. You can add your own CSS rules for these classes to your web page to change the appearance of the widget.

Note: Centova Cast also gives your station a public start page that shows several widgets together. For more information, see the Start Page section.