Module device
Connect and control SBN media devices
Functions
- Device.getDeviceID (deviceUrl)
-
Extract a device ID from a url
Parameters:
- deviceUrl string
Returns:
-
string result device ID
- Device.getDeviceType (deviceUrl)
-
Extract the device type from a url
Parameters:
- deviceUrl string
Returns:
-
string result device type
- Device.create (deviceUrl)
-
Create a device
Parameters:
- deviceUrl string The URL of the device to create
Returns:
-
string | nil result the device url if the device was created
- Device.connect (deviceUrl, peerID)
-
Connect to a device
Parameters:
- deviceUrl string The device to connect to
- peerID string A unique (usually random) ID to identify the peer that is connecting to the device
Returns:
-
string | nil deviceURL If successful the deviceUrl will be returned
- Device.requestDisconnect (deviceUrl, peerID)
-
Request a device be disconnected.
This does not force a device to close - only if there are no further connections will the device close
Parameters:
- deviceUrl string The device to request to disconnect
- peerID string The peerID that was used to connect to the device
- Device.disconnect (deviceUrl)
-
Disconnect a device
This will force a device to be a disconnected, even if multple peers are connected
Parameters:
- deviceUrl string The device to disconnect
- Device.sendControl (deviceUrl, control)
-
Send a control message to a device
This is a low level function. Use higher level functions
Parameters:
- deviceUrl string The device URL to send a control message
- control table A key value map of the control request
Returns:
-
boolean success If successful this will return true
See also:
- Device.enableSpeaker (deviceUrl)
-
Enables the speaker on a device
Parameters:
- deviceUrl string The device URL to enable to speaker on
Returns:
-
boolean result whether it was successful
- Device.disableSpeaker (deviceUrl)
-
Disables the speaker on a device
Parameters:
- deviceUrl string The device URL to disable the speaker on
Returns:
-
boolean result whether it was successful
- Device.setAudioStream (deviceUrl, audioUrl)
-
Set the source audio stream
Parameters:
- deviceUrl string The device URL to set the audio stream on
- audioUrl string The device URL to take the audio stream from
- Device.stopScriptOnDisconnect (deviceURL)
-
Stop a script if the device is disconnected
Parameters:
- deviceURL string The url to listen for a disconnect