- StreamRecorderKit: 跨平台库 - StreamRecorderEngine: 协议+类型 - HLSVariantResolver: HLS master 解析 - FFmpegRecorder: macOS (Process+ffmpeg) - AVFoundationRecorder: iOS (AVAssetReader+Writer) - RecorderFactory: 平台工厂 - StreamRecorder: CLI 入口 - 15秒录制测试通过
29 lines
725 B
Swift
29 lines
725 B
Swift
import Foundation
|
||
|
||
/// 录制引擎工厂
|
||
public struct RecorderFactory {
|
||
|
||
/// 创建适合当前平台的录制引擎
|
||
/// - Returns: macOS 返回 FFmpegRecorder,iOS 返回 AVFoundationRecorder
|
||
public static func createRecorder() -> StreamRecorderEngine {
|
||
#if os(macOS)
|
||
return FFmpegRecorder()
|
||
#elseif os(iOS)
|
||
return AVFoundationRecorder()
|
||
#else
|
||
fatalError("不支持的平台")
|
||
#endif
|
||
}
|
||
|
||
/// 获取当前平台信息
|
||
public static var platformInfo: String {
|
||
#if os(macOS)
|
||
return "macOS (FFmpeg)"
|
||
#elseif os(iOS)
|
||
return "iOS (AVFoundation)"
|
||
#else
|
||
return "Unknown"
|
||
#endif
|
||
}
|
||
}
|