You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-8Lines changed: 31 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,46 @@
1
1
# Mux's Swift Upload SDK
2
-
This SDK makes it easy to upload videos to Mux from an iOS app. It handles large files by breaking them into chunks and uploads each chunk individually. Each file that gets uploaded will get sent to an [upload URL created by a backend server](https://docs.mux.com/guides/video/upload-files-directly). **Do not include credentials to create an upload URL from an app.**
2
+
This SDK makes it easy to upload videos for ingest to Mux from an iOS or iPadOS application. It handles large files by breaking them into chunks and uploading each chunk individually.
3
+
4
+
Each video is uploaded to an authenticated [upload URL created by a trusted backend server request to the Mux Video API](https://docs.mux.com/guides/video/upload-files-directly). **Do not include the secret API credentials to create an authenticated upload URL in your application.**
3
5
4
6
## Usage
5
-
To use this SDK, you must first add it as a dependency. The Mux Swift Upload SDK for iOS is available on SPM.
7
+
To use this SDK, you'll need to add it as a dependency using either Swift Package Manager or Cocoapods.
6
8
7
9
### Server-Side: Create a Direct Upload
8
10
9
-
To start an upload, you must first create an [upload URL](https://docs.mux.com/guides/video/upload-files-directly). Then, pass return that direct-upload PUT URL to your app, so the app can begin the upload process
11
+
If you haven't yet done so, you must create an [access token](https://docs.mux.com/guides/system/make-api-requests#http-basic-auth) to complete these steps.
12
+
To start an upload, you must first create an [upload URL](https://docs.mux.com/guides/video/upload-files-directly). Then, provide that direct-upload PUT URL to your app, so the app can begin the upload process.
13
+
14
+
### App-Side: Install the SDK
15
+
Add our SDK as a package dependency to your Xcode project.
16
+
17
+
#### Swift Package Manager
18
+
The Swift Package Manager is a tool for managing the distribution of Swift code. It's integrated with Xcode and the Swift build system to automate the process of downloading, compiling, and linking dependencies.
19
+
20
+
[Step-by-step guide on using Swift Package Manager in Xcode](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app). Our repository URL (for the 'search' field in the upper corner) is `https://github.com/muxinc/swift-upload-sdk`.
21
+
22
+
#### Cocoapods
23
+
Cocoapods is a dependency manager for Xcode project. See here for [usage instructions](https://guides.cocoapods.org/using/using-cocoapods.htm).
24
+
To integrate our SDK into your Xcode project using Cocoapods, specify it in your `Podfile` like so:
10
25
11
-
### App-Side: Add Package Dependency
12
-
Add our SDK as a package dependency to your XCode project [with the following steps](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app). Our repository URL (for the 'search' field in the upper corner) is `https://github.com/muxinc/swift-upload-sdk`
26
+
```ruby
27
+
28
+
pod 'Mux-Upload-SDK'
29
+
30
+
```
13
31
14
32
### App-Side: Start an Upload
15
33
To start an upload, you must first create an [upload URL](https://docs.mux.com/guides/video/upload-files-directly). Then, pass the upload URL and the file to be uploaded into the SDK.
16
34
17
35
```swift
36
+
importMuxUploadSDK
37
+
38
+
let directUploadURL: URL =/* Fetch the direct upload URL created before */
39
+
let videoInputURL: URL =/* File URL to your video file. See Test App for how to retrieve a video from PhotosKit */
40
+
18
41
let upload =MuxUpload(
19
-
uploadURL: myMuxUploadURL,
20
-
videoFileURL: myVideoFileURL,
42
+
uploadURL: directUploadURL,
43
+
videoFileURL: videoInputURL,
21
44
)
22
45
23
46
upload.progressHandler= { state in
@@ -44,6 +67,6 @@ A simple example usage can be found in our [Test App](https://github.com/muxinc/
44
67
45
68
## Development
46
69
47
-
This SDK is a swift package that can be opened by xcode. To edit this SDK, clone it and open the root folder in Xcode.
70
+
This SDK is a swift package that can be opened by Xcode. To edit this SDK, clone it and open the root folder in Xcode.
48
71
49
72
This SDK has a sample/test app in the `TestApp/` folder. You can run/edit the sample app by opening `apps/Test App/Upload Test App.xcodeproj`
0 commit comments