VLCMediaPlayerDelegate reports to UI time change each 2 seconds instead of 1
having this delegate for VLCMediaPlayerDelegate
func mediaPlayerTimeChanged(_ aNotification: Notification!) {
print("AudioPlayer.VLCMediaPlayerDelegate.mediaPlayerTimeChanged")
if let vlcPlayer = aNotification.object as? VLCMediaPlayer {
debugPrint("player data:",vlcPlayer)
print("AudioPlayer player.position: \(vlcPlayer.position)")
print("AudioPlayer player.remainingTime.stringValue: \(vlcPlayer.remainingTime.stringValue ?? "NA")")
let position = vlcPlayer.position
let playedTime = vlcPlayer.time != VLCTime.null() ? vlcPlayer.time.stringValue : "00:00"
delegate?.playerTrackDidChangePosition(self, position: position, playedTime: playedTime)
}
}
and the delegate object does this
func playerTrackDidChangePosition(_ player: AudioPlayer, position: Float, playedTime: String?) {
updateTrackSlider(position: position, playedTime: playedTime)
hideActivityIndicator()
}
the track change position every two seconds
the updateTracker position is this
func updateTrackSlider(position: Float, playedTime: String?) {
self.trackSlider.setValue(position, animated: true)
durationLabel.text = (playedTime != nil) ? playedTime : "00:00"
}
and the duration label text reports only from 2 to 2 seconds, is there a way to make this one second only or is this my code two slow to report every second the time changed.
Edited by Yoel Jimenez del Valle