IOS live stream
Live stream library for iOS from api.video
This module is an easy way to broadcast livestream on api.video platform
Installation
With Cocoapods
- Add the following entry to your Podfile:
pod ‘LiveStreamIos’
- Then run
pod install
- Don’t forget to import LiveStreamIos in every file you’d like to use api.video livestream library
Permissions
To be able to broadcast, you must update Info.plist with a usage description for camera and microphone
...
<key>NSCameraUsageDescription</key>
<string>Your own description of the purpose</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your own description of the purpose</string>
...
Quick Start
- In your ViewController.swift file import the library
- Add a viariable apiVideo
- Intenciate your variable with a view (or not if you dont want a preview of your stream)
- 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
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
Plugin | README |
---|---|
HaishinKit | https://github.com/shogo4405/HaishinKit.swift |
FAQ
If you have any questions, ask us here: https://community.api.video .
Or use Issues.
License
MIT License Copyright (c) 2021 api.video
Updated over 1 year ago