Skip to content

novalabio/api.video-ios-live-stream

 
 

Repository files navigation

badge   badge   badge

iOS RTMP live stream client

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.

Table of contents

Project description

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

Getting started

Installation

With Cocoapods

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

With Carthage

github "apivideo/ApiVideoLiveStream.swift" ~> 0.1.0

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>
...

Code sample

  1. In ViewController.swift import the library
import ApiVideoLiveStream
  1. Create a ApiVideoLiveStream object with your default audio and video configuration
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)
        }
    }
}
  1. Start your live stream with startStreaming
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

FAQ

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

Also feel free to test our Sample app.

About

iOS RTMP live stream client. Made with ♥ by api.video (https://api.video)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.1%
  • Ruby 2.9%