This commit is contained in:
Fredrik Burmester
2025-02-15 21:15:52 +01:00
parent 10bf8fa19a
commit 179f6c02ca
3 changed files with 22 additions and 11 deletions

View File

@@ -11,6 +11,8 @@ public class HlsDownloaderModule: Module {
Events("onProgress", "onError", "onComplete")
Function("downloadHLSAsset") { (providedId: String, url: String, assetTitle: String) -> Void in
print("Starting download - ID: \(providedId), URL: \(url), Title: \(assetTitle)")
guard let assetURL = URL(string: url) else {
self.sendEvent("onError", ["id": providedId, "error": "Invalid URL", "state": "FAILED"])
return
@@ -47,6 +49,7 @@ public class HlsDownloaderModule: Module {
])
task.resume()
print("Download task started with identifier: \(task.taskIdentifier)")
}
Function("checkForExistingDownloads") {

View File

@@ -1,5 +1,9 @@
export type OnProgressEventPayload = {
progress: number;
state: "PENDING" | "DOWNLOADING" | "PAUSED" | "DONE" | "FAILED" | "STOPPED";
id: string;
bytesDownloaded: number;
bytesTotal: number;
};
export type OnErrorEventPayload = {