Error with video= IndexSizeError: Index or size is negative or greater than the allowed amount

i have a sketch in which there is a video; not any problem with the code (it seems!) - When i run the sketch i get often and not always this error: “IndexSizeError: Index or size is negative or greater than the allowed amount” - the video seems to be loaded: i can get its width && height in setup(); the error appears when i draw the video with (image, x, y) without any resizing; worst is that if i trigger the refresh button in the browser sometimes the error disappears…And sometimes it 's allways here… I am not an expert with p5JS but i am not a newbie with programming and so i would know a) what this error means b) what workaround for avoiding that…

PS: the error appears using firefox; the video is very little (14Mo) and it’s webm. I have also tried with .mp4 || .ogg: same result.

ok, i have found by myself; in my code (draw()) the video was displayed at the very beginning because i want to put some text and images UPON the video; if i put the video AFTER this part of the code everything is ok but of course the text && images are not visible: they are BEHIND the video; so my question (in some sense it’ s the same!) is what to do to draw these little images and texts UPON the video??? - Is it any way to know that the video is ready to be displayed?