BothSidesCamera
要求
- iPhoneX, Xs, XR, XsMax, Pro
- iOS 13.2+
- Xcode 11.3
版本1.1.1 ~ 支持所有屏幕位置。
版本0.8.9 ~ 预览屏幕和播放屏幕完美匹配。
版本0.8 ~ 预览屏幕具有相同比例和录制功能。
Purple button logic Horizontal support
版本 0.7 ~ 同比例预览屏和录制功能
版本 0.6 ~ 具备截图功能。您可以使用左键拍摄图片,甚至在录像时(非录制状态下)也可以。
Gray button screenshot
White Button is a record button
Blue Button switches camera
Yellow Button is lighting.
功能
您可以在相机内外同时拍摄。两种屏幕比例均可调整。使用iPhonePro时,内存使用量约为260MB~,使用停止方法时,内存使用量约为80MB。
代码
水平旋转运动
class SceneDelegate
func windowScene(_ windowScene: UIWindowScene, didUpdate previousCoordinateSpace: UICoordinateSpace, interfaceOrientation previousInterfaceOrientation: UIInterfaceOrientation, traitCollection previousTraitCollection: UITraitCollection) {
model.orientation = windowScene.interfaceOrientation
contentView.bView.orientation(model: model)
}
struct ContentView
@EnvironmentObject var model: OrientationModel
final class OrientationModel
@Published var orientation: UIInterfaceOrientation = .unknown
// Generation
import BothSidesCamera
@ObservedObject private var observer = KeyboardResponder()
// Start and stop recording
previewView?.cameraStart(completion: saveBtn)
// This is call
func saveBtn() { print("movie save") }
// All stop
previewView.cameraStop()
// Resize
previewView.preViewSizeSet()
// Switch camera Please check the in-camera as the camera type is different.
previewView.changeDviceType(backDeviceType: .builtInUltraWideCamera, frontDeviceType:.builtInUltraWideCamera)
// Method to match the preview screen and playback screen
previewView.deviceAspect(rect: bView.backCameraVideoPreviewView.frame)
如何
pinchGesture →Scale
2 continuous taps →Preview screen switching
Trace the preview screen →Move preview screen
安装
BothSidesCamera 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'BothSidesCamera'
Charthage
正式支持:Carthage 0.34 及以上版本。
将其添加到 Cartfile
github "daisukenagata/BothSidesCamera"
终端命令
$ carthage update --platform iOS
作者
daisukenagata, [email protected]
许可
BothSidesCamera 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。