STSLiveStreamer
@interface STSLiveStreamer : NSObject
StraaS.io live streamer
-
The state of the live streamer.
Declaration
Objective-C
@property (nonatomic, readonly) STSStreamingState state;Swift
var state: STSStreamingState { get } -
The current streaming URL.
Declaration
Objective-C
@property (nonatomic, readonly) NSURL *_Nonnull streamingURL;Swift
var streamingURL: URL { get } -
The receiver’s delegate or nil if it doesn’t have a delegate.
Declaration
Objective-C
@property (nonatomic, weak, readwrite, nullable) id<STSLiveStreamerDelegate> delegate;Swift
weak var delegate: STSLiveStreamerDelegate? { get set } -
Creates and returns a STSLiveStreamer object with specified video and audio configurations.
Declaration
Objective-C
- (nonnull instancetype) initWithVideoConfiguration:(nonnull STSVideoConfiguration *)videoConfig audioConfiguration:(nonnull STSAudioConfiguration *)audioConfig;Swift
init(videoConfiguration videoConfig: STSVideoConfiguration, audioConfiguration audioConfig: STSAudioConfiguration)Parameters
videoConfigThe video configuration.
audioConfigThe audio configuration.
Return Value
An initialized STSLiveStreamer object.
-
Starts streaming with a given URL.
Declaration
Objective-C
- (void)startStreamingWithURL:(nonnull NSURL *)url success:(nonnull void (^)(void))success failure:(nonnull void (^)(NSError *_Nonnull))failure;Swift
func startStreaming(with url: URL, success: @escaping () -> Void, failure: @escaping (Error) -> Void)Parameters
urlThe streaming URL. Using multiple STSLiveStreamer instances to start stream with the same URL is unexpected.
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.
-
Stops streaming.
Declaration
Objective-C
- (void)stopStreamingWithSuccess:(nonnull void (^)(NSURL *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull, NSURL *_Nonnull))failure;Swift
func stopStreaming(success: @escaping (URL) -> Void, failure: @escaping (Error, URL) -> Void)Parameters
successA block object to be executed when the task finishes successfully. This block has no return value and takes one argument: the stopped streaming URL.
failureA block object to be executed when the task finishes unsuccessfully. This block has no return value and takes two arguments: the error object describing the error that occurred, and the streaming URL related to this error.
-
Pushes a video frame to the stream.
Declaration
Objective-C
- (void)pushVideoSampleBuffer:(nonnull CMSampleBufferRef)sampleBuffer;Swift
func pushVideoSampleBuffer(_ sampleBuffer: CMSampleBuffer)Parameters
sampleBufferThe video frame.
-
Pushes an audio frame to the stream.
Declaration
Objective-C
- (void)pushAudioSampleBuffer:(nonnull CMSampleBufferRef)sampleBuffer;Swift
func pushAudioSampleBuffer(_ sampleBuffer: CMSampleBuffer)Parameters
sampleBufferThe audio frame.
-
Pushes an audio frame which is sent from ReplayKit to the stream.
Declaration
Objective-C
- (void)pushAudioSampleBuffer:(nonnull CMSampleBufferRef)sampleBuffer ofAudioChannel:(nonnull NSString *)audioChannel;Swift
func pushAudioSampleBuffer(_ sampleBuffer: CMSampleBuffer, ofAudioChannel audioChannel: String)Parameters
sampleBufferThe audio frame.
audioChannelA constant NSString indicates the ReplayKit audio channel. The value could be kSTSReplayKitAudioChannelMic or kSTSReplayKitAudioChannelApp and must be registered by adding it to
replayKitAudioChannelsproperty of a STSAudioConfiguration object. ThesampleBufferwill be discarded if theaudioChannelis an unregistered channel.
View on GitHub
Install in Dash
STSLiveStreamer Class Reference