mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Merge branch 'main' into use-mpvkit
This commit is contained in:
@@ -174,7 +174,11 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
}
|
||||
|
||||
func togglePlay() {
|
||||
isPlaying ? pause() : play()
|
||||
if isPlaying {
|
||||
pause()
|
||||
} else {
|
||||
play()
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
@@ -414,9 +418,8 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
private func playerItem(_: Stream) -> AVPlayerItem? {
|
||||
if let asset {
|
||||
return AVPlayerItem(asset: asset)
|
||||
} else {
|
||||
return AVPlayerItem(asset: composition)
|
||||
}
|
||||
return AVPlayerItem(asset: composition)
|
||||
}
|
||||
|
||||
private func attachMetadata() {
|
||||
|
@@ -357,7 +357,11 @@ final class MPVBackend: PlayerBackend {
|
||||
}
|
||||
|
||||
func togglePlay() {
|
||||
isPlaying ? pause() : play()
|
||||
if isPlaying {
|
||||
pause()
|
||||
} else {
|
||||
play()
|
||||
}
|
||||
}
|
||||
|
||||
func cancelLoads() {
|
||||
|
@@ -86,7 +86,7 @@ final class MPVClient: ObservableObject {
|
||||
]
|
||||
|
||||
if mpv_render_context_create(&mpvGL, mpv, ¶ms) < 0 {
|
||||
puts("failed to initialize mpv GL context")
|
||||
print("failed to initialize mpv GL context")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
@@ -471,9 +471,8 @@ final class MPVClient: ObservableObject {
|
||||
let data = Data(bufPtr)
|
||||
if let lastIndex = data.lastIndex(where: { $0 != 0 }) {
|
||||
return String(data: data[0 ... lastIndex], encoding: .isoLatin1)!
|
||||
} else {
|
||||
return String(data: data, encoding: .isoLatin1)!
|
||||
}
|
||||
return String(data: data, encoding: .isoLatin1)!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user