mherger;353696 Wrote:
> > 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
That's what I needed, an example of how to do it. Your explanation
helps me digest what the script is doing too. Made the changes to my
html and works great! This was one of the last major hurdles to
overcome and now am very close to completing this project. This project
has gotten me interested in JavaScript. I will take your advice and get
Firefox and the Firebug add-on. Again, I appreciate your help!
PS -- I will post pics of the final project and share the final html
when I'm finished tweaking things.
--
starfleetcommand
------------------------------------------------------------------------
starfleetcommand's Profile:
http://forums.slimdevices.com/member.php?userid=20604
View this thread: http://forums.slimdevices.com/showthread.php?t=53975
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss