How to get "Display name" or "Hardware Key" from HTML Package

Hi there. In my scenario I have to get current media id (preloaded to a player) from an external DSP using javaScript embeded in HTML5 Package and play it. Sure I have to put player_id (display name or hardware key) into the request to let DSP know what the player is (location, format, orientation, OTS, audience at the moment etc). And everything working fine except one little issue. I can’t find out how to get playerId on Android. I did it on Windows version just sending request to embeded webserver (http://localhost:9696/config.xml) but it doesnt work on Android player. So, my question is … Is there any way to get player “display name” or “hardware key” from HTML Package on Android player? Please, help me guys ) I Can’t believe it’s impossible and I only one who stuck on this issue.

It will enough if somebody just post me “Yes it’s possible. Dig deeper.” or “No it’s impossible”. Anybody? :slight_smile:

I’ve got a feature request for this here already: Embedded Widget: displayId and other variables · Issue #2300 · xibosignage/xibo · GitHub and will add a link to this topic to it.

Your solution for Windows is ingenious and something we will likely want to prevent, now that we know its possible (sorry :cry:). I wonder though whether we could add a Player side API which provided an endpoint for this, which is the same then on each Player (recorded here).

We’re in the final stages of testing a v2 R207 Android release and could look at adding this feature to it. It will likely be a few days before it is available, but I will post back here when it is.

1 Like

Thank you for response Dan. I just hope you will add Player side API method we can use to get display id BEFORE you fix the “bug” )
P.S. “hardwarekey” file ia also available for reading from HTML embeded JavaScript even if you use file protocol.
function getPlayerId() {
var rawFile = new XMLHttpRequest();
rawFile.open(‘GET’, ‘…/hardwarekey’, false);
rawFile.onreadystatechange = function ()
{

WBR,
Nova

We released v2 R207 for Android yesterday and included is the http://localhost:9696/info endpoint which outputs some JSON containing the hardware key and name.

We will do the same, in the same format for windows.

{
  "hardwareKey": "",
  "displayName": "",
  "timeZone": ""
}

That is interesting and also surprising! I have made a note of that on the issue for windows and will investigate. Thank you.

Thank You, Dan. I am very grateful to you.

1 Like

I’ve completed this work in Windows for the next release.

If you want to try it out, there is a pre-release available here for the next 3 days: https://transfer.xibo.org.uk/c70ee7a2bab8

I missed a build step when producing the MSI :man_facepalming:

I’ve prepared another: https://transfer.xibo.org.uk/f65c92b4e1c6

Wow … I have lost for a couple of months )))
Great news, Dan. Now we can have a platform-independent HTML package. Thank You Very Much Again.

1 Like

Hi Dan, i’m back to this subject.
I developed a webpage in react (to run as as webpage widget inside a player) and I need to access the player info inside http://localhost:9696/info, but I’m having CORS issues to access the data. As the page isn’t hosted at localhost.
Is there a way to add the necessary headers in the webserver embedded in the player to allow no-cors, but not as an opaque response ? Or define a way to fetch the data using some sort of credentials?

Thanks in advace,

Fabio

Hi Dan!!

Did you have the opportunity to look at the CORS issue I mentioned ?

thanks in advance,

Hi Fabio,

We will certainly be considering how we allow external access to the endpoint in v3 of Xibo - mainly for interactive web hooks - but also for your use case above.

For the time being though, you’d need to have your web page has a Package HTML, so that it is actually served via localhost and CORS does not come into effect.

I hope that makes sense?

Thanks,
Dan

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.