Look, I've done some tests (I had time to test only AVI & MP4 formats), and for some reason, on Google Chrome, only the mp4 format is working by far.
Another thing, it is very unnecessary to write the code as you did, try to do it like that (it worked fine for me as I said.):