AVFoundation 的 Combine 扩展
本项目旨在通过为使用 AVFoundation
框架的常见任务提供 Publisher
扩展,从而实现统一性并减少样板代码。
有关完整的技术说明和关于实现自定义 Publisher
的动机和有用技术细节的详细解释,请访问 https://jozsef-vesza.dev/tags/combine/
您还可以观看我们关于该主题的演讲
设置好 Swift 包后,可以通过将其添加到 Package.swift 的 dependencies 值中来将 AVFoundationCombine 添加为依赖项。
dependencies: [
.package(url: "https://github.com/jozsef-vesza/AVFoundation-Combine", .upToNextMajor(from: "0.0.0"))
]
所有 publishers 都被设计为惰性的:它们仅在订阅时才开始观察属性。
Publisher | 来源 |
---|---|
AVPlayer | |
playheadProgressPublisher(interval:) |
addPeriodicTimeObserver(forInterval:queue:using:) |
currentItemPublisher() |
currenItem |
ratePublisher() |
rate |
AVPlayerItem | |
statusPublisher() |
status |
durationPublisher() |
duration |
isPlaybackLikelyToKeepUpPublisher() |
isPlaybackLikelyToKeepUp |
isPlaybackBufferEmptyPublisher() |
isPlaybackBufferEmpty |
didPlayToEndTimePublisher(_:) |
.AVPlayerItemDidPlayToEndTime 通知 |
AVAsset | |
commonMetadataPublisher(key:) |
commonMetadata |
commonMetadataValuePublisher(key:) |
commonMetadata |
commonMetadataExtrasPublisher(key:) |
commonMetadata |
commonMetadataValuePublisher(key:as:) |
commonMetadata |
commonMetadataValuePublisher(stringValueKey:) |
commonMetadata |
commonMetadataArtworkPublisher() |
commonMetadata |
AVFoundationCombine 使用 MIT 许可证。 有关更多信息,请参见 LICENSE 文件。