1.确定 APP 包名
2.录制结束增加弹窗提示 3.完成读取剪切板内容、新增粘贴剪切板内容
This commit is contained in:
@@ -4,7 +4,7 @@ import UIKit
|
||||
final class PlatformInfoPlugin: NSObject, FlutterPlugin {
|
||||
static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(
|
||||
name: "com.gdfw.fxjk/platform_info",
|
||||
name: "com.qxy.dronex/platform_info",
|
||||
binaryMessenger: registrar.messenger()
|
||||
)
|
||||
let plugin = PlatformInfoPlugin()
|
||||
|
||||
@@ -142,7 +142,8 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
||||
|
||||
func initializePreview(result: @escaping FlutterResult) {
|
||||
guard let previewView else {
|
||||
result(FlutterError(code: "NO_PREVIEW", message: "Camera preview is not attached", details: nil))
|
||||
result(
|
||||
FlutterError(code: "NO_PREVIEW", message: "Camera preview is not attached", details: nil))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -176,7 +177,8 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
||||
|
||||
func startRecording(withAudio: Bool, displayName: String?, result: @escaping FlutterResult) {
|
||||
guard previewView != nil else {
|
||||
result(FlutterError(code: "NO_PREVIEW", message: "Camera preview is not attached", details: nil))
|
||||
result(
|
||||
FlutterError(code: "NO_PREVIEW", message: "Camera preview is not attached", details: nil))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -306,7 +308,9 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
||||
if let error {
|
||||
latestGallerySaved = false
|
||||
latestGalleryErrorMessage = error.localizedDescription
|
||||
updateStatus(RecordingStatus(state: .error, outputPath: latestOutputPath, message: error.localizedDescription))
|
||||
updateStatus(
|
||||
RecordingStatus(
|
||||
state: .error, outputPath: latestOutputPath, message: error.localizedDescription))
|
||||
finishStopRecording(stopResult: stopResult)
|
||||
return
|
||||
}
|
||||
@@ -411,10 +415,14 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
||||
return
|
||||
}
|
||||
|
||||
guard let videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)
|
||||
?? AVCaptureDevice.default(for: .video)
|
||||
guard
|
||||
let videoDevice = AVCaptureDevice.default(
|
||||
.builtInWideAngleCamera, for: .video, position: .back)
|
||||
?? AVCaptureDevice.default(for: .video)
|
||||
else {
|
||||
throw NSError(domain: "RecordingCamera", code: 1, userInfo: [NSLocalizedDescriptionKey: "No camera device available"])
|
||||
throw NSError(
|
||||
domain: "RecordingCamera", code: 1,
|
||||
userInfo: [NSLocalizedDescriptionKey: "No camera device available"])
|
||||
}
|
||||
|
||||
let nextVideoInput = try AVCaptureDeviceInput(device: videoDevice)
|
||||
@@ -424,14 +432,18 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
||||
|
||||
guard session.canAddInput(nextVideoInput) else {
|
||||
session.commitConfiguration()
|
||||
throw NSError(domain: "RecordingCamera", code: 2, userInfo: [NSLocalizedDescriptionKey: "Cannot add camera input"])
|
||||
throw NSError(
|
||||
domain: "RecordingCamera", code: 2,
|
||||
userInfo: [NSLocalizedDescriptionKey: "Cannot add camera input"])
|
||||
}
|
||||
session.addInput(nextVideoInput)
|
||||
videoInput = nextVideoInput
|
||||
|
||||
guard session.canAddOutput(movieOutput) else {
|
||||
session.commitConfiguration()
|
||||
throw NSError(domain: "RecordingCamera", code: 3, userInfo: [NSLocalizedDescriptionKey: "Cannot add movie output"])
|
||||
throw NSError(
|
||||
domain: "RecordingCamera", code: 3,
|
||||
userInfo: [NSLocalizedDescriptionKey: "Cannot add movie output"])
|
||||
}
|
||||
session.addOutput(movieOutput)
|
||||
session.commitConfiguration()
|
||||
@@ -516,7 +528,7 @@ private final class RecordingCameraController: NSObject, AVCaptureFileOutputReco
|
||||
}
|
||||
|
||||
private enum RecordingChannelNames {
|
||||
static let packageName = "com.gdfw.fxjk"
|
||||
static let packageName = "com.qxy.dronex"
|
||||
static let method = "\(packageName)/recording"
|
||||
static let events = "\(packageName)/recording_events"
|
||||
}
|
||||
@@ -584,7 +596,9 @@ final class RecordingPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
|
||||
}
|
||||
}
|
||||
|
||||
func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
|
||||
func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink)
|
||||
-> FlutterError?
|
||||
{
|
||||
eventSink = events
|
||||
events(controller.currentStatusMap())
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user