测试已测试 | ✓ |
Lang语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2017年5月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✓ |
由 alexruperez 维护。
AVPlayerItemHomeOutput 允许您协调与您的 HomeKit 灯泡相关的内容输出。
换句话说,它变成了 播放器的环绕灯效。
适用于所有 HomeKit(和 HomeBridge)兼容的灯泡。
AVPlayerItemHomeOutput 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:
pod 'AVPlayerItemHomeOutput'
dependencies: [
.Package(url: "https://github.com/alexruperez/AVPlayerItemHomeOutput.git")
]
let sample = URL(string: "https://raw.githubusercontent.com/bower-media-samples/big-buck-bunny-1080p-30s/master/video.mp4")!
let asset = AVAsset(url: sample)
let playerItem = AVPlayerItem(asset: asset)
let homeOutput = AVPlayerItemHomeOutput(playerItem) // Only create your instance...
homeOutput.setDelegate(self, queue: nil) // Optional AVPlayerItemOutputPullDelegate.
playerItem.add(homeOutput) // ...and add it to your AVPlayerItem!
let playerViewController = AVPlayerViewController()
playerViewController.player = AVPlayer(playerItem: playerItem)
present(playerViewController, animated: true) {
playerViewController.player?.play()
}
将 NSHomeKitUsageDescription 键添加到您的 Info.plist 中,以指定您应用中 HomeKit 的使用。
AVPlayerItemHomeOutput 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。