mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Minor fixes
This commit is contained in:
parent
f5016cc961
commit
b8380b2528
@ -129,7 +129,7 @@ final class MPVBackend: PlayerBackend {
|
|||||||
) {
|
) {
|
||||||
self.model = model
|
self.model = model
|
||||||
self.controls = controls
|
self.controls = controls
|
||||||
self.playerTime = playerTime ?? PlayerTimeModel.shared
|
self.playerTime = playerTime ?? PlayerTimeModel.shared
|
||||||
self.networkState = networkState
|
self.networkState = networkState
|
||||||
|
|
||||||
clientTimer = .init(interval: .seconds(Self.timeUpdateInterval), mode: .infinite) { [weak self] _ in
|
clientTimer = .init(interval: .seconds(Self.timeUpdateInterval), mode: .infinite) { [weak self] _ in
|
||||||
|
@ -274,7 +274,7 @@ final class MPVClient: ObservableObject {
|
|||||||
let height = [self.backend.model.playerSize.height, self.backend.model.playerSize.width / aspectRatio].min()!
|
let height = [self.backend.model.playerSize.height, self.backend.model.playerSize.width / aspectRatio].min()!
|
||||||
var insets = 0.0
|
var insets = 0.0
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
insets = OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? SafeArea.insets.bottom : 0
|
insets = OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? SafeArea.insets.bottom : 0
|
||||||
#endif
|
#endif
|
||||||
let offsetY = self.backend.model.playingFullScreen ? ((self.backend.model.playerSize.height / 2.0) - ((height + insets) / 2)) : 0
|
let offsetY = self.backend.model.playingFullScreen ? ((self.backend.model.playerSize.height / 2.0) - ((height + insets) / 2)) : 0
|
||||||
self.glView?.frame = CGRect(x: 0, y: offsetY, width: roundedWidth, height: height)
|
self.glView?.frame = CGRect(x: 0, y: offsetY, width: roundedWidth, height: height)
|
||||||
|
@ -45,13 +45,13 @@ struct ChapterView: View {
|
|||||||
ProgressView()
|
ProgressView()
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
.indicator(.activity)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
#else
|
#else
|
||||||
.frame(width: thumbnailWidth, height: 60)
|
.frame(width: thumbnailWidth, height: 60)
|
||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,22 +64,18 @@ struct Seek: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
|
||||||
.frame(minWidth: 250, minHeight: 100)
|
|
||||||
.padding(30)
|
|
||||||
#endif
|
|
||||||
.frame(maxWidth: playerControlsLayout.seekOSDWidth)
|
.frame(maxWidth: playerControlsLayout.seekOSDWidth)
|
||||||
.padding(2)
|
#if os(tvOS)
|
||||||
.modifier(ControlBackgroundModifier())
|
.padding(30)
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 3))
|
#else
|
||||||
.foregroundColor(.primary)
|
.padding(2)
|
||||||
|
.modifier(ControlBackgroundModifier())
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 3))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.foregroundColor(.primary)
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
|
||||||
.fixedSize()
|
|
||||||
.buttonStyle(.card)
|
|
||||||
#else
|
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
#endif
|
|
||||||
.opacity(visible || YatteeApp.isForPreviews ? 1 : 0)
|
.opacity(visible || YatteeApp.isForPreviews ? 1 : 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ struct PlayerControls: View {
|
|||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
.frame(maxWidth: .infinity, alignment: .topLeading)
|
.frame(maxWidth: .infinity, alignment: .topLeading)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.offset(x: 10, y: 10)
|
|
||||||
.focused($focusedField, equals: .seekOSD)
|
.focused($focusedField, equals: .seekOSD)
|
||||||
.onChange(of: player.seek.lastSeekTime) { _ in
|
.onChange(of: player.seek.lastSeekTime) { _ in
|
||||||
if !model.presentingControls {
|
if !model.presentingControls {
|
||||||
@ -161,7 +160,6 @@ struct PlayerControls: View {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}.opacity(model.presentingControls && !model.presentingOverlays ? 1 : 0)
|
}.opacity(model.presentingControls && !model.presentingOverlays ? 1 : 0)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
@ -313,7 +311,7 @@ struct PlayerControls: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var settingsButton: some View {
|
private var settingsButton: some View {
|
||||||
button("settings", systemImage: "gearshape", active: model.presentingControlsOverlay) {
|
button("settings", systemImage: "gearshape") {
|
||||||
withAnimation(Self.animation) {
|
withAnimation(Self.animation) {
|
||||||
model.presentingControlsOverlay.toggle()
|
model.presentingControlsOverlay.toggle()
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,11 @@ struct TVControls: UIViewRepresentable {
|
|||||||
|
|
||||||
let controls = UIHostingController(rootView: PlayerControls(player: player, thumbnails: thumbnails))
|
let controls = UIHostingController(rootView: PlayerControls(player: player, thumbnails: thumbnails))
|
||||||
controls.view.frame = .init(
|
controls.view.frame = .init(
|
||||||
origin: .zero,
|
origin: .init(x: SafeArea.insets.left, y: SafeArea.insets.top),
|
||||||
size: .init(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
|
size: .init(
|
||||||
|
width: UIScreen.main.bounds.width - SafeArea.horizontalInsets,
|
||||||
|
height: UIScreen.main.bounds.height - SafeArea.verticalInset
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
controlsArea.addSubview(controls.view)
|
controlsArea.addSubview(controls.view)
|
||||||
|
@ -461,6 +461,7 @@ struct VideoPlayerView: View {
|
|||||||
struct VideoPlayerView_Previews: PreviewProvider {
|
struct VideoPlayerView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VideoPlayerView()
|
VideoPlayerView()
|
||||||
|
.environmentObject(SeekModel())
|
||||||
.injectFixtureEnvironmentObjects()
|
.injectFixtureEnvironmentObjects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,14 @@ struct SafeArea {
|
|||||||
return keyWindow?.safeAreaInsets ?? .init()
|
return keyWindow?.safeAreaInsets ?? .init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static var verticalInset: Double {
|
||||||
|
insets.top + insets.bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
static var horizontalInsets: Double {
|
||||||
|
insets.left + insets.right
|
||||||
|
}
|
||||||
|
|
||||||
static var scene: UIWindowScene? {
|
static var scene: UIWindowScene? {
|
||||||
UIApplication.shared.connectedScenes
|
UIApplication.shared.connectedScenes
|
||||||
.filter { $0.activationState == .foregroundActive }
|
.filter { $0.activationState == .foregroundActive }
|
@ -79,13 +79,13 @@ struct VideoBanner: View {
|
|||||||
} placeholder: {
|
} placeholder: {
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
#else
|
#else
|
||||||
.frame(width: thumbnailWidth, height: 60)
|
.frame(width: thumbnailWidth, height: 60)
|
||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
WebImage(url: url)
|
WebImage(url: url)
|
||||||
.resizable()
|
.resizable()
|
||||||
@ -93,13 +93,13 @@ struct VideoBanner: View {
|
|||||||
ProgressView()
|
ProgressView()
|
||||||
}
|
}
|
||||||
.indicator(.activity)
|
.indicator(.activity)
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(width: thumbnailWidth, height: 140)
|
.frame(width: thumbnailWidth, height: 140)
|
||||||
.mask(RoundedRectangle(cornerRadius: 12))
|
.mask(RoundedRectangle(cornerRadius: 12))
|
||||||
#else
|
#else
|
||||||
.frame(width: thumbnailWidth, height: 60)
|
.frame(width: thumbnailWidth, height: 60)
|
||||||
.mask(RoundedRectangle(cornerRadius: 6))
|
.mask(RoundedRectangle(cornerRadius: 6))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,9 +428,9 @@ struct VideoCell: View {
|
|||||||
} placeholder: {
|
} placeholder: {
|
||||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||||
}
|
}
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(minHeight: 320)
|
.frame(minHeight: 320)
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
WebImage(url: url)
|
WebImage(url: url)
|
||||||
.resizable()
|
.resizable()
|
||||||
@ -443,9 +443,9 @@ struct VideoCell: View {
|
|||||||
thumbnails.insertUnloadable(url)
|
thumbnails.insertUnloadable(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(minHeight: 320)
|
.frame(minHeight: 320)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||||
|
@ -38,7 +38,7 @@ struct ChannelCell: View {
|
|||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
if #available(iOS 15, macOS 12, *) {
|
if #available(iOS 15, macOS 12, *) {
|
||||||
AsyncImage(url: channel.thumbnailURL) { image in
|
AsyncImage(url: channel.thumbnailURL) { image in
|
||||||
image
|
image
|
||||||
.resizable()
|
.resizable()
|
||||||
} placeholder: {
|
} placeholder: {
|
||||||
|
@ -38,7 +38,7 @@ struct ChannelPlaylistCell: View {
|
|||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
if #available(iOS 15, macOS 12, *) {
|
if #available(iOS 15, macOS 12, *) {
|
||||||
AsyncImage(url: playlist.thumbnailURL) { image in
|
AsyncImage(url: playlist.thumbnailURL) { image in
|
||||||
image
|
image
|
||||||
.resizable()
|
.resizable()
|
||||||
} placeholder: {
|
} placeholder: {
|
||||||
|
@ -215,6 +215,7 @@
|
|||||||
37319F0627103F94004ECCD0 /* PlayerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37319F0427103F94004ECCD0 /* PlayerQueue.swift */; };
|
37319F0627103F94004ECCD0 /* PlayerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37319F0427103F94004ECCD0 /* PlayerQueue.swift */; };
|
||||||
37319F0727103F94004ECCD0 /* PlayerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37319F0427103F94004ECCD0 /* PlayerQueue.swift */; };
|
37319F0727103F94004ECCD0 /* PlayerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37319F0427103F94004ECCD0 /* PlayerQueue.swift */; };
|
||||||
3732BFD028B83763009F3F4D /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 3732BFCF28B83763009F3F4D /* KeychainAccess */; };
|
3732BFD028B83763009F3F4D /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 3732BFCF28B83763009F3F4D /* KeychainAccess */; };
|
||||||
|
3732C9FD28C012E600E7DCAF /* SafeArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37ECED55289FE166002BC2C9 /* SafeArea.swift */; };
|
||||||
3736A1FE286BB72300C9E5EE /* libavdevice.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3736A1EF286BB72300C9E5EE /* libavdevice.xcframework */; };
|
3736A1FE286BB72300C9E5EE /* libavdevice.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3736A1EF286BB72300C9E5EE /* libavdevice.xcframework */; };
|
||||||
3736A1FF286BB72300C9E5EE /* libavdevice.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3736A1EF286BB72300C9E5EE /* libavdevice.xcframework */; };
|
3736A1FF286BB72300C9E5EE /* libavdevice.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3736A1EF286BB72300C9E5EE /* libavdevice.xcframework */; };
|
||||||
3736A200286BB72300C9E5EE /* libuchardet.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3736A1F0286BB72300C9E5EE /* libuchardet.xcframework */; };
|
3736A200286BB72300C9E5EE /* libuchardet.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3736A1F0286BB72300C9E5EE /* libuchardet.xcframework */; };
|
||||||
@ -1901,7 +1902,6 @@
|
|||||||
37B4E802277D0A72004BF56A /* AppDelegate.swift */,
|
37B4E802277D0A72004BF56A /* AppDelegate.swift */,
|
||||||
37B4E804277D0AB4004BF56A /* Orientation.swift */,
|
37B4E804277D0AB4004BF56A /* Orientation.swift */,
|
||||||
379B0252287A1CDF001015B5 /* OrientationTracker.swift */,
|
379B0252287A1CDF001015B5 /* OrientationTracker.swift */,
|
||||||
37ECED55289FE166002BC2C9 /* SafeArea.swift */,
|
|
||||||
3784B23A272894DA00B09468 /* ShareSheet.swift */,
|
3784B23A272894DA00B09468 /* ShareSheet.swift */,
|
||||||
3749BF9227ADA142000480FF /* BridgingHeader.h */,
|
3749BF9227ADA142000480FF /* BridgingHeader.h */,
|
||||||
37992DC726CC50BC003D4C27 /* Info.plist */,
|
37992DC726CC50BC003D4C27 /* Info.plist */,
|
||||||
@ -2022,6 +2022,7 @@
|
|||||||
3761ABFC26F0F8DE00AA496F /* EnvironmentValues.swift */,
|
3761ABFC26F0F8DE00AA496F /* EnvironmentValues.swift */,
|
||||||
3729037D2739E47400EA99F6 /* MenuCommands.swift */,
|
3729037D2739E47400EA99F6 /* MenuCommands.swift */,
|
||||||
37B7958F2771DAE0001CF27B /* OpenURLHandler.swift */,
|
37B7958F2771DAE0001CF27B /* OpenURLHandler.swift */,
|
||||||
|
37ECED55289FE166002BC2C9 /* SafeArea.swift */,
|
||||||
3700155E271B12DD0049C794 /* SiestaConfiguration.swift */,
|
3700155E271B12DD0049C794 /* SiestaConfiguration.swift */,
|
||||||
37FFC43F272734C3009FFD26 /* Throttle.swift */,
|
37FFC43F272734C3009FFD26 /* Throttle.swift */,
|
||||||
378FFBC328660172009E3FBE /* URLParser.swift */,
|
378FFBC328660172009E3FBE /* URLParser.swift */,
|
||||||
@ -3327,6 +3328,7 @@
|
|||||||
376B2E0926F920D600B1D64D /* SignInRequiredView.swift in Sources */,
|
376B2E0926F920D600B1D64D /* SignInRequiredView.swift in Sources */,
|
||||||
378FFBC628660172009E3FBE /* URLParser.swift in Sources */,
|
378FFBC628660172009E3FBE /* URLParser.swift in Sources */,
|
||||||
37141671267A8ACC006CA35D /* TrendingView.swift in Sources */,
|
37141671267A8ACC006CA35D /* TrendingView.swift in Sources */,
|
||||||
|
3732C9FD28C012E600E7DCAF /* SafeArea.swift in Sources */,
|
||||||
37C3A24727235DA70087A57A /* ChannelPlaylist.swift in Sources */,
|
37C3A24727235DA70087A57A /* ChannelPlaylist.swift in Sources */,
|
||||||
3788AC2926F6840700F6BAA9 /* FavoriteItemView.swift in Sources */,
|
3788AC2926F6840700F6BAA9 /* FavoriteItemView.swift in Sources */,
|
||||||
37319F0727103F94004ECCD0 /* PlayerQueue.swift in Sources */,
|
37319F0727103F94004ECCD0 /* PlayerQueue.swift in Sources */,
|
||||||
|
Loading…
Reference in New Issue
Block a user