Skip to content
Joshua Monson edited this page Aug 7, 2013 · 1 revision

These two JavaScript files deal with the playback and authoring of PlayGraphs (or playlists as they are called on the site).

  • player.js
  • widgets.js

player.js

This script handles the playing back of PlayGraphs.

PlayGraphPlayer.play({
    playGraph: {
        key: "PlayGraph player key goes here",
        secret: "PlayGraph player secret goes here",
        host: "PlayGraph host goes here"
    },
    content: [Content Object],
    $holder: [JQuery wrapper of element]
});

widgets.js

PlayGraphs have a standard editor on http://playgraph.byu.edu/ which can be extended with custom widgets. When a user edits a "playlist" he/she is taken to the PlayGraph editor with Ayamel widgets. This script is that widget extension.

To open the PlayGraph editor with custom widgets, make a POST request to http://playgraph.byu.edu/author with the following parameters:

Parameter name Value Purpose
author [String] This is your PlayGraph author key. Needed for associating the graph with your account.
player [String] (optional) This is your PlayGraph player key. If included, then a Preview button will appear.
graph [Number] The ID of the graph to edit. Set this to 0 to create a new graph.
action edit Must be "edit".
exit [String] This is a URL. When the user click the Exit button he/she will be taken to this URL.
play [String] (optional) If you want to use your custom PlayGraph player for previewing a graph, include that URL here. A new window/tab will be opened to that URL when Preview is clicked. The graphId, player key, and player secret will be passed in via the query string.
widgets [String] (optional) If you want to use custom widgets, then set this to be the URL of the JavaScript file to use.

Widget JavaScript file

The widget file will create widgets and register them under the PlayGraph.registeredObjects object. Valid widgets available for registering are:

  • initializer
  • nameRenderer
  • DataEditor
  • GraphEditor
  • NodeSelector
  • TransitionRuleEditor
  • SettingsEditor
Clone this wiki locally