Is it possible to display an item only when the music is playing??
Is it possible to display an item only when the music is playing??
]]>
« Hi everyone! (Previous Post)
< ![CDATA[
You may be able to with Tasker
]]>
< ![CDATA[
Yeah i already know it, maybe i should specify saing “using only scripts, no third party apps”.
Thanks anyway for your quick answer 🙂
]]>
< ![CDATA[
TrianguloY Lukas Morawietz ?
]]>
< ![CDATA[
LL.getContext().getSystemService(Context.AUDIO_SERVICE).isMusicActive()
]]>
< ![CDATA[
Lukas Morawietz really thanks you can’t even begin to imagine how it will be useful to me ^^
]]>
< ![CDATA[
Lukas Morawietz another little question, For which event I should set the script?
]]>
< ![CDATA[
You need to regularly check the value using a timer. Initiate the timer in some item resume event, and cancel it in the pause event.
]]>
< ![CDATA[
Pierre Hébert I’m not practical with timers, to be honest I’ve never used them xD
But I have an idea and I want to know if I’m right.
resume event script:
var script=LL.getCurrentscript();
script.setTag(0);
var tag=script.getTag();
while(tag==0){
LL.setTimeout(music(),2000);
}
function music(){
do something…
}
paused event script:
var script=LL.getScriptByName(“resume event script”);
script.setTag(1);
Is there a better way or am i totally wrong?
]]>
< ![CDATA[
This is roughly the right thing to do, but use the timer id to cancel it.
You can find a sample in the clock script which link is at the bottom of http://www.pierrox.net/cmsms/applications/lightning-launcher/scripting.html
]]>
< ![CDATA[
Pierre Hébert thanks ^__^
]]>
< ![CDATA[
I had been pondering a similar idea, except I’d want the icon to also spin like a record while music is playing and then slow down and stop when music stops and then have the icon disappear. That I’m sure is impossible.
]]>
< ![CDATA[
It’s possible, but it needs a bit more work. When detecting a change from inactive to active start a timer loop to slowly animate the rotation. When detecting a change from active to inactive stop the previous timer and start a new one shot animation to end the rotation progressively.
]]>
< ![CDATA[
So you’re saying that we can have spinning icons? Wow I didn’t know that.
]]>
< ![CDATA[
The easiest would be to animate the rotation angle of some item, otherwise it could be possible to use an animated gif and TrianguloY script http://www.pierrox.net/android/applications/lightning_launcher/wiki/doku.php?id=script_animated_icons
]]>
< ![CDATA[
I’d like to see someone pull this off hehe
]]>