Files
2026-09-15 15:44:13 +07:00

33 lines
1.1 KiB
Swift

import UIKit
import Flutter
import VideoToolbox
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// H.265 硬解能力查询通道(复用 com.yinse/device)。VTIsHardwareDecodeSupported 天然是硬解判断,
// iOS11+ 且 A9(iPhone 6s)起为 true,旧机型返回 false → 回落 264。
if let controller = window?.rootViewController as? FlutterViewController {
let channel = FlutterMethodChannel(name: "com.yinse/device", binaryMessenger: controller.binaryMessenger)
channel.setMethodCallHandler { call, result in
if call.method == "isH265HardwareSupported" {
if #available(iOS 11.0, *) {
result(VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC))
} else {
result(false)
}
} else {
result(FlutterMethodNotImplemented)
}
}
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}