Add a custom event to capture frame before requestAnimationFrame #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have added a CustomEvent
before_frame_render
just before requestAnimationFrame. Reason is given bellow.I was trying to capture a frame and send it to sever using an ajax call.
Initially, I tried to use
pretick
but it just gave me all pixel transparent frame, showing buffer was empty at that point. I then triedtick
event and even that resulted in the same transparent image, again showing buffer was empty at that point too.Adding an event just before
requestAnimationFrame
helped me capture the frame and send it to sever.I am still trying to understand the working of requestAnimationFrame and why pretick didn't do the trick.
I assume pretick is just before it starts adding pixels to the frame and tick is just after it has removed pixels from the frame.
The snippet I used to capture and send the frame :