我正在尝试使用 AVPlayer 的当前时间更新 UISlider。我使用 NSTimer 每 1 秒调用一次带有此代码的方法:
CMTime duration = audioPlayer.currentTime;
float seconds = CMTimeGetSeconds(duration);
NSLog(@"duration: %.2f", seconds);
nowPlayingSlider.value = seconds;
时间记录正确,但 uislider 永远不会更新。