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:
| Item | Notes |
|---|---|
Access ID | Assigned by the TiRTC platform |
Secret Key | The secret paired with the Access ID |
| One license | Used by the media provider to start the walkthrough |
| One computer | Used to run the CLI and show config information. Currently macOS only |
| Two Android phones | One runs the media provider and the other runs the viewer |
Download the Two Android Demos
The quick walkthrough uses these two Android demos:
| Role | App | Download |
|---|---|---|
| Media provider | RTC-Server | https://www.pgyer.com/tirtc-example-android-server |
| Viewer | RTC-Client | https://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
npm install -g tirtc-devtools-cli@latestAfter installation, confirm that the CLI is available:
tirtc-devtools-cli token issue --helpConfigure Access ID and Secret Key
Export the two values as environment variables:
export TIRTC_CONN_ACCESS_ID="<ACCESS_ID>"
export TIRTC_CONN_SECRET_KEY="<SECRET_KEY>"Run the Command
Then run:
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_idtoken- 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:
{
"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
- To issue tokens from your own backend service, see Generate a Connection Token
- To integrate the viewer into your Android client project, see Android SDK Integration Guide
- To implement your own media provider, such as an IoT device, see Nano SDK Integration Guide