new Stream(options)
Create a new Stream
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Various configuration parameters for this stream
Properties
|
Methods
pause()
Tells Roundware server to pause the audio stream - you should always call this when pausing
local playback, to avoid wasting server resources
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 |
Returns:
represents the pending API call
- Type
- Promise
toString()
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 | [{}] |