English | 简体中文
The solution allows anchors to compete with each other and co-anchor with viewers in real time, with a global end-to-end latency of below 300 ms on average, and supports 1080p resolution.
live_flutter_plugin pub dev homepage
- Supports RTMP, HTTP-FLV, TRTC and WebRTC.
- View capturing, which allows you to capture the video images of the current livestream.
- Delay adjustment, which allows you to set the minimum time and maximum time for auto adjustment of the player cache.
- Customized video collection, which allows you to customize your audio and video data sources based on the project requirements.
- Beauty filters, filters, and stickers. The pusher contains multiple sets of beauty retouch algorithms (natural & smooth) and multiple color space filters (supporting custom filters).
- QoS traffic throttling technology and uplink network adaptation capability. The pusher can adjust the audio and video data volumes in real time based on the actual network conditions on the host side.
.
├── manager
│ ├── tx_audio_effect_manager.dart audio effect manager
│ ├── tx_beauty_manager.dart beauty manager
│ ├── tx_device_manager.dart device manager
│ └── tx_live_manager.dart pusher/player create/destroy
├── v2_tx_live_code.dart Definitions of error codes and warning codes of Tencent Cloud LVB.
├── v2_tx_live_def.dart Key type definitions for Tencent Cloud LVB.
├── v2_tx_live_player.dart Tencent Cloud live player-This player pulls audio and video data from the specified livestreaming URL and plays the data after decoding and local rendering.
├── v2_tx_live_player_observer.dart Tencent Cloud live player callback notification.
├── v2_tx_live_premier.dart V2TXLive High-level interface
├── v2_tx_live_pusher.dart Tencent Cloud live pusher-The live pusher encodes the local audio and video data and pushes the encoded data to a specified push URL.
├── v2_tx_live_pusher_observer.dart Live pusher callback notification.
└── widget
└── v2_tx_live_video_widget.dart V2TXLiveVideoWidget
The SDK for Flutter has been published on Pub. You can have the SDK downloaded and updated automatically by configuring pubspec.yaml.
dependencies:
live_flutter_plugin: latest version number
<key>NSCameraUsageDescription</key>
<string>Video calls are possible only with camera permission.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Audio calls are possible only with mic permission.</string>
2. Add xmlns:tools="http://schemas.android.com/tools" to “manifest”.
Note: Without the above steps, the “Android Manifest merge failed” error will occur and the compilation will fail.
1. Setup License
import 'package:live_flutter_plugin/v2_tx_live_premier.dart';
/// License Management View (https://console.cloud.tencent.com/live/license)
setupLicense() {
// License URL of your application
var LICENSEURL = "";
// License key of your application
var LICENSEURLKEY = "";
V2TXLivePremier.setLicence(LICENSEURL, LICENSEURLKEY);
}
note: Please use a real device, Simulator are not supported.
import 'package:live_flutter_plugin/v2_tx_live_pusher.dart';
/// V2TXLivePusher Initialization
initPusher() {
_livePusher = V2TXLivePusher(V2TXLiveMode.v2TXLiveModeRTC);
/// setup Pusher listener
_livePusher.addListener(onPusherObserver);
}
/// pusher observer
onPusherObserver(V2TXLivePusherListenerType type, param) {
debugPrint("==pusher listener type= ${type.toString()}");
debugPrint("==pusher listener param= $param");
}
import 'package:live_flutter_plugin/widget/v2_tx_live_video_widget.dart';
// viewId: view ID generated by `V2TXLiveVideoWidget`
Widget renderView() {
return V2TXLiveVideoWidget(
onViewCreated: (viewId) async {
_livePusher.setRenderViewID(_renderViewId);
},
);
}
startPush() async {
// open camera
await _livePusher.startCamera(true);
// open microphone
await _livePusher.startMicrophone();
// generate RTMP/TRTC url
var url = "";
// start push
await _livePusher.startPush(url);
}
stopPush() async {
// close camera
await _livePusher.stopCamera();
// close microphone
await _livePusher.stopMicrophone();
// stop push
await _livePusher.stopPush();
}
note: Please use other devices to test。
import 'package:live_flutter_plugin/v2_tx_live_player.dart';
initPlayer() {
/// Create V2TXLivePlayer
_livePlayer = V2TXLivePlayer();
_livePlayer.addListener(onPlayerObserver);
}
/// Player observer
onPlayerObserver(V2TXLivePlayerListenerType type, param) {
debugPrint("==player listener type= ${type.toString()}");
debugPrint("==player listener param= $param");
}
import 'package:live_flutter_plugin/widget/v2_tx_live_video_widget.dart';
// viewId: view ID generated by `V2TXLiveVideoWidget`
Widget renderView() {
return V2TXLiveVideoWidget(
onViewCreated: (viewId) async {
// set video renderView
_livePlayer.setRenderViewID(_renderViewId);
},
);
}
startPlay() async {
// generate RTMP/TRTC/Leb url
var url = ""
// start play
await _livePlayer?.startLivePlay(url);
}
/// stop play
stopPlay() {
_livePlayer.stopPlay();
}
live_flutter_plugin 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/
Please confirm io.flutter.embedded_views_preview is YES
in your info.plist
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