I have not built a lot of Kiosk deployments in Appspace, but the few I have always turn into extreme learning opportunities.
Here is a simplified setup for context:
Using an advanced channel.
I have two MediaZone widgets that I use as buttons.
One has a START image the other has a STOP image as the only content.
I also have a MediaZone widget loaded with a .Wav file of a song.
I can use an Event Action to trigger the song to start playing with:
Source: StartButton:MediaZone
When: Mouse Click/Touch
Condition: {blank}
Select: Song:MediaZone
Do: Load Media
Offset: 0
Increment: {blank}
If I click on the button, it starts playing the song…
I can stop the song with:
Source: StopButton:MediaZone
When: Mouse Click/Touch
Condition: (we will get to that later)
Select: Song:MediaZone
Do: unload media
And the song will stop.
Here is where I need a little help.
I have two buttons, I would like to use one.
At first I tried to use the Media Load function.
I started with the (Turn it on) button loaded by default.
A mouseclick would trigger the media to change from index 0 to index 1.
And I could have a second event start the song.
But, how would I have the second mouse click end the song.
There is a condition: part of the event. And from what I can tell, I should be able to detect if the media:song is playing.
The logic would be.
If BUTTON is clicked and Song is playing:
Change image to Start Song & stop the song from playing.
If BUTTON is clicked and the song is NOT playing:
Change the image to End Song & start the song playing.
Unfortunately, I do not know the magic method for formatting the condition test.
I tried “MediaZone:Song.audiostate” ( = ) “playing”
And a few other suggestions from various A.I.s
I searched for details on how the conditions can be used.
I also realized I would have a problem with the state of the song.
Unless I could package both steps into one event action, I run the risk of the song being unloaded before the button is updated properly.
There are some documents that suggest the event actions can be scripted, but the “Scripting” or “advanced” buttons are not anywhere to be seen on the Event actions table.
I almost had some luck with the HideComponent method.
I still used two buttons, but I stacked the ON button directly on top of the OFF button. When the ON button was clicked, I had a second Event Action set up to hide the ON button.
Source: OnButton
When: Mouse Click/Touch
Condition: {blank}
Select: Application
Do: HideComponent
ComponentID: 37539
hide:true
inverse: {blank}
The ON button would vanish and the OFF button would appear right below it.
When the OFF button was clicked, the OFF button would be hidden by the ON button reappearing directly on top of it.
Source: OffButton
When: Mouse Click/Touch
Condition: {blank}
Select: Application
Do: HideComponent
ComponentID: 37539
hide:false
inverse: {blank}
I also needed an event at the end of the song. If I did not unload the audio, it would just keep looping.
Source: Song
When: Media Complete
Condition: {blank}
Select: Song:MediaZone
Do: unload media
And a second Event to show the ON button again.
Source: Song
When: Media Complete
Condition: {blank}
Select: Song:Application
Do: HideComponent
ComponentID: 37539
hide:false
inverse: {blank}
The only downside was the ON button kept reappearing. It seemed to stay hidden for 15 seconds and then it would reappear.
I tried to figure out what was causing it. At first I thought it may have been something else on the screen, but the timing never worked out. I checked the pictures I had loaded as content for the MediaZones buttons and they were set to last up to 4 minutes.
If anyone can help me figure out why the hidden zone would not stay hidden,
OR.. A better way to do this.. Please let me know.
Thanks,
-Mike
