MuxUpload

class MuxUpload

Represents an upload of a video as a Mux Video asset. In order to use this SDK, you must first create a direct upload server-side, then return that direct upload PUT URL to your app.

Once you have a PUT URL, you can create and start your upload using the Builder

For example:

// Start a new upload
val upload = MuxUpload.Builder(myUploadUrl, myInputFile).build()
upload.setResultListener { myHandleResult(it) }
upload.setProgressListener { myHandleProgress(it) }
upload.start()

For full documentation on how to configure your upload, see the Builder

See also

Types

Link copied to clipboard
class Builder(val uploadUri: Uri, val videoFile: File)

Builds instances of MuxUpload.

Link copied to clipboard
data class Progress(val bytesUploaded: Long = 0, val totalBytes: Long = 0, val startTime: Long = 0, val updatedTime: Long = 0)

The current progress of an upload, in terms of time elapsed and data transmitted

Functions

Link copied to clipboard

If the upload has not succeeded, this function will suspend until the upload completes and return the result

Link copied to clipboard
fun cancel()

Cancels this upload. The upload job will be canceled and it will not be possible to start this job again where it left off

Link copied to clipboard

Clears all listeners set on this object

Link copied to clipboard
fun pause()

Pauses the upload. If the upload was already paused, this method has no effect

Link copied to clipboard

Sets a listener for progress updates on this upload

Link copied to clipboard

Sets a listener for success or failure updates on this upload

Link copied to clipboard
fun start(forceRestart: Boolean = false)

Starts this Upload. You don't need to hold onto this object in order for the upload to complete, it will continue in parallel with the rest of your app. You can always get a handle to an ongoing upload by using MuxUploadManager.findUploadByFile

Properties

Link copied to clipboard

The current state of the upload. To be notified of state updates, you can use setProgressListener and setResultListener

Link copied to clipboard

If the upload has failed, gets the error associated with the failure

Link copied to clipboard

True when the upload is running, false if it's paused, failed, or canceled

Link copied to clipboard

True if the upload was successful, false otherwise

Link copied to clipboard

File containing the video to be uploaded