In the below example Firm5 is being used versus an on-screen button.
Place the below at the activity level:function doPageStart() {
if(System.getGlobal("Blu-ray Play/Pause")=="Play") {
GUI.widget("PS_FIRM5").label="Play \uF087";
}
else {
System.setGlobal("Blu-ray Play/Pause","Pause");
GUI.widget("PS_FIRM5").label="Pause \uF085";
}
}
//
function bdPlayPause() {
if(System.getGlobal("Blu-ray Play/Pause")=="Play") {
CF.widget("Play","Blu-ray","IR Codes").executeActions();
System.setGlobal("Blu-ray Play/Pause","Pause");
GUI.widget("PS_FIRM5").label="Pause \uF085";
}
else {
CF.widget("Pause","Blu-ray","IR Codes").executeActions();
System.setGlobal("Blu-ray Play/Pause","Play");
GUI.widget("PS_FIRM5").label="Play \uF087";
}
}Place the below at the page level:doPageStart();Place the below on Firm5:bdPlayPause();Note that I'm using both text and the appropriate symbol when addressing the label of the firm key. See Appendix C of the
"ProntoScript Developer's Guide" for a full listing of the special unicode characters which are available. Note also that while a regular variable would work per the above I've chosen to use a global variable instead, that way if one leaves the activity then returns to the activity the "Play/Pause" functionality is still set to the proper state.
Getting things back in sync...In the event the true "Play/Pause" state of your Blu-ray player gets out of sync with the remote it's always good to have a quick and easy way to get things back in sync via the remote. The below ProntoScript adds "Press & Hold" functionality to the firm key. A normal press of the firm key will execute the "Play/Pause" functionality. An extended press of the firm key will change the naming of the label only in addition to updating the global variable allowing you to easily get things back in sync if needed.
Add the below at the activity level:function bdPlayPauseSync() {
if(System.getGlobal("Blu-ray Play/Pause")=="Play") {
System.setGlobal("Blu-ray Play/Pause","Pause");
GUI.widget("PS_FIRM5").label="Pause \uF085";
}
else {
System.setGlobal("Blu-ray Play/Pause","Play");
GUI.widget("PS_FIRM5").label="Play \uF087";
}
}Place the below on Firm5:
var counter = 0;
onHold = function()
{ counter++;
if (counter==1) { bdPlayPauseSync(); }
}
onHoldInterval = 1000; onRelease = function()
{ if (counter==0) { bdPlayPause(); }
}
Last edited by Lowpro on August 26, 2010 17:40.