PDA

View Full Version : addDispatch problem?



philippe_44
2017-12-25, 01:30
I guess I'm not well awake today, but why does

my $old = addDispatch(['pause', '_newvalue', '_fadein', '_suppressShowBriefly'], [1, 0, 0, \&mySUB]);

give me the result where mySub is only called to get pause status (no parameter given) and when pausing, not when retsrated

mherger
2017-12-26, 23:19
> my $old = addDispatch(['pause', '_newvalue', '_fadein',
> '_suppressShowBriefly'], [1, 0, 0, \&mySUB]);
>
> give me the result where mySub is only called to get pause status (no
> parameter given) and when pausing, not when retsrated

I'm not sure I understand your question: this command would _not_ create
a listener, but register your own handler for the "pause 1|0|?" command.
Eg. it would be called if something did a "pause 1" command, but not if
it was a "play".

--

Michael

philippe_44
2017-12-30, 14:10
> my $old = addDispatch(['pause', '_newvalue', '_fadein',
> '_suppressShowBriefly'], [1, 0, 0, \&mySUB]);
>
> give me the result where mySub is only called to get pause status (no
> parameter given) and when pausing, not when retsrated

I'm not sure I understand your question: this command would _not_ create
a listener, but register your own handler for the "pause 1|0|?" command.
Eg. it would be called if something did a "pause 1" command, but not if
it was a "play".

--

Michael

Yes, I wanted to *manage" the pause action, not just listen to it (i.e. in some cases I did not want to pause). I was expecting that on pause and resume, I would get a call with 'pause 1|0', but it's not the case at least when using the UI - I only get called with the query version (i.e. no parameter) and with pause (param 1), but not when resuming (I though it would be param 0). What is being called when the web UI is used seems to be "playlist pause".

But when subscribing to 'pause' (as a listener), then the callback was called on pause and resume when using the webUI, hence I was confused.