@@ -11,7 +11,8 @@ import Foundation
1111public typealias UploadResult = Result < MuxUpload . Success , MuxUpload . UploadError >
1212
1313///
14- /// Uploads a video file to a previously-created Mux Video Direct Upload.
14+ /// Uploads a media asset to Mux using a previously-created
15+ /// Direct Upload signed URL.
1516///
1617/// This class is part of a full-stack workflow for uploading video files to Mux Video. In order to use this object you must first have
1718/// created a [Direct Upload](https://docs.mux.com/guides/video/upload-files-directly) on your server backend.
@@ -66,7 +67,7 @@ public final class MuxUpload : Hashable, Equatable {
6667 input. uploadInfo
6768 }
6869
69- /// Indicates the status of the upload as it goes
70+ /// Indicates the status of the upload input as it goes
7071 /// through its lifecycle
7172 public enum InputStatus {
7273 /// Upload initialized and not yet started
@@ -91,6 +92,8 @@ public final class MuxUpload : Hashable, Equatable {
9192 case uploadFailed( AVAsset , Status , UploadResult )
9293 }
9394
95+ /// Current status of the upload input as it goes through
96+ /// its lifecycle
9497 public var inputStatus : InputStatus {
9598 switch input. status {
9699 case . ready( let sourceAsset) :
@@ -183,9 +186,12 @@ public final class MuxUpload : Hashable, Equatable {
183186
184187 }
185188
186- /// Initializes a MuxUpload with the given configuration
189+ /// Initializes a MuxUpload from a local file URL with
190+ /// the given configuration
187191 /// - Parameters:
188- /// - uploadURL: the URL of the direct upload
192+ /// - uploadURL: the URL of the direct upload that's
193+ /// included in the create a new direct upload URL
194+ /// [response](https://docs.mux.com/api-reference#video/operation/create-direct-upload)
189195 /// - videoFileURL: the file:// URL of the upload
190196 /// input
191197 /// - chunkSize: the size of chunks when uploading,
@@ -194,7 +200,8 @@ public final class MuxUpload : Hashable, Equatable {
194200 /// a failed chunk upload request
195201 /// - inputStandardization: enable or disable input
196202 /// standardization by the SDK locally
197- /// - optOutOfEventTracking: opt out of event tracking
203+ /// - eventTracking: options to opt out of event
204+ /// tracking
198205 public convenience init (
199206 uploadURL: URL ,
200207 videoFileURL: URL ,
@@ -203,40 +210,43 @@ public final class MuxUpload : Hashable, Equatable {
203210 inputStandardization: UploadOptions . InputStandardization = . init(
204211 targetResolution: UploadOptions . InputStandardization. ResolutionPreset. default
205212 ) ,
206- optOutOfEventTracking : Bool = false
213+ eventTracking : UploadOptions . EventTracking = UploadOptions . EventTracking ( optedOut : false )
207214 ) {
208- let uploadSettings = UploadOptions (
209- inputStandardization: inputStandardization,
210- transport: UploadOptions . Transport (
211- chunkSize: chunkSize,
212- retriesPerChunk: retriesPerChunk
213- ) ,
214- eventTracking: UploadOptions . EventTracking (
215- optedOut: optOutOfEventTracking
216- )
217- )
218-
219- let inputSourceAsset = AVAsset ( url: videoFileURL)
220-
221- let input = UploadInput ( status: . ready( inputSourceAsset) )
222-
223215 self . init (
224- input: input,
225- options: uploadSettings,
216+ input: UploadInput ( asset: AVAsset ( url: videoFileURL) ) ,
217+ options: UploadOptions (
218+ inputStandardization: inputStandardization,
219+ transport: UploadOptions . Transport (
220+ chunkSize: chunkSize,
221+ retriesPerChunk: retriesPerChunk
222+ ) ,
223+ eventTracking: eventTracking
224+ ) ,
226225 uploadManager: . shared
227226 )
228227 }
229228
229+ /// Initializes a MuxUpload from a local file URL
230+ ///
231+ /// - Parameters:
232+ /// - uploadURL: the URL of the direct upload that's
233+ /// included in the create a new direct upload URL
234+ /// [response](https://docs.mux.com/api-reference#video/operation/create-direct-upload)
235+ /// - inputFileURL: the file:// URL of the upload
236+ /// input
237+ /// - options: options used to control the direct
238+ /// upload of the input to Mux
230239 public convenience init (
231240 uploadURL: URL ,
232241 inputFileURL: URL ,
233242 options: UploadOptions
234243 ) {
235- let inputSourceAsset = AVAsset ( url: inputFileURL)
236- let input = UploadInput ( status: . ready( inputSourceAsset) )
237-
238244 self . init (
239- input: input,
245+ input: UploadInput (
246+ asset: AVAsset (
247+ url: inputFileURL
248+ )
249+ ) ,
240250 manage: true ,
241251 options: options,
242252 uploadManager: . shared
0 commit comments