浏览代码

360Video: moved currentMediaIs360 to playbackController

adjusted Bool properties from nonatomic to assign
turned interfacelock off for 360Videos
Carola Nitz 7 年之前
父节点
当前提交
e10b9f28c0
共有 3 个文件被更改,包括 26 次插入18 次删除
  1. 17 15
      Sources/VLCMovieViewController.m
  2. 4 3
      Sources/VLCPlaybackController.h
  3. 5 0
      Sources/VLCPlaybackController.m

+ 17 - 15
Sources/VLCMovieViewController.m

@@ -639,21 +639,23 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
 
 - (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
 {
-    if (!_closeGestureEnabled || isnan(recognizer.velocity))
-        return;
-
     CGFloat diff = DEFAULT_FOV * -(ZOOM_SENSITIVITY * recognizer.velocity / _screenSizePixel.width);
 
-    if ([_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular) {
-        if ([_vpc updateViewpoint:0 pitch:0 roll:0 fov:diff absolute:NO]) {
-            //Checking for fov value in case of
-            _fov = MAX(MIN(_fov + diff, MAX_FOV), MIN_FOV);
-        }
-    } else if (recognizer.velocity < 0.) {
+    if ([_vpc currentMediaIs360Video]) {
+        [self zoom360Video:diff];
+    } else if (recognizer.velocity < 0. && _closeGestureEnabled) {
         [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
 {
     if (touch.view != self.view)
@@ -843,7 +845,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
 
 - (void)setupForMediaProjection
 {
-    BOOL mediaHasProjection = [_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular;
+    BOOL mediaHasProjection = [_vpc currentMediaIs360Video];
     _fov = mediaHasProjection ? DEFAULT_FOV : 0.f;
 
     [_panRecognizer setEnabled:mediaHasProjection];
@@ -1333,14 +1335,14 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 
     // only check for seeking gesture if on iPad , will overwrite last statements if true
     if ([deviceType isEqualToString:@"iPad"] && location.y < 110) {
-            panType = VLCPanTypeSeek;
+        panType = VLCPanTypeSeek;
     }
 
-    if ([_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular) {
+    if ([_vpc currentMediaIs360Video]) {
         panType = VLCPanTypeProjection;
     }
 
-        return panType;
+    return panType;
 }
 
 - (void)panRecognized:(UIPanGestureRecognizer*)panRecognizer
@@ -1418,7 +1420,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
         _currentPanType = VLCPanTypeNone;
 
         //Invalidate saved location when the gesture is ended
-        if ([_vpc currentMediaProjection] == VLCMediaProjectionEquiRectangular)
+        if ([_vpc currentMediaIs360Video])
             _saveLocation = CGPointMake(-1.f, -1.f);
     }
 }
@@ -1587,7 +1589,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 
 - (BOOL)rotationIsDisabled
 {
-    return _interfaceIsLocked;
+    return _interfaceIsLocked || [_vpc currentMediaIs360Video];
 }
 
 - (BOOL)shouldAutorotate

+ 4 - 3
Sources/VLCPlaybackController.h

@@ -79,9 +79,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 @property (readonly) NSInteger numberOfVideoSubtitlesIndexes;
 @property (readonly) NSInteger numberOfTitles;
 @property (readonly) NSInteger numberOfChaptersForCurrentTitle;
-@property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom;
-@property (nonatomic, readwrite) BOOL fullscreenSessionRequested;
-@property (nonatomic, readonly) BOOL isSeekable;
+@property (assign, readonly) BOOL currentMediaHasTrackToChooseFrom;
+@property (assign, readwrite) BOOL fullscreenSessionRequested;
+@property (assign, readonly) BOOL isSeekable;
+@property (assign, readonly) BOOL currentMediaIs360Video;
 @property (readonly) NSNumber *playbackTime;
 @property (nonatomic, readonly) NSDictionary *mediaOptionsDictionary;
 @property (nonatomic, readonly) NSTimer* sleepTimer;

+ 5 - 0
Sources/VLCPlaybackController.m

@@ -970,6 +970,11 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
     return [_mediaPlayer updateViewpoint:yaw pitch:pitch roll:roll fov:fov absolute:absolute];
 }
 
+- (BOOL)currentMediaIs360Video
+{
+    return [self currentMediaProjection] == VLCMediaProjectionEquiRectangular;
+}
+
 - (NSInteger)currentMediaProjection
 {
     VLCMedia *media = [_mediaPlayer media];