Swift Live stream Library

api.video Swift Live stream Library

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


With Cocoapods

  1. Add the following entry to your Podfile:
    pod ‘LiveStreamIos’
  2. Then run pod install
  3. Don’t forget to import LiveStreamIos in every file you’d like to use api.video livestream library


To be able to broadcast, you must update Info.plist with a usage description for camera and microphone

<string>Your own description of the purpose</string>
<string>Your own description of the purpose</string>

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
    class ViewController: UIViewController {
        var apiVideo:  ApiVideoLiveStream?
        @IBOutlet var viewCamera: UIView!
        override func 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


API.Video sdk is using external library

HaishinKit https://github.com/shogo4405/HaishinKit.swift


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


MIT License Copyright (c) 2021 api.video

Was this page helpful?