AudioStreamInfo

Represents an incoming or outgoing audio stream.


An audio stream is started through the StartAudioStreamRequest and it can be stopped through the StopAudioStreamRequest.

Members

(readonly) channels :number

Number of channels in the audio stream.
Type:
  • number

(readonly) delay :number

Amount of audio data, expressed in milliseconds, still remaining in the internal buffer of the current stream after a packet is processed and sent to the playback device.

The expected delay value is between 50 and 200 ms. If this value exceeds the upper threshold set in the audio configuration on the server side, a pitch shifting is applied to accellerate the playback and bring the latency back below the lower threshold (also set in the configuration).

Type:
  • number

(readonly) droppedFrames :number

Number of outgoing audio frames not delivered to the application because they were not processed fast enough.

In this API audio frames are never dropped (if the application doesn't process them fast enough, they are delivered late), so this value is always 0. It is available for consistency with the other SmartFoxServer client APIs, so that the same application logic can be used.

Audio frames not delivered while the stream is muted, or while no listeners are registered for the SFSAudioEvent.OUTGOING_FRAME event, are not counted: a gap in the sequenceNumber values means that the stream was muted, or that no listeners were registered.

Type:
  • number

(readonly) frameDurationMs :number

Duration of a single audio frame of the stream, expressed in milliseconds.

Audio is captured, encoded, transmitted and played back in fixed-length audio frames, each containing sampleRate * frameDurationMs / 1000 samples per channel. This value is defined in the audio configuration on the server side, is received by the client upon Audio Streaming System initialization and is shared by all audio streams.

When outgoing audio frames are exposed to the application (see ConfigData.AudioCfg.exposeOutgoingFrames), the time offset of an audio frame from the beginning of the stream is its sequenceNumber multiplied by this value.

Type:
  • number

(readonly) id :number

Identifier of the audio stream.

The id is always equal to the User id of the client sending the audio stream.

Type:
  • number

(readonly) isMono :boolean

Indicates whether the audio stream contains a single audio channel.
Type:
  • boolean

(readonly) isMuted :boolean

Indicates whether the current client is muted and no audio data is transmitted.
Type:
  • boolean

(readonly) leftLevel :number

The sound level of the left audio channel, expressed in dB.

Measured value is peak value or RMS (Root Mean Square) value, depending on the ConfigData.AudioCfg.monitoringMode property. If this is an incoming stream, this value is measured if the ConfigData.AudioCfg.monitorInLevel property is set to true only. If this is an outgoing stream, it is measured if the ConfigData.AudioCfg.monitorOutLevel property is set to true only.

Type:
  • number

(readonly) rightLevel :number

The sound level of the right audio channel, expressed in dB.

See leftLevel for more information. For mono audio (single audio channel), this value is equal to the left channel value.

Type:
  • number

(readonly) room :SFSRoom

The object representing the Room where the audio stream is transmitted.
Type:

(readonly) sampleRate :number

Sample rate of the audio stream.
Type:
  • number

(readonly) user :SFSUser

The User object representing the owner of the audio stream.
Type: