Latest 0.1.2
Homepage https://github.com/SYNQfm/SYNQ-Swift
License MIT
Platforms ios 8.0
Dependencies Alamofire, SynqHttpLib
Authors

CI Status
Version
License
Platform

This is the SYNQ mobile SDK for iOS, written in Swift. It lets you easily integrate your mobile app with the SYNQ platform and the SYNQ Video API.

Example

To run the example project, clone the repo, and run pod install from the Example directory first. The example project features an app that utilizes the features of the SDK, and this shows how parts of the SDK are to be used.

Installation

SynqSwift is available through CocoaPods. If you do not have CocoaPods installed, you can install it with the following command:

$ gem install cocoapods

To integrate SynqSwift into your Xcode project, specify it in your Podfile:

pod "SynqSwift"

Then run the following commang to install:

$ pod install

If you get an error saying [!] Unable to find a specification for <name of pod>, try running pod repo update, and then run pod install again. This should fix it.

SynqUploader

This part consists of classes for fetching videos from the Photos library, exporting and uploading them to SYNQ. The SDK uses Alamofire for communicating with the server. It utilizes a background configured session manager to manage video uploads. This makes the upload continue regardless of whether the app is in the foreground or background.

Import SynqSwift

import SynqSwift

Init an instance of SynqUploader and set SQVideoUploadDelegate to be able to handle upload results

let uploader = SynqUploader()
uploader.delegate = self

Create a SQVideoUpload object for each PHAsset to be uploaded

let aVideo = SQVideoUpload.init(asset: anAsset)

Set upload parameters for the SQVideoUpload object

To do this, you must do two things.
1: Create a video object in the SYNQ API, and
2: Fetch upload parameters from the API for the created video object.

In the example project, the SynqHttpLib pod and the example server (SYNQ-Nodejs-example-server) performs these two functions in one step via the function "createVideoAndGetParamsWithSuccess:"

video.uploadParameters = uploadParams

Add each SQVideoUpload object to an array and call the upload function

uploader.uploadVideoArray(videos: videoArray, exportProgress:
{ progress in
    // Report export progress to UI
    self.progressView.progress = Float(progress)

}, uploadProgress: { progress in
    // We need progress between 0 and 1, so must divide percent by 100
    let progressBelowOne = progress / 100.0;

    // Report upload progress to UI
    self.progressView.progress = Float(progressBelowOne)
})

SQVideoUploadDelegate

The outcome of each upload is reported through the SQVideoUploadDelegate methods. These are the methods that are available, and how they should be used:

func videoUploadComplete(video: SQVideoUpload)

A video is successfully uploaded.

func videoUploadFailed(video: SQVideoUpload)

There was an error uploading a video.

func allVideosUploadedSuccessfully()

All videos were successfully uploaded.

Important note

The SDK is dependant on access to the SYNQ API to be able to create a video object and to fetch the upload parameters needed when calling the upload function. The SYNQ API is intended to be accessed from a server, this means that you should have your own server authenticating requests from the mobile client and making http calls to the SYNQ API. You will need to get an API key from the SYNQ admin panel, and use the key when making the calls to the SYNQ API. To get you started, you can use our [NodeJS example server] (https://github.com/SYNQfm/SYNQ-Nodejs-example-server) to see how the requests can be made. This also lets you try the functionality of the SDK.

For more info, please read the projects and api keys section in the docs.

Requirements

This SDK requires iOS 8 or above

Author

Kjartan Vestvik, [email protected]

License

SynqSwift is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SynqSwift",
    "version": "0.1.2",
    "summary": "SynqSwift is a Swift SDK that lets you easily add SYNQ video functionality to your mobile app",
    "description": "This SDK contains what you need to make your app interact with the SYNQ video API. The SDK contains functionality for accessing the videos on the device, and for uploading videos into the SYNQ infrastructure.nPlease note: this pod is an add-on to the SYNQ video API and is of no use unless you already have created a service for accessing the API, either directly or by using one of our SDKs. (http://docs.synq.fm)",
    "homepage": "https://github.com/SYNQfm/SYNQ-Swift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kjartan Vestvik": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SYNQfm/SYNQ-Swift.git",
        "tag": "0.1.2"
    },
    "social_media_url": "http://twitter.com/synqfm",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SynqSwift/Classes/**/*",
    "dependencies": {
        "Alamofire": [
            "~> 4.4"
        ],
        "SynqHttpLib": [
            "~> 0.2"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This