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
# API Changes
* `MuxUpload`'s initializer no longer requires a MIME type or Retry Time. These are calculated internally
* Added methods for querying the `UploadManager` for the list of currenty-active uploads, and listening for changes to the list
## Improvements
* NFC: call into upload manager reference (#14)
* api: Remove extraneous MIME type and retry time config fields, add opt-out for event tracking (#16)
* doc: Add a much-improved example app (#15)
## Fixes
* Fix: Uploads continue without reporting progress after being resumed (#24)
* Fix: handlers not retained unless callers retain the `MuxUpload` (#25)
Co-authored-by: AJ Lauer Barinov <102617203+andrewjl-mux@users.noreply.github.com>
Co-authored-by: Liam Lindner <liam@mux.com>
Co-authored-by: Emily Dixon <edixon@mux.com>
Co-authored-by: GitHub <noreply@github.com>
/// Uploads created by this SDK are globally managed by default, and can be resumed after failures or even after process death. For more information on
45
+
/// this topic, see ``UploadManager``
46
+
///
47
+
publicfinalclassMuxUpload:Hashable,Equatable{
12
48
13
-
TODO: usage here
14
-
*/
15
-
publicfinalclassMuxUpload{
16
-
17
49
privateletuploadInfo:UploadInfo
18
50
privateletmanageBySDK:Bool
19
51
privateletid:Int
@@ -26,7 +58,7 @@ public final class MuxUpload {
26
58
/**
27
59
Represents the state of an upload in progress.
28
60
*/
29
-
publicstructStatus:Sendable{
61
+
publicstructStatus:Sendable,Hashable{
30
62
publicletprogress:Progress?
31
63
publicletupdatedTime:TimeInterval
32
64
publicletstartTime:TimeInterval
@@ -50,21 +82,25 @@ public final class MuxUpload {
50
82
51
83
}
52
84
85
+
/// Creates a new `MuxUpload` with the given confguration
86
+
/// - Parameters
87
+
/// - uploadURL: the PUT URL for your direct upload
88
+
/// - videoFileURL: A URL to the input video file
89
+
/// - retriesPerChunk: The number of times each chunk of the file upload can be retried before failure is declared
90
+
/// - optOutOfEventTracking: This SDK collects performance and reliability data that helps make the Upload SDK the best it can be. If you do not wish to share this information with Mux, you may pass `true` for this parameter
53
91
publicconvenienceinit(
54
92
uploadURL:URL,
55
93
videoFileURL:URL,
56
-
videoMIMEType:String="video/*", // TODO: We can guess this, so make it optional,
57
-
chunkSize:Int=8*1024*1024, // Google recommends *at least* 8M,
94
+
chunkSize:Int=8*1024*1024, // Google recommends at least 8M
58
95
retriesPerChunk:Int=3,
59
-
retryBaseTimeInterval:TimeInterval=0.5
96
+
optOutOfEventTracking:Bool=false
60
97
){
61
98
letuploadInfo=UploadInfo(
62
99
uploadURL: uploadURL,
63
100
videoFile: videoFileURL,
64
-
videoMIMEType: videoMIMEType,
65
101
chunkSize: chunkSize,
66
102
retriesPerChunk: retriesPerChunk,
67
-
retryBaseTime: retryBaseTimeInterval
103
+
optOutOfEventTracking: optOutOfEventTracking
68
104
)
69
105
70
106
self.init(
@@ -84,7 +120,7 @@ public final class MuxUpload {
84
120
*/
85
121
publicvarprogressHandler:StateHandler?
86
122
87
-
publicstructSuccess:Sendable{
123
+
publicstructSuccess:Sendable,Hashable{
88
124
publicletfinalState:Status
89
125
}
90
126
@@ -107,7 +143,12 @@ public final class MuxUpload {
107
143
/**
108
144
True if this upload is currently in progress and not paused
// TODO: Computed Properties for some other UploadInfo properties
122
162
123
163
/**
124
164
Begins the upload. You can control what happens when the upload is already started. If `forceRestart` is true, the upload will be restarted. Otherwise, nothing will happen. The default is not to restart
125
165
*/
126
166
publicfunc start(forceRestart:Bool=false){
127
-
ifself.manageBySDK {
167
+
// Use an existing globally-managed upload if desired & one exists
@@ -156,11 +205,11 @@ public final class MuxUpload {
156
205
}
157
206
158
207
/**
159
-
Cancels an ongoing download. Temp files will be deleted asynchronously. State and Delegates will be cleared. Your delegates will recieve no further calls
208
+
Cancels an ongoing download. State and Delegates will be cleared. Your delegates will recieve no further calls
0 commit comments