0

I'm currently working on a video player for images. Works fine in Chrome, Safari and even in Internet Explorer. But there's a problem by playing the "video" in firefox. The image doesn't become exchanged immediately: It seems to become loaded again. (I'm preloading all images, before it's possible to play) The code for exchanging the images is simple:

    var newimg = new Image(); 
    newimg.src = MyBuffer[MyProgress].src
    newimg.name = "videoimage"; 
    var playercontainer = document.getElementById("playercontainer");
    playercontainer.replaceChild(newimg, document.images.videoimage);

Any ideas or good workarounds?

XQDev
  • 366
  • 4
  • 15
  • I hear there's a neat video element in HTML 5! – Anthony Aug 12 '14 at 11:30
  • Also, it's `getElementById`. Make sure it's not just a strict interpreter – Anthony Aug 12 '14 at 11:33
  • But the video element doesn't support a bunch of images, right? (Yes, there is no way to get to use another source format..) Sorry about the typo. Code wasn't simply copied + pasted. – XQDev Aug 12 '14 at 11:55
  • It's an easy typo to make and can break code, so always best to rule those out. You basically want a flip book video? – Anthony Aug 12 '14 at 11:57
  • Check out similar question :http://stackoverflow.com/questions/4448555/rendering-a-chain-of-images-like-a-video-in-javascript – Anthony Aug 12 '14 at 12:04
  • Yes, or a very fast diashow. I have a bunch of images and absolutely no control to change the format. (It's a set of jpeg images from a surveillance camera and the vendor doesn't implement any ordinary video format.) Thanks for the link, but that didn't work for me. I'm pre-buffering all images and only allow to start the play process after each Image.complete is true. Since the video is only flawed in Firefox, I believe it could be a problem with the DOM and rendering.. I found a similar project, which has the same problem with the Firefox browser: http://vagnervjs.github.io/frame-player/ – XQDev Aug 13 '14 at 08:21
  • And here is another one which works in Firefox: http://www.nihilogic.dk/labs/jsvideo/test2.php But I can't find the difference in the method of this project and that method that I use. – XQDev Aug 13 '14 at 08:24
  • Ha! I worked on a side project a few years back at my office doing a similar frame by frame image swap, but it was so long ago i can't remember the probably obsolete code. But the underlying Parameters were that our web cam stored a jpg for each second. We tried an animated jpg format server side, but got struck on what where you are. – Anthony Aug 13 '14 at 10:14
  • Why can't you just have one image object and use srcset to update the src on that one image? – Anthony Aug 13 '14 at 11:07
  • Yes, good question! That method was my first attempt to solve that problem, that's where that problem first occured. I've read somewhere that this problem is caused by Firefox method of rendering the DOM and it could be solved by creating a completely new image element to render. But that didn't do the trick. – XQDev Aug 13 '14 at 12:41

0 Answers0