From 7a8357d52efa01769cb7200b16ddbc236542f8e7 Mon Sep 17 00:00:00 2001 From: Corentin Larroque Date: Wed, 17 Apr 2019 15:53:51 +0200 Subject: [PATCH] Improve flip camera animation. --- Cartfile.resolved | 2 +- README.md | 6 ++-- Sample/Cartfile.resolved | 4 +-- VoxeetConferenceKit/Info.plist | 2 +- VoxeetConferenceKit/VCKViewController.swift | 31 +++++++++++---------- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index b2bb80e..dde2022 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ github "onevcat/Kingfisher" "b5abf719d7e7428895542ebd5f0faa115b41a262" -github "voxeet/voxeet-ios-sdk" "1.3.6" +github "voxeet/voxeet-ios-sdk" "1.3.7" diff --git a/README.md b/README.md index 159d630..9f62526 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ * **Operating systems:** iOS 9.0 and later versions -* **IDE:** [Xcode 10.0+](https://developer.apple.com/xcode/) -* **Languages:** Swift 4.2+, Objective-C, [React Native](https://github.com/voxeet/react-native-voxeet-conferencekit), [Cordova](https://github.com/voxeet/voxeet-cordova-conferencekit) +* **IDE:** [Xcode 10.2+](https://developer.apple.com/xcode/) +* **Languages:** Swift 5+, Objective-C, [React Native](https://github.com/voxeet/react-native-voxeet-conferencekit), [Cordova](https://github.com/voxeet/voxeet-cordova-conferencekit) * **Supported architectures:** armv7, arm64, i386, x86_64 ## Sample application @@ -235,6 +235,6 @@ The Voxeet iOS SDK and ConferenceKit rely on these open source projects: ## SDK version -1.1.7 +1.1.9 © Voxeet, 2019 diff --git a/Sample/Cartfile.resolved b/Sample/Cartfile.resolved index 8343037..ca87253 100644 --- a/Sample/Cartfile.resolved +++ b/Sample/Cartfile.resolved @@ -1,3 +1,3 @@ github "onevcat/Kingfisher" "b5abf719d7e7428895542ebd5f0faa115b41a262" -github "voxeet/voxeet-ios-conferencekit" "1.1.8" -github "voxeet/voxeet-ios-sdk" "1.3.6" +github "voxeet/voxeet-ios-conferencekit" "1.1.9" +github "voxeet/voxeet-ios-sdk" "1.3.7" diff --git a/VoxeetConferenceKit/Info.plist b/VoxeetConferenceKit/Info.plist index 86a355b..7c48465 100644 --- a/VoxeetConferenceKit/Info.plist +++ b/VoxeetConferenceKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.1.8 + 1.1.9 CFBundleVersion 0 NSPrincipalClass diff --git a/VoxeetConferenceKit/VCKViewController.swift b/VoxeetConferenceKit/VCKViewController.swift index 525407f..48cbcd7 100644 --- a/VoxeetConferenceKit/VCKViewController.swift +++ b/VoxeetConferenceKit/VCKViewController.swift @@ -393,23 +393,26 @@ class VCKViewController: UIViewController { */ @objc private func flipCamera(recognizer: UITapGestureRecognizer) { - VoxeetSDK.shared.conference.flipCamera() - + let mirrorEffectTransformation = self.ownVideoRenderer.layer.transform.m11 * -1 flipImage.isHidden = true ownVideoRenderer.isUserInteractionEnabled = false - - // Apply a mirror effect to the own video renderer. - DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.38) { - let mirrorEffectTransformation = self.ownVideoRenderer.layer.transform.m11 * -1 - UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseIn, animations: { - self.ownVideoRenderer.transform = CGAffineTransform(scaleX: 1.2 * mirrorEffectTransformation, y: 1.2) + UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseIn, animations: { + self.ownVideoRenderer.transform = CGAffineTransform(scaleX: 1.2 * mirrorEffectTransformation, y: 1.2) + }) { _ in + UIView.animate(withDuration: 0.10, delay: 0, options: .curveEaseOut, animations: { + self.ownVideoRenderer.transform = CGAffineTransform(scaleX: 1 * mirrorEffectTransformation, y: 1) }) { _ in - UIView.animate(withDuration: 0.10, delay: 0, options: .curveEaseOut, animations: { - self.ownVideoRenderer.transform = CGAffineTransform(scaleX: 1 * mirrorEffectTransformation, y: 1) - }) { _ in - self.flipImage.isHidden = false - self.ownVideoRenderer.isUserInteractionEnabled = true - } + self.flipImage.isHidden = false + self.ownVideoRenderer.isUserInteractionEnabled = true + } + } + + ownVideoRenderer.subviews.first?.alpha = 0 + VoxeetSDK.shared.conference.flipCamera { + DispatchQueue.main.async { + UIView.animate(withDuration: 0.10, animations: { + self.ownVideoRenderer.subviews.first?.alpha = 1 + }) } } }