mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-26 21:34:05 +02:00
Fix:iOS play audiobook tracks inside subfolders #483
This commit is contained in:
@@ -472,18 +472,18 @@ class AudioPlayer: NSObject {
|
|||||||
|
|
||||||
if (playbackSession.playMethod == PlayMethod.directplay.rawValue) {
|
if (playbackSession.playMethod == PlayMethod.directplay.rawValue) {
|
||||||
// The only reason this is separate is because the filename needs to be encoded
|
// The only reason this is separate is because the filename needs to be encoded
|
||||||
let filename = track.metadata?.filename ?? ""
|
let relPath = track.metadata?.relPath ?? ""
|
||||||
let filenameEncoded = filename.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)
|
let filepathEncoded = relPath.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)
|
||||||
let urlstr = "\(Store.serverConfig!.address)/s/item/\(itemId)/\(filenameEncoded ?? "")?token=\(Store.serverConfig!.token)"
|
let urlstr = "\(Store.serverConfig!.address)/s/item/\(itemId)/\(filepathEncoded ?? "")?token=\(Store.serverConfig!.token)"
|
||||||
let url = URL(string: urlstr)!
|
let url = URL(string: urlstr)!
|
||||||
return AVURLAsset(url: url)
|
return AVURLAsset(url: url)
|
||||||
} else if (playbackSession.playMethod == PlayMethod.local.rawValue) {
|
} else if (playbackSession.playMethod == PlayMethod.local.rawValue) {
|
||||||
guard let localFile = track.getLocalFile() else {
|
guard let localFile = track.getLocalFile() else {
|
||||||
// Worst case we can stream the file
|
// Worst case we can stream the file
|
||||||
logger.log("Unable to play local file. Resulting to streaming \(track.localFileId ?? "Unknown")")
|
logger.log("Unable to play local file. Resulting to streaming \(track.localFileId ?? "Unknown")")
|
||||||
let filename = track.metadata?.filename ?? ""
|
let relPath = track.metadata?.relPath ?? ""
|
||||||
let filenameEncoded = filename.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)
|
let filepathEncoded = relPath.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)
|
||||||
let urlstr = "\(Store.serverConfig!.address)/s/item/\(itemId)/\(filenameEncoded ?? "")?token=\(Store.serverConfig!.token)"
|
let urlstr = "\(Store.serverConfig!.address)/s/item/\(itemId)/\(filepathEncoded ?? "")?token=\(Store.serverConfig!.token)"
|
||||||
let url = URL(string: urlstr)!
|
let url = URL(string: urlstr)!
|
||||||
return AVURLAsset(url: url)
|
return AVURLAsset(url: url)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user