View video from IP Camera

Asked

Viewed 1,361 times

3

Gentlemen, I’m no expert in PHP, I’m starting now, and would like a direction on how to display the video of 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 please explain to me?

Thank you.

1 answer

1

I believe the problem is here:

setTimeout("Start()", 300)

The setTimeout receives a function in the first parameter. Your case is running the function Start (which, because it is in string form, is making a eval) and passing the function result for setTimeout.

The right thing would be:

setTimeout(Start, 300)
  • The path of the video is correct?

  • If the file snapshot.php is at the root of the site and the domain is correct, yes

  • Ah, ball show then, as soon as you get home, I’ll be

  • Do you have any quick port forwarding tips? how it works?

  • I don’t understand that

  • what treatment I could do to verify the existence of this variable or file? $img="http://usuario:senha@ipddns:portacamip/mjpeg.cgi?user=usuario&password=senha&channel=0&.mjpg";

  • That would be another question :)

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.