Mojave/macOS 10.14.0: [AVPlayerItem duration] is always indefinite
问题 I'm trying to read the duration of a locally stored audio file using the following code: #import <Foundation/Foundation.h> #import <CoreMedia/CoreMedia.h> #import <AVFoundation/AVFoundation.h> AVPlayer *player = [AVPlayer playerWithURL: urlForLocalAudioFile]; // busy wait - I know, not elegant, please ignore int timeout = 0; while (([player status] == AVPlayerStatusUnknown || [[player currentItem] status] == AVPlayerItemStatusUnknown) && timeout < 100) { [NSThread sleepForTimeInterval: 0.1];