AVPlayer not reaching the end of playback
-
06-06-2021 - |
Question
I'm creating a movie with AVFoundation. For that I create a playerItem with an AVMutableComposition and a AVPlayer with that playerItem. My problem is that the AVPlayer does not play exactly until the end. It ends half a second before or so.
The weird part is that if I log the currentTime of the AVPlayer, it actually reaches the end time. But I can see by the movie that it is not exactly in the end.
Also, I have a timeLine playback control which is just a UISlider, that allows me to seek the time manually. And if I seek the time manually I can reach the actual end of the movie.
The only thing I can think of is some float or CMTime roundings which are generating this issue. But I can't come up with any solution.
If someone could give me some advices or possible solutions it would be great.
Thanks very much!
Solution
I fixed the problem by changing the frameDuration of the videoComposition.