mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 14:03:41 +00:00
Minor fixes
This commit is contained in:
parent
e0620abf9f
commit
08ae69b5d2
@ -508,7 +508,13 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func extractAdaptiveFormats(from streams: [JSON]) -> [Stream] {
|
private func extractAdaptiveFormats(from streams: [JSON]) -> [Stream] {
|
||||||
guard let audioStream = streams.first(where: { $0["type"].stringValue.starts(with: "audio/mp4") }) else {
|
let audioStreams = streams
|
||||||
|
.filter { $0["type"].stringValue.starts(with: "audio/mp4") }
|
||||||
|
.sorted {
|
||||||
|
$0.dictionaryValue["bitrate"]?.int ?? 0 >
|
||||||
|
$1.dictionaryValue["bitrate"]?.int ?? 0
|
||||||
|
}
|
||||||
|
guard let audioStream = audioStreams.first else {
|
||||||
return .init()
|
return .init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,6 @@ struct PlayerControls: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.modifier(ControlBackgroundModifier())
|
.modifier(ControlBackgroundModifier())
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 2))
|
.clipShape(RoundedRectangle(cornerRadius: 2))
|
||||||
.offset(x: -2, y: -2)
|
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.opacity(model.presentingControls || model.presentingOverlays ? 0 : player.lastSkipped.isNil ? 0 : 1)
|
.opacity(model.presentingControls || model.presentingOverlays ? 0 : player.lastSkipped.isNil ? 0 : 1)
|
||||||
|
@ -41,6 +41,7 @@ struct VideoPlayerView: View {
|
|||||||
@State private var orientation = UIInterfaceOrientation.portrait
|
@State private var orientation = UIInterfaceOrientation.portrait
|
||||||
@State private var lastOrientation: UIInterfaceOrientation?
|
@State private var lastOrientation: UIInterfaceOrientation?
|
||||||
#elseif os(macOS)
|
#elseif os(macOS)
|
||||||
|
var hoverThrottle = Throttle(interval: 0.5)
|
||||||
var mouseLocation: CGPoint { NSEvent.mouseLocation }
|
var mouseLocation: CGPoint { NSEvent.mouseLocation }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -209,8 +210,10 @@ struct VideoPlayerView: View {
|
|||||||
#elseif os(macOS)
|
#elseif os(macOS)
|
||||||
.onAppear(perform: {
|
.onAppear(perform: {
|
||||||
NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved]) {
|
NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved]) {
|
||||||
if !player.currentItem.isNil, hoveringPlayer {
|
hoverThrottle.execute {
|
||||||
playerControls.resetTimer()
|
if !player.currentItem.isNil, hoveringPlayer {
|
||||||
|
playerControls.resetTimer()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $0
|
return $0
|
||||||
|
Loading…
Reference in New Issue
Block a user