Class OdinRoom
Wrapper class of OdinNative.Wrapper.Room.Room for Unity.
This convenient class provides dispatching of events to Unity with passthrough
Default Unity GameObject altering event callback functions:
OdinNative.Unity.OdinRoom.PeerJoinedCreateComponent(System.Object,PeerJoinedEventArgs)
Creates GameObject with OdinNative.Unity.OdinPeer componentOdinNative.Unity.OdinRoom.PeerLeftRemoveComponent(System.Object,PeerLeftEventArgs)
Destroy GameObject with OdinNative.Unity.OdinPeer componentOdinNative.Unity.OdinRoom.RoomStatusState(System.Object,RoomStateChangedEventArgs)
Destroy this components GameObject if the connection is closed i.e cleanup
Assembly: cs.temp.dll.dll
Implements:
Odin.IRoom
Properties
Samplerate
Unity samplerate
IsStereo
Unity channel flag
Id
Odin room id
CryptoCipher
Parent
Default value gameObject parent or Unity root
IsJoined
Fields
Gateway
Odin endpoint server
Token
Odin room token
AudioMixerGroup
Unity mixer
CryptoComponent
Odin Crypto cipher component
OnRoomJoined
OnMediaAdded
Event OdinNative.Wrapper.Room.Room.OnMediaStarted redirected as Unity event
OnMediaRemoved
Event OdinNative.Wrapper.Room.Room.OnMediaStopped redirected as Unity event
OnPeerJoined
Event OdinNative.Wrapper.Room.Room.OnPeerJoined redirected as Unity event
OnPeerLeft
Event OdinNative.Wrapper.Room.Room.OnPeerLeft redirected as Unity event
OnMessageReceived
Event OdinNative.Wrapper.Room.Room.OnMessageReceived redirected as Unity event
OnRoomStateChanged
Event OdinNative.Wrapper.Room.Room.OnRoomStatusChanged redirected as Unity event
Methods
GetBaseRoom<T>()
Odin base room
Returns
<T>
: wrapper room object##### Type Parameters
T
Room_OnDatagram(object, DatagramEventArgs)
Parameters
Type | Name |
---|---|
System.Object | sender |
Odin.DatagramEventArgs | args |
Room_OnRpc(object, RpcEventArgs)
Parameters
Type | Name |
---|---|
System.Object | sender |
Odin.RpcEventArgs | args |
Room_OnMessageReceived(object, ulong, byte[])
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
System.Byte[] | message |
Room_OnMediaStarted(object, ulong, MediaRpc)
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
Odin.MediaRpc | media |
MediaAddedPeerCreateComponent(object, MediaAddedEventArgs)
Parameters
Type | Name |
---|---|
System.Object | sender |
Odin.MediaAddedEventArgs | args |
Room_OnMediaStopped(object, ulong, ushort)
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
System.UInt16 | mediaId |
MediaRemovedPeerRemoveComponent(object, MediaRemovedEventArgs)
Parameters
Type | Name |
---|---|
System.Object | sender |
Odin.MediaRemovedEventArgs | args |
Room_OnRoomJoined(object, ulong, string, string, byte[], ushort[], ReadOnlyCollection<PeerRpc>)
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | ownPeerId |
System.String | name |
System.String | customer |
System.Byte[] | roomUserData |
System.UInt16[] | mediaIds |
System.Collections.ObjectModel.ReadOnlyCollection<OdinNative.Wrapper.Peer.PeerRpc> | peers |
Room_OnPeerLeft(object, ulong)
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
PeerLeftRemoveComponent(object, PeerLeftEventArgs)
Removes all child components with the same peer id
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | OdinRoom object |
Odin.PeerLeftEventArgs | args | left peer data |
RemovePeerComponent(GameObject)
Remove a OdinNative.Unity.OdinPeer from a gameobject
Parameters
Type | Name |
---|---|
Odin.GameObject | containerObject |
Room_OnPeerJoined(object, ulong, string, byte[], MediaRpc[])
Parameters
Type | Name |
---|---|
System.Object | sender |
System.UInt64 | peerId |
System.String | userId |
System.Byte[] | userData |
Odin.MediaRpc[] | medias |
PeerJoinedCreateComponent(object, PeerJoinedEventArgs)
Add a new GameObject with a new OdinNative.Unity.OdinPeer component
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | OdinRoom object |
Odin.PeerJoinedEventArgs | args | peer join data |
AddPeerComponent(GameObject, ulong, bool)
Add OdinNative.Unity.OdinPeer to a gameobject
Returns
OdinNative.Unity.OdinPeer: created component
Parameters
Type | Name | Description |
---|---|---|
Odin.GameObject | containerObject | gameobject where the component will be added |
System.UInt64 | peerId | id of OdinNative.Wrapper.PeerEntity |
System.Boolean | enable | flag if the new OdinNative.Unity.OdinPeer component is enabled |
Room_OnConnectionStatusChanged(object, string)
Parameters
Type | Name |
---|---|
System.Object | sender |
System.String | connectionStatus |
RoomStatusState(object, RoomStateChangedEventArgs)
Check status if the room should destroy the gameobject
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | OdinRoom object |
Odin.RoomStateChangedEventArgs | status | new status |
Join(string)
Room join
Returns
System.Boolean
: result of Join or false
Parameters
Type | Name |
---|---|
System.String | token |
Join(string, OdinCipherHandle)
Room join with optional encryption
Returns
System.Boolean
: result of Join or false
Parameters
Type | Name | Description |
---|---|---|
System.String | token | |
Odin.OdinCipherHandle | cipher | crypto cipher |
ProxyAudio(float[], int, bool)
Redirects audio to all media encoders in the corresponding room.
Parameters
Type | Name |
---|---|
System.Single[] | buffer |
System.Int32 | position |
System.Boolean | isSilent |
LinkInputMedia(uint, bool, out MediaEncoder)
Add a input media encoder to the corresponding room.
Returns
System.Boolean
: true on start or false
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | samplerate | encoder samplerate |
System.Boolean | stereo | encoder channel flag |
Odin.MediaEncoder | encoder | started encoder or null |
UnlinkInputMedia(MediaEncoder, bool)
Remove a input media encoder from the corresponding room.
Returns
System.Boolean
: true on stop or false
Parameters
Type | Name | Description |
---|---|---|
Odin.MediaEncoder | encoder | input media |
System.Boolean | free | flag if the freed up encoder id will be available for the room again |
ResumeOutputMedia(OdinMedia)
Start a stopped remote output decoder
Returns
System.Boolean
: true on start or false
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Unity.OdinMedia | media | output wrapper |
ResumeOutputMedia(MediaDecoder)
Start a stopped remote output decoder
Returns
System.Boolean
: true on start or false
Parameters
Type | Name | Description |
---|---|---|
Odin.MediaDecoder | decoder | output |
PauseOutputMedia(OdinMedia)
Stop a started remote output decoder
Returns
System.Boolean
: true on stop or false
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Unity.OdinMedia | media | output wrapper |
PauseOutputMedia(MediaDecoder)
Stop a started remote output decoder
Returns
System.Boolean
: true on stop or false
Parameters
Type | Name | Description |
---|---|---|
Odin.MediaDecoder | decoder | output |
GenerateTestToken(string, string, double, string)
Generate a test token from a test key
Returns
System.String
: Token or empty
Parameters
Type | Name | Description |
---|---|---|
System.String | roomId | Room name |
System.String | userId | User name |
System.Double | lifetimeMinutes | token valid timeframe |
System.String | testKey | optional test accesskey |
WebRequestToken(string, string)
Uses UnityWebRequest with POST data as json to get a response from a token-server
Returns
Odin.IEnumerator
: IEnumerator for Coroutine
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Token-Server endpoint |
System.String | jsonPayload | Request data |
WebRequestToken(string, string, UnityAction<DownloadHandler>)
Uses UnityWebRequest with POST data as json to get a response from a token-server
Returns
Odin.IEnumerator
: IEnumerator for Coroutine
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Token-Server endpoint |
System.String | jsonPayload | Request data |
Odin.UnityAction<DownloadHandler> | response | Response callback |
Implements
Odin.IRoom