diff --git a/JellyfinPlayer.xcodeproj/project.pbxproj b/JellyfinPlayer.xcodeproj/project.pbxproj index 0b7ff8ec..fa3fc3cb 100644 --- a/JellyfinPlayer.xcodeproj/project.pbxproj +++ b/JellyfinPlayer.xcodeproj/project.pbxproj @@ -561,7 +561,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 23; + CURRENT_PROJECT_VERSION = 26; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 9R8RREG67J; ENABLE_BITCODE = NO; @@ -587,7 +587,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 23; + CURRENT_PROJECT_VERSION = 26; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 9R8RREG67J; diff --git a/JellyfinPlayer/ContentView.swift b/JellyfinPlayer/ContentView.swift index d2554751..25a8b59b 100644 --- a/JellyfinPlayer/ContentView.swift +++ b/JellyfinPlayer/ContentView.swift @@ -210,7 +210,7 @@ struct ContentView: View { LatestMediaView(library: library_id) }.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0)) } - Spacer().frame(height: 7) + Spacer().frame(height: 20) } .navigationTitle("Home") .toolbar { diff --git a/JellyfinPlayer/Info.plist b/JellyfinPlayer/Info.plist index ba1364e6..161fabef 100644 --- a/JellyfinPlayer/Info.plist +++ b/JellyfinPlayer/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 23 + 26 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/JellyfinPlayer/Views/VideoPlayer.swift b/JellyfinPlayer/Views/VideoPlayer.swift index c1c230fc..fb498b4a 100644 --- a/JellyfinPlayer/Views/VideoPlayer.swift +++ b/JellyfinPlayer/Views/VideoPlayer.swift @@ -113,6 +113,7 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe @IBAction func exitButtonPressed(_ sender: Any) { sendStopReport() + mediaPlayer.stop() delegate?.exitPlayer(self) } @@ -163,13 +164,14 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe optionsVC.subtitles = subtitleTrackArray optionsVC.audioTracks = audioTrackArray // Use the popover presentation style for your view controller. - optionsVC.modalPresentationStyle = .popover - - // Specify the anchor point for the popover. - optionsVC.popoverPresentationController?.sourceView = playerSettingsButton - + let navVC = UINavigationController(rootViewController: optionsVC) + navVC.modalPresentationStyle = .popover + navVC.popoverPresentationController?.sourceView = playerSettingsButton + + + // Present the view controller (in a popover). - self.present(optionsVC, animated: true) { + self.present(navVC, animated: true) { print("popover visible, pause playback") self.mediaPlayer.pause() self.mainActionButton.setImage(UIImage(systemName: "play"), for: .normal) @@ -300,15 +302,15 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe mediaPlayer.media = VLCMedia(url: playbackItem.videoUrl) mediaPlayer.play() mediaPlayer.jumpForward(Int32(manifest.Progress/10000000)) + mediaPlayer.pause() subtitleTrackArray.forEach() { sub in if(sub.id != -1 && sub.delivery == "External" && sub.codec != "subrip") { print("adding subs for id: \(sub.id) w/ url: \(sub.url)") mediaPlayer.addPlaybackSlave(sub.url, type: .subtitle, enforce: false) } } - mediaPlayer.pause() delegate?.showLoadingView(self) - sleep(3) + while(mediaPlayer.numberOfSubtitlesTracks != subtitleTrackArray.count - 1) {} mediaPlayer.currentVideoSubTitleIndex = selectedCaptionTrack; mediaPlayer.pause() mediaPlayer.play() diff --git a/JellyfinPlayer/Views/VideoPlayerSettingsView.swift b/JellyfinPlayer/Views/VideoPlayerSettingsView.swift index a1405da4..ff40adbd 100644 --- a/JellyfinPlayer/Views/VideoPlayerSettingsView.swift +++ b/JellyfinPlayer/Views/VideoPlayerSettingsView.swift @@ -54,7 +54,7 @@ class SettingsViewDelegate: ObservableObject { } class VideoPlayerSettingsView: UIViewController { - private var ctntView: VideoPlayerSettings! + private var ctntView: VideoPlayerSettings? private var contentViewDelegate: SettingsViewDelegate = SettingsViewDelegate() weak var delegate: VideoPlayerSettingsDelegate? private var subChangePublisher: AnyCancellable? @@ -62,12 +62,12 @@ class VideoPlayerSettingsView: UIViewController { private var shouldClosePublisher: AnyCancellable? var subtitles: [Subtitle] = [] var audioTracks: [AudioTrack] = [] - var currentSubtitleTrack: Int32! - var currentAudioTrack: Int32! + var currentSubtitleTrack: Int32? + var currentAudioTrack: Int32? override func viewDidLoad() { super.viewDidLoad() - ctntView = VideoPlayerSettings(delegate: self.contentViewDelegate, subtitles: self.subtitles, audioTracks: self.audioTracks, initSub: currentSubtitleTrack, initAudio: currentAudioTrack) + ctntView = VideoPlayerSettings(delegate: self.contentViewDelegate, subtitles: self.subtitles, audioTracks: self.audioTracks, initSub: currentSubtitleTrack ?? -1, initAudio: currentAudioTrack ?? 1) let contentView = UIHostingController(rootView: ctntView) self.view.addSubview(contentView.view) contentView.view.translatesAutoresizingMaskIntoConstraints = false @@ -94,7 +94,6 @@ class VideoPlayerSettingsView: UIViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) - delegate?.settingsPopoverDismissed() } } @@ -110,46 +109,36 @@ struct VideoPlayerSettings: View { self.subtitles = subtitles self.audioTracks = audioTracks - self.subtitleSelection = initSub - self.audioTrackSelection = initAudio - print(initSub) - print(initAudio) + subtitleSelection = initSub + audioTrackSelection = initAudio } var body: some View { - GeometryReader { proxy in - NavigationView() { - Form() { - Picker("Closed Captions", selection: $subtitleSelection) { - ForEach(subtitles, id: \.id) { caption in - Text(caption.name).tag(caption.id) - } - }.onChange(of: subtitleSelection) { id in - self.delegate.subtitleTrackID = id - } - Picker("Audio Track", selection: $audioTrackSelection) { - ForEach(audioTracks, id: \.id) { caption in - Text(caption.name).tag(caption.id).lineLimit(1) - } - }.onChange(of: audioTrackSelection) { id in - self.delegate.audioTrackID = id - } - }.navigationTitle("Audio & Captions") - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItemGroup(placement: .navigationBarLeading) { - Button { - delegate.close = true; - } label: { - HStack() { - Text("Back").font(.callout) - } - } + Form() { + if(UIDevice.current.userInterfaceIdiom == .phone) { + Button { + delegate.close = true + } label: { + HStack() { + Image(systemName: "chevron.left") + Text("Back").font(.callout) } } - }.navigationViewStyle(StackNavigationViewStyle()) - .padding(6) - .frame(width: proxy.size.width, height: proxy.size.height) + } + Picker("Closed Captions", selection: $subtitleSelection) { + ForEach(subtitles, id: \.id) { caption in + Text(caption.name).tag(caption.id) + } + }.onChange(of: subtitleSelection) { id in + delegate.subtitleTrackID = id + } + Picker("Audio Track", selection: $audioTrackSelection) { + ForEach(audioTracks, id: \.id) { caption in + Text(caption.name).tag(caption.id).lineLimit(1) + } + }.onChange(of: audioTrackSelection) { id in + delegate.audioTrackID = id + } } } }