Live Streaming to Swift
1 answer
You can try to use the VideoCore library , which will combine these frameworks into a complete streaming package. With this package, you can easily get started publishing with minimal effort. Take the following considerations (replicated from their projects):
To initiate a connection (Obj-C):
VCSimpleSession *sess = [[VCSimpleSession alloc] initWithVideoSize:CGSizeMake(width, height) frameRate:frameRate bitrate:bitrate] useInterfaceOrientation:YES];
sess.delegate = self;
To initiate a connection (Swift):
var sess:VCSimpleSession = VCSimpleSession(videoSize: CGSize(width: width, height: height), frameRate: frameRate, bitrate: bitRate, useInterfaceOrientation: false)
sess.delegate = self;
Use event handler (Obj-C):
- (void) connectionStatusChanged:(VCSessionState) state{
if(state==VCSessionStateStarting){
// connecting to destination host
}
else if(state==VCSessionStateStarted){
// connected, streaming has begun
}
// ... etc
}
Use event handler (Swift):
func connectionStatusChanged(sessionState: VCSessionState) {
switch session.rtmpSessionState {
case .Starting:
// initiating connection
case .Started:
// connected
default:
// connect
}
}
In addition, there is a paid SDK that can get support, for example the Wowza GoCoder SDK . Lots of options and stable infrastructure.
thank
Matt
0
source to share