You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crash in setter of currentTime property: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVPlayerItem seekToTime:toleranceBefore:toleranceAfter:completionHandler:] Seeking is not possible to time {INVALID}'
#9
Open
bughana opened this issue
Sep 14, 2016
· 1 comment
firstly thanks for the library, it works really well.
I got one issue though with a crash pretty frequently happening in the setter of the currentTime property in line 143: player!.seekToTime(newTime,toleranceBefore: CMTime.zero,toleranceAfter: CMTime.zero)
It crashes due to the reason of newTime being invalid.
I added a workaround which works fine for me. I just do a safety check on newTime before calling seekToTime on the player: if !CMTIME_IS_INVALID(newTime) { player!.seekToTime(newTime,toleranceBefore: CMTime.zero,toleranceAfter: CMTime.zero) }`
Could you add the code to the library or do you see problems with it? Or would you like me to create a pull request for it?
Thanks in advance
The text was updated successfully, but these errors were encountered:
Here ,you might wanna create CMTime first and then provide that value to seek() as follows.
let seekTime = CMTime(value: CMTimeValue(seconds), timescale: 1)
here timescale has to be 1. Refer this link explaining it. After this, add following code. player.currentItem?.seek(to: seekTime, completionHandler: { (finished) in print("Seeking finished") self.playbackStarted() })
Hi there,
firstly thanks for the library, it works really well.
I got one issue though with a crash pretty frequently happening in the setter of the currentTime property in line 143:
player!.seekToTime(newTime,toleranceBefore: CMTime.zero,toleranceAfter: CMTime.zero)
It crashes due to the reason of newTime being invalid.
I added a workaround which works fine for me. I just do a safety check on newTime before calling seekToTime on the player:
if !CMTIME_IS_INVALID(newTime) { player!.seekToTime(newTime,toleranceBefore: CMTime.zero,toleranceAfter: CMTime.zero)
}`Could you add the code to the library or do you see problems with it? Or would you like me to create a pull request for it?
Thanks in advance
The text was updated successfully, but these errors were encountered: