The WebChatRadio Engine

This text is replaced by the Flash movie.

The WebChatRadioEngine (WCRE) is an invisible Flash swf designed to communicate with the WebChat Radio Network Server. "If it's invisible, why can I see it?" you may ask. That's because the WCRE swf is designed to support themes, or skins. The theme itself is another Flash movie that loads the WCRE applet, and is allowed to control the swf in a limited way. The theme is able to start, stop, and control the volume of the WCRE stream when playing. The theme will also receive updates from the WCRE to know when the stream is started and stopped, current time in the stream if playing, and (approximately) the current track playing on WebChatRadioNetwork. (Approximately because the next song is sometimes being displayed a few seconds ahead of when it will be heard in the stream, due to buffering. The difference can be as much as 30 seconds.)

The default example theme is named RadioTheme-Default and its Flash Project File can be downloaded here. Or you can view just the Actionscript here. Use it as a guide to creating your own radio theme, or even for incorporating the WebChatRadioEngine into other projects. You will need to use System.security.allowDomain() in your own project to allow the WCRE to script your project.

*NEW* A new addition is a tiny loader swf that checks for the latest version of themes and the WCRE, named WebChatRadio.swf. You can still load the theme directly as your swf, but it doesn't have the version loading feature, and if you have an older version in your browser cache, you will probably get it instead.

The WCRE has a few functions that you will need to call and/or implement in order to use it.

To control the WebChatRadioEngine

Function Arguments Description
doPlay()
none
Call this function to tell the WCRE to start playing the stream, if not streaming already.
doStop()
none
Call this function to tell the WCRE to stop playing the stream, if streaming.
doSetVolume(vol:Number)
vol:Number
Call this function to tell the WCRE to set the volume of the streaming audio, from 0 (mute)to 100 (full volume). If not streaming, there is no effect.

 

Functions to implement to receive information from the WebChatRadioEngine

Function
Arguments
Description
doStartedStreaming()
none
Implement this function to allow the WCRE to notify you when it starts streaming audio.
doStoppedStreaming()
none
Implement this function to allow the WCRE to notify you when it stops streaming audio.
doSetTime(time:String)
time:String
Implement this function to allow the WCRE to give you the elapsed time since the stream was started.
doSetTrackName(track:String)
track:String
Implement this function to allow the WCRE to give you the current track according to the WebChat Radio Server. Note that the WCRE will be updating the track name whether it is streaming or not. The default radio theme uses this information to show a preview of the current track when not streaming.
doSetStatus(status:String)
status:String
Implement this function to allow the WCRE to send you certain status text. The default radio theme displays this information in place of the track name as needed.

 

Adding your Flash movie to your site

When you are ready to embed your Flash movie that uses the WCRE on your site there are a few variables that the WCRE can read from the _root object. I use SWFObject to make passing those variables easier, as well as adding extra features such as browser detection. The HTML to add the above swf is very simple:

<script type="text/javascript" src="swfobject.js"></script>

<div id="flashcontent">
This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
var so = new SWFObject("RadioTheme-Default.swf", "WebChatRadio", "520", "30", "8", "#000000");
so.addParam("wmode", "transparent");
so.addVariable("showbackground", "true");
so.write("flashcontent");
</script>

The showbackground variable is a variable only with the RadioTheme-Default.swf movie, which causes it to show the gray rectangle in the background. If set to false, or left out altogether, only the controls will be visible. If the wmode param is set to transparent, in most browsers the web page will show through behind the controls, making it appear to really be embedded in your web page.

If you simply embed the RadioTheme-Default.swf movie, be sure to set the URL to the movie accordingly, it is http://radio.webmaster.com/WebChatRadio/RadioTheme-Default.swf . If you use the SWFObject code, make sure you include the swfobject.js script as well.

 

*NEW* If you wish to use the tiny version loading swf to load your radio theme, change your swf name to http://radio.webmaster.com/WebChatRadio/WebChatRadio.swf instead. Do be aware however, that currently this can only load themes from the main site. For example:

var so = new SWFObject("http://radio.webmaster.com/WebChatRadio/WebChatRadio.swf", "WebChatRadio", "520", "30", "8", "#000000");

The WebChatRadio.swf has an additional variable, to tell the swf which theme to load. You can either refer to it's full name, such as RadioTheme-Default.swf or just it's theme name, which is Default and the swf will add the RadioTheme- to the beginning and .swf to the end automatically. To specify which theme you want to use, use the theme variable. For example:

so.addVariable("theme", "Default");

 

If you are utilizing the WCRE in your own project, the URL to the movie is http://radio.webmaster.com/WebChatRadio/WebChatRadioEngine.swf and you must also be sure to set the System.security.allowDomain("http://radio.webmaster.com/WebChatRadio/") so that WCRE can script your movie.

 

(c) Copyright 2006 WebMaster, Incorporated. All Rights Reserved. Send questions and comments to WebMaster Support.