http
and end with flv
) for LVB and WebRTC for LEB. For more information, please see LEB.Protocol | Pro | Con | Playback Latency |
HLS | Mature, well adapted to high-concurrency scenarios | SDK integration is required. | 3s - 5s |
FLV | Mature, well adapted to high-concurrency scenarios | SDK integration is required | 2s - 3s |
RTMP | Relatively low latency | Poor performance in high-concurrency scenarios | 1s - 3s |
WebRTC | Lowest latency | SDK integration is required | < 1s |
public class MyApplication extends Application {@Overridepublic void onCreate() {super.onCreate();String licenceURL = ""; // your licence urlString licenceKey = ""; // your licence keyV2TXLivePremier.setEnvironment("GDPR"); // set your environmentV2TXLivePremier.setLicence(this, licenceURL, licenceKey);V2TXLivePremier.setObserver(new V2TXLivePremierObserver() {@Overridepublic void onLicenceLoaded(int result, String reason) {Log.i(TAG, "onLicenceLoaded: result:" + result + ", reason:" + reason);}});}
<com.tencent.rtmp.ui.TXCloudVideoViewandroid:id="@+id/video_view"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_centerInParent="true"android:visibility="visible"/>
// mPlayerView is the view added in step 1TXCloudVideoView mView = (TXCloudVideoView) view.findViewById(R.id.video_view);// Create a player objectV2TXLivePlayer mLivePlayer = new V2TXLivePlayerImpl(mContext);// Associate the player object with the viewmLivePlayer.setRenderView(mView);
String flvUrl = "http://2157.liveplay.myqcloud.com/live/2157_xxxx.flv";mLivePlayer.startPlay(flvUrl);
video_view
control added in Step3.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 in whole. |
V2TXLiveFillModeFit | Images are scaled as large as the longer side can go. Neither side exceeds the screen after scaling. Images are centered, and there may be black bars. |
Value | Description |
V2TXLiveRotation0 | Original |
V2TXLiveRotation90 | Rotate 90 degrees clockwise |
V2TXLiveRotation180 | Rotate 180 degrees clockwise |
V2TXLiveRotation270 | Rotate 270 degrees clockwise |
// Set the fill modemLivePlayer.setRenderFillMode(V2TXLiveFillModeFit);// Set the rotation of videomLivePlayer.setRenderRotation(V2TXLiveRotation0);
// Pause playbackmLivePlayer.pauseAudio();mLivePlayer.pauseVideo();// Resume playbackmLivePlayer.resumeAudio();mLivePlayer.resumeVideo();
stopPlay
to stop playback.mLivePlayer.stopPlay();
mLivePlayer.setObserver(new MyPlayerObserver());mLivePlayer.snapshot();// Get the screenshot taken in the onSnapshotComplete callback of MyPlayerObserverprivate class MyPlayerObserver extends V2TXLivePlayerObserver {...@Overridepublic void onSnapshotComplete(V2TXLivePlayer v2TXLivePlayer, Bitmap bitmap) {}...}
Mode | Stutter | Average Latency | Scenario | Remarks |
Speedy | More likely than the speedy mode | 2-3s | Live showroom (Chongding Dahui) | The mode delivers low latency and is suitable for latency-sensitive scenarios. |
Smooth | Least likely of the three | >= 5s | Game streaming (Penguin Esports) | Playback is least likely to stutter in this mode, which makes it suitable for ultra-high-bitrate streaming of games such as PUBG. |
Auto | Self-adaptive to network conditions | 2-8s | Hybrid | The better network conditions at the audience end, the lower the latency. |
// Auto modemLivePlayer.setCacheParams(1.0f, 5.0f);// Speedy modemLivePlayer.setCacheParams(1.0f, 1.0f);// Smooth modemLivePlayer.setCacheParams(5.0f, 5.0f);// Start playback after configuration
V2TXLivePlayer
object to receive callback notifications about the player status, playback volume, first audio/video frame, statistics, warning and error messages, etc.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 of enableVolumeEvaluation
.
Was this page helpful?