-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send-User-Variables-To-HTML #4
Comments
Why do I need the plugin at all? I saw that I can basically do the same thing with JavaScript that reads the user values. I just need one single user variable that can be changed via serial or UDP to end up as a JavaScript variable. Unfortunately I can't get it done, already in contact with BS support. But I think it would a great thing to have some basic JS (just like the "take-user-variable-and-turn-it-into-a-JS-variable"-thing to have here on github. Would be a great starting point for BS projects. |
If all you need is the ability to save and read variables from Javascript, I would recommend using html5 local storage (see e.g. https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). To enable it, turn on HTML Local Storage (see http://docs.brightsign.biz/display/DOC/Editing+Preferences#EditingPreferences-Storagestorage). You could then set your variables based on UDP or serial messages in Javascript using http://docs.brightsign.biz/display/DOC/BSDatagramSocket or http://docs.brightsign.biz/display/DOC/BSSerialPort. |
I just need to read the current brightsign user variable and put its value in a js variable, tried modifying the weather widget demo, bit cantget it to work. <title>vizit</title> <script src="js/jquery-1.10.1.min.js"></script> <script src="js/bsp.js"></script> <script> //NOTE: this variable stores the value from the uservariables on the BrightSign unit var newposition //NOTE: this function gets the user variable from the BrightSign unit function getUserVars(callback) { console.log("getUserVars"); sUrl="http://localhost:8080/GetUserVars"; $.get(sUrl,function(data,status,jqXHR) { un=jqXHR.responseText; xmlDoc = $.parseXML( un ); $xml = $( xmlDoc ); console.log(un); console.log("fetching variables...") $xml.find('BrightSignVar').each(function(){ var name = $(this).attr('name') console.log(name); }); }); } //NOTE: this fetches the user variable with the name position switch (name){ case "position": var newposition = $(this).text(); break; $('#thenewposition').html(newposition); </script> <style> #thepage{ width:1920px; height:1080px; background-color: red; } </style> |
you can use a Javascript get with the user variables URL on the player. The URL of the database is |
@jpbrightsign i dont think that will work, the allow cross origin flag is not set on the application server/ variables server so a get request gets denied. in theory you could do a custom variables page and set the flag however that seams more effort then simply using the plugin/ adapting the plugin further to allow the HTML widget to request variables and have the plugin reply, which im currently working on |
I'm not sure, I may be misunderstanding. The question was: "I just need to read the current brightsign user variable and put its value in a js variable, tried modifying the weather widget demo, bit can not get it to work." If the user var was created with BrightAuthor and then published you can certainly get the values into JS localstorage
You don't need a pluigin for this it's quite straight forward. I can email you a simple sample if you wish. |
you are understanding it correctly i was getting a "Cross-Origin Request Blocked" error when i tested this however i have now found the source of this issue and agree that you are correct the method you outline above does work. the only small down site is that the HTML site has to poll the uservars at http://player-ip-address:8008/GetUserVars. for changes rather then get an alert on change, not major issue though |
I am experimenting with the plugin. Trying to use variables that are filled by serial Input (later I would like to use the UDP input) and afterwards sending them to HTML using the plugin. I have not made any changes in the code, all I have done is:
Now, the user variable is made out of the serial input (i can see that working in the live text zone), but the user variable is not displayed in the HTML page? What am I doing wrong (BrightAuthor file attached)
serial2html.zip
The text was updated successfully, but these errors were encountered: