fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
29.11k stars 3.52k forks source link

Canvas objects deleted when video seeking #6873

Closed shadrech closed 2 years ago

shadrech commented 3 years ago

Version

3.6.0

Test Case

https://jsbin.com/riqaqig/1/edit?html,js,output

Information about environment

On chrome browser. Also brave browser

Steps to reproduce

When I try integrate a video background into a canvas, then add objects. When seeking the video the canvas either displaces other objects or in my projects case deletes the other objects altogether.

Expected Behavior

When seeking video other objects should not be effected

Actual Behavior

When seeking video other objects are rendered weird or removed from canvas

asturur commented 3 years ago

I have been looking into this 2 times, and seems like the loop with requestRenderAll or renderAll is breaking object movements, a thing i would not expect at all. I need to see if this is a bug, you code is simple and i think is ok.

ShaMan123 commented 2 years ago

You have created endless instances of fabric.Canvas attached to the same HTMLCanvas. That's why everything went crazy. I am not sure about attaching to oncanplay but anyways I've added a flag to prevent endless intializations. JSBIN is awful... https://jsfiddle.net/9103vter/5/

ShaMan123 commented 2 years ago

closing. If you think we should reopen comment below.

ShaMan123 commented 2 years ago

@asturur should we add an attribute on the canvas html object to avoid this? And throw an error if the attribute exists?