Skip to content

Out-of-Box Experience

This guide is for developers trying TiRTC for the first time. The goal is to run one complete path with minimal setup and in the shortest possible time.

Prepare These Items First

Before you begin, prepare the following:

ItemNotes
Access IDAssigned by the TiRTC platform
Secret KeyThe secret paired with the Access ID
One licenseUsed by the media provider to start the walkthrough
One computerUsed to run the CLI and show config information. Currently macOS only
Two Android phonesOne runs the media provider and the other runs the viewer

Download the Two Android Demos

The quick walkthrough uses these two Android demos:

RoleAppDownload
Media providerRTC-Serverhttps://www.pgyer.com/tirtc-example-android-server
ViewerRTC-Clienthttps://www.pgyer.com/tirtc-example-android-client

Install the two apps on two Android phones before moving on.

Basic Flow

CLI

The CLI generates the token required for this connection.

Media Provider

The media provider captures local audio and video and waits for the viewer to connect.

This walkthrough uses the Android demo RTC-Server.

Viewer

The viewer uses peer_id and token to connect and play the remote audio and video.

This walkthrough uses the Android demo RTC-Client.

Step 1: Generate a Connection Token with the CLI

Install the CLI on your computer, then use it to generate the connection token and QR code for this walkthrough.

Install the CLI

bash
npm install -g tirtc-devtools-cli@latest

After installation, confirm that the CLI is available:

bash
tirtc-devtools-cli token issue --help

Configure Access ID and Secret Key

Export the two values as environment variables:

bash
export TIRTC_CONN_ACCESS_ID="<ACCESS_ID>"
export TIRTC_CONN_SECRET_KEY="<SECRET_KEY>"

Run the Command

Then run:

bash
tirtc-devtools-cli token issue "<PEER_ID>"

You only need to replace these placeholders:

  • <ACCESS_ID>
  • <SECRET_KEY>
  • <PEER_ID>

On success, the CLI prints:

  • peer_id
  • token
  • the ASCII QR code in the terminal
  • the local path to the QR code PNG

Step 2: Start the Media Provider

Prepare a QR code that contains the following content:

json
{
  "license": "XXAABBDDKKFF,zjdangjkasdjasd...."
}

Launch RTC-Server on one Android phone. After scanning the QR code, it enters the waiting state for incoming connections.

Step 3: Start the Viewer and Connect

Launch RTC-Client on the other Android phone.

Scan the connection token QR code generated by the CLI. The viewer then connects directly and starts playing the audio and video streamed from the first phone.

The connection token has replay protection. It becomes invalid after one use and must be generated again.

Next

TiRTC