Skip to content

Commit

Permalink
Merge pull request LaiFengiOS#92 from kciter/patch-1
Browse files Browse the repository at this point in the history
Add syntax highlighting
  • Loading branch information
小歪~~~ authored Sep 21, 2016
2 parents 73c9ade + 7dcda23 commit 77d6a5b
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <LFLiveKit.h>

//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 <LFLiveKit.h>

//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
Expand Down

0 comments on commit 77d6a5b

Please sign in to comment.