Class: Stream

Stream

new Stream(options)

Create a new Stream
Parameters:
Name Type Description
options Object Various configuration parameters for this stream
Properties
Name Type Attributes Default Description
apiClient apiClient the API client object to use for server API calls
heartbeatIntervalSeconds Number <optional>
60" how frequently to send a stream heartbeat
Source:

Methods

pause()

Tells Roundware server to pause the audio stream - you should always call this when pausing local playback, to avoid wasting server resources
Source:

play(sessionId, initialGeoLocation, firstPlayCallback) → {Promise}

Request a streaming audio URL from Roundware server and establish a regular heartbeat. The heartbeat is used to keep a stream alive during a session. Streams take a lot of resources on the server, so we put the auto-kill mechanism in place to not have useless streams taking resources, but needed a method to keep them alive when we know they are still wanted. After we initially connect to Roundware, subsequent calls are forwarded to the Roundware server as "resume playing" API messages.
Parameters:
Name Type Description
sessionId Number Identifies the current session, must have been previously established by an instance of the Session class
initialGeoLocation Promise we will wait on this promise to resolve with initial coordinates before attempting to establish a stream
firstPlayCallback Stream~firstPlayCallback invoked the first time we connect to roundware and retrieve a stream URL
Source:
See:
  • pause()
Returns:
represents the pending API call
Type
Promise

toString()

Source:
Returns:
{String] human-readable description of this stream

update(data)

Sends data to the Roundware server. If the Stream has not been established, does nothing. Can use a list of tag_ids or a position (lat/lon) to filter the assets available to the stream. Typically for a normal geo-listen project, the position PATCH calls are triggered automatically by the client’s GPS/location system: every time a new position is registered by the client, a PATCH call is sent to let the server know and the server acts accordingly by adjusting the underlying music mix as well as modifying the playlist of available assets to be played.
Parameters:
Name Type Description
data Object [{}]
Source:

Stream

Establishes an audio stream with the Roundware server, and notifies Roundware of events like tag and geoposition updates

Constructor

new Stream()

Source:
To Do:
  • skip/ - causes currently playing asset to fade out and next available asset in playlist to begin playing thereafter
  • playasset/ - causes currently playing asset to fade out and asset specified by asset_id param is played thereafter
  • replayasset/ - causes currently playing asset to fade out and start playing again
  • pause/ - causes currently playing asset to fade out and prevents any further assets from being added to the stream (though the playlist continues to be updated per PATCH calls)
  • resume/ - un-does pause by allowing assets to be added to stream again from the playlist

Methods

pause()

Tells Roundware server to pause the audio stream - you should always call this when pausing local playback, to avoid wasting server resources
Source:

play(sessionId, initialGeoLocation, firstPlayCallback) → {Promise}

Request a streaming audio URL from Roundware server and establish a regular heartbeat. The heartbeat is used to keep a stream alive during a session. Streams take a lot of resources on the server, so we put the auto-kill mechanism in place to not have useless streams taking resources, but needed a method to keep them alive when we know they are still wanted. After we initially connect to Roundware, subsequent calls are forwarded to the Roundware server as "resume playing" API messages.
Parameters:
Name Type Description
sessionId Number Identifies the current session, must have been previously established by an instance of the Session class
initialGeoLocation Promise we will wait on this promise to resolve with initial coordinates before attempting to establish a stream
firstPlayCallback Stream~firstPlayCallback invoked the first time we connect to roundware and retrieve a stream URL
Source:
See:
  • pause()
Returns:
represents the pending API call
Type
Promise

toString()

Source:
Returns:
{String] human-readable description of this stream

update(data)

Sends data to the Roundware server. If the Stream has not been established, does nothing. Can use a list of tag_ids or a position (lat/lon) to filter the assets available to the stream. Typically for a normal geo-listen project, the position PATCH calls are triggered automatically by the client’s GPS/location system: every time a new position is registered by the client, a PATCH call is sent to let the server know and the server acts accordingly by adjusting the underlying music mix as well as modifying the playlist of available assets to be played.
Parameters:
Name Type Description
data Object [{}]
Source: