Asynchronous Video Encoding using Tencent SDK

Hello, developers and expert,

trying to implement encoding video simply using tencent sdk but I got error, and continuation doesn't return any progress or result.

anyone help me please... what i am missing?

SWIFT TASK CONTINUATION MISUSE: generateVideo(_:) leaked its continuation!
2023-03-30 12:07:15.694914+0900 Metacellar (dev)[87044:19556775] SWIFT TASK CONTINUATION MISUSE: generateVideo(_:) leaked its continuation!
    func encodeVideo() async throws {        
        if let video {
            let encoded = try await TencentVideoEncoder.generateVideo(video)
        }
    }
import TXLiteAVSDK_Professional

class TencentVideoEncoder: NSObject {
    static func generateVideo(_ original: AVAsset) async throws -> AVAsset {
        let inputPath = try await Cache.saveToLocal(
            asset: original, cache: Cache.temporary, cacheKey: UUID().uuidString)
        let outputPath = MetaCellarCache.temporary.cachePath(forKey: UUID().uuidString)!

        let editor = TXVideoEditer()
        editor.setVideoBitrate(2300)
        editor.setVideoPath(inputPath)
        editor.setCutFromTime(0, toTime: 10)

        return try await withCheckedThrowingContinuation { continuation in
            let listener = Listener(onComplete: { result in
                switch result.retCode {
                case .GENERATE_RESULT_OK:
                    continuation.resume(returning: AVAsset(url: URL(fileURLWithPath: outputPath)))
                default:
                    continuation.resume(throwing: NSError(domain: "Encoding Failed",
                                                          code: result.retCode.rawValue))
                }
            }, onProgress: { progress in
                print(progress)
            })
            editor.generateDelegate = listener


            editor.generateVideo(withTwoPass: .VIDEO_COMPRESSED_720P, videoOutputPath: outputPath)
        }
    }

    class Listener: NSObject, TXVideoGenerateListener {
        private var onComplete: (TXGenerateResult) -> ()
        private var onProgress: (Float) -> ()

        init(onComplete: @escaping (TXGenerateResult) -> (),
             onProgress: @escaping (Float) -> ())
        {
            self.onComplete = onComplete
            self.onProgress = onProgress
        }

        func onGenerateComplete(_ result: TXGenerateResult) {
            onComplete(result)
        }

        func onGenerateProgress(_ progress: Float) {
            onProgress(progress)
        }
    }
}
Asynchronous Video Encoding using Tencent SDK
 
 
Q