Browse Source

360 video: adjust values when they get out of bounds

Carola Nitz 7 years ago
parent
commit
7712970fa3
1 changed files with 10 additions and 1 deletions
  1. 10 1
      Sources/VLCPlaybackController.m

+ 10 - 1
Sources/VLCPlaybackController.m

@@ -967,7 +967,16 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
 #if !TARGET_OS_TV
 - (BOOL)updateViewpoint:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll fov:(CGFloat)fov absolute:(BOOL)absolute
 {
-    NSLog(@"update with yaw:%f pitch:%f roll:%f, fov:%f", yaw, pitch, roll, fov);
+    //adjusting the values
+    if (fabs(yaw) > 180) {
+        yaw = yaw > 0 ? yaw - 360 : yaw + 360;
+    }
+    if (fabs(roll) > 180) {
+        roll = roll > 0 ? roll - 360 : roll + 360;
+    }
+    if (fabs(pitch) > 90) {
+        pitch = pitch > 0 ? pitch - 180 : pitch + 180;
+    }
     return [_mediaPlayer updateViewpoint:yaw pitch:pitch roll:roll fov:fov absolute:absolute];
 }