Tencent / libpag

The official rendering library for PAG (Portable Animated Graphics) files that renders After Effects animations natively across multiple platforms.
https://pag.art
Other
4.73k stars 437 forks source link

Optimze PAGFileImpl LoadAsync method callback in the main thread #2202

Closed gaoyuexit closed 2 months ago

gaoyuexit commented 2 months ago
    目前setPathAsync返回的callback不在主线程
    pagView.setPathAsync(urlString) { [weak self] pagFile in
        //返回不是主线程
        DispatchQueue.main.async {
            let pagFile: PAGFile? = pagFile
            guard let self, let pagFile else {
                onFailure?(GzErrors.ERROR_CLIENT_NEWWORK)
                return
            }
            onSuccess?()
            self.pagView.setComposition(pagFile)
            self.pagView.play()
        }
    }
gaoyuexit commented 2 months ago

一些主流三方库的下载回调都在主线程, 不需要外部调用的时候再手动切换到主线程