I am building a tvOS app using swift3. It is an app where video plays in a loop with sounds. I need to include brightness control, Speed control and a sleep timer.
This is my code:
@IBOutlet var downBtn: UIButton!
@IBOutlet var upBtnn: UIButton!
private var brightness: CGFloat?
var scale: Double = 0
let maxScale: Double = 1
@IBAction func increaseBtn(_ sender: Any) {
if scale > maxScale {
return
}
scale += 0.10
uiscreenbrightness(UInt(scale))
}
@IBAction func decreaseBright(_ sender: Any) {
if scale <= 0 {
return
}
scale -= 0.10
uiscreenbrightness(UInt(scale))
}
func uiscreenbrightness(_ scale: UInt) {
// UIScreen.main.brightness = CGFloat(scale)
}
But this gives me an error " Brightness is unavailable". How do I include the brightness functionality?
Also, this app has a customized timer functionality. So when the user sets a time, the TV will sleep after that. Is it possible to do this?
Thanks for your help :)