-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Improvements * doc: Finish out the public KDoc (#49) * doc: Improve KDocs and add logo (#51) * nfc: Hide some internal classes from java. This should not affect anyone using the SDK ## Fixes * fix: pausing uploads shouldn't create errors (#55) Co-authored-by: Emily Dixon <edixon@mux.com>
- Loading branch information
1 parent
9bca4ad
commit 73fd6dc
Showing
11 changed files
with
221 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Module Mux Upload SDK | ||
|
||
The Mux Upload SDK processes and uploads video files to [Mux Video](https://www.mux.com/video) from | ||
a user's local device. It is part of a full-stack flow described in our | ||
guide, [Upload Files Directly](https://docs.mux.com/guides/video/upload-files-directly). | ||
|
||
Once you have your direct upload URL, you can use it to upload a file using this SDK. | ||
|
||
## Initializing the SDK | ||
|
||
This SDK must be initialized once with a `Context` before it can be used | ||
|
||
```kotlin | ||
// from your custom Application class, Activity, etc. The context isn't saved | ||
MuxUploadSdk.initialize(appContext = this) | ||
``` | ||
|
||
## Starting a new upload | ||
|
||
The `MuxUpload` class can be used to start a video upload and observe its progress. | ||
|
||
```kotlin | ||
// Start a new upload | ||
val upload = MuxUpload.Builder(myUploadUrl, myInputFile).build() | ||
upload.setResultListener { /*...*/ } | ||
upload.setProgressListener { /*...*/ } | ||
upload.start() | ||
``` | ||
|
||
### Handling errors | ||
|
||
The upload SDK handles transient errors according to a customizable retry policy. Fatal errors are | ||
reported by `MuxUpload.setResultListener`. | ||
|
||
```kotlin | ||
upload.setResultListener { result -> | ||
if (!result.isSuccess) { | ||
notifyError() | ||
} else { | ||
/*...*/ | ||
} | ||
} | ||
``` | ||
|
||
## Resuming uploads after process death | ||
|
||
Uploads managed by this SDK can be resumed after process death, or if network connectivity caused | ||
them to fail at some time in the past. | ||
|
||
```kotlin | ||
MuxUploadManager.resumeAllCachedJobs() | ||
val upload = MuxUploadManager.findUploadByFile(myVideoFile) | ||
upload.setResultListener { /*...*/ } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.