http
and ends with .flv
for LVB. For LEB, we recommend you use the WebRTC protocol. For more information, see LEB.Protocol | Advantage | Disadvantage | Playback Latency |
HLS | Mature, well adapted to high-concurrency scenarios | SDK integration is required | 3–5 seconds |
FLV | Mature, well adapted to high-concurrency scenarios | SDK integration is required. | 2-3 seconds |
RTMP | Relatively low latency | Poor performance in high-concurrency scenarios | 1-3 seconds |
WebRTC | Lowest latency | SDK integration is required | < 1 second |
Platform | GitHub Address |
iOS | |
Android | |
Flutter |
dependencies:live_flutter_plugin: latest version number
live_flutter_plugin
, complete the following configuration:import 'package:live_flutter_plugin/v2_tx_live_premier.dart';/// Tencent Cloud license management page (https://console.tencentcloud.com/live/license)setupLicense() {// The license URL of the current applicationvar LICENSEURL = "";// The license key of the current applicationvar LICENSEURLKEY = "";V2TXLivePremier.setLicence(LICENSEURL, LICENSEURLKEY);}
packageName/BundleId
configured in the license must be the same as that of the application; otherwise, playback will fail.V2TXLivePlayer
module in the SDK offers live playback capabilities.import 'package:live_flutter_plugin/v2_tx_live_player.dart';/// Initialize `V2TXLivePlayer`initPlayer() {_livePlayer = V2TXLivePlayer();_livePlayer.addListener(onPlayerObserver);}
v2_tx_live_video_widget
to create a video rendering view for the player to display video images on.import 'package:live_flutter_plugin/widget/v2_tx_live_video_widget.dart';/// The video rendering view widgetWidget renderView() {return V2TXLiveVideoWidget(onViewCreated: (viewId) async {// Set the video rendering view_livePlayer.setRenderViewID(_renderViewId);},);}
/// Start pulling the streamstartPlay() async {// Generate the `url` (RTMP/TRTC/LEB)var url = ""// Start pulling the streamawait _livePlayer?.startPlay(url);}
V2TXLIVE_ERROR_INVALID_LICENSE
returned?If the startPush
API returns V2TXLIVE_ERROR_INVALID_LICENSE
, it means your license verification failed. Please check your configuration against Step 2. Configure a license for the SDK.Value | Description |
V2TXLiveFillModeFill | Images are scaled to fill the entire screen, and the excess parts are cropped. There are no black bars in this mode, but images may not be displayed entirely. |
V2TXLiveFillModeFit | Images are scaled so that the long side of the video fits the screen. Neither side exceeds the screen after scaling. Images are centered, and there may be black bars visible. |
Value | Description |
V2TXLiveRotation0 | No rotation |
V2TXLiveRotation90 | Rotate 90 degrees clockwise |
V2TXLiveRotation180 | Rotate 180 degrees |
V2TXLiveRotation270 | Rotate 270 degrees clockwise |
// Pause playback_livePlayer.pauseAudio();_livePlayer.pauseVideo();// Resume playback_livePlayer.resumeAudio();_livePlayer.resumeVideo();
// Stop playback_livePlayer.stopPlay();
Mode | Stutter | Average Latency | Scenario | Remarks |
Speedy | Relatively high | 2-3s | Live showroom | Has better latency control and is suitable for scenarios that require a low latency. |
Smooth | Low | >= 5s | Game streaming | Suitable for game live streaming scenarios with a high bitrate. |
Auto | Adapts to network conditions | 2-8s | Hybrid | The better the network conditions at the audience end, the lower the latency. |
// Auto mode_txLivePlayer.setCacheParams(1, 5);// Speedy mode_txLivePlayer.setCacheParams(1, 1);// Smooth mode_txLivePlayer.setCacheParams(5, 5);// Start playback after configuration
V2TXLivePlayer
. Then, all internal SDK status information, such as player status, playback volume level, reception of the first audio/video frame, statistical data, warnings, and errors, will be notified to you through corresponding callbacks.Parameter | Description |
appCpu | CPU usage (%) of the application |
systemCpu | CPU usage (%) of the system |
width | Video width |
height | Video height |
fps | Frame rate (fps) |
audioBitrate | Audio bitrate (Kbps) |
videoBitrate | Video bitrate (Kbps) |
intervalMs
parameter in enableVolumeEvaluation
.
Was this page helpful?