Skip to content

Commit e71f654

Browse files
Merge pull request #81 from apivideo/bugfix/swift5_sample_progress
fix(swift5): example: dispatch call to main thread
2 parents 63ef5e8 + 81de5b6 commit e71f654

File tree

2 files changed

+41
-56
lines changed

2 files changed

+41
-56
lines changed

Example/Example/MainViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ class MainViewController: UIViewController {
123123
do {
124124
return try await self.upload(fileUrl: videoUrl, progress: { progress in
125125
print("Progress: \(progress.fractionCompleted)")
126-
self.progressView.progress = Float(progress.fractionCompleted)
126+
DispatchQueue.main.async {
127+
self.progressView.progress = Float(progress.fractionCompleted)
128+
}
127129
})
128130
} catch {
129131
print("Upload error: \(error)")

README.md

Lines changed: 38 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,40 @@
1-
<!--<documentation_excluded>-->
21
[![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video) &nbsp; [![badge](https://img.shields.io/github/stars/apivideo/api.video-swift-uploader?style=social)]() &nbsp; [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video)
32
![](https://github.com/apivideo/.github/blob/main/assets/apivideo_banner.png)
43
<h1 align="center">api.video Swift uploader</h1>
54

65
[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.
76

8-
## Table of contents
7+
# Table of contents
98

10-
- [Table of contents](#table-of-contents)
119
- [Project description](#project-description)
1210
- [Getting started](#getting-started)
1311
- [Installation](#installation)
1412
- [Carthage](#carthage)
15-
- [CocoaPods](#cocoapods)
13+
- [CocoaPods](#cocoaPods)
1614
- [Code sample](#code-sample)
1715
- [Documentation](#documentation)
1816
- [API Endpoints](#api-endpoints)
19-
- [VideosAPI](#videosapi)
20-
- [Retrieve an instance of VideosAPI:](#retrieve-an-instance-of-videosapi)
21-
- [Endpoints](#endpoints)
17+
- [VideosAPI](#VideosAPI)
2218
- [Models](#models)
23-
- [Documentation for Authorization](#documentation-for-authorization)
19+
- [Authorization](#documentation-for-authorization)
2420
- [API key](#api-key)
2521
- [Public endpoints](#public-endpoints)
26-
- [Have you gotten use from this API client?](#have-you-gotten-use-from-this-api-client)
22+
- [Have you gotten use from this API client?](#have-you-gotten-use-from-this-api-client)
2723
- [Contribution](#contribution)
2824

29-
<!--</documentation_excluded>-->
30-
<!--<documentation_only>
31-
---
32-
title: api.video Swift video uploader
33-
meta:
34-
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.
35-
---
25+
# Project description
3626

37-
# api.video Swift video uploader
38-
39-
[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.
40-
41-
</documentation_only>-->
42-
## Project description
43-
44-
api.video's Swift uploader for iOS, macOS and tvOS uploads videos to api.video using delegated upload token or API Key.
27+
api.video's Swift for iOS, macOS and tvOS uploads videos to api.video using delegated upload token or API Key.
4528

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

50-
## Getting started
33+
# Getting started
5134

52-
### Installation
35+
## Installation
5336

54-
#### Carthage
37+
### Carthage
5538

5639
Specify it in your `Cartfile`:
5740

@@ -61,13 +44,13 @@ github "apivideo/api.video-swift-uploader" ~> 1.2.2
6144

6245
Run `carthage update`
6346

64-
#### CocoaPods
47+
### CocoaPods
6548

6649
Add `pod 'ApiVideoUploader', '1.2.2'` in your `Podfile`
6750

6851
Run `pod install`
6952

70-
### Code sample
53+
## Code sample
7154

7255
Please follow the [installation](#installation) instruction and execute the following Swift code:
7356
```swift
@@ -86,66 +69,66 @@ try VideosAPI.uploadWithUploadToken(token: "MY_VIDEO_TOKEN", file: url) { video,
8669
}
8770
```
8871

89-
## Documentation
72+
# Documentation
9073

91-
### API Endpoints
74+
## API Endpoints
9275

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

9578

96-
#### VideosAPI
79+
### VideosAPI
9780

98-
##### Retrieve an instance of VideosAPI:
81+
#### Retrieve an instance of VideosAPI:
9982

10083
```swift
10184
VideosAPI
10285
```
10386

104-
##### Endpoints
87+
#### Endpoints
10588

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

11194

11295

113-
### Models
96+
## Models
11497

115-
- [AccessToken](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AccessToken.md)
116-
- [AdditionalBadRequestErrors](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AdditionalBadRequestErrors.md)
117-
- [AuthenticatePayload](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/AuthenticatePayload.md)
118-
- [BadRequest](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/BadRequest.md)
119-
- [Metadata](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/Metadata.md)
120-
- [NotFound](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/NotFound.md)
121-
- [RefreshTokenPayload](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/RefreshTokenPayload.md)
122-
- [Video](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/Video.md)
123-
- [VideoAssets](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoAssets.md)
124-
- [VideoSource](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSource.md)
125-
- [VideoSourceLiveStream](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSourceLiveStream.md)
126-
- [VideoSourceLiveStreamLink](https://github.com/apivideo/api.video-swift-uploader/blob/main/docs/VideoSourceLiveStreamLink.md)
98+
- [AccessToken](docs/AccessToken.md)
99+
- [AdditionalBadRequestErrors](docs/AdditionalBadRequestErrors.md)
100+
- [AuthenticatePayload](docs/AuthenticatePayload.md)
101+
- [BadRequest](docs/BadRequest.md)
102+
- [Metadata](docs/Metadata.md)
103+
- [NotFound](docs/NotFound.md)
104+
- [RefreshTokenPayload](docs/RefreshTokenPayload.md)
105+
- [Video](docs/Video.md)
106+
- [VideoAssets](docs/VideoAssets.md)
107+
- [VideoSource](docs/VideoSource.md)
108+
- [VideoSourceLiveStream](docs/VideoSourceLiveStream.md)
109+
- [VideoSourceLiveStreamLink](docs/VideoSourceLiveStreamLink.md)
127110

128111

129-
### Documentation for Authorization
112+
## Documentation for Authorization
130113

131-
#### API key
114+
### API key
132115

133116
Most endpoints required to be authenticated using the API key mechanism described in our [documentation](https://docs.api.video/reference#authentication).
134117

135118
You must NOT store your API key in your application code to prevent your API key from being exposed in your source code.
136119
Only the [Public endpoints](#public-endpoints) can be called without authentication.
137120
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.
138121

139-
#### Public endpoints
122+
### Public endpoints
140123

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

143-
### Have you gotten use from this API client?
126+
## Have you gotten use from this API client?
144127

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

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

149-
## Contribution
132+
# Contribution
150133

151-
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.
134+
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.

0 commit comments

Comments
 (0)