Commit 5ab3cb78 authored by Felix Paul Kühne's avatar Felix Paul Kühne

ATV: add PoC fullscreen playback view controller

parent 37b091f0
......@@ -17,6 +17,8 @@
#if TARGET_OS_IOS
#import "VLCMovieViewController.h"
#else
#import "VLCFullscreenMovieTVViewController.h"
#endif
static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDisplayControllerDisplayMode";
......@@ -125,6 +127,8 @@ static inline void commonSetup(VLCPlayerDisplayController *self)
if (!_movieViewController) {
#if TARGET_OS_IOS
_movieViewController = [[VLCMovieViewController alloc] initWithNibName:nil bundle:nil];
#else
_movieViewController = [[VLCFullscreenMovieTVViewController alloc] initWithNibName:nil bundle:nil];
#endif
[VLCPlaybackController sharedInstance].delegate = _movieViewController;
}
......@@ -242,11 +246,9 @@ static inline void commonSetup(VLCPlayerDisplayController *self)
- (void)_presentFullscreenPlaybackViewIfNeeded
{
#if TARGET_OS_IOS
if (!self.movieViewController.presentingViewController) {
[self _presentMovieViewControllerAnimated:[self shouldAnimate]];
}
#endif
}
- (void)_closeFullscreenPlayback
......
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import <UIKit/UIKit.h>
#import "VLCPlaybackController.h"
@interface VLCFullscreenMovieTVViewController : UIViewController <VLCPlaybackControllerDelegate>
@property (readwrite, nonatomic, weak) IBOutlet UIView *movieView;
@end
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCFullscreenMovieTVViewController.h"
#import "VLCPlayerDisplayController.h"
@interface VLCFullscreenMovieTVViewController ()
{
BOOL _playerIsSetup;
BOOL _viewAppeared;
}
@end
@implementation VLCFullscreenMovieTVViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.extendedLayoutIncludesOpaqueBars = YES;
self.edgesForExtendedLayout = UIRectEdgeAll;
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(appBecameActive:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
[center addObserver:self
selector:@selector(playbackDidStop:)
name:VLCPlaybackControllerPlaybackDidStop
object:nil];
_movieView.userInteractionEnabled = NO;
_playerIsSetup = NO;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:animated];
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
vpc.delegate = self;
[vpc recoverPlaybackState];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
_viewAppeared = YES;
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc recoverDisplayedMetadata];
vpc.videoOutputView = nil;
vpc.videoOutputView = self.movieView;
}
- (void)viewWillDisappear:(BOOL)animated
{
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
if (vpc.videoOutputView == self.movieView) {
vpc.videoOutputView = nil;
}
_viewAppeared = NO;
[self.navigationController setNavigationBarHidden:NO animated:YES];
[super viewWillDisappear:animated];
}
- (void)prepareForMediaPlayback:(VLCPlaybackController *)controller
{
APLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)appBecameActive:(NSNotification *)aNotification
{
VLCPlayerDisplayController *pdc = [VLCPlayerDisplayController sharedInstance];
if (pdc.displayMode == VLCPlayerDisplayControllerDisplayModeFullscreen) {
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc recoverDisplayedMetadata];
if (vpc.videoOutputView != self.movieView) {
vpc.videoOutputView = nil;
vpc.videoOutputView = self.movieView;
}
}
}
- (void)playbackDidStop:(NSNotification *)aNotification
{
[[UIApplication sharedApplication] sendAction:@selector(closeFullscreenPlayback) to:nil from:self forEvent:nil];
}
- (void)mediaPlayerStateChanged:(VLCMediaPlayerState)currentState
isPlaying:(BOOL)isPlaying
currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
currentMediaHasChapters:(BOOL)currentMediaHasChapters
forPlaybackController:(VLCPlaybackController *)controller
{
APLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)displayMetadataForPlaybackController:(VLCPlaybackController *)controller
title:(NSString *)title
artwork:(UIImage *)artwork
artist:(NSString *)artist
album:(NSString *)album
audioOnly:(BOOL)audioOnly
{
APLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)showStatusMessage:(NSString *)statusMessage
forPlaybackController:(VLCPlaybackController *)controller
{
APLog(@"%s", __PRETTY_FUNCTION__);
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9058" systemVersion="14F1017" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9058"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCFullscreenMovieTVViewController">
<connections>
<outlet property="movieView" destination="SpU-aa-czI" id="zKW-zZ-hB6"/>
<outlet property="view" destination="iN0-l3-epB" id="Eym-vH-oyN"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SpU-aa-czI">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="SpU-aa-czI" secondAttribute="bottom" id="J9T-OC-2Sd"/>
<constraint firstItem="SpU-aa-czI" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="SnQ-Wu-aiI"/>
<constraint firstItem="SpU-aa-czI" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="XAU-E6-19A"/>
<constraint firstAttribute="trailing" secondItem="SpU-aa-czI" secondAttribute="trailing" id="loH-43-lbw"/>
</constraints>
</view>
</objects>
</document>
......@@ -101,7 +101,7 @@
- (void)_openURLStringAndDismiss:(NSString *)url
{
[VLCPlayerDisplayController sharedInstance].displayMode = VLCPlayerDisplayControllerDisplayModeMiniplayer;
[VLCPlayerDisplayController sharedInstance].displayMode = VLCPlayerDisplayControllerDisplayModeFullscreen;
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc playURL:[NSURL URLWithString:url] subtitlesFilePath:nil];
......
......@@ -203,6 +203,8 @@
7DEC8BD81BD66DA8006E1093 /* VLCMiniPlaybackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D95610A1AF3E9E800779745 /* VLCMiniPlaybackView.m */; };
7DEC8BD91BD670EB006E1093 /* VLCPlaybackNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D9CB9DB1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m */; };
7DEC8BDA1BD67112006E1093 /* VLCFrostedGlasView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BADAF44185FBD9D00108BD8 /* VLCFrostedGlasView.m */; };
7DEC8BDE1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DEC8BDC1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m */; };
7DEC8BDF1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7DEC8BDD1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib */; };
7DF04F4D1961F2B8004A5429 /* web-download-fixed.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DF04F491961F2B8004A5429 /* web-download-fixed.png */; };
7DF04F4E1961F2B8004A5429 /* web-download.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DF04F4A1961F2B8004A5429 /* web-download.png */; };
7DF04F4F1961F2B8004A5429 /* web-open-fixed.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DF04F4B1961F2B8004A5429 /* web-open-fixed.png */; };
......@@ -707,6 +709,9 @@
7DE56C181AD93F9100E8CA00 /* VLCPlaybackController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCPlaybackController.h; path = Sources/VLCPlaybackController.h; sourceTree = SOURCE_ROOT; };
7DE56C191AD93F9100E8CA00 /* VLCPlaybackController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPlaybackController.m; path = Sources/VLCPlaybackController.m; sourceTree = SOURCE_ROOT; };
7DEB3B5F17647DE30038FC70 /* iTunesArtwork@2x */ = {isa = PBXFileReference; lastKnownFileType = file; path = "iTunesArtwork@2x"; sourceTree = "<group>"; };
7DEC8BDB1BD67899006E1093 /* VLCFullscreenMovieTVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCFullscreenMovieTVViewController.h; sourceTree = "<group>"; };
7DEC8BDC1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCFullscreenMovieTVViewController.m; sourceTree = "<group>"; };
7DEC8BDD1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VLCFullscreenMovieTVViewController.xib; sourceTree = "<group>"; };
7DF04F491961F2B8004A5429 /* web-download-fixed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "web-download-fixed.png"; path = "Resources/web-download-fixed.png"; sourceTree = SOURCE_ROOT; };
7DF04F4A1961F2B8004A5429 /* web-download.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "web-download.png"; path = "Resources/web-download.png"; sourceTree = SOURCE_ROOT; };
7DF04F4B1961F2B8004A5429 /* web-open-fixed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "web-open-fixed.png"; path = "Resources/web-open-fixed.png"; sourceTree = SOURCE_ROOT; };
......@@ -1107,6 +1112,8 @@
7DC71D241BC830A5001FACAA /* VLCLocalNetworkTVViewController.m */,
7D7EF3D71BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.h */,
7D7EF3D81BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.m */,
7DEC8BDB1BD67899006E1093 /* VLCFullscreenMovieTVViewController.h */,
7DEC8BDC1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m */,
7DC71D281BC83138001FACAA /* xibs */,
7D13294E1BA1F10100BE647E /* Assets.xcassets */,
7D1329501BA1F10100BE647E /* Info.plist */,
......@@ -1579,6 +1586,7 @@
7DC71D281BC83138001FACAA /* xibs */ = {
isa = PBXGroup;
children = (
7DEC8BDD1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib */,
7DC71D201BC83058001FACAA /* VLCAppSharesTVViewController.xib */,
7DC71D251BC830A5001FACAA /* VLCLocalNetworkTVViewController.xib */,
7D7EF3D91BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.xib */,
......@@ -2037,6 +2045,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7DEC8BDF1BD67899006E1093 /* VLCFullscreenMovieTVViewController.xib in Resources */,
7DC71D271BC830A5001FACAA /* VLCLocalNetworkTVViewController.xib in Resources */,
7DC71D221BC83058001FACAA /* VLCAppSharesTVViewController.xib in Resources */,
7D13294F1BA1F10100BE647E /* Assets.xcassets in Resources */,
......@@ -2188,6 +2197,7 @@
7DEC8BD81BD66DA8006E1093 /* VLCMiniPlaybackView.m in Sources */,
7D7EF3DA1BD56B5900CD4CEE /* VLCOpenNetworkStreamTVViewController.m in Sources */,
7D7EF3DD1BD5779F00CD4CEE /* VLCPlaybackController.m in Sources */,
7DEC8BDE1BD67899006E1093 /* VLCFullscreenMovieTVViewController.m in Sources */,
7DEC8BD71BD658E6006E1093 /* VLCPlayerDisplayController.m in Sources */,
7DC71D261BC830A5001FACAA /* VLCLocalNetworkTVViewController.m in Sources */,
7DEC8BD91BD670EB006E1093 /* VLCPlaybackNavigationController.m in Sources */,
......
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