STSLiveEventListener
@interface STSLiveEventListener : NSObject
An instance of STSLiveEventListener is a means for listening live event from StraaS server.
-
The CCU of the current live.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *ccu;Swift
var ccu: NSNumber? { get } -
The hit count of the current live.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *hitCount;Swift
var hitCount: NSNumber? { get } -
The broadcast start time in millisecond.
nilif the live stream is stopped.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSNumber *broadcastStartTimeInMS;Swift
var broadcastStartTimeInMS: NSNumber? { get } -
The id of the current live.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *liveId;Swift
var liveId: String? { get } -
A boolean value indicates whether the STSLiveEventListener object is listening to the live event or not. This property is deprecated. Use
stateinstead.Declaration
Objective-C
@property (nonatomic, readonly) BOOL isListening;Swift
var isListening: Bool { get } -
The state of the STSLiveEventListener.
Declaration
Objective-C
@property (nonatomic, readonly) STSLiveEventListenerState state;Swift
var state: STSLiveEventListenerState { get } -
The broadcast state of the live.
Declaration
Objective-C
@property (nonatomic, readonly) STSLiveBroadcastState broadcastState;Swift
var broadcastState: STSLiveBroadcastState { get } -
Creates a STSLiveEventListener with the given parameters.
This method can only be called after you configured application successfully (by calling
configureApplication:method inSTSApplicationclass), otherwise you will get a nil object.Declaration
Objective-C
- (nonnull instancetype) initWithWithJWT:(NSString *_Nullable)JWT delegate:(nonnull id<STSLiveEventListenerDelegate>)delegate;Swift
init(withJWT JWT: String?, delegate: STSLiveEventListenerDelegate)Parameters
JWTThe member token got from StraaS server. Set this parameter to
nilif the member is a guest.delegateThe delegate of the STSLiveEventListener object.
Return Value
A newly STSLiveEventListener object.
-
Starts to listen to the live event with given live id.
Declaration
Objective-C
- (void)startWithLiveId:(nonnull NSString *)liveId success:(void (^_Nullable)(void))success failure:(void (^_Nullable)(NSError *_Nonnull))failure;Swift
func start(withLiveId liveId: String, success: (() -> Void)?, failure: ((Error) -> Void)? = nil)Parameters
liveIdThe id of the live you want to listent its event.
successA block object to be executed when the task finishes successfully.
failureA block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
-
Stop to listen to the change of the live.
Declaration
Objective-C
- (void)stop;Swift
func stop()
View on GitHub
Install in Dash
STSLiveEventListener Class Reference