New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVPlayer Looping #4
Comments
I managed to get a video looping using
and
But after looping a few times, I get some repeated memory warnings, then the app crashes. |
Hi , Yes there is a memory issue with SKVideoNode leaking memory :/ I'll report you to this opened issue and NickAtGit response: #2 Arthur |
Thanks @kosso for the video loop ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to take action when the video finishes. To do this I subscribed to the AVPlayerItemDidPlayToEndTimeNotification notification. By doing this I noticed that this notification gets called repeatedly after the video finishes, multiple times a second.
I looked into the issue further by setting up KVO on the "rate" property of the player and noticed that after the videos finishes the rate values switches between 0 and 1 repeatedly, multiple times per second.
This explains why AVPlayerItemDidPlayToEndTimeNotification is getting calls so much but does not explain why the rate keeps toggling. The actual on screen video is frozen at the last frame and does not seen to be impacted.
The only thing that breaks this loop is calling videoSpriteKitNode!.pause(). Even this approach is not ideal because you still get a few AVPlayerItemDidPlayToEndTimeNotification notifications before you have a chance to call videoSpriteKitNode!.pause().
The text was updated successfully, but these errors were encountered: