Last active
December 10, 2018 13:40
-
-
Save cacheleocode/001877922a3e75825aa3e77bb776b678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.randomNum = arc4random_uniform(15) // range | |
self.someInt = Int(self.randomNum!) | |
self.someDouble = Double(self.someInt!) / 10 | |
self.someCMTime = CMTime(seconds: someDouble!, preferredTimescale: 90000) | |
debugPrint(self.player.currentItem!.asset.duration) | |
if ((self.someCMTime?.seconds)! > self.player.currentItem!.asset.duration.seconds) { | |
debugPrint("too much!") | |
} else { | |
debugPrint(self.someCMTime!.seconds) | |
} | |
self.player.seek(to: self.someCMTime!) | |
print("duration in seconds = \(self.player.currentItem!.asset.duration.seconds)") | |
// print("timescale = \(self.player.currentItem!.asset.duration.timescale)") | |
self.someCMTime = self.player.currentItem!.asset.duration | |
self.someCMTime = CMTimeMakeWithSeconds(self.getRandomDouble(limit: self.player.currentItem!.asset.duration.seconds), preferredTimescale: self.player.currentItem!.asset.duration.timescale) | |
// self.someCMTime = CMTime(seconds: self.getRandomDouble(limit: self.player.currentItem!.asset.duration.seconds), preferredTimescale: self.player.currentItem!.asset.duration.timescale) | |
print("random time = \(Double((self.someCMTime?.seconds)!))") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment