Commit a13219e0 authored by Felix Paul Kühne's avatar Felix Paul Kühne

make sure video output doesn't get lost in background mode

parent ab9096f9
......@@ -567,11 +567,12 @@ continueUserActivity:(NSUserActivity *)userActivity
- (void)openMediaFromManagedObject:(NSManagedObject *)mediaObject
{
BOOL retainFullscreenPlayback = false;
if (self.movieViewController.presentingViewController)
retainFullscreenPlayback = YES;
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
if (vpc.presentingMovieViewController)
retainFullscreenPlayback = YES;
if ([mediaObject isKindOfClass:[MLFile class]])
vpc.fileFromMediaLibrary = (MLFile *)mediaObject;
else if ([mediaObject isKindOfClass:[MLAlbumTrack class]])
......
......@@ -144,9 +144,15 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
_videoView = nil;
}
} else {
if (_videoView) {
[_videoView removeFromSuperview];
_videoView = nil;
}
_videoView = [[UIView alloc] initWithFrame:_artworkView.frame];
[self addSubview:_videoView];
controller.videoOutputView = _videoView;
if (!controller.presentingMovieViewController)
controller.videoOutputView = _videoView;
}
NSString *metaDataString;
......
......@@ -412,8 +412,8 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
}
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
vpc.videoOutputView = self.movieView;
vpc.delegate = self;
vpc.presentingMovieViewController = YES;
[vpc recoverPlaybackState];
[self setControlsHidden:NO animated:YES];
......@@ -426,6 +426,8 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc recoverDisplayedMetadata];
vpc.videoOutputView = nil;
vpc.videoOutputView = self.movieView;
}
- (void)viewWillLayoutSubviews
......@@ -470,7 +472,9 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
- (void)viewWillDisappear:(BOOL)animated
{
[VLCPlaybackController sharedInstance].videoOutputView = nil;
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
vpc.videoOutputView = nil;
vpc.presentingMovieViewController = NO;
_viewAppeared = NO;
if (_idleTimer) {
......
......@@ -66,6 +66,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom;
@property (nonatomic, readonly) BOOL activePlaybackSession;
@property (nonatomic, readonly) BOOL audioOnlyPlaybackSession;
@property (nonatomic, readwrite) BOOL presentingMovieViewController;
+ (VLCPlaybackController *)sharedInstance;
......
......@@ -589,6 +589,9 @@
[_actualVideoOutputView layoutSubviews];
[_actualVideoOutputView updateConstraints];
if (_mediaPlayer.currentVideoTrackIndex == -1)
_mediaPlayer.currentVideoTrackIndex = 0;
[videoOutputView addSubview:_actualVideoOutputView];
} else
[_actualVideoOutputView removeFromSuperview];
......
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