This commit is contained in:
Aiden Vigue 2021-05-27 14:55:01 -04:00
parent decd0bd5c0
commit 484bd445e6
No known key found for this signature in database
GPG Key ID: E7570472648F4544
5 changed files with 43 additions and 52 deletions

View File

@ -478,7 +478,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23; CURRENT_PROJECT_VERSION = 26;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9R8RREG67J; DEVELOPMENT_TEAM = 9R8RREG67J;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
@ -504,7 +504,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 23; CURRENT_PROJECT_VERSION = 26;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9R8RREG67J; DEVELOPMENT_TEAM = 9R8RREG67J;

View File

@ -204,7 +204,7 @@ struct ContentView: View {
LatestMediaView(library: library_id) LatestMediaView(library: library_id)
}.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0)) }.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
} }
Spacer().frame(height: 7) Spacer().frame(height: 20)
} }
.navigationTitle("Home") .navigationTitle("Home")
.toolbar { .toolbar {

View File

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>23</string> <string>26</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>

View File

@ -113,6 +113,7 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
@IBAction func exitButtonPressed(_ sender: Any) { @IBAction func exitButtonPressed(_ sender: Any) {
sendStopReport() sendStopReport()
mediaPlayer.stop()
delegate?.exitPlayer(self) delegate?.exitPlayer(self)
} }
@ -163,13 +164,14 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
optionsVC.subtitles = subtitleTrackArray optionsVC.subtitles = subtitleTrackArray
optionsVC.audioTracks = audioTrackArray optionsVC.audioTracks = audioTrackArray
// Use the popover presentation style for your view controller. // Use the popover presentation style for your view controller.
optionsVC.modalPresentationStyle = .popover let navVC = UINavigationController(rootViewController: optionsVC)
navVC.modalPresentationStyle = .popover
// Specify the anchor point for the popover. navVC.popoverPresentationController?.sourceView = playerSettingsButton
optionsVC.popoverPresentationController?.sourceView = playerSettingsButton
// Present the view controller (in a popover). // Present the view controller (in a popover).
self.present(optionsVC, animated: true) { self.present(navVC, animated: true) {
print("popover visible, pause playback") print("popover visible, pause playback")
self.mediaPlayer.pause() self.mediaPlayer.pause()
self.mainActionButton.setImage(UIImage(systemName: "play"), for: .normal) self.mainActionButton.setImage(UIImage(systemName: "play"), for: .normal)
@ -300,15 +302,15 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
mediaPlayer.media = VLCMedia(url: playbackItem.videoUrl) mediaPlayer.media = VLCMedia(url: playbackItem.videoUrl)
mediaPlayer.play() mediaPlayer.play()
mediaPlayer.jumpForward(Int32(manifest.Progress/10000000)) mediaPlayer.jumpForward(Int32(manifest.Progress/10000000))
mediaPlayer.pause()
subtitleTrackArray.forEach() { sub in subtitleTrackArray.forEach() { sub in
if(sub.id != -1 && sub.delivery == "External" && sub.codec != "subrip") { if(sub.id != -1 && sub.delivery == "External" && sub.codec != "subrip") {
print("adding subs for id: \(sub.id) w/ url: \(sub.url)") print("adding subs for id: \(sub.id) w/ url: \(sub.url)")
mediaPlayer.addPlaybackSlave(sub.url, type: .subtitle, enforce: false) mediaPlayer.addPlaybackSlave(sub.url, type: .subtitle, enforce: false)
} }
} }
mediaPlayer.pause()
delegate?.showLoadingView(self) delegate?.showLoadingView(self)
sleep(3) while(mediaPlayer.numberOfSubtitlesTracks != subtitleTrackArray.count - 1) {}
mediaPlayer.currentVideoSubTitleIndex = selectedCaptionTrack; mediaPlayer.currentVideoSubTitleIndex = selectedCaptionTrack;
mediaPlayer.pause() mediaPlayer.pause()
mediaPlayer.play() mediaPlayer.play()

View File

@ -54,7 +54,7 @@ class SettingsViewDelegate: ObservableObject {
} }
class VideoPlayerSettingsView: UIViewController { class VideoPlayerSettingsView: UIViewController {
private var ctntView: VideoPlayerSettings! private var ctntView: VideoPlayerSettings?
private var contentViewDelegate: SettingsViewDelegate = SettingsViewDelegate() private var contentViewDelegate: SettingsViewDelegate = SettingsViewDelegate()
weak var delegate: VideoPlayerSettingsDelegate? weak var delegate: VideoPlayerSettingsDelegate?
private var subChangePublisher: AnyCancellable? private var subChangePublisher: AnyCancellable?
@ -62,12 +62,12 @@ class VideoPlayerSettingsView: UIViewController {
private var shouldClosePublisher: AnyCancellable? private var shouldClosePublisher: AnyCancellable?
var subtitles: [Subtitle] = [] var subtitles: [Subtitle] = []
var audioTracks: [AudioTrack] = [] var audioTracks: [AudioTrack] = []
var currentSubtitleTrack: Int32! var currentSubtitleTrack: Int32?
var currentAudioTrack: Int32! var currentAudioTrack: Int32?
override func viewDidLoad() { override func viewDidLoad() {
super.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) let contentView = UIHostingController(rootView: ctntView)
self.view.addSubview(contentView.view) self.view.addSubview(contentView.view)
contentView.view.translatesAutoresizingMaskIntoConstraints = false contentView.view.translatesAutoresizingMaskIntoConstraints = false
@ -94,7 +94,6 @@ class VideoPlayerSettingsView: UIViewController {
override func viewWillDisappear(_ animated: Bool) { override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated) super.viewWillDisappear(animated)
delegate?.settingsPopoverDismissed()
} }
} }
@ -110,46 +109,36 @@ struct VideoPlayerSettings: View {
self.subtitles = subtitles self.subtitles = subtitles
self.audioTracks = audioTracks self.audioTracks = audioTracks
self.subtitleSelection = initSub subtitleSelection = initSub
self.audioTrackSelection = initAudio audioTrackSelection = initAudio
print(initSub)
print(initAudio)
} }
var body: some View { var body: some View {
GeometryReader { proxy in Form() {
NavigationView() { if(UIDevice.current.userInterfaceIdiom == .phone) {
Form() { Button {
Picker("Closed Captions", selection: $subtitleSelection) { delegate.close = true
ForEach(subtitles, id: \.id) { caption in } label: {
Text(caption.name).tag(caption.id) HStack() {
} Image(systemName: "chevron.left")
}.onChange(of: subtitleSelection) { id in Text("Back").font(.callout)
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)
}
}
} }
} }
}.navigationViewStyle(StackNavigationViewStyle()) }
.padding(6) Picker("Closed Captions", selection: $subtitleSelection) {
.frame(width: proxy.size.width, height: proxy.size.height) 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
}
} }
} }
} }