Commit 4a38e44d authored by Carola Nitz's avatar Carola Nitz

360Video: moved currentMediaIs360 to playbackController

adjusted Bool properties from nonatomic to assign
turned interfacelock off for 360Videos

(cherry picked from commit e10b9f28)
parent 9563d3af
...@@ -643,21 +643,23 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -643,21 +643,23 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
- (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer - (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
{ {
if (!_closeGestureEnabled || isnan(recognizer.velocity))
return;
CGFloat diff = DEFAULT_FOV * -(ZOOM_SENSITIVITY * recognizer.velocity / _screenSizePixel.width); CGFloat diff = DEFAULT_FOV * -(ZOOM_SENSITIVITY * recognizer.velocity / _screenSizePixel.width);
if ([_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular) { if ([_vpc currentMediaIs360Video]) {
if ([_vpc updateViewpoint:0 pitch:0 roll:0 fov:diff absolute:NO]) { [self zoom360Video:diff];
//Checking for fov value in case of } else if (recognizer.velocity < 0. && _closeGestureEnabled) {
_fov = MAX(MIN(_fov + diff, MAX_FOV), MIN_FOV);
}
} else if (recognizer.velocity < 0.) {
[self minimizePlayback:nil]; [self minimizePlayback:nil];
} }
} }
- (void)zoom360Video:(CGFloat)zoom
{
if ([_vpc updateViewpoint:0 pitch:0 roll:0 fov:zoom absolute:NO]) {
//Checking for fov value in case of
_fov = MAX(MIN(_fov + zoom, MAX_FOV), MIN_FOV);
}
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{ {
if (touch.view != self.view) if (touch.view != self.view)
...@@ -847,7 +849,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -847,7 +849,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
- (void)setupForMediaProjection - (void)setupForMediaProjection
{ {
BOOL mediaHasProjection = [_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular; BOOL mediaHasProjection = [_vpc currentMediaIs360Video];
_fov = mediaHasProjection ? DEFAULT_FOV : 0.f; _fov = mediaHasProjection ? DEFAULT_FOV : 0.f;
[_panRecognizer setEnabled:mediaHasProjection]; [_panRecognizer setEnabled:mediaHasProjection];
...@@ -1340,7 +1342,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1340,7 +1342,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
panType = VLCPanTypeSeek; panType = VLCPanTypeSeek;
} }
if ([_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular) { if ([_vpc currentMediaIs360Video]) {
panType = VLCPanTypeProjection; panType = VLCPanTypeProjection;
} }
...@@ -1422,7 +1424,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1422,7 +1424,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
_currentPanType = VLCPanTypeNone; _currentPanType = VLCPanTypeNone;
//Invalidate saved location when the gesture is ended //Invalidate saved location when the gesture is ended
if ([_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular) if ([_vpc currentMediaIs360Video])
_saveLocation = CGPointMake(-1.f, -1.f); _saveLocation = CGPointMake(-1.f, -1.f);
} }
} }
...@@ -1592,7 +1594,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1592,7 +1594,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (BOOL)rotationIsDisabled - (BOOL)rotationIsDisabled
{ {
return _interfaceIsLocked; return _interfaceIsLocked || [_vpc currentMediaIs360Video];
} }
- (BOOL)shouldAutorotate - (BOOL)shouldAutorotate
......
...@@ -80,9 +80,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -80,9 +80,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@property (readonly) NSInteger numberOfVideoSubtitlesIndexes; @property (readonly) NSInteger numberOfVideoSubtitlesIndexes;
@property (readonly) NSInteger numberOfTitles; @property (readonly) NSInteger numberOfTitles;
@property (readonly) NSInteger numberOfChaptersForCurrentTitle; @property (readonly) NSInteger numberOfChaptersForCurrentTitle;
@property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom; @property (assign, readonly) BOOL currentMediaHasTrackToChooseFrom;
@property (nonatomic, readwrite) BOOL fullscreenSessionRequested; @property (assign, readwrite) BOOL fullscreenSessionRequested;
@property (nonatomic, readonly) BOOL isSeekable; @property (assign, readonly) BOOL isSeekable;
@property (assign, readonly) BOOL currentMediaIs360Video;
@property (readonly) NSNumber *playbackTime; @property (readonly) NSNumber *playbackTime;
@property (nonatomic, readonly) NSDictionary *mediaOptionsDictionary; @property (nonatomic, readonly) NSDictionary *mediaOptionsDictionary;
@property (nonatomic, readonly) NSTimer* sleepTimer; @property (nonatomic, readonly) NSTimer* sleepTimer;
......
...@@ -968,6 +968,11 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -968,6 +968,11 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
return [_mediaPlayer updateViewpoint:yaw pitch:pitch roll:roll fov:fov absolute:absolute]; return [_mediaPlayer updateViewpoint:yaw pitch:pitch roll:roll fov:fov absolute:absolute];
} }
- (BOOL)currentMediaIs360Video
{
return [self currentMediaProjection] == VLCMediaProjectionEquiRectangular;
}
- (NSInteger)currentMediaProjection - (NSInteger)currentMediaProjection
{ {
VLCMedia *media = [_mediaPlayer media]; VLCMedia *media = [_mediaPlayer media];
......
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