Commit 0075b6c6 authored by Gleb Pinigin's avatar Gleb Pinigin Committed by Felix Paul Kühne

Aspen: add support for external display

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 2ac25fd3
......@@ -26,6 +26,7 @@
A79246C4170F114E0036AAF2 /* VLCPlaylistViewController~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = A79246BF170F114E0036AAF2 /* VLCPlaylistViewController~ipad.xib */; };
A79246C5170F114E0036AAF2 /* VLCPlaylistViewController~iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = A79246C0170F114E0036AAF2 /* VLCPlaylistViewController~iphone.xib */; };
A79246C8170F11DF0036AAF2 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A79246C6170F11DF0036AAF2 /* Localizable.strings */; };
A7DA16D1171083DF00D6FED9 /* VLCExternalDisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = A7DA16D0171083DF00D6FED9 /* VLCExternalDisplayController.m */; };
CC1BBC3F1704934300A20CBF /* libMobileVLCKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1BBC3E1704934200A20CBF /* libMobileVLCKit.a */; };
CC1BBC431704935E00A20CBF /* MediaLibrary.mom in Resources */ = {isa = PBXBuildFile; fileRef = CC1BBC421704935E00A20CBF /* MediaLibrary.mom */; };
CC1BBC461704938300A20CBF /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1BBC451704938300A20CBF /* libiconv.dylib */; };
......@@ -69,6 +70,8 @@
A79246C0170F114E0036AAF2 /* VLCPlaylistViewController~iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "VLCPlaylistViewController~iphone.xib"; path = "Resources/VLCPlaylistViewController~iphone.xib"; sourceTree = SOURCE_ROOT; };
A79246C7170F11DF0036AAF2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
A79246C9170F11E40036AAF2 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
A7DA16CF171083DF00D6FED9 /* VLCExternalDisplayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExternalDisplayController.h; sourceTree = "<group>"; };
A7DA16D0171083DF00D6FED9 /* VLCExternalDisplayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCExternalDisplayController.m; sourceTree = "<group>"; };
CC1BBC3E1704934200A20CBF /* libMobileVLCKit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMobileVLCKit.a; path = "ImportedSources/VLCKit/build/Release-iphonesimulator/libMobileVLCKit.a"; sourceTree = "<group>"; };
CC1BBC421704935E00A20CBF /* MediaLibrary.mom */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = MediaLibrary.mom; path = "ImportedSources/MediaLibraryKit/build/Release-iphonesimulator/MediaLibrary.mom"; sourceTree = "<group>"; };
CC1BBC451704938300A20CBF /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
......@@ -158,6 +161,8 @@
7D94FCFA16DE7D1100F2623B /* VLCMovieViewController.m */,
7DA62099170A0CE500643D11 /* VLCPlaylistTableViewCell.h */,
7DA6209A170A0CE500643D11 /* VLCPlaylistTableViewCell.m */,
A7DA16CF171083DF00D6FED9 /* VLCExternalDisplayController.h */,
A7DA16D0171083DF00D6FED9 /* VLCExternalDisplayController.m */,
7DADC5601704FACC001DAC63 /* Imported */,
7DADC55C1704FAA8001DAC63 /* XIBs */,
A7924697170F0ED20036AAF2 /* Resources */,
......@@ -297,6 +302,7 @@
7D94FCFB16DE7D1100F2623B /* VLCMovieViewController.m in Sources */,
7DADC55F1704FABF001DAC63 /* OBSlider.m in Sources */,
7DA6209B170A0CE500643D11 /* VLCPlaylistTableViewCell.m in Sources */,
A7DA16D1171083DF00D6FED9 /* VLCExternalDisplayController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
//
// VLCExternalDisplayController.h
// AspenProject
//
// Created by Gleb on 4/6/13.
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface VLCExternalDisplayController : UIViewController
@end
//
// VLCExternalDisplayController.m
// AspenProject
//
// Created by Gleb on 4/6/13.
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
#import "VLCExternalDisplayController.h"
@interface VLCExternalDisplayController ()
@end
@implementation VLCExternalDisplayController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return NO;
}
- (BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return ~UIInterfaceOrientationMaskAll;
}
@end
......@@ -7,9 +7,11 @@
//
#import "VLCMovieViewController.h"
#import "VLCExternalDisplayController.h"
@interface VLCMovieViewController ()
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
@property (nonatomic, retain) UIPopoverController *masterPopoverController;
@property (nonatomic, retain) UIWindow *externalWindow;
@end
@implementation VLCMovieViewController
......@@ -19,6 +21,8 @@
{
[_mediaItem release];
[_masterPopoverController release];
[_externalWindow release];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
......@@ -45,6 +49,16 @@
self.navigationItem.titleView = self.positionSlider;
self.navigationItem.rightBarButtonItem = self.timeDisplay;
self.navigationItem.rightBarButtonItem.style = UIBarButtonItemStylePlain;
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(handleExternalScreenDidConnect:)
name:UIScreenDidConnectNotification object:nil];
[center addObserver:self selector:@selector(handleExternalScreenDidDisconnect:)
name:UIScreenDidDisconnectNotification object:nil];
if ([self hasExternalDisplay]) {
[self showOnExternalDisplay];
}
}
- (void)viewWillAppear:(BOOL)animated
......@@ -193,4 +207,49 @@
self.masterPopoverController = nil;
}
#pragma mark - External Display
- (BOOL)hasExternalDisplay
{
return ([[UIScreen screens] count] > 1);
}
- (void)showOnExternalDisplay
{
UIScreen *screen = [[UIScreen screens] objectAtIndex:1];
screen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
self.externalWindow = [[UIWindow alloc] initWithFrame:screen.bounds];
UIViewController *controller = [[VLCExternalDisplayController alloc] init];
self.externalWindow.rootViewController = controller;
[controller.view addSubview:_movieView];
controller.view.frame = screen.bounds;
_movieView.frame = screen.bounds;
self.externalWindow.screen = screen;
self.externalWindow.hidden = NO;
}
- (void)hideFromExternalDisplay
{
[self.view addSubview:_movieView];
[self.view sendSubviewToBack:_movieView];
_movieView.frame = self.view.frame;
self.externalWindow.hidden = YES;
self.externalWindow = nil;
}
- (void)handleExternalScreenDidConnect:(NSNotification *)notification
{
[self showOnExternalDisplay];
}
- (void)handleExternalScreenDidDisconnect:(NSNotification *)notification
{
[self hideFromExternalDisplay];
}
@end
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