完善 OTG 相机有线传图:支持 Sony/Canon 自动识别,页面 detach 保持会话以便再次进入复连。
引入进程级 CameraTetheringSession 与共享 USB Browser;离开传图页仅取消 UI 回调,App 终止时再完整 shutdown 释放 PTP 与 Browser 资源。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
17
suixinkan/Core/CameraTethering/CameraTetheringSession.swift
Normal file
17
suixinkan/Core/CameraTethering/CameraTetheringSession.swift
Normal file
@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
/// 进程级 OTG 相机会话:页面离开仅 detach UI 回调,App 终止时 shutdown 释放全部资源。
|
||||
@MainActor
|
||||
enum CameraTetheringSession {
|
||||
static let sharedService = AutoDetectCameraService()
|
||||
|
||||
/// 页面离开:清空 UI 回调,保持 ICC/PTP 会话与 Browser。
|
||||
static func detachFromUI() {
|
||||
sharedService.detachFromUI()
|
||||
}
|
||||
|
||||
/// App 终止:完整释放相机连接与 USB Browser。
|
||||
static func shutdown() async {
|
||||
await sharedService.shutdown()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user