nanocosmos Documentation

nanocosmos Documentation

  • nanoStream Cloud
  • H5Live Player
  • nanoStream Webcaster
  • nanoMeet
  • nanoStream Apps and SDKs
  • Samples
  • FAQ

›iOS

nanoStream SDKs/Apps

  • Introduction

Android

  • Getting started
  • Playback
  • Streaming Media
  • Sample

iOS

  • Developer Quickstart
  • Getting started
  • SDK for iOS
  • bintu.live client SDK
  • iOS Streaming App in 5 Minutes
  • License Deployment Information

Windows

  • Binary Modules for Windows
  • Developer Manual
  • nanoStream Windows Language Integration
  • Setting the license
  • RTMP Network Renderer & Writer
  • Encoder Plugin API

DirectShow

  • Overview
  • H264
  • RTMP
  • RTMP Writer
  • RTSP
  • UDP/TS Streaming
  • Video Filter
Edit

Developer Quickstart

The documentation is updated for nanoStream SDK v.4.10.0.0.

Purpose

This documentation is about the nanoStream Live Video Streaming SDK for iOS and can be used by software developers to integrate nanoStream Live Video Encoding into custom apps.

Requirements

  • Apple Mac with MacOS 10.9 or higher with Xcode 6 or higher
  • Apple iPhone with iOS 7 or later (min. iOS 8.1 recommended)

Check library version

int version = [nanostreamAVC getVersion];
if (version != NANOSTREAM_AVC_VERSION) {
  // Handle header and library version mismatch
}

nanostreamAVCSettings *nAVCSettings = [[nanostreamAVCSettings alloc] init];

// Set the RTMP URL, you want to stream to
[nAVCSettings setUrl:@"rtmp://localhost/live"];
[nAVCSettings setStreamId:@"myStream"];

// Set the video settings
[nAVCSettings setVideoResolution:Resolution640x480];
[nAVCSettings setVideoBitrate:512];
[nAVCSettings setKeyFramerate:60];
[nAVCSettings setOrientation:AVCaptureVideoOrientationLandscapeRight];
[nAVCSettings setCropMode:NoCrop];
[nAVCSettings setFramerate:30];
[nAVCSettings setH264Level:Baseline30];

// Set the audio settings
[nAVCSettings setInitialVolume:1.0];
[nAVCSettings setAudioMonoStereo:Stereo];
[nAVCSettings setAudioSamplerate:44100.0f];

Initialize the nanoStream module

// nAVC is a property of the controller class in this example
self.nAVC = [[nanostreamAVC alloc] initWithSettings:nAVCSettings
                                      eventListener:self];

// Set the license key (required for streaming)
[self.nAVC setLicense:@"nlic:1.2:LiveEnc:1.1:LvApp=1.....288"];

// Implement the nanostreamEventListener protocol method 
// to display a preview in the previewView
- (void)didUpdatePreviewLayer:(CALayer*)layer {

    // UI View is modified, main queue required
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self.previewView.layer.sublayers.count > 0) {
            self.previewView.layer.sublayers = nil;
        }
        layer.bounds = CGRectZero;
        [layer setFrame:self.previewView.bounds];
        [(AVCaptureVideoPreviewLayer*)layer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
        [self.previewView.layer addSublayer:layer];
    });
}

Start a stream

// Start broadcast asynchronously with completion handler
[self.nAVC start: ^(NSXError error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (error == NSXErrorNone) {
            // Handle succesful stream start
        } else {
            // Handle failure
        }
    });
}];
Last updated on 9/11/2023
← SampleGetting started →
  • Purpose
  • Requirements
  • Check library version
  • Initialize the nanoStream module
  • Start a stream
Contact
HomepageContactSupportLegal Terms
Products
Nanostream Cloud with Bintu.LiveH5Live Low Latency HTML5-PlayernanoStream WebcasterNanostream Apps and SDK
More
BlogTwitterFacebookLinkedInGitHubStar
nanocosmos GmbH
Copyright © 2023 nanocosmos GmbH - doc version Mon Sep 11 2023 09:43:20 GMT+0000 (Coordinated Universal Time)