Sync player session with server media progress

This commit is contained in:
ronaldheft 2022-08-18 17:08:41 -04:00
parent 519969eee0
commit 5fd3f3c080
3 changed files with 51 additions and 0 deletions

View file

@ -205,6 +205,14 @@ class ApiClient {
}
}
public static func getMediaProgress(libraryItemId: String, episodeId: String?, callback: @escaping (_ progress: MediaProgress?) -> Void) {
NSLog("getMediaProgress \(libraryItemId) \(episodeId ?? "NIL")")
let endpoint = episodeId?.isEmpty ?? true ? "api/me/progress/\(libraryItemId)" : "api/me/progress/\(libraryItemId)/\(episodeId ?? "")"
getResource(endpoint: endpoint, decodable: MediaProgress.self) { obj in
callback(obj)
}
}
public static func getLibraryItemWithProgress(libraryItemId:String, episodeId:String?, callback: @escaping (_ param: LibraryItem?) -> Void) {
var endpoint = "api/items/\(libraryItemId)?expanded=1&include=progress"
if episodeId != nil {