The AVPlayerItemHomeOutput lets you coordinate the output of content associated with your HomeKit lightbulbs.
In other words, becomes #Ambilight.
Works with all HomeKit (and HomeBridge) compatible lightbulbs.
AVPlayerItemHomeOutput is available through CocoaPods. To installit, simply add the following line to your Podfile:
pod 'AVPlayerItemHomeOutput'
github "alexruperez/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()
}
Add NSHomeKitUsageDescription key to your Info.plist to specify the use of HomeKit in your app.
alexruperez, contact@alexruperez.com
AVPlayerItemHomeOutput is available under the MIT license. See the LICENSE file for more info.