Minimal Command Line Client
We have a full working example of a minimal ODIN client in C, which demonstrates how to connect to an ODIN room and exchange voice data with other peers. The example is built using the miniaudio library for cross-platform audio capture and playback.
The example is located in the test
directory of the ODIN SDK repository.
To build and run the example, follow the instructions below.
Clone the Repository
To get started, clone the repository and navigate to the test
directory:
Configuring and Building
-
Create a build directory:
mkdir -p build && cd build
-
Generate build scripts for your preferred build system:
- For make ...
cmake ../
- ... or for ninja ...
cmake -GNinja ../
- For make ...
-
Build the test client:
- Using make ...
make
- ... or ninja ...
ninja
- Using make ...
On Windows, calling cmake
from the build directory will create a Visual Studio solution, which can be built using
the following command:
Using the Test Client
The test client accepts several arguments to control its functions, but the following three options are particularly crucial for its intended purpose:
The -r
argument (or --room-id
) is used to specify the name of the room to join. If no room name is provided, the
client will automatically join a room called default.
The -k
argument (or --access-key
) is used to specify an access key for generating tokens. If no access key is
provided, the test client will auto-generate a key and display it in the console. An access key is a unique
authentication key used to generate room tokens for accessing the 4Players ODIN server network. It is important to use
the same access key for all clients that wish to join the same ODIN room. For more information about access keys, please
refer to our documentation.
The -s
argument (or --server-url
) allows you to specify an alternate ODIN server address. This address can be either
the URL to an ODIN gateway or an ODIN server. You may need to specify an alternate server if you are hosting your own
fleet of ODIN servers. If you do not specify an ODIN server URL, the test client will use the default gateway, which is
located at https://gateway.odin.4players.io.
Note: You can use the --help
argument to get a full list of options provided by the console client.