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

**URL:** https://discourse.processing.org/t/error-with-video-indexsizeerror-index-or-size-is-negative-or-greater-than-the-allowed-amount/22306
**Category:** Coding Questions
**Created:** [July 1, 2020, 5:09pm UTC](https://discourse.processing.org/t/error-with-video-indexsizeerror-index-or-size-is-negative-or-greater-than-the-allowed-amount/22306 "2020-07-01T17:09:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [July 1, 2020, 5:09pm UTC](https://discourse.processing.org/t/error-with-video-indexsizeerror-index-or-size-is-negative-or-greater-than-the-allowed-amount/22306/1 "2020-07-01T17:09:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [July 2, 2020, 5:18pm UTC](https://discourse.processing.org/t/error-with-video-indexsizeerror-index-or-size-is-negative-or-greater-than-the-allowed-amount/22306/2 "2020-07-02T17:18:01Z")

</div>

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?
