player fixes

This commit is contained in:
Aiden Vigue 2021-05-24 18:14:11 -04:00
parent 4801b01b16
commit c86c08d4bb
5 changed files with 15 additions and 14 deletions

View File

@ -136,7 +136,8 @@ class PreferenceUIHostingController: UIHostingController<AnyView> {
// MARK: Lock orientation
public var _orientations: UIInterfaceOrientationMask = .allButUpsideDown {
didSet { UIViewController.attemptRotationToDeviceOrientation();
didSet {
UIViewController.attemptRotationToDeviceOrientation();
if(_orientations == .landscapeRight) {
let value = UIInterfaceOrientation.landscapeRight.rawValue;
UIDevice.current.setValue(value, forKey: "orientation")

View File

@ -355,10 +355,10 @@ struct EpisodeItemView: View {
WebImage(url: cast.Image)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder {
Image(uiImage: UIImage(blurHash: (cast.ImageBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : cast.ImageBlurHash), size: CGSize(width: 32, height: 32))!)
Image(uiImage: UIImage(blurHash: (cast.ImageBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : cast.ImageBlurHash), size: CGSize(width: 4, height: 4))!)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.frame(width: 70, height: 70)
.cornerRadius(10)
}
.aspectRatio(contentMode: .fill)
@ -596,7 +596,7 @@ struct EpisodeItemView: View {
}.introspectTabBarController { (UITabBarController) in
UITabBarController.tabBar.isHidden = true
}
}.onAppear(perform: loadData)
}.onAppear(perform: loadData).supportedOrientations(.allButUpsideDown)
}
}
}

View File

@ -61,8 +61,7 @@ struct JellyfinPlayerApp: App {
.environmentObject(OrientationInfo())
.environmentObject(jsi)
.withHostingWindow() { window in
window?.rootViewController = PreferenceUIHostingController(wrappedView: ContentView().environment(\.managedObjectContext, persistenceController.container.viewContext)
.environmentObject(jsi).environmentObject(OrientationInfo()))
window?.rootViewController = PreferenceUIHostingController(wrappedView: ContentView().environment(\.managedObjectContext, persistenceController.container.viewContext).environmentObject(OrientationInfo()).environmentObject(jsi))
}
}
}

View File

@ -401,14 +401,14 @@ struct MovieItemView: View {
WebImage(url: cast.Image)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder {
Image(uiImage: UIImage(blurHash: (cast.ImageBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : cast.ImageBlurHash), size: CGSize(width: 32, height: 32))!)
Image(uiImage: UIImage(blurHash: (cast.ImageBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : cast.ImageBlurHash), size: CGSize(width: 4, height: 4))!)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.frame(width: 70, height: 70)
.cornerRadius(10)
}
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.frame(width: 70, height: 70)
.cornerRadius(10).shadow(radius: 6)
Text(cast.Name).font(.footnote).fontWeight(.regular).lineLimit(1).frame(width: 100).foregroundColor(Color.primary)
if(cast.Role != "") {
@ -641,7 +641,7 @@ struct MovieItemView: View {
}.introspectTabBarController { (UITabBarController) in
UITabBarController.tabBar.isHidden = false
}
}.onAppear(perform: loadData)
}.onAppear(perform: loadData).supportedOrientations(.allButUpsideDown)
}
}
}

View File

@ -374,8 +374,9 @@ struct VideoPlayerView: View {
VLCPlayer(url: $pbitem, player: $vlcplayer, startTime: Int(item.Progress)).onDisappear(perform: {
_isPlaying.wrappedValue = false;
vlcplayer.stop()
})
}.overlay(
}).padding(EdgeInsets(top: 0, leading: UIDevice.current.hasNotch ? 30 : 0, bottom: 0, trailing: UIDevice.current.hasNotch ? 30 : 0))
}
.overlay(
VStack() {
HStack() {
HStack() {
@ -459,7 +460,6 @@ struct VideoPlayerView: View {
Text(timeText).fontWeight(.semibold).frame(width: 80).foregroundColor(.white)
}.padding(EdgeInsets(top: -20, leading: 44, bottom: 42, trailing: 40))
}
.padding(EdgeInsets(top: 0, leading: UIDevice.current.hasNotch ? -30 : 0, bottom: 0, trailing: UIDevice.current.hasNotch ? -30 : 0))
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.black).opacity(0.4))
.isHidden(inactivity)
@ -469,12 +469,13 @@ struct VideoPlayerView: View {
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.prefersHomeIndicatorAutoHidden(true)
.edgesIgnoringSafeArea(.all)
.supportedOrientations(.landscapeRight)
.preferredColorScheme(.dark)
.introspectTabBarController { (UITabBarController) in
UITabBarController.tabBar.isHidden = true
}
.statusBar(hidden: true)
.edgesIgnoringSafeArea(.all)
.onTapGesture(perform: resetTimer)
.fullScreenCover(isPresented: self.$captionConfiguration) {
NavigationView() {