> I'm still stumped on trying to make my html detect when the player is
> Paused/Stopped or powered On/Off using the below reference.  I've

Ok, I think we have to start with some basics here ;-). When using
SqueezeJS you shouldn't need to care about that player state and querying
SC etc. SqueezeJS.Controller should do this for you. It will then signal
eg. "playerstatechange" events whenever the current player has changed
some status (play mode, playlist, volume etc.). All of the SqueezeJS.UI
components do this for you: they listen to this event, receive the new
player state information when it happens, and update themselves
accordingly.

So what you need is some component which will use the "mode" part of the
player status to update itself.

> attached my html. What I'd like is to replace the Title with "Now
> Stopped" whenever the player is stopped, "Now Paused" when the player
> is paused, and "Powered OFF" when the player is powered off. Any
> suggestions?

In this case you might want to use something based on
SqueezeJS.UI.RawTitle:

SqueezeJS.UI.MyTitle = Ext.extend(SqueezeJS.UI.Component, {
        onPlayerStateChange : function(status){
                var title;

                // overwrite
                if (status.mode == 'stop')
                        title = 'Stopped';
                else if (status.mode == 'pause')
                        title = 'Paused';
                // assuming we're playing
                else
                        title = SqueezeJS.SonginfoParser.title(result, 
this.noLink, false,  
true);

                this.el.update(title);
        }
});


Then use new SqueezeJS.UI.MyTitle() instead of RawTitle in your page.

As mentioned above this component will be signalled a state change  
whenever there's one. It's also sent the new status object. "mode" is part  
of this object (as is a lot more information - see the "status" CLI  
query). So instead of using the title in any case (as does RawTitle()), it  
checks the player mode and displays something else accordingly. Does this  
make any sense?

FWIW: if you're seriously trying to do some JavaScript work, you should  
get Firefox and install the Firebug add-on. This is a tool which will let  
you inspect whatever is going on in SqueezeJS. You could eg. step through  
the above onPlayerStateChange() method, inspect the full status object and  
learn about what other information would be available to it.

Michael
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to