View Camera IP video

3

Gentlemen, I'm no expert in PHP, I'm starting now, and would like a direction on how to display the video from my IP Camera - P2P

snapshot.php

<?php
    $img="http://usuario:senha@ipddns:portacamip/mjpeg.cgi?user=usuario&password=senha&channel=0&.mjpg"; 
    readfile($img); 
?> 

index.php

<img src="http://meudominio.com/snapshot.php"width="640" height="380" name="refresh">

<script language="JavaScript" type="text/javascript">     
    image = "http://meudominio.com/snapshot.php"
    function Start() {
    tmp = new Date();
    tmp = "?"+tmp.getTime()
    document.images["refresh"].src = image+tmp
    setTimeout("Start()", 300)
    }
    Start();       
</script>

What am I doing wrong? Could you explain please?

Thank you.

    
asked by anonymous 16.03.2015 / 12:36

1 answer

1

I think the problem is here:

setTimeout("Start()", 300)

setTimeout gets a function in the first parameter. Your case is executing the function Start (which, because it is in the form of a string, is doing eval ) and passing the result of the function to setTimeout . >

The correct one would be:

setTimeout(Start, 300)
    
16.03.2015 / 13:06