Skip to content

Commit

Permalink
fix: sometimes duration is invalid after waitForMovieLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
banjun committed Jun 5, 2018
1 parent b752998 commit c39c85f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion LoveLiver-osx/MovieDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MovieDocument: NSDocument, NSWindowDelegate {
}

fileprivate func waitForMovieLoaded() {
guard let videoSize = playerItem?.naturalSize else {
guard let videoSize = playerItem?.naturalSize, playerItem?.duration.isIndefinite == false else {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(1 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) {
self.waitForMovieLoaded()
}
Expand Down

0 comments on commit c39c85f

Please sign in to comment.