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 |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {NSString * const licenceURL = @"<your licenseUrl>";NSString * const licenceKey = @"<your key>";[V2TXLivePremier setEnvironment:@"GDPR"];// set your environment// V2TXLivePremier located in "V2TXLivePremier.h"[V2TXLivePremier setLicence:licenceURL key:licenceKey];[V2TXLivePremier setObserver:self];NSLog(@"SDK Version = %@", [V2TXLivePremier getSDKVersionStr]);return YES;}#pragma mark - V2TXLivePremierObserver- (void)onLicenceLoaded:(int)result Reason:(NSString *)reason {NSLog(@"onLicenceLoaded: result:%d reason:%@", result, reason);}@end
V2TXLivePlayer *_txLivePlayer = [[V2TXLivePlayer alloc] init];
// Use setRenderView to bind a rendering view to the player[_txLivePlayer setRenderView:_myView];
_myView
in the sample code) you provide. Instead, it creates a subview for OpenGL rendering over the view.transform
rather than frame
attribute of the view.[UIView animateWithDuration:0.5 animations:^{_myView.transform = CGAffineTransformMakeScale(0.3, 0.3); // Shrink by 1/3}];
NSString* url = @"http://2157.liveplay.myqcloud.com/live/2157_xxxx.flv";[_txLivePlayer startPlay:url];
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 |
// Pause playback[_txLivePlayer pauseAudio];[_txLivePlayer pauseVideo];// Resume playback[_txLivePlayer resumeAudio];[_txLivePlayer resumeVideo];
// Stop playback[_txLivePlayer stopPlay];
V2TXLivePlayerObserver
. This method captures a frame of the streamed video. To capture the UI, use the corresponding API of the iOS system.
...[_txLivePlayer setObserver:self];[_txLivePlayer snapshot];...- (void)onSnapshotComplete:(id<V2TXLivePlayer>)player image:(TXImage *)image {if (image != nil) {dispatch_async(dispatch_get_main_queue(), ^{[self handle:image];});}}
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 mode[_txLivePlayer setCacheParams:1 maxTime:5];// Speedy mode[_txLivePlayer setCacheParams:1 maxTime:1];// Smooth mode[_txLivePlayer setCacheParams:5 maxTime:5];// 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?