diff --git a/NYT360Video.podspec b/NYT360Video.podspec index f71525a..5177834 100644 --- a/NYT360Video.podspec +++ b/NYT360Video.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'NYT360Video' - s.version = '1.1.0' + s.version = '1.1.1' s.summary = 'NYT360Video plays 360ยบ video streamed from an AVPlayer.' s.description = <<-DESC diff --git a/README.md b/README.md index be6f496..66ec1c1 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ You may want to restrict the gesture-based interactions with `NYT360ViewControll First, [`NYT360ViewController` provides properties](https://github.com/NYTimes/ios-360-videos/blob/68c522d51d6c88ddd705e4febbb480de825cdc5d/Sources/NYT360ViewController.h#L111) to configure which axes of movement are allowed. (This would be the simplest way to solve the example problem set out above.) -The library exposes its pan gesture recognizer as a property on `NYT360ViewController` for more advanced ingegration with other gesture recognizers. And finally, the type `NYT360CameraPanGestureRecognizer` is introduced so that host applications can more easily configure interaction with other gesture recognizers, without having to refer to specific instances of an NYT360Video gesture recognizer. +The library exposes its pan gesture recognizer as a property on `NYT360ViewController` for more advanced integration with other gesture recognizers. And finally, the type `NYT360CameraPanGestureRecognizer` is introduced so that host applications can more easily configure interaction with other gesture recognizers, without having to refer to specific instances of an NYT360Video gesture recognizer. ## Requirements diff --git a/Sources/Info.plist b/Sources/Info.plist index 09bc972..c6f194e 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.1.0 + 1.1.1 CFBundleSignature ???? CFBundleVersion diff --git a/Sources/NYT360CameraController.m b/Sources/NYT360CameraController.m index 14bf38b..a76920b 100644 --- a/Sources/NYT360CameraController.m +++ b/Sources/NYT360CameraController.m @@ -82,7 +82,7 @@ - (void)stopMotionUpdates { #pragma mark - Compass Angle - (float)compassAngle { - return NYT360CompassAngleForEulerAngles(self.pointOfView.eulerAngles, NYT360EulerAngleCalculationDefaultReferenceCompassAngle); + return NYT360CompassAngleForEulerAngles(self.pointOfView.eulerAngles); } #pragma mark - Camera Control diff --git a/Sources/NYT360EulerAngleCalculations.h b/Sources/NYT360EulerAngleCalculations.h index d55d1aa..32edd0f 100644 --- a/Sources/NYT360EulerAngleCalculations.h +++ b/Sources/NYT360EulerAngleCalculations.h @@ -48,4 +48,4 @@ CGFloat NYT360OptimalYFovForViewSize(CGSize viewSize); * * Input values in excess of one rotation will be mapped to an equivalent value within the range of plus or minus one radian, such that output values will exceed one rotation. Input values equal (or very very close to equal) to a multiple of one radian (positive or negative) will be mapped to 0. */ -float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles, float referenceAngle); +float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles); diff --git a/Sources/NYT360EulerAngleCalculations.m b/Sources/NYT360EulerAngleCalculations.m index 24634c4..768217d 100644 --- a/Sources/NYT360EulerAngleCalculations.m +++ b/Sources/NYT360EulerAngleCalculations.m @@ -11,7 +11,7 @@ #pragma mark - Constants CGFloat const NYT360EulerAngleCalculationNoiseThresholdDefault = 0.12; -float const NYT360EulerAngleCalculationDefaultReferenceCompassAngle = 0; +float const NYT360EulerAngleCalculationDefaultReferenceCompassAngle = 3.14; #pragma mark - Inline Functions @@ -155,6 +155,6 @@ CGFloat NYT360OptimalYFovForViewSize(CGSize viewSize) { return yFov; } -float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles, float referenceAngle) { - return NYT360UnitRotationForCameraRotation((-1.0 * eulerAngles.y) + referenceAngle); +float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles) { + return NYT360UnitRotationForCameraRotation((-1.0 * eulerAngles.y) + NYT360EulerAngleCalculationDefaultReferenceCompassAngle); } diff --git a/Sources/NYT360PlayerScene.m b/Sources/NYT360PlayerScene.m index b0ea7dd..26ed186 100644 --- a/Sources/NYT360PlayerScene.m +++ b/Sources/NYT360PlayerScene.m @@ -87,7 +87,9 @@ - (instancetype)initWithAVPlayer:(AVPlayer *)player boundToView:(SCNView *)view [self.rootNode addChildNode:_cameraNode]; SKScene *skScene = ({ - SKScene *scene = [[SKScene alloc] initWithSize:CGSizeMake(1280, 1280)]; + AVAssetTrack *assetTrack = [[player.currentItem.asset tracksWithMediaType:AVMediaTypeVideo] firstObject]; + CGSize assetDimensions = assetTrack ? CGSizeApplyAffineTransform(assetTrack.naturalSize, assetTrack.preferredTransform) : CGSizeMake(1280, 1280); + SKScene *scene = [[SKScene alloc] initWithSize:CGSizeMake(fabsf(assetDimensions.width), fabsf(assetDimensions.height))]; scene.shouldRasterize = YES; scene.scaleMode = SKSceneScaleModeAspectFit; _videoNode = ({ diff --git a/Sources/NYT360ViewController.m b/Sources/NYT360ViewController.m index ab02bb9..2881018 100644 --- a/Sources/NYT360ViewController.m +++ b/Sources/NYT360ViewController.m @@ -78,6 +78,10 @@ - (instancetype)initWithAVPlayer:(AVPlayer *)player motionManager:(id