Write and read files

Prev Next

The player allows the application to write data to the hard drive and to read it from the application itself or from another application.

Write a file to the player

Writes a file to the player.

Parameters

function(directory, fileName, data)

directory is the subdirectory in which the file is stored.

fileName is the name of the file and the file extension, for example, .json or .xml.

data is the data as a string. The string can contain XML or JSON data. All spots that want to use this file must use the same structure.

Examples

GFSpotBase.writeFile("sampleData/","sample.xml","<product><id>243</id><name>Some Product Name</name></product>");

Players

Windows Player version 7.7 or later

Linux Player version 8.0 or later

Android Player version 8.1.0.0 or later

Read a file from the player

To load the data of a previously saved file into the HTML application, the method GFSpotBase.receiveOnReadFile must first be overwritten.

Use the init() method after the <body onload="init()">:

function init() {
  // Override the receiver function
  GFSpotBase.receiveOnReadFile = function (fileName, data) {
    // do something with the data
  };

  // Request the data
  GFSpotBase.readFile("sampleData/", "sample.xml");
}

Retrieve all spots from the playlist

To poll the playlist data in the HTML application, the method GFSpotBase.receiveOnGetAllSpots must be overwritten first.

Use the init() method after the <body onload="init()">:

function init() {
  // Override the receiver function
  GFSpotBase.receiveOnGetAllSpots = function (data) {
    // do something with the data
  };

  // Request the data
  GFSpotBase.getAllSpots();
}

Function

Lets the spot retrieve a list of all spots in the playlist, for example, to jump from a central control spot to other spots.

The return takes place analogously to readFile() via a return function.

Parameters

None

Players

Windows and Linux Player version 10.1 or later

Android Player version 8.1.0.0 or later

Example response:

{
  "Spots":[
    {
      "BlockID":"4760",
      "BlockName":"Any default playlist",
      "Overlay":"false",
      "ScreenNr":"1",
      "SplitNr":"0",
      "SpotName":"SpotSelector Website",
      "SpotID":"32709",
      "SpotInstanceID":"69820",
      "ThumbFilePath":"http://localhost:9090/thumb/_32709-5191-Manual-DefaultIXM One80X60-1-1.png",
      "EventType":"null",
      "EventValue":"null",
      "FilePath":"http://localhost:9090/_32709_v.1_WebsiteSpot.xml"
    },
    {
      "BlockID":"4762",
      "BlockName":"Some Image Event Playlist",
      "Overlay":"false",
      "ScreenNr":"1",
      "SplitNr":"0",
      "SpotName":"Flowers A",
      "SpotID":"32150",
      "SpotInstanceID":"68697",
      "ThumbFilePath":"http://localhost:9090/thumb/_32150-4762-Automatic-DefaultIXM One80X60-1-1.png",
      "EventType":"Start",
      "EventValue":"123",
      "FilePath":"http://localhost:9090/newNum_02.jpg"
    },
    {
      "BlockID":"4630",
      "BlockName":"Idle Playlist Test",
      "Overlay":"false",
      "ScreenNr":"1",
      "SplitNr":"0",
      "SpotName":"Grassfish Website",
      "SpotID":"25298",
      "SpotInstanceID":"63863",
      "ThumbFilePath":"http://localhost:9090/thumb/_25298-3227-Manual-DefaultIXM One80X60-1-1.png",
      "EventType":"IdleSeconds",
      "EventValue":"10",
      "FilePath":"http://localhost:9090/_25298_v.10_WebsiteSpot.xml"
    },
    {
      "BlockID":"4626",
      "BlockName":"Time Playlist Test",
      "Overlay":"false",
      "ScreenNr":"1",
      "SplitNr":"0",
      "SpotName":"Pictures-36",
      "SpotID":"25491",
      "SpotInstanceID":"63854",
      "ThumbFilePath":"http://localhost:9090/thumb/_25491-1007-Automatic-DefaultIXM One80X60-1-1.png",
      "EventType":"Time",
      "EventValue":"12:00:00 18:00:00",
      "FilePath":"http://localhost:9090/_25491_v.1_Pictures_36.jpg"
    }
  ]
}