Skip to main content
Version: 1.x

Class Room

Main Room

Declaration
public class Room : IDisposable

Properties​

ConnectionState​

ConnectionState of the Room that is set by ODIN

Declaration
public static KeyValuePair<OdinRoomConnectionState, OdinRoomConnectionStateChangeReason> ConnectionState { get; }

ConnectionRetry​

The count of ConnectionState OdinNative.Core.Imports.NativeBindings.OdinRoomConnectionState.Connecting retry for reconnects. Reset on Connected

Declaration
public int ConnectionRetry { get; }

IsJoined​

true on successful Join or false

Declaration
public bool IsJoined { get; }

Self​

Client Peer

Declaration
public Peer Self { get; }

RoomUserData​

Odin UserData helper for marshal byte arrays on Room level

Declaration
public UserData RoomUserData { get; }

RemotePeers​

Conatiner of room peers

Declaration
public PeerCollection RemotePeers { get; }

PlaybackMedias​

Get all medias of room peers

Declaration
public IEnumerable<MediaCollection> PlaybackMedias { get; }

MicrophoneMedia​

Current room microphone data route

Declaration
public MicrophoneStream MicrophoneMedia { get; }

Fields​

Config​

Room configuration

Declaration
public readonly RoomConfig Config

Methods​

GetRoomId()​

Retrieves the room ID (e.g. the name of the room)

Declaration
public string GetRoomId()
Returns​

System.String: room name### GetRoomCustomer() Retrieves the identifier of the customer the room

Declaration
public string GetRoomCustomer()
Returns​

System.String: customer### GetRoomPeerId() Retrieves your own peer ID

Declaration
public ulong GetRoomPeerId()
Returns​

System.UInt64: peer id### GetRoomConnectionStats() Retrieves statistics for the underlying connection of this room

Declaration
public OdinConnectionStats GetRoomConnectionStats()
Returns​

Global.OdinConnectionStats: Statistics for the underlying connection of this room### SetApmConfig(OdinRoomConfig) Set rooms new Apm config

Declaration
public bool SetApmConfig(OdinRoomConfig config)
Returns​

System.Boolean: true on successful set or false

Parameters​
TypeNameDescription
Global.OdinRoomConfigconfignew Apm configuration

Join(string, string, IUserData)​

Join the room via Odin gateway

Declaration
public bool Join(string name, string userId, IUserData userData = null)
Returns​

System.Boolean: true on successful join or false

Parameters​
TypeNameDescription
System.Stringnameroom name
System.StringuserIduser id
OdinNative.Odin.IUserDatauserDatacustom userdata

Join(string)​

Join the room via Odin gateway

Declaration
public bool Join(string token)
Returns​

System.Boolean: true on successful join or false

Parameters​
TypeNameDescription
System.Stringtokenroom token

CreateMicrophoneMedia(OdinMediaConfig)​

Try to add a OdinNative.Odin.Media.MicrophoneStream to the room and set it to OdinNative.Odin.Room.Room.MicrophoneMedia

Declaration
public bool CreateMicrophoneMedia(OdinMediaConfig config)
Returns​

System.Boolean: true if media was added to the room or false

Parameters​
TypeNameDescription
Global.OdinMediaConfigconfigMicrophone device configuration

UpdatePeerUserData(IUserData)​

Updates the user data for our own peer. The server will populate this data to all other visible peers in the same room.

Declaration
public bool UpdatePeerUserData(IUserData userData)
Returns​

System.Boolean: true if userdata was set for the peer or false

Parameters​
TypeNameDescription
OdinNative.Odin.IUserDatauserDataUserdata to send

UpdatePeerUserDataAsync(IUserData)​

Updates the user data for our own peer. The server will populate this data to all other visible peers in the same room.

Declaration
public Task<bool> UpdatePeerUserDataAsync(IUserData userData)
Returns​

Global.Task<System.Boolean>: true if userdata was set for the peer or false

Parameters​
TypeNameDescription
OdinNative.Odin.IUserDatauserDataUserdata to send

SendMessage(ulong[], byte[])​

Sends arbitrary data to a array of target peerIds.

Declaration
public bool SendMessage(ulong[] peerIdList, byte[] data)
Returns​

System.Boolean: true if data was send or false

Parameters​
TypeNameDescription
System.UInt64[]peerIdListarray of ids(OdinNative.Odin.Peer.Peer.Id)
System.Byte[]dataarbitrary byte array

SendMessageAsync(ulong[], byte[])​

Sends arbitrary data to a array of target peerIds.

Declaration
public Task<bool> SendMessageAsync(ulong[] peerIdList, byte[] data)
Returns​

Global.Task<System.Boolean>: true if data was send or false

Parameters​
TypeNameDescription
System.UInt64[]peerIdListarray of ids(OdinNative.Odin.Peer.Peer.Id)
System.Byte[]dataarbitrary byte array

BroadcastMessage(byte[], bool)​

Sends arbitrary data to a all remote peers in this room.

Declaration
public bool BroadcastMessage(byte[] data, bool includeSelf = false)
Returns​

System.Boolean: true if data was send or false

Parameters​
TypeNameDescription
System.Byte[]dataarbitrary byte array
System.BooleanincludeSelfidicates whether this current peer id

BroadcastMessageAsync(byte[], bool)​

Sends arbitrary data to a all remote peers in this room.

Declaration
public Task<bool> BroadcastMessageAsync(byte[] data, bool includeSelf = false)
Returns​

Global.Task<System.Boolean>: true if data was send or false

Parameters​
TypeNameDescription
System.Byte[]dataarbitrary byte array
System.BooleanincludeSelfidicates whether this current peer get the message too

GetRemotePeersIds(bool)​

Get a copy of all PeerIds in this room

Declaration
public List<ulong> GetRemotePeersIds(bool includeSelf)
Returns​

Global.List<System.UInt64>: PeerIds

Parameters​
TypeNameDescription
System.BooleanincludeSelfto add the own peer id from the Joined event

GetRemotePeersMediaStreamIds()​

All ids of OdinNative.Odin.Media.MediaStream from remote peers in this room

Declaration
public ILookup<ulong, IEnumerable<long>> GetRemotePeersMediaStreamIds()
Returns​

Global.ILookup<System.UInt64,IEnumerable<System.Int64>>: Lookup of PeerId, MediaStreamIds

SetPositionScale(float)​

Configures the allowed 'view' distance for proximity calculation of peers in the room. Peers are visible to each other only within a unit circle of radius 1.0. When altering a peer's position, ensure the position is scaled such that the maximum distance remains one or less. So usually you want to set the scaling factor to 1/MaximumHearingDistance. This scaling can be performed manually or by specifying the multiplicative scale here.

Declaration
public bool SetPositionScale(float scale)
Returns​

System.Boolean: true if set or false

Parameters​
TypeNameDescription
System.SinglescalePer default, the room will use a distance of 1.0 fo proximity calculation

UpdatePosition(float, float)​

Updates the two-dimensional position of our own peer in the room

Declaration
public bool UpdatePosition(float x, float y)
Returns​

System.Boolean: true if set or false

Parameters​
TypeNameDescription
System.Singlexx postition
System.Singleyy postition

AudioProcessReverse(float[])​

Processes the reverse audio stream, also known as the loopback data to be used in the ODIN echo canceller.This should only be done if you are NOT using OdinNative.Core.Imports.NativeMethods.AudioMixStreams(RoomHandle,StreamHandle[],System.Single[]) .

Declaration
public bool AudioProcessReverse(float[] buffer)
Returns​

System.Boolean: false on error

Parameters​
TypeNameDescription
System.Single[]bufferthe audio buffer to process

ToString()​

Debug

Declaration
public override string ToString()
Returns​

System.String: info### Leave() Leave a room and free all remote peers and associated medias

Declaration
public void Leave()

Dispose(bool)​

On dispose will free the room and token generator

Declaration
protected virtual void Dispose(bool disposing)
Parameters​
TypeName
System.Booleandisposing

~Room()​

Default deconstructor

Declaration
protected ~Room()

Dispose()​

On dispose will free the room and token generator

Declaration
public void Dispose()

Events​

OnPeerJoined​

Passthrough event that identified a new PeerJoined event by Event-Tag.

Declaration
public event RoomPeerJoinedEventHandler OnPeerJoined
Event Type​

OdinNative.Odin.Room.RoomPeerJoinedEventHandler

OnPeerLeft​

Passthrough event that identified a new PeerLeft event by Event-Tag.

Declaration
public event RoomPeerLeftEventHandler OnPeerLeft
Event Type​

OdinNative.Odin.Room.RoomPeerLeftEventHandler

OnPeerUserDataChanged​

Passthrough event that identified a new PeerUpdated event by Event-Tag.

Declaration
public event RoomPeerUserDataChangedEventHandler OnPeerUserDataChanged
Event Type​

OdinNative.Odin.Room.RoomPeerUserDataChangedEventHandler

OnMediaAdded​

Passthrough event that identified a new MediaAdded event by Event-Tag.

Declaration
public event RoomMediaAddedEventHandler OnMediaAdded
Event Type​

OdinNative.Odin.Room.RoomMediaAddedEventHandler

OnMediaRemoved​

Passthrough event that identified a new MediaRemoved event by Event-Tag.

Declaration
public event RoomMediaRemovedEventHandler OnMediaRemoved
Event Type​

OdinNative.Odin.Room.RoomMediaRemovedEventHandler

OnMediaActiveStateChanged​

Passthrough event that identified a new MediaActiveStateChanged event by Event-Tag.

Declaration
public event MediaActiveStateChangedEventHandler OnMediaActiveStateChanged
Event Type​

OdinNative.Odin.Room.MediaActiveStateChangedEventHandler

OnRoomUserDataChanged​

Passthrough event that identified a new RoomUserDataChanged event by Event-Tag. Changing a Room's UserData is only possible via request to Odin server API, but not supported inside the client SDK.

Declaration
public event RoomUserDataChangedEventHandler OnRoomUserDataChanged
Event Type​

OdinNative.Odin.Room.RoomUserDataChangedEventHandler

OnMessageReceived​

Passthrough event that identified a new MessageReceived event by Event-Tag.

Declaration
public event RoomMessageReceivedEventHandler OnMessageReceived
Event Type​

OdinNative.Odin.Room.RoomMessageReceivedEventHandler

OnConnectionStateChanged​

Passthrough event that identified a new ConnectionStateChanged event by Event-Tag.

Declaration
public event RoomConnectionStateChangedEventHandler OnConnectionStateChanged
Event Type​

OdinNative.Odin.Room.RoomConnectionStateChangedEventHandler