trtc flutter库

loki.wu 89f4ebe4bd Revert "新增缺失的方法" 1 year ago
.dart_tool 5f7f5dce2b do pub get 1 year ago
android 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
ios 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
lib 89f4ebe4bd Revert "新增缺失的方法" 1 year ago
macos 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
web b6b12aa5dd 完成 TRTC SDK 升级,2.4.2->2.7.0 1 year ago
windows 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
.gitignore ac16996136 init project 2 years ago
API.md 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
CHANGELOG.md 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
COMMON_ISSUE.md ac16996136 init project 2 years ago
LICENSE ac16996136 init project 2 years ago
README.md 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago
dartdoc_options.yaml ac16996136 init project 2 years ago
pubspec.lock 5f7f5dce2b do pub get 1 year ago
pubspec.yaml 33ba8a83c1 使用 2.7.0 原版 SDK 完全覆盖 trtc_magic 1 year ago

README.md

简体中文 | English

TRTC SDK (Flutter)

API OverViewAPI Detailed documentation

Demonstrates how to use RTC APIs for Flutter. API Example

Note: Demo does not support simulator operation. Please use real machine development and debugging.

Demo quick start

Please see Demo Quick Start(Flutter)

SDK quick integration

Please see Quick integration(Flutter)

SDK class files

  • trtc_cloud-Tencent Cloud TRTC Core Function Interface.
  • trtc_cloud_video_view-Provides widgets for rendering video TRTCCloudVideoView.
  • tx_audio_effect_manager-Tencent Cloud Audio Effect Management Module.
  • tx_beauty_manager-Beauty filter and animated effect parameter management.
  • tx_device_manager-Tencent Cloud Audio Effect Management Module.
  • trtc_cloud_def-TRTC key class definition Description: definitions of interfaceerated and constant values such as resolution and quality level
  • trtc_cloud_listener-Tencent Cloud TRTC Event Notification Interface.

Sample call

1.Initialization

// Create TRTCCloud singleton
trtcCloud = await TRTCCloud.sharedInstance();
// Tencent Cloud Audio Effect Management Module
txDeviceManager = trtcCloud.getDeviceManager();
// Beauty filter and animated effect parameter management
txBeautyManager = trtcCloud.getBeautyManager();
// Tencent Cloud Audio Effect Management Module
txAudioManager = trtcCloud.getAudioEffectManager();

2.Room entry/exit

// Room entry/exit
trtcCloud.enterRoom(
        TRTCParams(
            sdkAppId: sdkAppId,
            userId: userId,
            userSig: userSig,
            roomId: roomId),
        TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL);
// Leave a room
trtcCloud.exitRoom();

3.Listener registration

// Register a listener
trtcCloud.registerListener(onRtcListener);
onRtcListener(type, param) {
  // Callback for room entry
  if (type == TRTCCloudListener.onEnterRoom) {
    if (param > 0) {
      showToast('Entered the room successfully');
    }
  }
  // Callback for the entry of a remote user
  if (type == TRTCCloudListener.onRemoteUserEnterRoom) {
    // The parameter is the user ID of the remote user.
  }
  // Whether the remote user has a playable primary image (generally for camera)
  if (type == TRTCCloudListener.onUserVideoAvailable) {
    //param['userId'] is the user ID of the remote user
    //param['visible'] indicates whether image is enabled
  }
}
//Remove a listener
trtcCloud.unRegisterListener(onRtcListener);

4.Playing local video

// Parameters:
// frontCamera: `true`: front camera; `false`: rear camera
// viewId: view ID generated by `TRTCCloudVideoView`
TRTCCloudVideoView(
    onViewCreated: (viewId) {
      trtcCloud.startLocalPreview(true, viewId);
});

5.Display remote video

// Parameters:
// userId: Specifies the userid of the remote user
// streamType: Specifies the type of video stream to watch userid:
//* HD big picture:TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG
//* Low definition large picture:TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_SMALL
// viewId: view ID generated by `TRTCCloudVideoView`
TRTCCloudVideoView(
    onViewCreated: (viewId) {
      trtcCloud.startRemoteView(userId, TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_SMALL, viewId);
});

5.Display remote screen sharing

/// Parameters:
/// userId: Specifies the userid of the remote user
/// streamType: type of the remote user’s video stream to play:
///* Substream (screen sharing): TRTCCloudDe.TRTC_VIDEO_STREAM_TYPE_SUB
/// viewId: view ID generated by `TRTCCloudVideoView`
TRTCCloudVideoView(
    onViewCreated: (viewId) {
      trtcCloud.startRemoteView(userId, TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_SUB, viewId);
});

How do I view TRTC logs?

TRTC logs are compressed and encrypted by default with the XLOG extension. You can set setLogCompressEnabled to specify whether to encrypt logs. If a log filename contains C (compressed), the log is compressed and encrypted; if it contains R (raw), the log is in plaintext.

  • iOS:Documents/log of the application sandbox
  • Android
    • 6.7 or below: /sdcard/log/tencent/liteav
    • 6.8 or above: /sdcard/Android/data/package name/files/log/tencent/liteav/

Common problem

IOS cannot display video (Android is good)

Please confirm io.flutter.embedded_views_preview is YES in your info.plist

Android Manifest merge failed

Please Open '/example/android/app/src/main/AndroidManifest.xml' file。

1.Add xmlns:tools="http://schemas.android.com/tools" to manifest

2.Add tools:replace="android:label" to application