Commit 10de9b62 authored by Carola Nitz's avatar Carola Nitz

VLCMovieViewController: fix displaying on external screen via HDMI

When we refactored we didn't pass the movieView to the external screen when displaying externally
This worked well for chromecast and mirroring but sadly not for attaching an external screen via HDMI
(closes #263)
parent 50920782
...@@ -21,9 +21,8 @@ class VLCPlayingExternallyView: UIView { ...@@ -21,9 +21,8 @@ class VLCPlayingExternallyView: UIView {
} }
var externalWindow: UIWindow? var externalWindow: UIWindow?
@objc func shouldDisplay(_ show: Bool) { @objc func shouldDisplay(_ show: Bool, movieView: UIView) {
self.isHidden = !show self.isHidden = !show
externalWindow?.isHidden = !show
if show { if show {
guard let screen = UIScreen.screens.count > 1 ? UIScreen.screens[1] : nil else { guard let screen = UIScreen.screens.count > 1 ? UIScreen.screens[1] : nil else {
return return
...@@ -34,11 +33,14 @@ class VLCPlayingExternallyView: UIView { ...@@ -34,11 +33,14 @@ class VLCPlayingExternallyView: UIView {
return return
} }
externalWindow.rootViewController = VLCExternalDisplayController() externalWindow.rootViewController = VLCExternalDisplayController()
externalWindow.rootViewController?.view.addSubview(movieView)
externalWindow.screen = screen externalWindow.screen = screen
externalWindow.rootViewController?.view.frame = externalWindow.bounds externalWindow.rootViewController?.view.frame = externalWindow.bounds
movieView.frame = externalWindow.bounds
} else { } else {
externalWindow = nil externalWindow = nil
} }
externalWindow?.isHidden = !show
} }
override func awakeFromNib() { override func awakeFromNib() {
......
...@@ -1673,11 +1673,15 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1673,11 +1673,15 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)showOnDisplay:(UIView *)view - (void)showOnDisplay:(UIView *)view
{ {
// if we don't have a renderer we're mirroring and don't want to show the dialog // if we don't have a renderer we're mirroring and don't want to show the dialog
BOOL displayExternally = _vpc.renderer && view != _movieView; BOOL displayExternally = view != _movieView;
[_playingExternalView shouldDisplay:displayExternally]; [_playingExternalView shouldDisplay:displayExternally movieView:_movieView];
[_playingExternalView updateUIWithRendererItem:_vpc.renderer]; [_playingExternalView updateUIWithRendererItem:_vpc.renderer];
_vpc.videoOutputView = view;
_artworkImageView.hidden = displayExternally; _artworkImageView.hidden = displayExternally;
if (!displayExternally && _movieView.superview != self.view) {
[self.view addSubview:_movieView];
[self.view sendSubviewToBack:_movieView];
_movieView.frame = self.view.frame;
}
} }
- (void)handleExternalScreenDidConnect:(NSNotification *)notification - (void)handleExternalScreenDidConnect:(NSNotification *)notification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment