PlayerLowLatencyExtension - Straas/Straas-iOS-sdk GitHub Wiki

Overview

StraaS PlayerLowLatencyExtension SDK is an extension for StraaS player library for the purpose of viewing low latency Real-Time streaming live.

Installation

Requires Swift 4.0/Xcode 9.3 or later.

If you need Swift 3.x/Xcode 9.2(or earlier) use the v0.13.0.

CocoaPods

Add following lines to your Podfile:

pod 'StraaS-iOS-SDK/PlayerLowLatencyExtension'

Then run pod install in the command line.
(You might need to do pod repo update before pod install.)

Getting Started

Note: Before using the SDK, you should read StraaS Player SDK first.

Play a Low Latency Live Stream

You should read StraaS Player SDK first for the basic knowledge of playing a stream.

You could call the method loadLiveWithId: lowLatency: in STSSDKPlayerView to play a low latency live with setting lowLatency to true and prepare your own STSLowLatencyPlayer manually in advance. For example:


 - (IBAction)loadLive:(id)sender {
    STSSDKPlayerView * playerView = [STSSDKPlayerView new];
    playerView.liveEventDelegate = self;
    playerView.delegate = self;
    [playerView setupLowLatencyPlayerIfNecessary:lowLatency];
    [playerView loadLiveWithId:@"<#the_Live_id_you_want_to_play#>" lowLatency:lowLatency];
}
 - (void)setupLowLatencyPlayerIfNecessary:(BOOL)isLowLatency {
     if (isLowLatency && !self.playerView.lowLatencyPlayer) {
         STSLowLatencyPlayer * lowLatencyPlayer = [STSLowLatencyPlayer new];
         self.playerView.lowLatencyPlayer = (id<STSPlayerPlayback>)lowLatencyPlayer;
     }
 }