Improve MPV loading commands

This commit is contained in:
Arkadiusz Fal
2022-06-07 23:20:24 +02:00
parent c0c9967bfd
commit 208ba623e5
2 changed files with 50 additions and 6 deletions

View File

@@ -168,12 +168,15 @@ final class MPVBackend: PlayerBackend {
self?.isLoadingVideo = true
}
} else {
self.onFileLoaded = { [weak self] in
self.onFileLoaded = {
updateCurrentStream()
startPlaying()
}
self.client.loadFile(stream.videoAsset.url, audio: stream.audioAsset.url, time: time) { [weak self] _ in
let fileToLoad = self.model.musicMode ? stream.audioAsset.url : stream.videoAsset.url
let audioTrack = self.model.musicMode ? nil : stream.audioAsset.url
self.client.loadFile(fileToLoad, audio: audioTrack, time: time) { [weak self] _ in
self?.isLoadingVideo = true
self?.pause()
}
@@ -386,4 +389,16 @@ final class MPVBackend: PlayerBackend {
func setSize(_ width: Double, _ height: Double) {
self.client?.setSize(width, height)
}
func addVideoTrack(_ url: URL) {
self.client?.addVideoTrack(url)
}
func setVideoToAuto() {
self.client?.setVideoToAuto()
}
func setVideoToNo() {
self.client?.setVideoToNo()
}
}