https://github.com/tencent-rtc/wtn-demos
WTN(WebRTC Transmission Network) Demos
https://github.com/tencent-rtc/wtn-demos
Last synced: 2 months ago
JSON representation
WTN(WebRTC Transmission Network) Demos
- Host: GitHub
- URL: https://github.com/tencent-rtc/wtn-demos
- Owner: Tencent-RTC
- License: mit
- Created: 2022-02-24T11:35:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T01:55:19.000Z (about 4 years ago)
- Last Synced: 2025-03-24T08:54:41.330Z (about 1 year ago)
- Language: C++
- Size: 309 KB
- Stars: 8
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WTN-Demos
WTN(WebRTC Transmission Network) Demos
## HOW TO USE
1, Create your own TRTC app in Tencent Cloud.
2, Change your own `sdkappid` and `secret` in `server/config.ts`.
***Note that WTN is not for public for now, you should contact me to add your sdkappid to white list***
3, Run the server.
```bash
cd server/ && npm install
npx ts-node server.ts
```
4, Run the client.
```bash
cd client/ && npm install
npm run dev
```
## WTN(WebRTC Transmission Network)
WTN(WebRTC Transmission Network) is based on Tencent's RTC(TRTC), providing a high-quality WebRTC service.
It provides a simple http signaling api based on `WHIP`, and extend `WHIP` to support WebRTC playback.
[WHIP ietf](https://datatracker.ietf.org/doc/html/draft-ietf-wish-whip-02)
### Push stream
Push URL
`https://signaling.rtc.qcloud.com/v1/push/streamid?sdkappid=xxx&userid=xxx&usersig=xxxx`
| Params | Description | Required |
| ----------------- | -------------------- | -------------- |
| sdkappid | current sdkappid | YES |
| userid | current userid | YES |
| usersig | current usersig | YES |
| streamid | streamid | YES |
| prefervcodec | 'h264' or 'vp8', h264 default | NO |
Method: `POST`
Body: `SDP`
Content-Type: `application/sdp`
Resonse Code:
```
200/201: OK
400: Bad Request
403: Unauthorized
404: Not Found
409: Conflict, the steam exist
```
Response Header:
`Location: https://signaling.rtc.qcloud.com/v1/push/streamid?sdkappid=xxx&userid=xxxx&usersig=xxxxx&relay=xxxxx`
***Location is the url used to stop the stream***
Response Body: `SDP`
### Stop push stream
Stop URL
`https://signaling.rtc.qcloud.com/v1/push/streamid?sdkappid=xxx&userid=xxx&usersig=xxxx?relay=xxxx`
| Params | Description | Required |
| ----------------- | -------------------- | -------------- |
| sdkappid | current sdkappid | YES |
| userid | current userid | YES |
| usersig | current usersig | YES |
| streamid | streamid | YES |
| relay | relay id | YES |
Method: `DELETE`
Resonse Code:
```
200/201: OK
400: Bad Request
403: Unauthorized
404: Not Found
```
### Play stream
Push URL
`https://signaling.rtc.qcloud.com/v1/play/streamid?sdkappid=xxx&userid=xxx&usersig=xxxx`
| Params | Description | Required |
| ----------------- | -------------------- | -------------- |
| sdkappid | current sdkappid | YES |
| userid | current userid | YES |
| usersig | current usersig | YES |
| streamid | streamid | YES |
Method: `POST`
Body: `SDP`
Content-Type: `application/sdp`
Resonse Code:
```
200/201: OK
400: Bad Request
403: Unauthorized
404: Not Found
```
Response Header:
`Location: https://signaling.rtc.qcloud.com/v1/play/streamid?sdkappid=xxx&userid=xxxx&usersig=xxxxx&relay=xxxxx`
***Location is the url used to stop the stream***
Response Body: `SDP`
### Stop Play stream
Stop URL
`https://signaling.rtc.qcloud.com/v1/play/streamid?sdkappid=xxx&userid=xxx&usersig=xxxx?relay=xxxx`
| Params | Description | Required |
| ----------------- | -------------------- | -------------- |
| sdkappid | current sdkappid | YES |
| userid | current userid | YES |
| usersig | current usersig | YES |
| streamid | streamid | YES |
| relay | relay id | YES |
Method: `DELETE`
Resonse Code:
```
200/201: OK
400: Bad Request
403: Unauthorized
404: Not Found
```