Skip to content

Commit

Permalink
Improve flip camera animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Comanga committed Apr 17, 2019
1 parent d30fff3 commit 7a8357d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "onevcat/Kingfisher" "b5abf719d7e7428895542ebd5f0faa115b41a262"
github "voxeet/voxeet-ios-sdk" "1.3.6"
github "voxeet/voxeet-ios-sdk" "1.3.7"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions Sample/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion VoxeetConferenceKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.8</string>
<string>1.1.9</string>
<key>CFBundleVersion</key>
<string>0</string>
<key>NSPrincipalClass</key>
Expand Down
31 changes: 17 additions & 14 deletions VoxeetConferenceKit/VCKViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
}
}
Expand Down

0 comments on commit 7a8357d

Please sign in to comment.