feat: apiHost 改为 api.duooomi.com,ANI 转换参数可配置
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,8 +26,11 @@ dependencies: [
|
|||||||
```swift
|
```swift
|
||||||
let sdk = DuooomiBleSDK(config: .init(
|
let sdk = DuooomiBleSDK(config: .init(
|
||||||
apiKey: "your-api-key" // 必填
|
apiKey: "your-api-key" // 必填
|
||||||
// apiHost: URL(...)!, // 默认 https://api.mixvideo.bowong.cc
|
// apiHost: URL(...)!, // 默认 https://api.duooomi.com
|
||||||
// cdnHost: "https://cdn.bowong.cc/", // 默认
|
// cdnHost: "https://cdn.bowong.cc/", // 默认
|
||||||
|
// aniWidth: 360, // ANI 转换宽度,默认 360
|
||||||
|
// aniHeight: 360, // ANI 转换高度,默认 360
|
||||||
|
// aniFps: "24", // ANI 转换帧率,默认 24
|
||||||
// firmwareIdentifier: "duomi", // 默认
|
// firmwareIdentifier: "duomi", // 默认
|
||||||
// firmwareStatus: "DRAFT" // 默认
|
// firmwareStatus: "DRAFT" // 默认
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -12,18 +12,30 @@ public struct DuooomiBleConfig: Sendable {
|
|||||||
public let firmwareIdentifier: String
|
public let firmwareIdentifier: String
|
||||||
/// 固件查询状态,如 "DRAFT" / "PUBLISHED"
|
/// 固件查询状态,如 "DRAFT" / "PUBLISHED"
|
||||||
public let firmwareStatus: String
|
public let firmwareStatus: String
|
||||||
|
/// ANI 转换宽度(像素)
|
||||||
|
public let aniWidth: Int
|
||||||
|
/// ANI 转换高度(像素)
|
||||||
|
public let aniHeight: Int
|
||||||
|
/// ANI 转换帧率
|
||||||
|
public let aniFps: String
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
apiHost: URL = URL(string: "https://api.mixvideo.bowong.cc")!,
|
apiHost: URL = URL(string: "https://api.duooomi.com")!,
|
||||||
apiKey: String,
|
apiKey: String,
|
||||||
cdnHost: String = "https://cdn.bowong.cc/",
|
cdnHost: String = "https://cdn.bowong.cc/",
|
||||||
firmwareIdentifier: String = "duomi",
|
firmwareIdentifier: String = "duomi",
|
||||||
firmwareStatus: String = "DRAFT"
|
firmwareStatus: String = "DRAFT",
|
||||||
|
aniWidth: Int = 360,
|
||||||
|
aniHeight: Int = 360,
|
||||||
|
aniFps: String = "24"
|
||||||
) {
|
) {
|
||||||
self.apiHost = apiHost
|
self.apiHost = apiHost
|
||||||
self.apiKey = apiKey
|
self.apiKey = apiKey
|
||||||
self.cdnHost = cdnHost.hasSuffix("/") ? cdnHost : cdnHost + "/"
|
self.cdnHost = cdnHost.hasSuffix("/") ? cdnHost : cdnHost + "/"
|
||||||
self.firmwareIdentifier = firmwareIdentifier
|
self.firmwareIdentifier = firmwareIdentifier
|
||||||
self.firmwareStatus = firmwareStatus
|
self.firmwareStatus = firmwareStatus
|
||||||
|
self.aniWidth = aniWidth
|
||||||
|
self.aniHeight = aniHeight
|
||||||
|
self.aniFps = aniFps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ final class AniConverter {
|
|||||||
|
|
||||||
let body: [String: Any] = [
|
let body: [String: Any] = [
|
||||||
"videoUrl": fileUrl,
|
"videoUrl": fileUrl,
|
||||||
"width": 360,
|
"width": config.aniWidth,
|
||||||
"height": 360,
|
"height": config.aniHeight,
|
||||||
"fps": "24",
|
"fps": config.aniFps,
|
||||||
]
|
]
|
||||||
request.httpBody = try JSONSerialization.data(withJSONObject: body)
|
request.httpBody = try JSONSerialization.data(withJSONObject: body)
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>NSExceptionDomains</key>
|
<key>NSExceptionDomains</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>api.mixvideo.bowong.cc</key>
|
<key>api.duooomi.com</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
|||||||
16
project.yml
16
project.yml
@@ -15,17 +15,6 @@ settings:
|
|||||||
packages: {}
|
packages: {}
|
||||||
|
|
||||||
targets:
|
targets:
|
||||||
DuooomiBleSDK:
|
|
||||||
type: framework
|
|
||||||
platform: iOS
|
|
||||||
sources:
|
|
||||||
- path: Sources/DuooomiBleSDK
|
|
||||||
settings:
|
|
||||||
base:
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER: com.duooomi.sdk
|
|
||||||
PRODUCT_NAME: DuooomiBleSDK
|
|
||||||
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
|
|
||||||
GENERATE_INFOPLIST_FILE: YES
|
|
||||||
demo:
|
demo:
|
||||||
type: application
|
type: application
|
||||||
platform: iOS
|
platform: iOS
|
||||||
@@ -40,7 +29,7 @@ targets:
|
|||||||
NSBluetoothAlwaysUsageDescription: "This app needs Bluetooth to communicate with your device"
|
NSBluetoothAlwaysUsageDescription: "This app needs Bluetooth to communicate with your device"
|
||||||
NSAppTransportSecurity:
|
NSAppTransportSecurity:
|
||||||
NSExceptionDomains:
|
NSExceptionDomains:
|
||||||
api.mixvideo.bowong.cc:
|
api.duooomi.com:
|
||||||
NSIncludesSubdomains: true
|
NSIncludesSubdomains: true
|
||||||
NSExceptionAllowsInsecureHTTPLoads: true
|
NSExceptionAllowsInsecureHTTPLoads: true
|
||||||
NSExceptionMinimumTLSVersion: TLSv1.0
|
NSExceptionMinimumTLSVersion: TLSv1.0
|
||||||
@@ -59,5 +48,4 @@ targets:
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER: com.duooomi.demo
|
PRODUCT_BUNDLE_IDENTIFIER: com.duooomi.demo
|
||||||
PRODUCT_NAME: demo
|
PRODUCT_NAME: demo
|
||||||
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks"
|
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks"
|
||||||
dependencies:
|
dependencies: []
|
||||||
- target: DuooomiBleSDK
|
|
||||||
|
|||||||
Reference in New Issue
Block a user