- fork from https://pub-web.flutter-io.cn/packages/live_flutter_plugin
- 修复了自渲染内存溢出的问题
Melon ce075c2fd5 update gitignore | hai 1 ano | |
---|---|---|
android | hai 1 ano | |
example | hai 1 ano | |
ios | hai 1 ano | |
lib | hai 1 ano | |
test | hai 1 ano | |
.gitignore | hai 1 ano | |
CHANGELOG.md | hai 1 ano | |
LICENSE | hai 1 ano | |
README.md | hai 1 ano | |
README_zh-CN.md | hai 1 ano | |
analysis_options.yaml | hai 1 ano | |
pubspec.lock | hai 1 ano | |
pubspec.yaml | hai 1 ano |
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
.
├── 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>
Note: Without the above steps, the “Android Manifest merge failed” error will occur and the compilation will fail.
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.
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