Class: Roundware

Roundware

This class is the primary integration point between Roundware's server and your application NOTE that we depend on jQuery being injected, because we use its $.ajax function. As browsers evolve and the whatwg-fetch polyfill evolves, we may be able to switch over to using window.fetch

Constructor

new Roundware(window, options)

Initialize a new Roundware instance
Parameters:
Name Type Description
window Object representing the context in which we are executing - provides references to window.navigator, window.console, etc.
options Object Collection of parameters for configuring this Roundware instance
Properties
Name Type Description
serverUrl String identifies the Roundware server
projectId Number identifies the Roundware project to connect
geoListenEnabled Boolean whether or not to attempt to initialize geolocation-based listening
Source:
Example
var roundwareServerUrl = "http://localhost:8888/api/2";
   var roundwareProjectId = 1;

   var roundware = new Roundware(window,{
     serverUrl: roundwareServerUrl,
     projectId: roundwareProjectId
   });

   function ready() {
     console.info("Connected to Roundware Server. Ready to play.");
     // this is a good place to initialize audio player controls, etc.
   }

   // Generally we throw user-friendly messages and log a more technical message
   function handleError(userErrMsg) {
     console.error("Roundware Error: " + userErrMsg);
   }

  roundware.connect().
    then(ready).
    catch(handleError);

  function startListening(streamURL) {
    console.info("Loading " + streamURL);
    // good place to connect your audio player to the audio stream
  }

  roundware.play(startListening).catch(handleError);

Methods

connect() → {Promise}

Initiate a connection to Roundware
Source:
Returns:
- Can be resolved in order to get the audio stream URL, or rejected to get an error message; see example above
Type
Promise

pause()

Tell Roundware server to pause the audio stream. You should always call this when the local audio player has been paused.
Source:
See:
  • Stream.pause

play()

Create or resume the audio stream o
Source:
See:
  • Stream.play

tags(tagIdStr)

Update the Roundware stream with new tag IDs
Parameters:
Name Type Description
tagIdStr string comma-separated list of tag IDs to send to the streams API
Source: