mirror of
https://github.com/yattee/yattee.git
synced 2025-10-12 02:18:17 +00:00
Load audio and video together with one command with MPV
This commit is contained in:
@@ -103,13 +103,21 @@ final class MPVClient: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
func loadFile(_ url: URL, time: CMTime? = nil, completionHandler: ((Int32) -> Void)? = nil) {
|
||||
func loadFile(_ url: URL, audio: URL? = nil, time: CMTime? = nil, completionHandler: ((Int32) -> Void)? = nil) {
|
||||
var args = [url.absoluteString]
|
||||
var options = [String]()
|
||||
|
||||
if let time = time {
|
||||
args.append("replace")
|
||||
args.append("start=\(Int(time.seconds))")
|
||||
options.append("start=\(Int(time.seconds))")
|
||||
}
|
||||
|
||||
if let audioURL = audio?.absoluteString {
|
||||
options.append("audio-files-append=\"\(audioURL)\"")
|
||||
}
|
||||
|
||||
args.append(options.joined(separator: ","))
|
||||
|
||||
command("loadfile", args: args, returnValueCallback: completionHandler)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user