Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 67 additions & 57 deletions sdks/vod/apivideo-swift-uploader.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,77 @@
---
title: api.video Swift video uploader
meta:
description: The official api.video Swift video uploader for api.video. [api.video](https://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.
---

# api.video Swift video uploader

[api.video](https://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.

## Project description

api.video's Swift uploader uploads videos using delegated upload token or API Key.
[![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video)   [![badge](https://img.shields.io/github/stars/apivideo/api.video-swift-uploader?style=social)]()   [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video)
![](https://github.com/apivideo/.github/blob/main/assets/apivideo_banner.png)
<h1 align="center">api.video Swift uploader</h1>

[api.video](https://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](#project-description)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Carthage](#carthage)
- [CocoaPods](#cocoaPods)
- [Code sample](#code-sample)
- [Documentation](#documentation)
- [API Endpoints](#api-endpoints)
- [VideosAPI](#VideosAPI)
- [Models](#models)
- [Authorization](#documentation-for-authorization)
- [API key](#api-key)
- [Public endpoints](#public-endpoints)
- [Have you gotten use from this API client?](#have-you-gotten-use-from-this-api-client)
- [Contribution](#contribution)

# Project description

api.video's Swift for iOS, macOS and tvOS uploads videos to api.video using delegated upload token or API Key.

It allows you to upload videos in two ways:
- standard upload: to send a whole video file in one go
- progressive upload: to send a video file by chunks, without needing to know the final size of the video file

## Getting started
# Getting started

### Installation
## Installation

#### Carthage
### Carthage

Specify it in your `Cartfile`:

```
github "apivideo/api.video-swift-uploader" ~> 1.2.1
github "apivideo/api.video-swift-uploader" ~> 1.2.2
```

Run `carthage update`

#### CocoaPods
### CocoaPods

Add `pod 'ApiVideoUploader', '1.2.1'` in your `Podfile`
Add `pod 'ApiVideoUploader', '1.2.2'` in your `Podfile`

Run `pod install`

### Code sample
## Code sample

Please follow the [installation](#installation) instruction and execute the following Swift code:
```swift
import ApiVideoUploader

// If you rather like to use the sandbox environment:
// ApiVideoUploader.basePath = Environment.sandbox.rawValue

// If you rather like to use the sandbox environment:
// ApiVideoUploader.basePath = Environment.sandbox.rawValue
// If you rather like to upload with your "YOUR_API_KEY" (upload)
// ApiVideoUploader.apiKey = "YOUR_API_KEY"

try VideosAPI.uploadWithUploadToken(token: "MY_VIDEO_TOKEN", file: url) { video, error in
if let video = video {
// Manage upload with upload token success here
}
if let error = error {
// Manage upload with upload token error here
}
try VideosAPI.uploadWithUploadToken(token: "MY_VIDEO_TOKEN", file: url) { video, error in
if let video = video {
// Manage upload with upload token success here
}

if let error = error {
// Manage upload with upload token error here
}
}
```

## Documentation
# Documentation

### API Endpoints
## API Endpoints

All URIs are relative to *https://ws.api.video*

Expand All @@ -78,47 +88,47 @@ VideosAPI

Method | HTTP request | Description
------------- | ------------- | -------------
[**upload**](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideosAPI.md#upload) | **POST** /videos/{videoId}/source | Upload a video
[**uploadWithUploadToken**](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideosAPI.md#uploadWithUploadToken) | **POST** /upload | Upload with an delegated upload token
[**upload**](docs/VideosAPI.md#upload) | **POST** /videos/{videoId}/source | Upload a video
[**uploadWithUploadToken**](docs/VideosAPI.md#uploadWithUploadToken) | **POST** /upload | Upload with an delegated upload token



### Models
## Models

- [AccessToken](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AccessToken.md)
- [AdditionalBadRequestErrors](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AdditionalBadRequestErrors.md)
- [AuthenticatePayload](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AuthenticatePayload.md)
- [BadRequest](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/BadRequest.md)
- [Metadata](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/Metadata.md)
- [NotFound](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/NotFound.md)
- [RefreshTokenPayload](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/RefreshTokenPayload.md)
- [Video](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/Video.md)
- [VideoAssets](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoAssets.md)
- [VideoSource](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSource.md)
- [VideoSourceLiveStream](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSourceLiveStream.md)
- [VideoSourceLiveStreamLink](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSourceLiveStreamLink.md)
- [AccessToken](docs/AccessToken.md)
- [AdditionalBadRequestErrors](docs/AdditionalBadRequestErrors.md)
- [AuthenticatePayload](docs/AuthenticatePayload.md)
- [BadRequest](docs/BadRequest.md)
- [Metadata](docs/Metadata.md)
- [NotFound](docs/NotFound.md)
- [RefreshTokenPayload](docs/RefreshTokenPayload.md)
- [Video](docs/Video.md)
- [VideoAssets](docs/VideoAssets.md)
- [VideoSource](docs/VideoSource.md)
- [VideoSourceLiveStream](docs/VideoSourceLiveStream.md)
- [VideoSourceLiveStreamLink](docs/VideoSourceLiveStreamLink.md)


## Documentation for Authorization

### API key

Most endpoints required to be authenticated using the API key mechanism described in our [documentation](https://docs.api.video/reference#authentication).
The access token generation mechanism is automatically handled by the client. All you have to do is provide an API key:
```swift
ApiVideoUploader.apiKey = YOUR_API_KEY
```

You must NOT store your API key in your application code to prevent your API key from being exposed in your source code.
Only the [Public endpoints](#public-endpoints) can be called without authentication.
In the case, you want to call an endpoint that requires authentication, you will have to use a backend server. See [Security best practices](https://docs.api.video/sdks/security) for more details.

### Public endpoints

Some endpoints don't require authentication. These one can be called without setting `ApiVideoUploader.apiKey`:
Some endpoints don't require authentication. These one can be called without setting `ApiVideoUploader.apiKey`.

## Have you gotten use from this API client?

Please take a moment to leave a star on the client ⭐

This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!

## Contribution
# Contribution

Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our [client generator](https://github.com/apivideo/api-client-generator). Otherwise, you can also simply open an issue detailing your need on this repository.
Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our [client generator](https://github.com/apivideo/api-client-generator). Otherwise, you can also simply open an issue detailing your need on this repository.