From 7dcda23bf448889fee407026f7f8fbecba20085c Mon Sep 17 00:00:00 2001 From: Lee Sun-Hyoup Date: Sat, 17 Sep 2016 16:58:01 +0900 Subject: [PATCH] Add syntax highlighting --- README.md | 112 +++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index cb4a270f..1f07cf18 100644 --- a/README.md +++ b/README.md @@ -71,63 +71,63 @@ LFLiveKit ## Usage example #### Objective-C - - - (LFLiveSession*)session { - if (!_session) { - _session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]]; - _session.preView = self; - _session.delegate = self; - } - return _session; - } - - - (void)startLive { - LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new]; - streamInfo.url = @"your server rtmp url"; - [self.session startLive:streamInfo]; - } - - - (void)stopLive { - [self.session stopLive]; - } - - //MARK: - CallBack: - - (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state; - - (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo; - - (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode; - +```objc +- (LFLiveSession*)session { + if (!_session) { + _session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]]; + _session.preView = self; + _session.delegate = self; + } + return _session; +} + +- (void)startLive { + LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new]; + streamInfo.url = @"your server rtmp url"; + [self.session startLive:streamInfo]; +} + +- (void)stopLive { + [self.session stopLive]; +} + +//MARK: - CallBack: +- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state; +- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo; +- (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode; +``` #### Swift - - // import LFLiveKit in [ProjectName]-Bridging-Header.h - import - - //MARK: - Getters and Setters - lazy var session: LFLiveSession = { - let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration() - let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false) - let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration) - - session?.delegate = self - session?.preView = self.view - return session! - }() - - //MARK: - Event - func startLive() -> Void { - let stream = LFLiveStreamInfo() - stream.url = "your server rtmp url"; - session.startLive(stream) - } - - func stopLive() -> Void { - session.stopLive() - } - - //MARK: - Callback - func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?) - func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode) - func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState) - +```swift +// import LFLiveKit in [ProjectName]-Bridging-Header.h +#import + +//MARK: - Getters and Setters +lazy var session: LFLiveSession = { + let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration() + let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false) + let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration) + + session?.delegate = self + session?.preView = self.view + return session! +}() + +//MARK: - Event +func startLive() -> Void { + let stream = LFLiveStreamInfo() + stream.url = "your server rtmp url"; + session.startLive(stream) +} + +func stopLive() -> Void { + session.stopLive() +} + +//MARK: - Callback +func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?) +func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode) +func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState) +``` ## Release History * 2.0.0