0

Hey guys, new to HTML, can't find a simple solution anywhere.
I am writing an app for android that "streams" video by taking photos at a small set interval. The idea is to stream this to a website, my problem is that I can't find a simple, small way to refresh just the image on the website (yes, I'm coding the website too).

Any pointers would be great, I'm not looking for a complete worked solution, just some ideas.

FizzBuzz
  • 558
  • 2
  • 13
  • 29

1 Answers1

2

You can change the src attribute of the current image to the new image using javascript

var image = new Image();
image.src = "newimagedir.jpg";    
image.onload = function(){
    //when it loads
    document.getElementById("myImage").src= image.src;
}

<img src="" id="myImage" />

If you are going to be doing a lot of HTML manipulation i suggest you use a javascript library. If so you can see how to change the image here: Changing the image source using jQuery

Community
  • 1
  • 1
amosrivera
  • 26,114
  • 9
  • 67
  • 76