API reference
API reference
Select your platform
No SDKs available
No versions available

Voip Class

The voip API provides platform methods to interact with the voip connections, inputs, syncing, and systems. You can also retrieve different statuses for the current voip state. These methods exist to help integrate a platform solution for voip in your app. Read more about voip in our docs

Static Member Functions

Gets whether the microphone is currently available to the app. This can be used to show if the user's voice is able to be heard by other users. Returns a microphone availability state flag which determines whether it is available or not - com.meta.horizon.platform.ovr.models.MicrophoneAvailabilityState.
Sets whether SystemVoip should be suppressed so that this app's Voip can use the microphone and play incoming Voip audio. Once microphone switching functionality for the user is released, this function will no longer work. You can use com.meta.horizon.platform.ovr.requests.Voip#getMicrophoneAvailability() to see if the user has allowed the app access to the microphone. This returns a com.meta.horizon.platform.ovr.models.SystemVoipState object which contains statuses about whether the microphone is muted or whether passthrough is enabled.
Parameters
suppressed
- A boolean indicates if the voip is supressed or not.
Accepts a VoIP connection from a given user.
Parameters
userID
- The ID of the user to accept the VoIP connection from.
Gets whether or not a voice connection is using discontinuous transmission (DTX). Both sides must set to using DTX when their connection is established in order for this to be true. Returns unknown if there is no connection.
Parameters
peerID
- The ID of the peer whose voice connection's DTX status is being queried.
Returns
VoipDtxState
Gets the current local bitrate used for the connection to the specified user. This is set by the current client. Returns unknown if there is no connection.
Parameters
peerID
- The ID of the peer whose local bitrate is being queried.
Returns
VoipBitrate
Returns the size of the internal ringbuffer used by the voip system in elements. This size is the maximum number of elements that can ever be returned by com.meta.horizon.platform.ovr.requests.Voip#getPCM.This function can be safely called from any thread.
Returns
long
Returns the current number of audio samples available to read for the specified user. This function is inherently racy; it's possible that more data can be added between a call to this function and a subsequent call to com.meta.horizon.platform.ovr.requests.Voip#getPCM.This function can be safely called from any thread.
Parameters
senderID
- The ID of the user to get the audio sample count for.
Returns
long
Gets the current remote bitrate used for the connection to the specified user. This is set by the client on the other side of the connection. Returns unknown if there is no connection.
Parameters
peerID
- The ID of the peer whose remote bitrate is being queried.
Returns
VoipBitrate
Returns a timestamp used for synchronizing audio samples sent to the given user with an external data stream.Timestamps associated with audio frames are implicitly transmitted to remote peers; on the receiving side, they can be obtained by using com.meta.horizon.platform.ovr.requests.Voip#getPCMWithTimestamp. com.meta.horizon.platform.ovr.requests.Voip#getPCMWithTimestamp is used to fetch those timestamps on the sending side an application can insert the value returned by this function into each data packet and compare it to the value returned by GetPCMWithTimestamp() on the receiving side in order to determine the ordering of two events (sampling audio and composing a data packet).Note: the timestamp is generated by an unspecified clock; it's doesn't generally represent wall-clock time. Use com.meta.horizon.platform.ovr.requests.Voip#getSyncTimestampDifference to convert the difference between two timestamps to microseconds.This function assumes that a voice connection to the user already exists; it returns 0 if that isn't the case.
Parameters
userID
- he ID of the user to which the audio samples are being sent.
Returns
long
Calculates the difference between two sync timestamps, returned by either com.meta.horizon.platform.ovr.requests.Voip#getSyncTimestamp or com.meta.horizon.platform.ovr.requests.Voip#getPCMWithTimestamp, and converts it to microseconds.Return value will be negative if lhs is smaller than rhs, zero if both timestamps are the same, and positive otherwise. The absolute value of the result is the time in microseconds between two sync timestamps.
Parameters
lhs
- The first sync timestamp to compare.
rhs
- The second sync timestamp to compare.
Returns
long
Returns SystemVoip microphone's mute state.
Returns
VoipMuteState
Returns SystemVoip status.
Returns
SystemVoipStatus
This function is used to enable or disable the local microphone. When muted, the microphone will not transmit any audio. Voip connections are unaffected by this state. New connections can be established or closed whether the microphone is muted or not. This can be used to implement push-to-talk, or a local mute button. The default state is unmuted.This function can be safely called from any thread.
Parameters
state
- A value indicating whether to mute or unmute the local microphone.
The options set for newly created connections to use. Existing connections will continue to use their current settings until they are destroyed and recreated.
Parameters
voipOptions
- The new options to be used for newly created connections.
Sets the output sample rate. Audio data will be resampled as it is placed into the internal ringbuffer.This function can be safely called from any thread.
Parameters
rate
- The new output sample rate to use.
Attempts to establish a VoIP session with the specified user.A message of type com.meta.horizon.platform.ovr.Message.MessageType#Notification_Voip_SystemVoipState will be posted when the session is established.This function can be safely called from any thread.
Parameters
userID
- The ID of the user to establish a VoIP session with.
Terminates a VoIP session with the specified user. Note that a muting functionality should be used to temporarily stop sending audio; restarting a VoIP session after tearing it down may be an expensive operation.This function can be safely called from any thread.
Parameters
userID
- The ID of the user to terminate the VoIP session with.
Indicates that the current microphone availability state has been updated. Use com.meta.horizon.platform.ovr.requests.Voip#getMicrophoneAvailability() to extract the microphone availability state.
Sent to indicate that some part of the overall state of SystemVoip has changed. Use com.meta.horizon.platform.ovr.models.SystemVoipState#getStatus() and the properties of com.meta.horizon.platform.ovr.models.SystemVoipState to extract the state that triggered the notification. Note that the state may have changed further since the notification was generated, and that you may call the GetSystemVoip...() family of functions at any time to get the current state directly.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon