mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 22:30:32 +05:30
Force seek only on HLS
This commit is contained in:
parent
e54d3b811e
commit
24355f3a4b
@ -239,7 +239,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
startPlaying()
|
startPlaying()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.client.loadFile(url, sub: captions?.url, time: time) { [weak self] _ in
|
self.client.loadFile(url, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in
|
||||||
self?.isLoadingVideo = true
|
self?.isLoadingVideo = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -251,7 +251,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
let fileToLoad = self.model.musicMode ? stream.audioAsset.url : stream.videoAsset.url
|
let fileToLoad = self.model.musicMode ? stream.audioAsset.url : stream.videoAsset.url
|
||||||
let audioTrack = self.model.musicMode ? nil : stream.audioAsset.url
|
let audioTrack = self.model.musicMode ? nil : stream.audioAsset.url
|
||||||
|
|
||||||
self.client?.loadFile(fileToLoad, audio: audioTrack, sub: captions?.url, time: time) { [weak self] _ in
|
self.client?.loadFile(fileToLoad, audio: audioTrack, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in
|
||||||
self?.isLoadingVideo = true
|
self?.isLoadingVideo = true
|
||||||
self?.pause()
|
self?.pause()
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,14 @@ final class MPVClient: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadFile(_ url: URL, audio: URL? = nil, sub: URL? = nil, time: CMTime? = nil, completionHandler: ((Int32) -> Void)? = nil) {
|
func loadFile(
|
||||||
|
_ url: URL,
|
||||||
|
audio: URL? = nil,
|
||||||
|
sub: URL? = nil,
|
||||||
|
time: CMTime? = nil,
|
||||||
|
forceSeekable: Bool = false,
|
||||||
|
completionHandler: ((Int32) -> Void)? = nil
|
||||||
|
) {
|
||||||
var args = [url.absoluteString]
|
var args = [url.absoluteString]
|
||||||
var options = [String]()
|
var options = [String]()
|
||||||
|
|
||||||
@ -140,7 +147,9 @@ final class MPVClient: ObservableObject {
|
|||||||
options.append("sub-files-append=\"\(subURL)\"")
|
options.append("sub-files-append=\"\(subURL)\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
options.append("force-seekable=yes")
|
if forceSeekable {
|
||||||
|
options.append("force-seekable=yes")
|
||||||
|
}
|
||||||
|
|
||||||
if !options.isEmpty {
|
if !options.isEmpty {
|
||||||
args.append(options.joined(separator: ","))
|
args.append(options.joined(separator: ","))
|
||||||
|
Loading…
Reference in New Issue
Block a user