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

playback: add lock button, which locks controls and rotation (close #11292, #11293)

parent 7b4bdf31
......@@ -28,6 +28,7 @@
<outlet property="gammaSlider" destination="151" id="169"/>
<outlet property="hueLabel" destination="143" id="158"/>
<outlet property="hueSlider" destination="144" id="157"/>
<outlet property="lockButton" destination="o2q-eo-cnU" id="08s-Qv-duE"/>
<outlet property="movieView" destination="121" id="122"/>
<outlet property="playPauseButton" destination="275" id="282"/>
<outlet property="playbackSpeedButton" destination="278" id="295"/>
......@@ -426,6 +427,17 @@
<action selector="toggleRepeatMode:" destination="-1" eventType="touchUpInside" id="UWl-MQ-MX7"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="o2q-eo-cnU">
<rect key="frame" x="552" y="5" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="L"/>
<connections>
<action selector="lock:" destination="-1" eventType="touchUpInside" id="QFm-Re-ySf"/>
</connections>
</button>
</subviews>
</view>
<view contentMode="scaleToFill" id="141" userLabel="Controls panel" customClass="VLCFrostedGlasView">
......
......@@ -31,6 +31,8 @@
<outlet property="gammaSlider" destination="137" id="144"/>
<outlet property="hueLabel" destination="134" id="234"/>
<outlet property="hueSlider" destination="133" id="235"/>
<outlet property="lockButton" destination="HmC-O6-R9e" id="e99-JZ-gn6"/>
<outlet property="lockButtonLandscape" destination="5Ty-RA-fET" id="UGg-xw-ppA"/>
<outlet property="movieView" destination="91" id="93"/>
<outlet property="playPauseButton" destination="76" id="101"/>
<outlet property="playPauseButtonLandscape" destination="nxS-aA-O6g" id="x1z-P6-yif"/>
......@@ -459,6 +461,17 @@
<action selector="toggleRepeatMode:" destination="-1" eventType="touchUpInside" id="Xza-fk-7Go"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="HmC-O6-R9e">
<rect key="frame" x="237" y="14" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="L"/>
<connections>
<action selector="lock:" destination="-1" eventType="touchUpInside" id="yaI-PP-7Md"/>
</connections>
</button>
</subviews>
</view>
<navigationBar contentMode="scaleToFill" barStyle="blackTranslucent" id="250">
......@@ -666,6 +679,17 @@
<action selector="switchTrack:" destination="-1" eventType="touchUpInside" id="M3v-tx-1MI"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5Ty-RA-fET">
<rect key="frame" x="398" y="6" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="L"/>
<connections>
<action selector="lock:" destination="-1" eventType="touchUpInside" id="58H-Ih-9tk"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
......
......@@ -22,6 +22,7 @@
#import "VLCPlaylistViewController.h"
#import "VLCMovieViewController.h"
#import "VLCPlaybackNavigationController.h"
#import "PAPasscodeViewController.h"
#import "UINavigationController+Theme.h"
#import "VLCHTTPUploaderController.h"
......@@ -454,7 +455,7 @@
_movieViewController.fileFromMediaLibrary = [(MLShowEpisode*)mediaObject files].anyObject;
[(MLFile *)_movieViewController.fileFromMediaLibrary setUnread:@(NO)];
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:_movieViewController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
}
......@@ -468,7 +469,7 @@
_movieViewController.url = url;
_movieViewController.successCallback = successCallback;
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:_movieViewController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
}
......@@ -487,7 +488,7 @@
_movieViewController.itemInMediaListToBePlayedFirst = index;
_movieViewController.pathToExternalSubtitlesFile = nil;
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:_movieViewController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
}
......@@ -500,7 +501,7 @@
_movieViewController.url = url;
_movieViewController.pathToExternalSubtitlesFile = SubtitlePath;
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:_movieViewController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
}
......
......@@ -35,6 +35,8 @@
@property (nonatomic, strong) IBOutlet UIButton *trackSwitcherButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *repeatButton;
@property (nonatomic, strong) IBOutlet UIButton *repeatButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *lockButton;
@property (nonatomic, strong) IBOutlet UIButton *lockButtonLandscape;
@property (nonatomic, strong) IBOutlet UINavigationBar *toolbar;
@property (nonatomic, strong) IBOutlet VLCFrostedGlasView *controllerPanel;
@property (nonatomic, strong) IBOutlet VLCFrostedGlasView *controllerPanelLandscape;
......@@ -104,6 +106,7 @@
- (IBAction)forward:(id)sender;
- (IBAction)toggleRepeatMode:(id)sender;
- (IBAction)switchTrack:(id)sender;
- (IBAction)lock:(id)sender;
- (IBAction)videoFilterToggle:(id)sender;
- (IBAction)videoFilterSliderAction:(id)sender;
......@@ -111,4 +114,6 @@
- (IBAction)playbackSliderAction:(id)sender;
- (IBAction)videoDimensionAction:(id)sender;
- (BOOL)rotationIsDisabled;
@end
......@@ -35,6 +35,10 @@
#define TRACK_SELECTOR_TABLEVIEW_CELL @"track selector table view cell"
#define TRACK_SELECTOR_TABLEVIEW_SECTIONHEADER @"track selector table view section header"
#define LOCKCHECK \
if (_interfaceIsLocked) \
return
@interface VLCMovieViewController () <UIGestureRecognizerDelegate, AVAudioSessionDelegate, VLCMediaDelegate, UITableViewDataSource, UITableViewDelegate>
{
VLCMediaListPlayer *_listPlayer;
......@@ -59,6 +63,7 @@
BOOL _positionSet;
BOOL _playerIsSetup;
BOOL _isScrubbing;
BOOL _interfaceIsLocked;
BOOL _swipeGesturesEnabled;
UIPinchGestureRecognizer *_pinchRecognizer;
......@@ -822,6 +827,8 @@
- (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
return;
......@@ -937,6 +944,8 @@
- (IBAction)closePlayback:(id)sender
{
LOCKCHECK;
[self setControlsHidden:NO animated:NO];
[self.navigationController dismissViewControllerAnimated:YES completion:^{
// switch back to the caller when user presses "Done"
......@@ -948,6 +957,8 @@
- (IBAction)positionSliderAction:(UISlider *)sender
{
LOCKCHECK;
/* we need to limit the number of events sent by the slider, since otherwise, the user
* wouldn't see the I-frames when seeking on current mobile devices. This isn't a problem
* within the Simulator, but especially on older ARMv7 devices, it's clearly noticeable. */
......@@ -969,6 +980,8 @@
- (IBAction)positionSliderTouchDown:(id)sender
{
LOCKCHECK;
[self _updateScrubLabel];
self.scrubIndicatorView.hidden = NO;
_isScrubbing = YES;
......@@ -976,6 +989,8 @@
- (IBAction)positionSliderTouchUp:(id)sender
{
LOCKCHECK;
self.scrubIndicatorView.hidden = YES;
_isScrubbing = NO;
}
......@@ -997,11 +1012,15 @@
- (IBAction)positionSliderDrag:(id)sender
{
LOCKCHECK;
[self _updateScrubLabel];
}
- (IBAction)volumeSliderAction:(id)sender
{
LOCKCHECK;
[self _resetIdleTimer];
}
......@@ -1057,6 +1076,8 @@
- (IBAction)playPause
{
LOCKCHECK;
if ([_mediaPlayer isPlaying])
[_listPlayer pause];
else
......@@ -1065,6 +1086,8 @@
- (IBAction)forward:(id)sender
{
LOCKCHECK;
if (self.mediaList)
[_listPlayer next];
else
......@@ -1073,6 +1096,8 @@
- (IBAction)backward:(id)sender
{
LOCKCHECK;
if (self.mediaList)
[_listPlayer previous];
else
......@@ -1094,6 +1119,8 @@
- (IBAction)switchTrack:(id)sender
{
LOCKCHECK;
[_trackSelectorTableView reloadData];
_trackSelectorContainer.hidden = NO;
......@@ -1112,11 +1139,18 @@
- (IBAction)toggleTimeDisplay:(id)sender
{
LOCKCHECK;
_displayRemainingTime = !_displayRemainingTime;
[self _resetIdleTimer];
}
- (IBAction)lock:(id)sender
{
_interfaceIsLocked = !_interfaceIsLocked;
}
#pragma mark - track selector table view
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
......@@ -1224,6 +1258,8 @@
- (void)tapRecognized
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
return;
......@@ -1268,6 +1304,8 @@
- (void)panRecognized:(UIPanGestureRecognizer*)panRecognizer
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
return;
......@@ -1324,6 +1362,8 @@
- (void)swipeRecognized:(UISwipeGestureRecognizer*)swipeRecognizer
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
return;
......@@ -1358,6 +1398,8 @@
- (IBAction)videoFilterToggle:(id)sender
{
LOCKCHECK;
if (!_playbackSpeedViewHidden)
self.playbackSpeedView.hidden = _playbackSpeedViewHidden = YES;
......@@ -1402,6 +1444,8 @@
#pragma mark - playback view
- (IBAction)playbackSliderAction:(UISlider *)sender
{
LOCKCHECK;
if (sender == _playbackSpeedSlider) {
double speed = pow(2, sender.value / 17.);
float rate = INPUT_RATE_DEFAULT / speed;
......@@ -1448,6 +1492,8 @@
- (IBAction)videoDimensionAction:(id)sender
{
LOCKCHECK;
if (sender == self.playbackSpeedButton || sender == self.playbackSpeedButtonLandscape) {
if (!_videoFiltersHidden)
self.videoFilterView.hidden = _videoFiltersHidden = YES;
......@@ -1663,6 +1709,11 @@
#pragma mark - autorotation
- (BOOL)rotationIsDisabled
{
return _interfaceIsLocked;
}
- (BOOL)shouldAutorotate
{
UIInterfaceOrientation toInterfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
......
/*****************************************************************************
* VLCPlaybackNavigationController.h
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
@interface VLCPlaybackNavigationController : UINavigationController
@end
/*****************************************************************************
* VLCPlaybackNavigationController.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 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 "VLCPlaybackNavigationController.h"
#import "VLCMovieViewController.h"
@interface VLCPlaybackNavigationController ()
@end
@implementation VLCPlaybackNavigationController
- (NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
- (BOOL)shouldAutorotate
{
id topVC = self.topViewController;
if ([topVC isKindOfClass:[VLCMovieViewController class]])
return ![(VLCMovieViewController *)topVC rotationIsDisabled];
return YES;
}
@end
......@@ -326,6 +326,7 @@
7D9870671A3E03D5009CF27D /* papasscode_failed_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D9870611A3E03D5009CF27D /* papasscode_failed_bg@2x.png */; };
7D9870681A3E03D5009CF27D /* papasscode_marker.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D9870621A3E03D5009CF27D /* papasscode_marker.png */; };
7D9870691A3E03D5009CF27D /* papasscode_marker@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D9870631A3E03D5009CF27D /* papasscode_marker@2x.png */; };
7D9CB9DC1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D9CB9DB1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m */; };
7DA7C905186324FA00B56120 /* serverIcon@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DA7C902186324FA00B56120 /* serverIcon@1x.png */; };
7DA7C906186324FA00B56120 /* serverIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DA7C903186324FA00B56120 /* serverIcon@2x.png */; };
7DA7C907186324FA00B56120 /* serverIcon@4x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DA7C904186324FA00B56120 /* serverIcon@4x.png */; };
......@@ -1049,6 +1050,8 @@
7D9B6B0A17C9626000F9425D /* sl */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = sl; path = "sl.lproj/badgeUnread@2x~iphone.png"; sourceTree = "<group>"; };
7D9B6B0B17C9626000F9425D /* sl */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = sl; path = "sl.lproj/badgeUnread~ipad.png"; sourceTree = "<group>"; };
7D9B6B0C17C9626000F9425D /* sl */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = sl; path = "sl.lproj/badgeUnread~iphone.png"; sourceTree = "<group>"; };
7D9CB9DA1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCPlaybackNavigationController.h; path = Sources/VLCPlaybackNavigationController.h; sourceTree = SOURCE_ROOT; };
7D9CB9DB1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPlaybackNavigationController.m; path = Sources/VLCPlaybackNavigationController.m; sourceTree = SOURCE_ROOT; };
7DA7C902186324FA00B56120 /* serverIcon@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "serverIcon@1x.png"; sourceTree = "<group>"; };
7DA7C903186324FA00B56120 /* serverIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "serverIcon@2x.png"; sourceTree = "<group>"; };
7DA7C904186324FA00B56120 /* serverIcon@4x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "serverIcon@4x.png"; sourceTree = "<group>"; };
......@@ -1733,6 +1736,8 @@
7D3784BD183A9938009EE944 /* VLCStatusLabel.m */,
7D50903018F41C7900180139 /* VLCAlertView.h */,
7D50903118F41C7900180139 /* VLCAlertView.m */,
7D9CB9DA1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.h */,
7D9CB9DB1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m */,
);
name = "UI Elements";
sourceTree = "<group>";
......@@ -3128,6 +3133,7 @@
4171D35018A2C19000A16EF9 /* VLCFolderCollectionViewFlowLayout.m in Sources */,
7D30F3CA183AB27A00FFC021 /* VLCDownloadViewController.m in Sources */,
7D30F3CD183AB29300FFC021 /* VLCMenuTableViewController.m in Sources */,
7D9CB9DC1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m in Sources */,
7D30F3D0183AB2AC00FFC021 /* VLCMediaFileDiscoverer.m in Sources */,
493B1A1D195D06B1000A491A /* BasicUPnPDevice+VLC.m in Sources */,
265D511D1922746C00E38383 /* VLCPlexParser.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