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_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;
@ -504,7 +504,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;

View File

@ -204,7 +204,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 {

View File

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

View File

@ -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()

View File

@ -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
}
}
}
}