User Tools

Site Tools


developer_center:recipe_book:extensions_and_core:listeners:observers

Data Remotes & Observers

Nightingale has a bunch of different listening & observing methods to hook into if you want to have code fire upon event initiation and completion. Typically, most people are interested in hooking into media playback.

Media Playback Observers

If you would like to be informed about media playback events, please see the Media Playback recipe for how to add an observer to the Media Core Manager.

Data Remotes

For events that aren't handled by sbIPlaylistPlaybackListener, you can also use Nightingale's DataRemotes mechanism for observing events. By examining playerControls.xml you can see many of the controls emit “dataremotes” such as “faceplate.mute” and “faceplate.playing”. We also have a full list of the dataremote listener topics in the Webpage API Documentation FIXME. You can bind arbitrary observers to these data remotes by creating a new data remote and then binding the observer to it like so:

var myDataRemoteObserver = {
    observe: function(subject, topic, data) {
        alert(subject + " -- " + topic + " -- " + data);
    }   
}   

const SONGBIRD_DATAREMOTE_CONTRACTID = "@songbirdnest.com/Songbird/DataRemote;1";
var createDataRemote = new Components.Constructor( SONGBIRD_DATAREMOTE_CONTRACTID,
    Components.interfaces.sbIDataRemote, "init");
var myPauseDataRemote = createDataRemote("faceplate.paused", null);
myPauseDataRemote.bindObserver(myDataRemoteObserver, true);
developer_center/recipe_book/extensions_and_core/listeners/observers.txt · Last modified: 2013/12/28 09:02 by geekshadow