Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK README - api.video-swift-live-stream] README to documentation synchro #353

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 73 additions & 48 deletions templates/documentation/sdks/livestream/swift-livestream-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,50 @@ title: Swift live stream library
meta:
description: The official Swift live stream library for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
---
<!--
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
IF YOU NEED TO CHANGE THIS FILE, CREATE A PR IN THE SOURCE REPOSITORY.
-->

Swift Live stream library
============================
# Swift Live stream library

## [api.video Swift Live stream Library](https://github.com/apivideo/LiveStreamIos/blob/master/README.md)
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

This module is an easy way to broadcast live stream on api.video platform
## Project description

This module is an easy way to broadcast RTMP live stream to [api.video](https://api.video) platform

## Getting started

### Installation

#### With Cocoapods
#### Swift Package Manager

In the Project Navigator select your own project. Then select the project in the Project section and click on the Package Dependencies tab. Click on the "+" button at the bottom. Paste the below url on the search bar on the top right. Finaly click on "Add package" button.

```
https://github.com/api.video-swift-live-stream
```
Or add this in your Package.swift
```
dependencies: [
.package(url: "https://github.com/api.video-swift-live-stream.git", from: "1.3.5"),
],
```

#### Cocoapods

1. Add the following entry to your Podfile:
```swift
pod ‘LiveStreamIos’
```
3. Then run `pod install`
4. Don’t forget to import LiveStreamIos in every file you’d like to use api.video livestream library
```swift
pod 'ApiVideoLiveStream', '1.3.5'
```
2. Then run `pod install`
3. Don’t forget to import `ApiVideoLiveStream` in every file you’d like to use api.video live stream library

#### Carthage
```
github "apivideo/ApiVideoLiveStream.swift" ~> 1.3.5
```

### Permissions
To be able to broadcast, you must update Info.plist with a usage description for camera and microphone
Expand All @@ -34,53 +60,52 @@ To be able to broadcast, you must update Info.plist with a usage description for
...
```

### Quick Start
1. In your ViewController.swift file import the library
2. Add a viariable apiVideo
3. Intenciate your variable with a view (or not if you dont want a preview of your stream)
4. to start your stream use startLiveStreamFlux() function
- if you're broadcasting on api.video you only have to add your stream key to liveStreamKey, and nil for rtmpServerUrl)
- if not add your rtmp server url to rtmpServerUrl

```swift
class ViewController: UIViewController {
var apiVideo: ApiVideoLiveStream?
@IBOutlet var viewCamera: UIView!
override func viewDidLoad() {
super.viewDidLoad()
apiVideo = ApiVideoLiveStream(view: viewCamera)
apiVideo?.startLiveStreamFlux(liveStreamKey: "Your_stream_key", rtmpServerUrl: nil)
}
}
```

By default your stream will be

- 720p
- 30 fps
- back camera
- landscape
- microphone : on

### Plugins

API.Video sdk is using external library
### Code sample
1. In ViewController.swift import the library
```swift
import ApiVideoLiveStream
```
2. Create a `ApiVideoLiveStream` object with your default audio and video configuration
```swift
class ViewController: UIViewController {
var liveStream: ApiVideoLiveStream?
@IBOutlet var viewCamera: UIView!
override func viewDidLoad() {
super.viewDidLoad()
let audioConfig = AudioConfig(bitrate: 32 * 1000)
let videoConfig = VideoConfig(bitrate: 2 * 1024 * 1024, resolution: Resolutions.RESOLUTION_720, fps: 30)
do {
liveStream = try ApiVideoLiveStream(initialAudioConfig: audioConfig, initialVideoConfig: videoConfig, preview: preview)
} catch {
print (error)
}
}
}
```
3. Start your live stream with `startStreaming`
```swift
liveStream?.startStreaming(streamKey: "YOUR_STREAM_KEY")
```
Alternatively, you can use `startStreaming` `url` parameter to set the URL of your RTMP server.

## Plugins

api.video sdk is using external library

| Plugin | README |
| ------ | ------ |
| HaishinKit | [https://github.com/shogo4405/HaishinKit.swift][HaishinKit] |

#### FAQ
## FAQ
If you have any questions, ask us here: https://community.api.video .
Or use [Issues].

License
----

MIT License Copyright (c) 2021 api.video

Also feel free to test our [Sample app].

[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)

[Issues]: <https://github.com/apivideo/LiveStreamIos/issues>
[Issues]: <https://github.com/apivideo/api.video-swift-live-stream/issues>
[HaishinKit]: <https://github.com/shogo4405/HaishinKit.swift>
[Sample app]: <https://github.com/apivideo/api.video-swift-live-stream/Example>


Loading