Members
captureDevice :AudioDevice
If a specific device is not selected, the system default device is used.
(readonly) hasUserPermission :boolean
Permission is requested by means of the requestUserPermission method and is mandatory before starting an audio stream. On browsers that support live permission tracking, this value reflects a later revocation; otherwise it stays true once the permission has been granted.
- boolean
(readonly) isMuted :boolean
- boolean
playbackDevice :AudioDevice
If a specific device is not selected, the system default device is used.
Note: selecting a specific output device relies on AudioContext.setSinkId, which may not be available on all browsers. If this setter is called on browsers without support, the selection is not applied nor stored, and playback stays on the system default output device.
Methods
getAudioStreamInfo(userId) → {AudioStreamInfo}
| Name | Type | Description |
|---|---|---|
userId | number | The id of the User owning the audio stream. |
null if no AudioStreamInfo object with the passed id can be found.- Type:
- AudioStreamInfo
(async) getDevices() → {Promise.<AudioDevices>}
This method is accessible after the Audio Streaming System is initialized and the permission to access audio devices is granted by the user (see requestUserPermission method).
- Error if context is not secure (HTTPS, or http://localhost).
- Type
- SFSError
- Error if browser doesn't support Opus encoding/decoding of audio data.
- Type
- SFSError
- User permission to access audio device was not granted, or grant request failed. For detailed information check the type and message of the nested Error returned by the cause property.
- Type
- SFSError
- Type:
- Promise.<AudioDevices>
isStreaming(userId) → {boolean}
| Name | Type | Description |
|---|---|---|
userId | number | The id of the User owning the audio stream. |
true if the client is currently streaming audio in any Room.- Type:
- boolean
isStreamingInRoom(room) → {boolean}
| Name | Type | Description |
|---|---|---|
room | SFSRoom | The object representing the Room where to check if the client is currently streaming audio. |
true if the client is currently streaming audio in the passed Room.- Type:
- boolean
(async) requestUserPermission()
This method triggers the default browser's prompt for access to media inputs. It should be called as a consequence of a user gesture (for example click on a 'settings' button to access the list of audio devices, or click on a 'start stream' button right before starting audio capture from microphone) and it is mandatory before requesting to start an audio stream or accessing the list of audio devices. An error is thrown otherwise.
- Error if context is not secure (HTTPS, or http://localhost).
- Type
- SFSError
- Error if browser doesn't support Opus encoding/decoding of audio data.
- Type
- SFSError
- User permission to access audio device was not granted, or grant request failed. For detailed information check the type and message of the nested Error returned by the cause property.
- Type
- SFSError