tencent cloud

Tencent Real-Time Communication

お知らせ・リリースノート
製品アップデート情報
Tencent Cloudオーディオビデオ端末SDKの再生アップグレードおよび承認チェック追加に関するお知らせ
TRTCアプリケーションのサブスクリプションパッケージサービスのリリースに関する説明について
製品の説明
製品概要
基礎概念
製品の機能
製品の強み
ユースケース
性能データ
購入ガイド
Billing Overview
無料時間の説明
Monthly subscription
Pay-as-you-go
TRTC Overdue and Suspension Policy
課金に関するよくあるご質問
Refund Instructions
初心者ガイド
Demo体験
Call
コンポーネントの説明(TUICallKit)
Activate the Service
Run Demo
クイック導入
オフライン通知
Conversational Chat
クラウドレコーディング(TUICallKit)
AI Noise Reduction
インターフェースのカスタマイズ
Calls integration to Chat
Additional Features
No UI Integration
Server APIs
Client APIs
Solution
ErrorCode
公開ログ
よくある質問
ライブ配信
Billing of Video Live Component
Overview
Activating the Service (TUILiveKit)
Demo のクイックスタート
No UI Integration
UI Customization
Live Broadcast Monitoring
Video Live Streaming
Voice Chat Room
Advanced Features
Client APIs
Server APIs
Error Codes
Release Notes
FAQs
RTC Engine
Activate Service
SDKのダウンロード
APIコードサンプル
Usage Guidelines
クライアント側 API
高度な機能
RTC RESTFUL API
History
Introduction
API Category
Room Management APIs
Stream mixing and relay APIs
On-cloud recording APIs
Data Monitoring APIs
Pull stream Relay Related interface
Web Record APIs
AI Service APIs
Cloud Slicing APIs
Cloud Moderation APIs
Making API Requests
Call Quality Monitoring APIs
Usage Statistics APIs
Data Types
Appendix
Error Codes
コンソールガイド
アプリケーション管理
使用統計
監視ダッシュボード
開発支援
Solution
Real-Time Chorus
よくあるご質問
課金関連問題
機能関連
UserSig関連
ファイアウォールの制限の対応関連
インストールパッケージの圧縮に関するご質問
AndriodおよびiOS関連
Web端末関連
Flutter関連
Electron関連
TRTCCalling Web関連
オーディオビデオ品質関連
その他のご質問
旧バージョンのドキュメント
TUIRoom(Web)の統合
TUIRoom (Android)の統合
TUIRoom (iOS)の統合
TUIRoom (Flutter)の統合
TUIRoom (Electron)の統合
TUIRoom APIのクエリー
クラウドレコーディングと再生の実現(旧)
Protocols and Policies
セキュリティコンプライアンス認証
セキュリティホワイトペーパー
情報セキュリティの説明
Service Level Agreement
Apple Privacy Policy: PrivacyInfo.xcprivacy
TRTC ポリシー
プライバシーポリシー
データ処理とセキュリティ契約
用語集

Flutter

PDF
フォーカスモード
フォントサイズ
最終更新日: 2024-02-02 18:42:44
This document describes how to enter a TRTC room. Only after entering an audio/video room can a user subscribe to the audio/video streams of other users in the room or publish his or her own audio/video streams.

Call Guidelines

Step 1: Import SDK and Configure App Permissions

Please refer to the document Import SDK into the project to complete the SDK import.

Step 2: Create an SDK instance and set an event listener

Invoke various platform initialization interfaces to create the object instance of TRTC.
// Create a TRTCCloud singleton trtcCloud = (await TRTCCloud.sharedInstance())!; // Register TRTC event callback trtcCloud.registerListener(onRtcListener);

Step 3. Listen for SDK events

You can use callback APIs to listen for errors, warnings, traffic statistics, network quality, as well as various audio/video events of the SDK.
// We need to define a method to handle event callbacks, processing appropriately based on the type of the received event. // Taking onError as an example trtcCloud.registerListener(onRtcListener); onRtcListener(type, param) async { if (type == TRTCCloudListener.onError) { if (param['errCode'] == -1308) { MeetingTool.toast('Failed to initiate screen recording', context); } else { showErrordDialog(param['errMsg']); } } }

Step 4: Prepare the TRTCParams for entering the room

When calling the enterRoom interface, two key parameters need to be filled, namely TRTCParams and the application scene. A detailed introduction is as follows:

Parameter one: scene

This parameter refers to the specific application scene, whether it be video calls, interactive video broadcasting, audio calls, or interactive audio broadcasting:
Scenario Type

Scenario Introduction

TRTC_APP_SCENE_VIDEOCALL

Within the context of video calling, 720p and 1080p high-definition image quality is supported. A single room can accommodate up to 300 simultaneous online users, with a maximum of 50 users speaking at the same time.

TRTC_APP_SCENE_LIVE

In the context of interactive video broadcasting, the mic can be smoothly turned on/off without switching latency, with host latency as low as 300 milliseconds. Supports live streaming for hundreds of thousands of concurrent viewers, with playback delay reduced to 1000 milliseconds.
Note: In this scenario, you need to specify the current user's role using the 'role' field in TRTCParams.

TRTC_APP_SCENE_AUDIOCALL

In the audio call context, it supports 48 kHz duplex audio calls. A single room accommodates up to 300 concurrent online users, with a maximum of 50 people speaking at once.

TRTC_APP_SCENE_VOICE_CHATROOM

In the context of interactive audio live streaming, microphones can be switched on and off smoothly without delay. The host experiences a low latency of fewer than 300 milliseconds. It accommodates hundreds of thousands concurrent viewer users, with the broadcast delay reduced to 1000 milliseconds.
Note: In this scenario, you need to specify the current user's role using the 'role' field in TRTCParams.


Parameter 2: TRTCParams

TRTCParams is composed of numerous parameters, but typically, your attention could be principally directed towards filling out the following parameters:
Parameter name

Field Description

Supplementary Information

Data Type

Example

sdkAppId

Application ID

You can locate the SDKAppID within the Tencent Real-Time Communication console, if not present, click on the "Create Application" button to institute a new application.

Number

1400000123

userId

User ID

It can contain only letters, digits, underscores, and hyphens. In TRTC, a user cannot use the same user ID to enter the same room on two different devices at the same time.

String

"denny" or "123321"

userSig

The authentication ticket needed to enter a room

You can calculate userSig using the SDKAppID and userId. Please refer to Calculating and Using UserSig for the calculation method.

String

eJyrVareCeYrSy1SslI...

roomId

Room ID

Numeric type 'Room ID'. Be aware, if you wish to utilize a character sequence as the Room ID, please resort to the strRoomId field, rather than the roomId field, as strRoomId and roomId should not be used interchangeably.

Number

29834

strRoomId

Room ID

Room ID of string type. Note that `strRoomId` and `roomId` shouldn't be used interchangeably, as to the TRTC backend service, "123" and 123 are not the same room.

String

"29834"

role

Roles

Divided into "Anchor" and "Audience" roles, this field only needs to be specified when the TRTCAppScene is designated as TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom, these two live streaming scenarios.

Enumeration

TRTCRoleAnchor or TRTCRoleAudience

Note:
TRTC does not support the simultaneous entry of the same userId on two different devices. Doing so could lead to interference.
Each endpoint in the application scenario, appScene, must be unified to prevent unpredictable issues from cropping up.

Step 5: Enter the room (enterRoom)

After preparing the two parameters from Step 4 (application scenario and TRTCParams), you can call the enterRoom function to enter the room.
enterRoom() async { try { userInfo['userSig'] = await GenerateTestUserSig.genTestSig(userInfo['userId']); meetModel.setUserInfo(userInfo); } catch (err) { userInfo['userSig'] = ''; print(err); }
// If your scenario is "interactive video live broadcast", please set the scene to TRTC_APP_SCENE_LIVE, and set the appropriate value for the role field in TRTCParams. await trtcCloud.enterRoom( TRTCParams( sdkAppId: GenerateTestUserSig.sdkAppId, userId: userInfo['userId'], userSig: userInfo['userSig'], role: TRTCCloudDef.TRTCRoleAnchor, roomId: meetId!), TRTCCloudDef.TRTC_APP_SCENE_LIVE); }
Event Callback If room entry is successful, SDK will return the onEnterRoom(result) event where result is a positive number, indicating the time consumed to join the room in milliseconds (ms). If room entry fails, SDK will also call back the onEnterRoom(result) event, but the parameter result will be a negative number, representing the error code of room entry failure.
//Listen for SDK's onEnterRoom event to check if room entry is successful or not
onRtcListener(type, param) async {
if (type == TRTCCloudListener.onEnterRoom) { if (param > 0) { MeetingTool.toast('Enter room success', context); } }
}

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック