swift - Music Player Timer -
func configureplayer() { player.addperiodictimeobserverforinterval(cmtimemakewithseconds(1, 1), queue: dispatch_get_main_queue()) { (cmtime) -> void in var timenow = int(self.player.currenttime().value) / int(self.player.currenttime().timescale) var currentmins = timenow / 60 var currentsec = timenow % 60 var duration: nsstring = "\(currentmins):\(currentsec)" self.durationoutlet.text = duration // <<- green line here self.slideroutlet.value = float(timenow) } }
i'm creating music player , works fine, crashes when try duration timer count or slider animate. works fine 2 seconds, crashes. call method in viewdidload
. there no errors @ except green line pointed above.
i think there problem durationoutlet
outlet.
so make sure durationoutlet
connected storyboard.
here sample project more info.
Comments
Post a Comment